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

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

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

revision 221 by schoenebeck, Fri Aug 20 17:25:19 2004 UTC revision 880 by schoenebeck, Tue Jun 27 22:57:37 2006 UTC
# Line 3  Line 3 
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, 2006 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  *
# Line 54  namespace LinuxSampler { Line 55  namespace LinuxSampler {
55          return true;          return true;
56      }      }
57    
58      void MidiInputDevice::ParameterActive::OnSetValue(bool b) throw (LinuxSamplerException) {      void MidiInputDevice::ParameterActive::OnSetValue(bool b) throw (Exception) {
59          if (b) ((MidiInputDevice*)pDevice)->Listen();          if (b) ((MidiInputDevice*)pDevice)->Listen();
60          else ((MidiInputDevice*)pDevice)->StopListen();          else ((MidiInputDevice*)pDevice)->StopListen();
61      }      }
# Line 92  namespace LinuxSampler { Line 93  namespace LinuxSampler {
93      }      }
94    
95      optional<int> MidiInputDevice::ParameterPorts::DefaultAsInt(std::map<String,String> Parameters) {      optional<int> MidiInputDevice::ParameterPorts::DefaultAsInt(std::map<String,String> Parameters) {
96          return 0;          return 1;
97      }      }
98    
99      optional<int> MidiInputDevice::ParameterPorts::RangeMinAsInt(std::map<String,String> Parameters) {      optional<int> MidiInputDevice::ParameterPorts::RangeMinAsInt(std::map<String,String> Parameters) {
# Line 107  namespace LinuxSampler { Line 108  namespace LinuxSampler {
108          return std::vector<int>();          return std::vector<int>();
109      }      }
110    
111      void MidiInputDevice::ParameterPorts::OnSetValue(int i) throw (LinuxSamplerException) {      void MidiInputDevice::ParameterPorts::OnSetValue(int i) throw (Exception) {
112          ((MidiInputDevice*)pDevice)->AcquirePorts(i);          ((MidiInputDevice*)pDevice)->AcquirePorts(i);
113      }      }
114    
# Line 120  namespace LinuxSampler { Line 121  namespace LinuxSampler {
121  // *************** MidiInputDevice ***************  // *************** MidiInputDevice ***************
122  // *  // *
123    
124      MidiInputDevice::MidiInputDevice(std::map<String,DeviceCreationParameter*> DriverParameters) {      MidiInputDevice::MidiInputDevice(std::map<String,DeviceCreationParameter*> DriverParameters, void* pSampler) {
125              this->Parameters = DriverParameters;          this->Parameters = DriverParameters;
126            this->pSampler   = pSampler;
127      }      }
128    
129      MidiInputDevice::~MidiInputDevice() {      MidiInputDevice::~MidiInputDevice() {
130              std::map<String,DeviceCreationParameter*>::iterator iter = Parameters.begin();          std::map<String,DeviceCreationParameter*>::iterator iter = Parameters.begin();
131              while (iter != Parameters.end()) {          while (iter != Parameters.end()) {
132                      Parameters.erase(iter);              delete iter->second;
133                      delete iter->second;              iter++;
134                      iter++;          }
135              }          Parameters.clear();
136      }      }
137    
138      MidiInputPort* MidiInputDevice::GetPort(uint iPort) throw (MidiInputException) {      MidiInputPort* MidiInputDevice::GetPort(uint iPort) throw (MidiInputException) {
# Line 151  namespace LinuxSampler { Line 153  namespace LinuxSampler {
153                   if (diff > 0) {        //We've got too many ports, remove one                   if (diff > 0) {        //We've got too many ports, remove one
154                           std::map<int,MidiInputPort*>::iterator portsIter = Ports.end();                           std::map<int,MidiInputPort*>::iterator portsIter = Ports.end();
155                           --portsIter;                           --portsIter;
                          Ports.erase(portsIter);  
156                           delete portsIter->second;                           delete portsIter->second;
157                             Ports.erase(portsIter);
158                           diff--;                           diff--;
159                   }                   }
160                   if (diff < 0) {       //We don't have enough ports, create one                   if (diff < 0) {       //We don't have enough ports, create one

Legend:
Removed from v.221  
changed lines
  Added in v.880

  ViewVC Help
Powered by ViewVC