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

CD track playback through the shared MCI CD device and Windows CD mixer. More...

#include <playbackimplementations.h>

Inheritance diagram for CdAudioPlayback:
Collaboration diagram for CdAudioPlayback:

Public Member Functions

 CdAudioPlayback ()
 Initialise single-track mode with zero duration; media initialisation sets command ranges.
void ReleaseEarPlaybackResources () override
 Release playback through the registered-closure operation without closing the shared device.
void SetEarPlaybackDirectionalGain (std::uint16_t direction, double gain, std::uint16_t matrix) override
 Write the shared CD mixer volume control immediately.
int InitializeEarPlayback (const void *source, int streaming, int looping) override
 Configure a track range from the loaded CD positions without starting playback.
int StartEarPlayback () override
 Apply specified start and end overrides, post an enabled start message, and play the range.
int PauseEarPlayback () override
 Pause CD playback and cache its position for a later resume when pausing succeeds.
int ResumeEarPlayback () override
 Resume an active paused range from the cached position and clear pause status on success.
std::uint32_t GetEarPlaybackMediaLength () override
void SetEarPlaybackMute (int muted) override
 Store mute state and write the shared Windows CD mixer's mute control.
int IsBufferedEarPlaybackComplete () override
 Query MCI stop state while active and restart a completed looping range.
Public Member Functions inherited from EarPlayback
 ~EarPlayback ()
 Invoke the base finalisation hook without releasing playback resources or derived storage.
void SetEarPlaybackFlags (std::uint16_t flags)
 Store source flags without validation or reinitialisation.
int GetStatus ()
int IsActive ()
void MarkComplete ()
 Request completion for the next completion check without stopping the device immediately.
int GetEarPlaybackMute ()
int IsEarPlaybackStreaming ()
int ResetPlaybackCompletion ()
 Withdraw a request to complete the playback.
void ClearPlaybackCompletion ()
 Withdraw a request to complete the playback.
virtual void SetEarPlaybackDirectionalMatrix (std::uint16_t direction, std::uint16_t matrix)
 Store directional matrix identifiers without resolving an entry or updating output.
virtual void ProcessEarPlaybackSmoothing ()
 Apply a frequency, gain, and pan smoothing pass to the current device buffer.
virtual void SetPlaybackSuppressionParameters (std::uint32_t enabled, std::uint16_t marker)
 Store suppression controls without starting or stopping playback.
virtual void SetEarPlaybackStartPosition (double position)
 Store an ordered nonzero start position and mark it specified; zero and NaN are ignored.
virtual void SetEarPlaybackStartMilliseconds (std::uint16_t milliseconds)
 Store an absolute start offset for wave-stream preparation.
virtual void SetReservedPlaybackEventControl (std::uint32_t control)
 Store a backend-specific event control value without applying it immediately.
virtual void CompleteEarPlayback ()
 Perform implementation-specific completion; the base implementation does not change state.
virtual void ApplyPreset (EarWaveSample *preset)
 Apply implementation-specific preset data; the base implementation ignores the request.
virtual void SetBackendPlaybackOverrideEnabled (int enabled)
 Store the implementation-specific playback override marker.
virtual void SetEarPlaybackFrequencyScale (double scale)
 Clamp an ordered changed scale to 0..6.5535 and recalculate frequency from the base rate.
virtual void SetEarPlaybackBaseFrequencyScale (double scale)
 Store the initial frequency multiplier without validation or device updates.
virtual void SetCachedBackendPlaybackParameter (double value)
 Store an ordered changed backend parameter and invoke the parameter-change hook.
virtual void SetEarPlaybackLooping (int enabled)
 Store looping state without changing the currently playing buffer's device flags.
virtual void SetEarPlaybackNotification (std::uint32_t flags, std::uint16_t event)
 Store notification controls for later playback transitions.

Protected Member Functions

void CloseRegisteredEarPlayback () override
 Stop CD playback, post an enabled end message, clear mute, restore full gain, and unregister.
Protected Member Functions inherited from EarPlayback
virtual void OnPlaybackWaveSampleAttached (EarWaveSample *sample)
 Respond to sample attachment; the base implementation ignores the notification.
virtual int IsDirectSoundBufferStopped ()
 Query the device buffer; a non-null buffer is required.
 EarPlayback ()
 Initialise inactive playback and smoothing defaults without allocating media or a buffer.
void SetPlaybackBufferBytes (std::uint32_t bytes)
 Store buffer capacity without reallocating storage.
void SetStreamHalfBytes (std::uint32_t bytes)
 Store the refill-half capacity without changing the buffer.
void DisablePlaybackStreaming ()
 Clear the streaming marker without changing device looping flags.
std::uint16_t GetPlaybackStartMilliseconds () const
bool HasPlaybackStartPosition () const
void SpecifyPlaybackStartPosition ()
 Mark the stored start position specified without changing its value.
void SetPlaybackStreamingAndLooping (int isStreaming, int isLooping)
 Store stream and loop markers without validation or device changes.
double GetPlaybackBaseFrequencyScale () const
void SetPlaybackBaseFrequency (std::uint32_t value)
 Store base frequency without updating the current device frequency.
void SetPlaybackHandle (std::uint32_t handle)
 Store a registration handle without modifying the playback registry.
std::uint32_t GetPlaybackHandle () const
HRESULT CreateDirectSoundPlaybackBuffer (IDirectSound *device, _DSBUFFERDESC *description)
 Create a Windows device buffer; an existing buffer must be released before replacement.
void ResetPlaybackBufferFrequency ()
 Reset current frequency to the initialised base frequency without updating the device.
std::uint32_t GetPlaybackBufferBytes () const
bool HasNonStreamingStartPosition () const
double GetPlaybackStartPosition () const
void ClearPlaybackStartPosition ()
 Clear the specified marker and reset the start position to zero.
EarDirectSoundPlaybackState::Buffer * GetDirectSoundBuffer () const
std::uint32_t IncrementLoopDrainCount ()
void EndStreamingPlaybackLoop ()
 Clear both loop and stream markers without stopping the device immediately.
std::uint16_t GetPlaybackSourceFlags () const
bool IsPlaybackLooping () const
bool HasPlaybackHandle () const
void DisablePlaybackLooping ()
 Clear the looping marker without changing device playback flags.
std::uint32_t GetStreamHalfIndex () const
std::uint32_t GetStreamHalfBytes () const
void FlipStreamHalfIndex ()
 Toggle the refill-half index between zero and one.

Additional Inherited Members

Protected Attributes inherited from EarPlayback
std::uint32_t playbackHandle
 Playback registry key, or zero when unregistered.
std::uint32_t reservedEventControl
 Implementation-specific event control, including in-memory MIDI source length in bytes.
std::uint32_t notificationFlags
 Notification bits for starts (1) and registered closures (2).
std::uint16_t notificationEvent
 Event identifier included in window notifications.
std::uint16_t flags
 Source flags interpreted by derived media implementations; base construction omits them.
int looping
 Nonzero while looping is requested.
int streaming
 Nonzero while media requires half-buffer refills.
int completionRequested
 Nonzero after completion is requested or detected.
std::uint32_t streamHalfIndex
 Next streaming half to refill, initially one.
int active
 Nonzero after successful playback starts, including during a pause.
int muted
 Nonzero when muted; cached gain remains available for unmuting.
int status
 Pause status, zero when unpaused.
int backendOverrideEnabled
 Nonzero when implementation-specific position or frequency overrides are enabled.
std::uint32_t suppressionEnabled
 Nonzero when spatial suppression processing is enabled.
int startPositionSpecified
 Nonzero when startPosition is specified rather than merely stored.
std::uint16_t suppressionMarker
 Suppression role, with one suppressing base device starts.
std::uint16_t startMilliseconds
 Wave-stream initial offset in milliseconds, or zero when disabled.
std::uint16_t matrixId
 Selected directional matrix handle, initially 16.
std::uint16_t directionIndex
 Selected directional row index, normally 0..127.
double previousGain
 Linear gain at the start of the current smoothing transition.
double targetGain
 Target linear gain before directional and master attenuation.
EarDirectionalMatrixEntry previousMatrixEntry
 Directional pan and gain at the start of the current smoothing transition.
EarDirectionalMatrixEntry targetMatrixEntry
 Target directional pan and gain resolved from the selected matrix.
std::uint32_t frequency
 Target sample frequency in hertz before device range clamping.
std::uint32_t previousFrequency
 Sample frequency in hertz at the start of the smoothing transition.
std::uint8_t unknown6c [2]
 Unrecovered bytes retained at the original object offset.
std::uint16_t smoothingPass
 Smoothing pass index; zero selects the target directly.
std::uint32_t bufferBytes
 Decoded device sample-buffer capacity in bytes.
std::uint32_t streamHalfBytes
 Decoded byte count in each streaming half.
double startPosition
 Implementation-specific start position, usually a fraction of media length.
double frequencyScale
 Current dimensionless playback frequency multiplier.
double baseFrequencyScale
 Initial frequency multiplier applied while preparing media.
std::uint32_t baseFrequency
 Initial sample frequency in hertz; derived initialisation must assign it.
double cachedBackendParameter
 Cached implementation-specific parameter, initially -1.
std::uint32_t loopDrainCount
 Number of post-data streaming refills used while draining non-looping playback.
EarDirectSoundPlaybackState directSound
 Device buffer reference and cached byte cursors; resource release is explicit.

Detailed Description

CD track playback through the shared MCI CD device and Windows CD mixer.

Device, track positions, and mixer controls must be initialised before playback operations.

Constructor & Destructor Documentation

◆ CdAudioPlayback()

CdAudioPlayback::CdAudioPlayback ( )

Initialise single-track mode with zero duration; media initialisation sets command ranges.

Ghidra address:
EAR: 0x10009ae0

Member Function Documentation

◆ ReleaseEarPlaybackResources()

void CdAudioPlayback::ReleaseEarPlaybackResources ( )
overridevirtual

Release playback through the registered-closure operation without closing the shared device.

Ghidra address:
EAR: 0x10009b19

Reimplemented from EarPlayback.

◆ SetEarPlaybackDirectionalGain()

void CdAudioPlayback::SetEarPlaybackDirectionalGain ( std::uint16_t direction,
double gain,
std::uint16_t matrix )
overridevirtual

Write the shared CD mixer volume control immediately.

Parameters
directionThe unused directional row index.
gainThe linear multiplier of the CD mixer's maximum volume, without clamping.
matrixThe unused directional matrix handle.
Ghidra address:
EAR: 0x1000a187

Reimplemented from EarPlayback.

◆ InitializeEarPlayback()

int CdAudioPlayback::InitializeEarPlayback ( const void * source,
int streaming,
int looping )
overridevirtual

Configure a track range from the loaded CD positions without starting playback.

Parameters
sourceA one-based track number encoded in pointer bits, or null for all audio tracks.
streamingThe streaming marker to store; CD playback does not use PCM refill halves.
loopingThe looping marker, with nonzero enabling restart at completion.
Returns
One on success; zero with EAR error 0x0d when the track exceeds the last audio track.
Ghidra address:
EAR: 0x1000a051

Reimplemented from EarPlayback.

◆ StartEarPlayback()

int CdAudioPlayback::StartEarPlayback ( )
overridevirtual

Apply specified start and end overrides, post an enabled start message, and play the range.

Whole-disc overrides encode track numbers divided by 10000; single-track overrides are fractions of track duration. Successful single-track playback clears applied overrides.

Returns
One on MCI success, with active state set and pause status cleared; zero on failure.
Ghidra address:
EAR: 0x10009df1

Reimplemented from EarPlayback.

◆ PauseEarPlayback()

int CdAudioPlayback::PauseEarPlayback ( )
overridevirtual

Pause CD playback and cache its position for a later resume when pausing succeeds.

Returns
One when MCI accepts the pause command; zero on failure.
Ghidra address:
EAR: 0x10009d39

Reimplemented from EarPlayback.

◆ ResumeEarPlayback()

int CdAudioPlayback::ResumeEarPlayback ( )
overridevirtual

Resume an active paused range from the cached position and clear pause status on success.

Returns
Nonzero when unpaused after the attempt, including when already unpaused.
Ghidra address:
EAR: 0x1000a21a

Reimplemented from EarPlayback.

◆ GetEarPlaybackMediaLength()

std::uint32_t CdAudioPlayback::GetEarPlaybackMediaLength ( )
overridevirtual
Returns
The configured playback range duration in milliseconds.
Ghidra address:
EAR: 0x1000a280

Reimplemented from EarPlayback.

◆ SetEarPlaybackMute()

void CdAudioPlayback::SetEarPlaybackMute ( int muted)
overridevirtual

Store mute state and write the shared Windows CD mixer's mute control.

Parameters
mutedThe mute marker, with nonzero indicating mute.
Ghidra address:
EAR: 0x10009cb3

Reimplemented from EarPlayback.

◆ IsBufferedEarPlaybackComplete()

int CdAudioPlayback::IsBufferedEarPlaybackComplete ( )
overridevirtual

Query MCI stop state while active and restart a completed looping range.

Returns
Nonzero on requested completion, detected non-looping completion, or loop restart failure; zero while incomplete or after a successful loop restart.
Ghidra address:
EAR: 0x10009bba

Reimplemented from EarPlayback.

◆ CloseRegisteredEarPlayback()

void CdAudioPlayback::CloseRegisteredEarPlayback ( )
overrideprotectedvirtual

Stop CD playback, post an enabled end message, clear mute, restore full gain, and unregister.

An absent playback handle suppresses closure work.

Ghidra address:
EAR: 0x10009b2f

Reimplemented from EarPlayback.


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