- Fixed: Selecting TiMidity++ as a MIDI device without a working timidity.exe, then switching to a different MIDI device would leave music silent until a new song was started.

(The discrepancy between mus_playing.handle and currSong is one which should probably be handled properly at some point.)

SVN r3212 (trunk)
This commit is contained in:
Randy Heit 2011-05-20 00:26:22 +00:00
parent 2de3937338
commit 1579fd1c1c
3 changed files with 29 additions and 5 deletions

View file

@ -2517,6 +2517,21 @@ void S_RestartMusic ()
}
}
//==========================================================================
//
// S_MIDIDeviceChanged
//
//==========================================================================
void S_MIDIDeviceChanged()
{
if (mus_playing.handle != NULL && mus_playing.handle->IsMIDI())
{
mus_playing.handle->Stop();
mus_playing.handle->Start(mus_playing.loop, -1, mus_playing.baseorder);
}
}
//==========================================================================
//
// S_GetMusic

View file

@ -313,6 +313,8 @@ bool S_ChangeCDMusic (int track, unsigned int id=0, bool looping=true);
void S_RestartMusic ();
void S_MIDIDeviceChanged();
int S_GetMusic (char **name);
// Stops the music for sure.

View file

@ -43,7 +43,9 @@ static void MIDIDeviceChanged(int newdev)
static int oldmididev = INT_MIN;
// If a song is playing, move it to the new device.
if (oldmididev != newdev && currSong != NULL && currSong->IsMIDI())
if (oldmididev != newdev)
{
if (currSong != NULL && currSong->IsMIDI())
{
MusInfo *song = currSong;
if (song->m_Status == MusInfo::STATE_Playing)
@ -52,6 +54,11 @@ static void MIDIDeviceChanged(int newdev)
song->Start(song->m_Looping);
}
}
else
{
S_MIDIDeviceChanged();
}
}
oldmididev = newdev;
}