void I_InitMusic(MusicSystemType musicsystem_type) { I_ShutdownMusic(); I_ResetMidiVolume(); if(Args.CheckParm("-nosound") || Args.CheckParm("-nomusic") || snd_musicsystem == MS_NONE) { // User has chosen to disable music musicsystem = new SilentMusicSystem(); current_musicsystem_type = MS_NONE; return; } switch ((int)musicsystem_type) { #ifdef OSX case MS_AUDIOUNIT: musicsystem = new AuMusicSystem(); break; #endif // OSX #ifdef PORTMIDI case MS_PORTMIDI: musicsystem = new PortMidiMusicSystem(); break; #endif // PORTMIDI case MS_SDLMIXER: // fall through default: musicsystem = new SdlMixerMusicSystem(); break; } current_musicsystem_type = musicsystem_type; }
void I_InitMusic(MusicSystemType musicsystem_type) { #if defined(UNIX) && !defined(OSX) struct stat buf; if(stat("/etc/timidity.cfg", &buf) && stat("/etc/timidity/timidity.cfg", &buf)) Args.AppendArg("-nomusic"); #endif I_ShutdownMusic(); I_ResetMidiVolume(); if(Args.CheckParm("-nosound") || Args.CheckParm("-nomusic") || snd_musicsystem == MS_NONE) { // User has chosen to disable music musicsystem = new SilentMusicSystem(); current_musicsystem_type = MS_NONE; return; } switch ((int)musicsystem_type) { #ifdef OSX case MS_AUDIOUNIT: musicsystem = new AuMusicSystem(); break; #endif // OSX #ifdef PORTMIDI case MS_PORTMIDI: musicsystem = new PortMidiMusicSystem(); break; #endif // PORTMIDI case MS_SDLMIXER: // fall through default: musicsystem = new SdlMixerMusicSystem(); break; } current_musicsystem_type = musicsystem_type; }
void I_PlaySong(byte* data, size_t length, bool loop) { if (!musicsystem) return; MusicSystemType newtype = I_SelectMusicSystem(data, length); if (newtype != current_musicsystem_type) { if (musicsystem) { I_ShutdownMusic(); S_StopMusic(); } I_InitMusic(newtype); } musicsystem->startSong(data, length, loop); // Hack for problems with Windows Vista/7 & SDL_Mixer // See comment for I_ResetMidiVolume(). I_ResetMidiVolume(); I_SetMusicVolume(snd_musicvolume); }