/[svn]/linuxsampler/trunk/src/drivers/midi/MidiInstrumentMapper.cpp
ViewVC logotype

Diff of /linuxsampler/trunk/src/drivers/midi/MidiInstrumentMapper.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3052 by schoenebeck, Wed Dec 14 17:34:54 2016 UTC revision 3054 by schoenebeck, Thu Dec 15 12:47:45 2016 UTC
# Line 1  Line 1 
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  *
# Line 178  namespace LinuxSampler { Line 178  namespace LinuxSampler {
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);
# Line 256  namespace LinuxSampler { Line 256  namespace LinuxSampler {
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                    
# Line 333  namespace LinuxSampler { Line 333  namespace LinuxSampler {
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) {
# Line 343  namespace LinuxSampler { Line 343  namespace LinuxSampler {
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() {
# Line 382  namespace LinuxSampler { Line 382  namespace LinuxSampler {
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                    
# Line 417  namespace LinuxSampler { Line 417  namespace LinuxSampler {
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() {
# Line 425  namespace LinuxSampler { Line 425  namespace LinuxSampler {
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() {

Legend:
Removed from v.3052  
changed lines
  Added in v.3054

  ViewVC Help
Powered by ViewVC