110 static void SDLCALL StreamCallback(
void *userData,
111 SDL_AudioStream *stream,
116 SDL_AudioStream *m_stream =
nullptr;
120 bool m_primed =
false;
122 bool m_musicTick =
false;
124 bool m_musicProcessing =
true;
125 bool m_sfxProcessing =
true;
126 bool m_paused =
false;
127 bool m_devicePaused =
true;
128 bool m_musicEnabled =
true;
129 bool m_sfxEnabled =
true;
void SetProcessingEnabled(bool music, bool soundEffects)
Enable each category independently of transient fades and playback pauses.
N64Audio()
Initialise channels in the active N64MixerContext, without opening an audio device.
void Stop()
Stop the module and silence its channels.
bool UpdateVolumeProcessing()
Suspend the device while paused or while both enabled audio categories are silent.
~N64Audio()
Destroy the playback stream before the mixer context is destroyed.
N64Audio & operator=(const N64Audio &)=delete
Prevent assignment of the playback stream and module storage.
std::vector< std::int16_t > Render(std::size_t frames)
Render stereo 16-bit frames without a device, as the device would receive them.
void Play(std::span< const std::uint8_t > module)
Load a module and start it from its first order.
bool OpenDevice()
Open the default playback device.
void SetMusicGain(float gain)
Scale the music of the modules, apart from the sound effects the player mixes with it.
N64Audio(const N64Audio &)=delete
Prevent copying the playback stream and module storage.
N64MixerContext()
Register the sole mixer context.
N64MixerContext(const N64MixerContext &)=delete
Prevent copying the registered mixer and its synchronisation resources.
N64MixerContext & operator=(const N64MixerContext &)=delete
Prevent assignment of the registered mixer and its synchronisation resources.
~N64MixerContext()
Unregister the mixer after all audio players and locks have been destroyed.
~N64MixerLock()
Release the mutex on the thread that acquired this lock.
N64MixerLock & operator=(const N64MixerLock &)=delete
Prevent assignment of a mutex acquisition.
N64MixerLock()
Acquire the active mixer context's recursive mutex on the calling thread.
N64MixerLock(const N64MixerLock &)=delete
Prevent copying a mutex acquisition.
Definition assetimport.h:11
constexpr int N64_AUDIO_RATE
The sample rate of the imported music, in stereo frames per second.
Definition music.h:38
void PublishN64Volumes()
Hand the volumes the game writes (g_bBgmVolume, g_bMusicVolume, g_bSfxMasterVolume,...