Skip to content

Commit

Permalink
do MIDI device lookup by lump index as well, for the same reasons as …
Browse files Browse the repository at this point in the history
…doing it for the volume.
  • Loading branch information
prof-hastig committed Dec 28, 2023
1 parent eb2f263 commit e0612d3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/common/audio/music/music.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion src/common/audio/music/s_music.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ struct MidiDeviceSetting
FString args;
};

typedef TMap<FName, MidiDeviceSetting> MidiDeviceMap;
typedef TMap<int, MidiDeviceSetting> MidiDeviceMap;
typedef TMap<int, float> MusicVolumeMap;

extern MidiDeviceMap MidiDevices;
Expand Down
4 changes: 2 additions & 2 deletions src/sound/s_advsound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit e0612d3

Please sign in to comment.