23 |
|
|
24 |
#include "MidiInputDevice.h" |
#include "MidiInputDevice.h" |
25 |
|
|
26 |
|
#include "../../Sampler.h" |
27 |
|
|
28 |
namespace LinuxSampler { |
namespace LinuxSampler { |
29 |
|
|
30 |
// *************** ParameterActive *************** |
// *************** ParameterActive *************** |
111 |
} |
} |
112 |
|
|
113 |
void MidiInputDevice::ParameterPorts::OnSetValue(int i) throw (Exception) { |
void MidiInputDevice::ParameterPorts::OnSetValue(int i) throw (Exception) { |
114 |
|
MidiInputDevice* dev = static_cast<MidiInputDevice*> (pDevice); |
115 |
|
Sampler* s = static_cast<Sampler*> (dev->pSampler); |
116 |
|
std::map<uint, SamplerChannel*> channels = s->GetSamplerChannels(); |
117 |
|
std::map<uint, SamplerChannel*>::iterator iter = channels.begin(); |
118 |
|
for (; iter != channels.end(); iter++) { |
119 |
|
SamplerChannel* chn = iter->second; |
120 |
|
if (chn->GetMidiInputDevice() == NULL || chn->GetMidiInputDevice() != pDevice) { |
121 |
|
continue; |
122 |
|
} |
123 |
|
|
124 |
|
int port = chn->GetMidiInputPort(); |
125 |
|
if (port >= i) { |
126 |
|
String err = "Sampler channel " + ToString(iter->first); |
127 |
|
err += " is still connected to MIDI port " + ToString(port); |
128 |
|
throw Exception(err); |
129 |
|
} |
130 |
|
} |
131 |
|
|
132 |
((MidiInputDevice*)pDevice)->AcquirePorts(i); |
((MidiInputDevice*)pDevice)->AcquirePorts(i); |
133 |
} |
} |
134 |
|
|