Index: src/engines/common/DiskThreadBase.h =================================================================== --- src/engines/common/DiskThreadBase.h (revision 2671) +++ src/engines/common/DiskThreadBase.h (working copy) @@ -26,6 +26,8 @@ #ifndef __LS_DISKTHREADBASE_H__ #define __LS_DISKTHREADBASE_H__ +#include + #include "StreamBase.h" #include "../EngineChannel.h" #include "../InstrumentManagerBase.h" @@ -506,11 +508,20 @@ // perform MIDI program change commands if (ProgramChangeQueue.read_space() > 0) { program_change_command_t cmd; - // skip all old ones, only process the latest one + std::map cmds; + // skip all old ones, only process the latest program + // change command on each engine channel do { ProgramChangeQueue.pop(&cmd); + cmds[cmd.pEngineChannel] = cmd.Program; } while (ProgramChangeQueue.read_space() > 0); - cmd.pEngineChannel->ExecuteProgramChange(cmd.Program); + // now execute those latest program change commands on + // their respective engine channel + for (std::map::const_iterator it = cmds.begin(); + it != cmds.end(); ++it) + { + it->first->ExecuteProgramChange(it->second); + } } RefillStreams(); // refill the most empty streams