void MIDIDeviceChanged(int newdev, bool force) { static int oldmididev = INT_MIN; // If a song is playing, move it to the new device. if (oldmididev != newdev || force) { if (currSong != NULL && currSong->IsMIDI()) { MusInfo *song = currSong; if (song->m_Status == MusInfo::STATE_Playing) { if (song->GetDeviceType() == MDEV_FLUIDSYNTH && force) { // FluidSynth must reload the song to change the patch set. auto mi = mus_playing; S_StopMusic(true); S_ChangeMusic(mi.name, mi.baseorder, mi.loop); } else { song->Stop(); song->Start(song->m_Looping); } } } else { S_MIDIDeviceChanged(); } } // 'force' if (!force) oldmididev = newdev; }
static void MIDIDeviceChanged(int newdev) { static int oldmididev = INT_MIN; // If a song is playing, move it to the new device. if (oldmididev != newdev) { if (currSong != NULL && currSong->IsMIDI()) { MusInfo *song = currSong; if (song->m_Status == MusInfo::STATE_Playing) { song->Stop(); song->Start(song->m_Looping); } } else { S_MIDIDeviceChanged(); } } oldmididev = newdev; }