From d36741fa07212eaeeded15010bc9ecf5f3c6c83a Mon Sep 17 00:00:00 2001 From: Ethan Lee Date: Fri, 14 Jan 2022 16:52:52 -0500 Subject: [PATCH] Move the Mix_OpenAudio call to SoundTrack, from MusicTrack. In hindsight, the FAudio pointer will likely be in SoundTrack since we will want to keep the mastering voice closer to the sounds and their source voice arrays, while the MusicTrack will likely just be one source voice that gets PCM from different streams. --- desktop_version/src/Music.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/desktop_version/src/Music.cpp b/desktop_version/src/Music.cpp index e044628e..c105c3fa 100644 --- a/desktop_version/src/Music.cpp +++ b/desktop_version/src/Music.cpp @@ -49,18 +49,6 @@ public: return true; } - static void Init(int audio_rate, int audio_channels) - { - const Uint16 audio_format = AUDIO_S16SYS; - const int audio_buffers = 1024; - - if (Mix_OpenAudio(audio_rate, audio_format, audio_channels, audio_buffers) != 0) - { - vlog_error("Unable to initialize audio: %s", Mix_GetError()); - SDL_assert(0 && "Unable to initialize audio!"); - } - } - static void Halt() { Mix_HaltMusic(); @@ -129,6 +117,18 @@ public: } } + static void Init(int audio_rate, int audio_channels) + { + const Uint16 audio_format = AUDIO_S16SYS; + const int audio_buffers = 1024; + + if (Mix_OpenAudio(audio_rate, audio_format, audio_channels, audio_buffers) != 0) + { + vlog_error("Unable to initialize audio: %s", Mix_GetError()); + SDL_assert(0 && "Unable to initialize audio!"); + } + } + static void Pause() { Mix_Pause(-1); @@ -155,7 +155,7 @@ static std::vector soundTracks; musicclass::musicclass(void) { - MusicTrack::Init(44100, 2); + SoundTrack::Init(44100, 2); safeToProcessMusic= false; m_doFadeInVol = false;