1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-22 17:49:43 +01:00

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.
This commit is contained in:
Ethan Lee 2022-01-14 16:52:52 -05:00
parent df618e6d22
commit d36741fa07

View file

@ -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<SoundTrack> soundTracks;
musicclass::musicclass(void)
{
MusicTrack::Init(44100, 2);
SoundTrack::Init(44100, 2);
safeToProcessMusic= false;
m_doFadeInVol = false;