3 |
* LinuxSampler - modular, streaming capable sampler * |
* LinuxSampler - modular, streaming capable sampler * |
4 |
* * |
* * |
5 |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
6 |
* Copyright (C) 2005 - 20010 Christian Schoenebeck * |
* Copyright (C) 2005 - 2011 Christian Schoenebeck * |
7 |
* * |
* * |
8 |
* This program is free software; you can redistribute it and/or modify * |
* This program is free software; you can redistribute it and/or modify * |
9 |
* it under the terms of the GNU General Public License as published by * |
* it under the terms of the GNU General Public License as published by * |
300 |
} |
} |
301 |
} |
} |
302 |
|
|
303 |
void EngineChannel::ExecuteProgramChange(uint8_t Program) { |
void EngineChannel::ExecuteProgramChange(uint32_t Program) { |
304 |
dmsg(1,("Received MIDI program change (prog=%d)\n",Program)); |
uint8_t hb = (Program >> 16) & 0xff; |
305 |
|
uint8_t lb = (Program >> 8) & 0xff; |
306 |
|
uint8_t pc = Program & 0x7f; |
307 |
|
|
308 |
|
dmsg(1,("Received MIDI program change (msb=%d) (lsb=%d) (prog=%d)\n", hb ,lb, pc)); |
309 |
std::vector<int> maps = MidiInstrumentMapper::Maps(); |
std::vector<int> maps = MidiInstrumentMapper::Maps(); |
310 |
if (maps.empty()) return; |
if (maps.empty()) return; |
311 |
|
|
|
SetMidiProgram(Program); |
|
312 |
if (UsesNoMidiInstrumentMap()) return; |
if (UsesNoMidiInstrumentMap()) return; |
313 |
if (MidiInstrumentMapper::GetMapCount() == 0) return; |
if (MidiInstrumentMapper::GetMapCount() == 0) return; |
314 |
// retrieve the MIDI instrument map this engine channel is assigned to |
// retrieve the MIDI instrument map this engine channel is assigned to |
316 |
? MidiInstrumentMapper::GetDefaultMap() /*default*/ : GetMidiInstrumentMap(); |
? MidiInstrumentMapper::GetDefaultMap() /*default*/ : GetMidiInstrumentMap(); |
317 |
// is there an entry for this MIDI bank&prog pair in that map? |
// is there an entry for this MIDI bank&prog pair in that map? |
318 |
midi_prog_index_t midiIndex; |
midi_prog_index_t midiIndex; |
319 |
midiIndex.midi_bank_msb = GetMidiBankMsb(); |
midiIndex.midi_bank_msb = hb; |
320 |
midiIndex.midi_bank_lsb = GetMidiBankLsb(); |
midiIndex.midi_bank_lsb = lb; |
321 |
midiIndex.midi_prog = GetMidiProgram(); |
midiIndex.midi_prog = pc; |
322 |
optional<MidiInstrumentMapper::entry_t> mapping = |
optional<MidiInstrumentMapper::entry_t> mapping = |
323 |
MidiInstrumentMapper::GetEntry(iMapID, midiIndex); |
MidiInstrumentMapper::GetEntry(iMapID, midiIndex); |
324 |
if (mapping) { // if mapping exists ... |
if (mapping) { // if mapping exists ... |