--- linuxsampler/trunk/src/engines/common/DiskThreadBase.h 2014/08/30 13:17:50 2671 +++ linuxsampler/trunk/src/engines/common/DiskThreadBase.h 2014/09/06 13:04:01 2672 @@ -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