diff --git a/src/common/audio/music/music.cpp b/src/common/audio/music/music.cpp index e05f9a04372..769d5c07c23 100644 --- a/src/common/audio/music/music.cpp +++ b/src/common/audio/music/music.cpp @@ -716,7 +716,6 @@ bool S_ChangeMusic(const char* musicname, int order, bool looping, bool force) } ZMusic_MusicStream handle = nullptr; - MidiDeviceSetting* devp = MidiDevices.CheckKey(musicname); // Strip off any leading file:// component. if (strncmp(musicname, "file://", 7) == 0) @@ -751,6 +750,8 @@ bool S_ChangeMusic(const char* musicname, int order, bool looping, bool force) else { int lumpnum = mus_cb.FindMusic(musicname); + MidiDeviceSetting* devp = MidiDevices.CheckKey(lumpnum); + auto volp = MusicVolumes.CheckKey(lumpnum); if (volp) { diff --git a/src/common/audio/music/s_music.h b/src/common/audio/music/s_music.h index 37a7c2de73e..cddfd36d626 100644 --- a/src/common/audio/music/s_music.h +++ b/src/common/audio/music/s_music.h @@ -68,7 +68,7 @@ struct MidiDeviceSetting FString args; }; -typedef TMap MidiDeviceMap; +typedef TMap MidiDeviceMap; typedef TMap MusicVolumeMap; extern MidiDeviceMap MidiDevices; diff --git a/src/sound/s_advsound.cpp b/src/sound/s_advsound.cpp index 3e3aed62423..f48e6855e4a 100644 --- a/src/sound/s_advsound.cpp +++ b/src/sound/s_advsound.cpp @@ -1077,7 +1077,7 @@ static void S_AddSNDINFO (int lump) case SI_MidiDevice: { sc.MustGetString(); - FName nm = sc.String; + int lumpnum = mus_cb.FindMusic(sc.String); FScanner::SavedPos save = sc.SavePos(); sc.SetCMode(true); @@ -1109,7 +1109,7 @@ static void S_AddSNDINFO (int lump) sc.RestorePos(save); sc.MustGetString(); } - MidiDevices[nm] = devset; + if (lumpnum >= 0) MidiDevices[lumpnum] = devset; } break;