coastline 0.0.4
Loading...
Searching...
No Matches
ScheduledEarEvent Class Reference

Schedule playback with delayed starts, attenuation, spatial updates, and completion timers. More...

#include <scheduledevent.h>

Public Member Functions

 ScheduledEarEvent (std::uint16_t flags, const void *source)
 Allocate playback for the source type and initialise scheduling defaults.
 ScheduledEarEvent (const ScheduledEarEvent &other)
 Create a twin with separate playback and borrowed source storage.
 ~ScheduledEarEvent ()
 Release playback resources and source storage copied by this event.
int GetScheduledEventPlaybackStatus ()
int IsScheduledEventPlaybackComplete ()
void RequestScheduledEventStop ()
 Disable backend looping and mark playback complete for subsequent event retirement.
int CanStartScheduledEarEvent ()
void AdvanceScheduledEventTimers (std::uint32_t elapsedMilliseconds)
 Advance pending timers or the active duration limit and mark expired playback complete.
int StartScheduledEarEvent ()
 Initialise playback if necessary, apply smoothing and frequency, and start the backend.
void UpdateScheduledEventPlayback (double gain)
 Advance fade attenuation and apply directional gain, frequency, and backend parameters.
void ApplyScheduledEventStopControl (std::uint16_t control)
 Select a stop fade, or disable looping and attempt a start when bit zero is set.
std::uint32_t GetScheduledEventMediaLength ()
void MuteScheduledEventPlayback ()
 Set backend mute without pausing event timers.
void UnmuteScheduledEventPlayback ()
 Clear backend mute without changing event timers.
void PauseScheduledEventPlayback ()
 Pause backend playback and discard the backend stop result.
int ResumeScheduledEventPlayback ()
 Clear paused status and attempt to restart an active paused backend.
int IsScheduledEventPlaybackActive ()
int IsScheduledEventPlaybackMuted ()
int HasScheduledEventFrequencyOverride ()
int IsScheduledEventPendingExpiryDisabled ()
int IsScheduledEventPlaybackStreaming ()
int IsScheduledEventStopping ()

Friends

class EarChannel
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, gain, timing, and queue mode, without starting it.
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, priority, and times, and its distance, delay, gain, and direction.
void __stdcall UpdateEarPlaybackEngine (void)
 Advance the gain of each channel towards its target, and the timers of each event of each channel that is not paused, then retire the events that completed, start those that may start, and update the others.

Detailed Description

Schedule playback with delayed starts, attenuation, spatial updates, and completion timers.

Playback methods require successful construction and an allocated playback implementation. A twin event borrows source storage from its original event.

Constructor & Destructor Documentation

◆ ScheduledEarEvent() [1/2]

ScheduledEarEvent::ScheduledEarEvent ( std::uint16_t flags,
const void * source )

Allocate playback for the source type and initialise scheduling defaults.

File-backed PCM and ADPCM paths without source flags 0x6000 are copied to 260-byte storage and truncated to 259 bytes. Other source storage remains borrowed until destruction. Failed allocation or an unsupported type records an EAR error and releases event resources.

Parameters
flagsThe source type in the low byte and playback flags in the high byte.
sourceThe source representation required by the type, including a preset handle encoded in pointer bits for type 3. File paths must be non-null, terminated strings.
Ghidra address:
EAR: 0x100077e0

◆ ScheduledEarEvent() [2/2]

ScheduledEarEvent::ScheduledEarEvent ( const ScheduledEarEvent & other)

Create a twin with separate playback and borrowed source storage.

The original source storage must remain valid until the twin is destroyed. Native construction does not initialise every scheduling field or report playback failure.

Parameters
otherThe original event with source storage valid throughout the twin's lifetime.
Ghidra address:
EAR: 0x10007b56

◆ ~ScheduledEarEvent()

ScheduledEarEvent::~ScheduledEarEvent ( )

Release playback resources and source storage copied by this event.

Twins do not extend the lifetime of source storage allocated by the original event.

Ghidra address:
EAR: 0x10007d6a

Member Function Documentation

◆ GetScheduledEventPlaybackStatus()

int ScheduledEarEvent::GetScheduledEventPlaybackStatus ( )
Returns
The backend status value, with zero for unpaused playback and nonzero for paused.
Ghidra address:
EAR: 0x10007310

◆ IsScheduledEventPlaybackComplete()

int ScheduledEarEvent::IsScheduledEventPlaybackComplete ( )
Returns
Nonzero when the backend reports playback complete; otherwise zero.
Ghidra address:
EAR: 0x10007330

◆ RequestScheduledEventStop()

void ScheduledEarEvent::RequestScheduledEventStop ( )

Disable backend looping and mark playback complete for subsequent event retirement.

Ghidra address:
EAR: 0x10007350

◆ CanStartScheduledEarEvent()

int ScheduledEarEvent::CanStartScheduledEarEvent ( )
Returns
Nonzero when playback is uninitialised, the delay has elapsed, and attenuation and distance requirements permit a start; otherwise zero.
Ghidra address:
EAR: 0x10007380

◆ AdvanceScheduledEventTimers()

void ScheduledEarEvent::AdvanceScheduledEventTimers ( std::uint32_t elapsedMilliseconds)

Advance pending timers or the active duration limit and mark expired playback complete.

Timer arithmetic wraps at 32 bits. A pending lifetime of -1000 disables lifetime processing. Other pending lifetimes expire below -500 milliseconds, even with countdown suppression.

Parameters
elapsedMillisecondsThe unsigned elapsed time in milliseconds.
Ghidra address:
EAR: 0x10007400

◆ StartScheduledEarEvent()

int ScheduledEarEvent::StartScheduledEarEvent ( )

Initialise playback if necessary, apply smoothing and frequency, and start the backend.

Initialisation failure records EAR error 0x1a and deactivates the event.

Returns
One on success; zero on initialisation failure, paused status, or backend failure.
Ghidra address:
EAR: 0x10008126

◆ UpdateScheduledEventPlayback()

void ScheduledEarEvent::UpdateScheduledEventPlayback ( double gain)

Advance fade attenuation and apply directional gain, frequency, and backend parameters.

Zero attenuation releases initialised playback resources when attenuation is required and no stop fade is active.

Parameters
gainThe linear gain multiplier applied after the event's 0..10000 attenuation.
Ghidra address:
EAR: 0x100074c0

◆ ApplyScheduledEventStopControl()

void ScheduledEarEvent::ApplyScheduledEventStopControl ( std::uint16_t control)

Select a stop fade, or disable looping and attempt a start when bit zero is set.

Fade attenuation decreases once per playback update rather than per millisecond.

Parameters
controlBit zero selects the non-looping start. Otherwise the low nibble selects decrements of 500 (2), 250 (4), 125 (8), or 10000 / ((control >> 4) * 0.02) (14). Other low nibbles select a zero decrement.
Ghidra address:
EAR: 0x100088ea

◆ GetScheduledEventMediaLength()

std::uint32_t ScheduledEarEvent::GetScheduledEventMediaLength ( )
Returns
The media length in backend-specific units, without conversion to milliseconds.
Ghidra address:
EAR: 0x1000c1d0

◆ MuteScheduledEventPlayback()

void ScheduledEarEvent::MuteScheduledEventPlayback ( )

Set backend mute without pausing event timers.

Ghidra address:
EAR: 0x1000c1f0

◆ UnmuteScheduledEventPlayback()

void ScheduledEarEvent::UnmuteScheduledEventPlayback ( )

Clear backend mute without changing event timers.

Ghidra address:
EAR: 0x1000c210

◆ PauseScheduledEventPlayback()

void ScheduledEarEvent::PauseScheduledEventPlayback ( )

Pause backend playback and discard the backend stop result.

Ghidra address:
EAR: 0x1000c230

◆ ResumeScheduledEventPlayback()

int ScheduledEarEvent::ResumeScheduledEventPlayback ( )

Clear paused status and attempt to restart an active paused backend.

Returns
One, including when the backend restart fails.
Ghidra address:
EAR: 0x1000c250

◆ IsScheduledEventPlaybackActive()

int ScheduledEarEvent::IsScheduledEventPlaybackActive ( )
Returns
Whether the playback is active.
Ghidra address:
EAR: 0x1000c520

◆ IsScheduledEventPlaybackMuted()

int ScheduledEarEvent::IsScheduledEventPlaybackMuted ( )
Returns
Whether the playback is muted.
Ghidra address:
EAR: 0x1000c820

◆ HasScheduledEventFrequencyOverride()

int ScheduledEarEvent::HasScheduledEventFrequencyOverride ( )
Returns
Whether the event overrides the frequency scale.
Ghidra address:
EAR: 0x1000c840

◆ IsScheduledEventPendingExpiryDisabled()

int ScheduledEarEvent::IsScheduledEventPendingExpiryDisabled ( )
Returns
Whether the countdown of the lifetime is suppressed.
Ghidra address:
EAR: 0x1000c860

◆ IsScheduledEventPlaybackStreaming()

int ScheduledEarEvent::IsScheduledEventPlaybackStreaming ( )
Returns
Whether the playback streams.
Ghidra address:
EAR: 0x1000c880

◆ IsScheduledEventStopping()

int ScheduledEarEvent::IsScheduledEventStopping ( )
Returns
Whether the event is fading out.
Ghidra address:
EAR: 0x1000c8a0

◆ EarChannel

friend class EarChannel
friend

◆ EAR_DLL_MixEvent

std::uint32_t __stdcall EAR_DLL_MixEvent ( const EarEventParams * params)
friend

Make an event from its parameters and add it to its channel, by its distance, direction, gain, timing, and queue mode, without starting it.

An event out of its distance is dropped.

Parameters
paramsThe parameters of the event.
Returns
The handle of the event, or 0.
Ghidra address:
EAR: 0x1000cc30

◆ EAR_DLL_MoveEvent

std::uint32_t __stdcall EAR_DLL_MoveEvent ( const EarEventParams * params)
friend

Update an event of a channel from its parameters: its matrix, its pause and mute, its pitch, priority, and times, and its distance, delay, gain, and direction.

Parameters
paramsThe parameters of the event.
Returns
The handle of the event, or 0.
Ghidra address:
EAR: 0x1000d960

◆ UpdateEarPlaybackEngine

void __stdcall UpdateEarPlaybackEngine ( void )
friend

Advance the gain of each channel towards its target, and the timers of each event of each channel that is not paused, then retire the events that completed, start those that may start, and update the others.

A channel waiting to shut down shuts down once its gain arrives.

Ghidra address:
EAR: 0x10004d3b

The documentation for this class was generated from the following file: