ma_engine_effecteffect;/* The effect containing all of the information for spatialization, pitching, etc. */
ma_engine_effecteffect;/* The effect containing all of the information for spatialization, pitching, etc. */
floatvolume;
floatvolume;
ma_uint64runningTimeInEngineFrames;/* The amount of time the sound has been running in engine frames, including start delays. */
ma_uint64seekTarget;/* The PCM frame index to seek to in the mixing thread. Set to (~(ma_uint64)0) to not perform any seeking. */
ma_uint64seekTarget;/* The PCM frame index to seek to in the mixing thread. Set to (~(ma_uint64)0) to not perform any seeking. */
ma_uint64fadeOutTimeInFrames;
ma_uint64fadeOutTimeInFrames;/* In the sound's sample rate. */
ma_uint64startDelayInEngineFrames;/* In the engine's sample rate. */
ma_bool32isPlaying;/* False by default. Sounds need to be explicitly started with ma_engine_sound_start() and stopped with ma_engine_sound_stop(). */
ma_bool32isPlaying;/* False by default. Sounds need to be explicitly started with ma_engine_sound_start() and stopped with ma_engine_sound_stop(). */
ma_bool32isFadingOut;/* Set to true to indicate that a fade out before stopping is in effect. */
ma_bool32isFadingOut;/* Set to true to indicate that a fade out before stopping is in effect. */
ma_bool32isSettingFadeOut;/* Whether or not a new fade out needs to be set. Fade outs are set on the mixer thread because it depends on the length of the sound which may not be known immediately. */
ma_bool32isSettingFadeOut;/* Whether or not a new fade out needs to be set. Fade outs are set on the mixer thread because it depends on the length of the sound which may not be known immediately. */
...
@@ -907,7 +909,7 @@ struct ma_sound_group
...
@@ -907,7 +909,7 @@ struct ma_sound_group
ma_sound_group*pFirstChild;
ma_sound_group*pFirstChild;
ma_sound_group*pPrevSibling;
ma_sound_group*pPrevSibling;
ma_sound_group*pNextSibling;
ma_sound_group*pNextSibling;
ma_sound*pFirstSoundInGroup;/* Marked as volatile because we need to be very explicit with when we make copies of this and we can't have the compiler optimize it out. */
ma_sound*pFirstSoundInGroup;
ma_mixermixer;
ma_mixermixer;
ma_mutexlock;/* Only used by ma_engine_sound_init_*() and ma_engine_sound_uninit(). Not used in the mixing thread. */
ma_mutexlock;/* Only used by ma_engine_sound_init_*() and ma_engine_sound_uninit(). Not used in the mixing thread. */
ma_bool32isPlaying;/* True by default. Sound groups can be stopped with ma_engine_sound_stop() and resumed with ma_engine_sound_start(). Also affects children. */
ma_bool32isPlaying;/* True by default. Sound groups can be stopped with ma_engine_sound_stop() and resumed with ma_engine_sound_start(). Also affects children. */
MA_APIma_resultma_engine_sound_seek_to_pcm_frame(ma_engine*pEngine,ma_sound*pSound,ma_uint64frameIndex);/* Just a wrapper around ma_data_source_seek_to_pcm_frame(). */
MA_APIma_resultma_engine_sound_seek_to_pcm_frame(ma_engine*pEngine,ma_sound*pSound,ma_uint64frameIndex);/* Just a wrapper around ma_data_source_seek_to_pcm_frame(). */
/* The sound is muted. We want to move time forward, but it be made faster by simply seeking instead of reading. We also want to bypass mixing completely. */
/* The sound is muted. We want to move time forward, but it be made faster by simply seeking instead of reading. We also want to bypass mixing completely. */
It's important that the delay be timed based on the engine's sample rate and not the rate of the sound. The reason is that no processing will be happening
by the sound before playback has actually begun and we won't have accurate frame counters due to resampling.