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-2009 Christian Schoenebeck * |
* Copyright (C) 2005-2009 Christian Schoenebeck * |
7 |
* Copyright (C) 2009 Grigor Iliev * |
* Copyright (C) 2009-2010 Grigor Iliev * |
8 |
* * |
* * |
9 |
* This program is free software; you can redistribute it and/or modify * |
* This program is free software; you can redistribute it and/or modify * |
10 |
* 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 * |
39 |
// fully loaded, try to give back instrument again (see bug #113) |
// fully loaded, try to give back instrument again (see bug #113) |
40 |
InstrumentChangeCmd< ::sfz::Region, ::sfz::Instrument>& cmd = ChangeInstrument(NULL); |
InstrumentChangeCmd< ::sfz::Region, ::sfz::Instrument>& cmd = ChangeInstrument(NULL); |
41 |
if (cmd.pInstrument) { |
if (cmd.pInstrument) { |
42 |
InstrumentResourceManager* instrs = dynamic_cast<InstrumentResourceManager*>(pEngine->GetInstrumentManager()); |
Engine::instruments.HandBack(cmd.pInstrument, this); |
|
instrs->HandBack(cmd.pInstrument, this); |
|
43 |
} |
} |
44 |
/////// |
/////// |
45 |
} |
} |
94 |
cmd.pRegionsInUse->clear(); |
cmd.pRegionsInUse->clear(); |
95 |
|
|
96 |
// delete all key groups |
// delete all key groups |
97 |
ActiveKeyGroups.clear(); |
DeleteGroupEventLists(); |
98 |
|
|
99 |
// request sfz instrument from instrument manager |
// request sfz instrument from instrument manager |
100 |
::sfz::Instrument* newInstrument; |
::sfz::Instrument* newInstrument; |
134 |
} |
} |
135 |
|
|
136 |
// rebuild ActiveKeyGroups map with key groups of current instrument |
// rebuild ActiveKeyGroups map with key groups of current instrument |
137 |
//for (::gig::Region* pRegion = newInstrument->GetFirstRegion(); pRegion; pRegion = newInstrument->GetNextRegion()) |
for (std::vector< ::sfz::Region*>::iterator itRegion = newInstrument->regions.begin() ; |
138 |
// if (pRegion->KeyGroup) ActiveKeyGroups[pRegion->KeyGroup] = NULL; |
itRegion != newInstrument->regions.end() ; ++itRegion) { |
139 |
// TODO: ^^^ |
AddGroup((*itRegion)->group); |
140 |
|
AddGroup((*itRegion)->off_by); |
141 |
|
} |
142 |
|
|
143 |
InstrumentIdxName = newInstrument->GetName(); |
InstrumentIdxName = newInstrument->GetName(); |
144 |
InstrumentStat = 100; |
InstrumentStat = 100; |
151 |
void EngineChannel::ProcessKeySwitchChange(int key) { } |
void EngineChannel::ProcessKeySwitchChange(int key) { } |
152 |
|
|
153 |
void EngineChannel::PreProcessNoteOn(uint8_t key, uint8_t velocity) { |
void EngineChannel::PreProcessNoteOn(uint8_t key, uint8_t velocity) { |
|
LastKey = key; |
|
154 |
if(pInstrument != NULL && pInstrument->HasKeySwitchBinding(key)) LastKeySwitch = key; |
if(pInstrument != NULL && pInstrument->HasKeySwitchBinding(key)) LastKeySwitch = key; |
155 |
PressedKeys[key] = true; |
PressedKeys[key] = true; |
156 |
} |
} |
157 |
|
|
158 |
|
void EngineChannel::PostProcessNoteOn(uint8_t key, uint8_t velocity) { |
159 |
|
LastKey = key; |
160 |
|
} |
161 |
|
|
162 |
void EngineChannel::PreProcessNoteOff(uint8_t key, uint8_t velocity) { |
void EngineChannel::PreProcessNoteOff(uint8_t key, uint8_t velocity) { |
163 |
PressedKeys[key] = false; |
PressedKeys[key] = false; |
164 |
} |
} |