1#ifndef COASTLINE_EAR_PLAYBACKIMPLEMENTATIONS_H
2#define COASTLINE_EAR_PLAYBACKIMPLEMENTATIONS_H
4#if TGR_PLATFORM == TGR_PLATFORM_WIN
54 void RefillEarPlaybackStream()
override;
82 int OpenWaveFileStream(
const char *path);
84 int PreparePcmWaveStream(
const void *source);
86 void CloseWaveFileStream();
130 int OpenMemoryWaveStream(
const void *source);
153#if TGR_PLATFORM == TGR_PLATFORM_WIN
236 void UpdateDirectSoundPlaybackGainAndPan()
override;
237 void UpdateDirectSoundPlaybackFrequency()
override;
241 DWORD lengthMilliseconds;
243 int ownsTemporaryFile;
332 void UpdateDirectSoundPlaybackGainAndPan()
override;
333 void UpdateDirectSoundPlaybackFrequency()
override;
338 DWORD durationMilliseconds;
366 void RefillEarPlaybackStream()
override;
385 int OpenImaAdpcmWaveStream(
const void *source);
393 void DecodeImaAdpcmStreamBlocks();
397 DWORD adpcmDataBytes;
398 DWORD blockBufferBytes;
399 DWORD blockHalfBytes;
401 int decodedDifference;
405 DWORD dataWordsPerBlock;
418 return value >= -0x1p63L && value < 0x1p63L ?
int InitializeEarPlayback(const void *source, int streaming, int looping) override
Configure a track range from the loaded CD positions without starting playback.
void ReleaseEarPlaybackResources() override
Release playback through the registered-closure operation without closing the shared device.
int IsBufferedEarPlaybackComplete() override
Query MCI stop state while active and restart a completed looping range.
void SetEarPlaybackMute(int muted) override
Store mute state and write the shared Windows CD mixer's mute control.
int ResumeEarPlayback() override
Resume an active paused range from the cached position and clear pause status on success.
int PauseEarPlayback() override
Pause CD playback and cache its position for a later resume when pausing succeeds.
CdAudioPlayback()
Initialise single-track mode with zero duration; media initialisation sets command ranges.
int StartEarPlayback() override
Apply specified start and end overrides, post an enabled start message, and play the range.
void CloseRegisteredEarPlayback() override
Stop CD playback, post an enabled end message, clear mute, restore full gain, and unregister.
void SetEarPlaybackDirectionalGain(std::uint16_t direction, double gain, std::uint16_t matrix) override
Write the shared CD mixer volume control immediately.
std::uint32_t GetEarPlaybackMediaLength() override
virtual std::uint32_t GetEarPlaybackMediaLength()
int looping
Nonzero while looping is requested.
Definition earplayback.h:493
int streaming
Nonzero while media requires half-buffer refills.
Definition earplayback.h:495
virtual int InitializeEarPlayback(const void *source, int streaming, int looping)
Initialise implementation-specific media; the base implementation does not change state.
virtual void ReleaseEarPlaybackResources()
Release registered playback through the virtual closure hook.
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 CloseRegisteredEarPlayback()
Stop and release a registered buffer, post an enabled closure notification, and unregister playback.
int muted
Nonzero when muted; cached gain remains available for unmuting.
Definition earplayback.h:503
EarPlayback()
Initialise inactive playback and smoothing defaults without allocating media or a buffer.
A wave file loaded whole into memory, which a preset registers and sample playbacks share.
Definition wavesample.h:15
ImaAdpcmWaveStream()
Initialise inherited stream state and empty ADPCM decoder and block-buffer state.
MemoryWaveStream()
Initialise inherited stream state without allocating or attaching a memory image.
int ResumeEarPlayback() override
Attempt to resume an active paused sequencer and clear paused status on success.
int PauseEarPlayback() override
Set paused status and pause the sequencer when active.
void SetEarPlaybackDirectionalGain(std::uint16_t direction, double gain, std::uint16_t matrix) override
Set shared MIDI mixer volume when active, or cache gain for the next start when inactive.
int StartEarPlayback() override
Seek to a specified fractional start, post an enabled notification, and play the sequence.
int InitializeEarPlayback(const void *source, int streaming, int looping) override
Open source media in the shared sequencer and query sequence length.
void CloseRegisteredEarPlayback() override
Request zero gain, record shared sequencer use, post an enabled end message, and unregister.
void SetEarPlaybackMute(int muted) override
Store mute state and write the shared Windows MIDI mixer's mute control.
void ReleaseEarPlaybackResources() override
Unregister playback and delete any temporary MIDI file and allocated temporary path.
int IsBufferedEarPlaybackComplete() override
Query MCI stop state unless inactive or a shared completion query is already in progress.
MidiPlayback()
Initialise empty media state; a gain adjustment must assign pendingGain before playback.
LONG originalFileOffset
Definition playbackimplementations.h:99
DWORD writeOffset
Definition playbackimplementations.h:103
DWORD dataBytes
Definition playbackimplementations.h:101
EarWaveFile file
Definition playbackimplementations.h:96
void CopyEarPlaybackSamplesToOutput() override
Copy the sample half opposite the refill index into the corresponding device-buffer half.
char * sampleBuffer
Definition playbackimplementations.h:100
LONG dataStartOffset
Definition playbackimplementations.h:98
int CheckEarPlaybackLoopCompletion() override
Drain a completed stream by copying its first trailing half and stopping on later checks.
std::uint16_t AllocateEarEventId() override
Create and fill the device buffer, apply initial frequency, and seek when requested.
int CheckWavePlaybackDeviceAccess()
EarWaveFormat format
Definition playbackimplementations.h:102
PcmWaveStream()
Initialise null file and sample references with zero read and write counters.
void CloseRegisteredEarPlayback() override
Release registered playback, close or restore the source file, and free sample storage.
DWORD readOffset
Definition playbackimplementations.h:97
SampleWavePlayback()
Initialise inherited stream state without attaching a preset.
std::uint32_t TruncatePlaybackInteger(long double value)
Convert a value to an integer as the x87 instruction of the original does, retaining the low 32 bits.
Definition playbackimplementations.h:416
The state of the decoder of one channel of IMA ADPCM, from the header of each block.
Definition playbackimplementations.h:343
std::int16_t stepIndex
Definition playbackimplementations.h:345
std::int16_t predictor
Definition playbackimplementations.h:344
WAVEFORMATEX EarWaveFormat
Definition wavechunks.h:23
IMAADPCMWAVEFORMAT EarImaAdpcmWaveFormat
Definition wavechunks.h:24
HMMIO EarWaveFile
Definition wavechunks.h:25