/[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 880 by schoenebeck, Tue Jun 27 22:57:37 2006 UTC revision 1424 by schoenebeck, Sun Oct 14 22:00:17 2007 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                        *   *   Copyright (C) 2005 - 2007 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 23  Line 23 
23    
24  #include "MidiInputDevice.h"  #include "MidiInputDevice.h"
25    
26    #include "../../common/global_private.h"
27    #include "../../Sampler.h"
28    
29  namespace LinuxSampler {  namespace LinuxSampler {
30    
31  // *************** ParameterActive ***************  // *************** ParameterActive ***************
# Line 97  namespace LinuxSampler { Line 100  namespace LinuxSampler {
100      }      }
101    
102      optional<int> MidiInputDevice::ParameterPorts::RangeMinAsInt(std::map<String,String> Parameters) {      optional<int> MidiInputDevice::ParameterPorts::RangeMinAsInt(std::map<String,String> Parameters) {
103          return optional<int>::nothing;          return 1;
104      }      }
105    
106      optional<int> MidiInputDevice::ParameterPorts::RangeMaxAsInt(std::map<String,String> Parameters) {      optional<int> MidiInputDevice::ParameterPorts::RangeMaxAsInt(std::map<String,String> Parameters) {
107          return optional<int>::nothing;          return 100;
108      }      }
109    
110      std::vector<int> MidiInputDevice::ParameterPorts::PossibilitiesAsInt(std::map<String,String> Parameters) {      std::vector<int> MidiInputDevice::ParameterPorts::PossibilitiesAsInt(std::map<String,String> Parameters) {
# Line 109  namespace LinuxSampler { Line 112  namespace LinuxSampler {
112      }      }
113    
114      void MidiInputDevice::ParameterPorts::OnSetValue(int i) throw (Exception) {      void MidiInputDevice::ParameterPorts::OnSetValue(int i) throw (Exception) {
115            MidiInputDevice* dev = static_cast<MidiInputDevice*> (pDevice);
116            Sampler* s = static_cast<Sampler*> (dev->pSampler);
117            std::map<uint, SamplerChannel*> channels = s->GetSamplerChannels();
118            std::map<uint, SamplerChannel*>::iterator iter = channels.begin();
119            for (; iter != channels.end(); iter++) {
120                SamplerChannel* chn = iter->second;
121                if (chn->GetMidiInputDevice() == NULL || chn->GetMidiInputDevice() != pDevice) {
122                    continue;
123                }
124                
125                int port = chn->GetMidiInputPort();
126                if (port >= i) {
127                    String err = "Sampler channel " + ToString(iter->first);
128                    err += " is still connected to MIDI port " + ToString(port);
129                    throw Exception(err);
130                }
131            }
132            
133          ((MidiInputDevice*)pDevice)->AcquirePorts(i);          ((MidiInputDevice*)pDevice)->AcquirePorts(i);
134      }      }
135    

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

  ViewVC Help
Powered by ViewVC