coastline 0.0.4
Loading...
Searching...
No Matches
scheduledevent.h
Go to the documentation of this file.
1#ifndef COASTLINE_EAR_SCHEDULEDEVENT_H
2#define COASTLINE_EAR_SCHEDULEDEVENT_H
3
4#include <cstdint>
5
6#if TGR_PLATFORM == TGR_PLATFORM_WIN
7#include <windows.h>
8#else
9#include "common/types.h"
10#endif
11
12#include "event.h"
13#include "playback.h"
14
15#pragma pack(push, 1)
16
17class EarChannel;
18class EarPlayback;
19
27
34public:
46 ScheduledEarEvent(std::uint16_t flags, const void *source);
62
78
93 void AdvanceScheduledEventTimers(std::uint32_t elapsedMilliseconds);
121
179
180private:
181 // A channel compares the priority and the attenuation of its events directly.
182 friend class EarChannel;
183 // Mixing and moving an event set its fields from the parameters directly.
184 friend std::uint32_t __stdcall EAR_DLL_MixEvent(const EarEventParams *params);
185 friend std::uint32_t __stdcall EAR_DLL_MoveEvent(const EarEventParams *params);
186 // The engine starts, updates, and retires the events of each channel.
187 friend void __stdcall UpdateEarPlaybackEngine(void);
188
190 int InitializeScheduledEarEventPlayback();
192 void UpdateScheduledEventDopplerScale();
194 long double CalculateScheduledEventDopplerScale();
196 void DeactivateScheduledEarEvent();
198 void ReleaseScheduledEventPlayback();
200 int CreateEarPlaybackImplementation(std::uint16_t flags);
201
202 EarEventSource source;
203 std::uint16_t sourceType;
204 std::uint16_t sourceFlags;
205 char *allocatedSource;
206 EarPlayback *playback;
207 int playbackInitialized;
208 int playbackStarted;
209 int looping;
210 int streaming;
211 int frequencyScaleOverrideEnabled;
212 int dopplerEnabled;
213 int fadingOut;
214 int lifetimeCountdownSuppressed;
215 int activeDurationLimitEnabled;
216 int attenuationRequired;
217 int distanceLimitEnabled;
218 int trackElapsedTime;
219 std::uint32_t suppressionEnabled;
220 std::uint16_t suppressionMarker;
221 std::uint16_t twinEventHandle;
222 std::uint16_t attenuation;
223 std::uint16_t directionIndex;
224 std::uint16_t matrixId;
225 std::int32_t startDelayMs;
226 std::int32_t remainingLifetimeMs;
227 std::int32_t remainingActiveTimeMs;
228 std::int32_t elapsedTimeMs;
229 std::uint16_t attenuationDecrement;
230 std::int32_t distance;
231 std::int32_t maximumDistance;
232 std::int32_t previousDistance;
233 double previousRadialSpeed;
234 DWORD previousDistanceTime;
235 std::uint32_t accumulatedDistance;
236 std::uint32_t accumulatedTime;
237 std::uint32_t distanceSampleCount;
238 int crossingActive;
239 double crossingInitialSpeed;
240 double crossingSpeedStep;
241 double crossingStep;
242 std::int32_t radialDirection;
243 std::uint16_t environmentId;
244 [[maybe_unused]] std::uint8_t unknownA6[2]; /* +0xa6 */
245 double frequencyScale;
246 double baseFrequencyScale;
247 double startPosition;
248 double backendParameter;
249 std::uint32_t notificationFlags;
250 [[maybe_unused]] std::uint8_t unknownCc[4]; /* +0xcc */
251 std::uint32_t reservedEventControl;
252 std::uint16_t priority;
253 std::uint16_t notificationEvent;
254};
255
256#pragma pack(pop)
257
258#endif /* COASTLINE_EAR_SCHEDULEDEVENT_H */
Common event playback state with overridable media, device, and stream operations.
Definition earplayback.h:17
friend std::uint32_t __stdcall EAR_DLL_MoveEvent(const EarEventParams *params)
Update an event of a channel from its parameters: its matrix, its pause and mute, its pitch,...
int CanStartScheduledEarEvent()
void UnmuteScheduledEventPlayback()
Clear backend mute without changing event timers.
friend class EarChannel
Definition scheduledevent.h:182
~ScheduledEarEvent()
Release playback resources and source storage copied by this event.
void UpdateScheduledEventPlayback(double gain)
Advance fade attenuation and apply directional gain, frequency, and backend parameters.
ScheduledEarEvent(std::uint16_t flags, const void *source)
Allocate playback for the source type and initialise scheduling defaults.
void AdvanceScheduledEventTimers(std::uint32_t elapsedMilliseconds)
Advance pending timers or the active duration limit and mark expired playback complete.
friend void __stdcall UpdateEarPlaybackEngine(void)
Advance the gain of each channel towards its target, and the timers of each event of each channel tha...
ScheduledEarEvent(const ScheduledEarEvent &other)
Create a twin with separate playback and borrowed source storage.
int ResumeScheduledEventPlayback()
Clear paused status and attempt to restart an active paused backend.
void MuteScheduledEventPlayback()
Set backend mute without pausing event timers.
std::uint32_t GetScheduledEventMediaLength()
friend std::uint32_t __stdcall EAR_DLL_MixEvent(const EarEventParams *params)
Make an event from its parameters and add it to its channel, by its distance, direction,...
int GetScheduledEventPlaybackStatus()
int IsScheduledEventPlaybackStreaming()
void RequestScheduledEventStop()
Disable backend looping and mark playback complete for subsequent event retirement.
int HasScheduledEventFrequencyOverride()
int StartScheduledEarEvent()
Initialise playback if necessary, apply smoothing and frequency, and start the backend.
void PauseScheduledEventPlayback()
Pause backend playback and discard the backend stop result.
int IsScheduledEventPlaybackMuted()
int IsScheduledEventPendingExpiryDisabled()
int IsScheduledEventStopping()
int IsScheduledEventPlaybackActive()
int IsScheduledEventPlaybackComplete()
void ApplyScheduledEventStopControl(std::uint16_t control)
Select a stop fade, or disable looping and attempt a start when bit zero is set.
The parameters of an event, as the game passes them to MixEvent and MoveEvent.
Definition eventparameters.h:52
The integer and floating-point types of the console, for headers shared with Windows.
Source representation selected by the low byte of the scheduled event flags.
Definition scheduledevent.h:21
std::uint16_t presetHandle
Registered wave-sample handle when the source type is 3.
Definition scheduledevent.h:25
const void * address
Borrowed filename or media pointer for the selected playback implementation.
Definition scheduledevent.h:23
typedef DWORD