26 |
#ifndef __LS_DISKTHREADBASE_H__ |
#ifndef __LS_DISKTHREADBASE_H__ |
27 |
#define __LS_DISKTHREADBASE_H__ |
#define __LS_DISKTHREADBASE_H__ |
28 |
|
|
29 |
|
#include <map> |
30 |
|
|
31 |
#include "StreamBase.h" |
#include "StreamBase.h" |
32 |
#include "../EngineChannel.h" |
#include "../EngineChannel.h" |
33 |
#include "../InstrumentManagerBase.h" |
#include "../InstrumentManagerBase.h" |
508 |
// perform MIDI program change commands |
// perform MIDI program change commands |
509 |
if (ProgramChangeQueue.read_space() > 0) { |
if (ProgramChangeQueue.read_space() > 0) { |
510 |
program_change_command_t cmd; |
program_change_command_t cmd; |
511 |
// skip all old ones, only process the latest one |
std::map<EngineChannel*,uint32_t> cmds; |
512 |
|
// skip all old ones, only process the latest program |
513 |
|
// change command on each engine channel |
514 |
do { |
do { |
515 |
ProgramChangeQueue.pop(&cmd); |
ProgramChangeQueue.pop(&cmd); |
516 |
|
cmds[cmd.pEngineChannel] = cmd.Program; |
517 |
} while (ProgramChangeQueue.read_space() > 0); |
} while (ProgramChangeQueue.read_space() > 0); |
518 |
cmd.pEngineChannel->ExecuteProgramChange(cmd.Program); |
// now execute those latest program change commands on |
519 |
|
// their respective engine channel |
520 |
|
for (std::map<EngineChannel*,uint32_t>::const_iterator it = cmds.begin(); |
521 |
|
it != cmds.end(); ++it) |
522 |
|
{ |
523 |
|
it->first->ExecuteProgramChange(it->second); |
524 |
|
} |
525 |
} |
} |
526 |
|
|
527 |
RefillStreams(); // refill the most empty streams |
RefillStreams(); // refill the most empty streams |