1 |
/*************************************************************************** |
/*************************************************************************** |
2 |
* * |
* * |
3 |
* Copyright (C) 2006 - 2013 Christian Schoenebeck * |
* Copyright (C) 2006 - 2016 Christian Schoenebeck * |
4 |
* * |
* * |
5 |
* This library is free software; you can redistribute it and/or modify * |
* This library is free software; you can redistribute it and/or modify * |
6 |
* 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 * |
178 |
MapFound = true; |
MapFound = true; |
179 |
Replaced = (iterMap->second.find(Index) != iterMap->second.end()); |
Replaced = (iterMap->second.find(Index) != iterMap->second.end()); |
180 |
iterMap->second[Index] = privateEntry; |
iterMap->second[Index] = privateEntry; |
181 |
InstrCount = iterMap->second.size(); |
InstrCount = (int)iterMap->second.size(); |
182 |
} |
} |
183 |
} |
} |
184 |
EngineFactory::Destroy(pEngine); |
EngineFactory::Destroy(pEngine); |
256 |
std::map<int,MidiInstrumentMap>::iterator iterMap = midiMaps.find(Map); |
std::map<int,MidiInstrumentMap>::iterator iterMap = midiMaps.find(Map); |
257 |
if (iterMap != midiMaps.end()) { // map found |
if (iterMap != midiMaps.end()) { // map found |
258 |
iterMap->second.erase(Index); // remove entry |
iterMap->second.erase(Index); // remove entry |
259 |
InstrCount = iterMap->second.size(); |
InstrCount = (int)iterMap->second.size(); |
260 |
} |
} |
261 |
} |
} |
262 |
|
|
333 |
|
|
334 |
int MidiInstrumentMapper::GetMapCount() { |
int MidiInstrumentMapper::GetMapCount() { |
335 |
LockGuard lock(midiMapsMutex); |
LockGuard lock(midiMapsMutex); |
336 |
return midiMaps.size(); |
return (int) midiMaps.size(); |
337 |
} |
} |
338 |
|
|
339 |
int MidiInstrumentMapper::GetInstrumentCount(int Map) { |
int MidiInstrumentMapper::GetInstrumentCount(int Map) { |
343 |
throw Exception("There is no MIDI instrument map " + ToString(Map)); |
throw Exception("There is no MIDI instrument map " + ToString(Map)); |
344 |
} |
} |
345 |
|
|
346 |
return iterMap->second.size(); |
return (int) iterMap->second.size(); |
347 |
} |
} |
348 |
|
|
349 |
int MidiInstrumentMapper::GetInstrumentCount() { |
int MidiInstrumentMapper::GetInstrumentCount() { |
382 |
__create_map: |
__create_map: |
383 |
midiMaps[ID].name = MapName; |
midiMaps[ID].name = MapName; |
384 |
|
|
385 |
fireMidiInstrumentMapCountChanged(Maps().size()); |
fireMidiInstrumentMapCountChanged((int)Maps().size()); |
386 |
// If there were no maps until now we must set a default map. |
// If there were no maps until now we must set a default map. |
387 |
if (midiMaps.size() == 1) SetDefaultMap(ID); |
if (midiMaps.size() == 1) SetDefaultMap(ID); |
388 |
|
|
417 |
if (Map == GetDefaultMap()) { |
if (Map == GetDefaultMap()) { |
418 |
SetDefaultMap(midiMaps.empty() ? -1 : (*(midiMaps.begin())).first); |
SetDefaultMap(midiMaps.empty() ? -1 : (*(midiMaps.begin())).first); |
419 |
} |
} |
420 |
fireMidiInstrumentMapCountChanged(Maps().size()); |
fireMidiInstrumentMapCountChanged((int)Maps().size()); |
421 |
} |
} |
422 |
|
|
423 |
void MidiInstrumentMapper::RemoveAllMaps() { |
void MidiInstrumentMapper::RemoveAllMaps() { |
425 |
|
|
426 |
midiMaps.clear(); |
midiMaps.clear(); |
427 |
SetDefaultMap(-1); |
SetDefaultMap(-1); |
428 |
fireMidiInstrumentMapCountChanged(Maps().size()); |
fireMidiInstrumentMapCountChanged((int)Maps().size()); |
429 |
} |
} |
430 |
|
|
431 |
int MidiInstrumentMapper::GetDefaultMap() { |
int MidiInstrumentMapper::GetDefaultMap() { |