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 - 2010 Christian Schoenebeck * |
* Copyright (C) 2005 - 2014 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 * |
25 |
|
|
26 |
#include "../../common/global_private.h" |
#include "../../common/global_private.h" |
27 |
#include "../../Sampler.h" |
#include "../../Sampler.h" |
28 |
|
#include "MidiInputDeviceFactory.h" |
29 |
|
|
30 |
namespace LinuxSampler { |
namespace LinuxSampler { |
31 |
|
|
119 |
std::map<uint, SamplerChannel*>::iterator iter = channels.begin(); |
std::map<uint, SamplerChannel*>::iterator iter = channels.begin(); |
120 |
for (; iter != channels.end(); iter++) { |
for (; iter != channels.end(); iter++) { |
121 |
SamplerChannel* chn = iter->second; |
SamplerChannel* chn = iter->second; |
122 |
if (chn->GetMidiInputDevice() == NULL || chn->GetMidiInputDevice() != pDevice) { |
std::vector<MidiInputPort*> vPorts = chn->GetMidiInputPorts(); |
123 |
continue; |
for (int k = 0; k < vPorts.size(); ++k) { |
124 |
} |
if (vPorts[k]->GetDevice() != pDevice) |
125 |
|
continue; |
126 |
int port = chn->GetMidiInputPort(); |
int port = vPorts[k]->GetPortNumber(); |
127 |
if (port >= i) { |
if (port >= i) { |
128 |
String err = "Sampler channel " + ToString(iter->first); |
String err = "Sampler channel " + ToString(iter->first); |
129 |
err += " is still connected to MIDI port " + ToString(port); |
err += " is still connected to MIDI port " + ToString(port); |
130 |
throw Exception(err); |
throw Exception(err); |
131 |
|
} |
132 |
} |
} |
133 |
} |
} |
134 |
|
|
171 |
return Parameters; |
return Parameters; |
172 |
} |
} |
173 |
|
|
174 |
|
int MidiInputDevice::MidiInputDeviceID() { |
175 |
|
std::map<uint, MidiInputDevice*> mDevices = MidiInputDeviceFactory::Devices(); |
176 |
|
for (std::map<uint, MidiInputDevice*>::const_iterator it = mDevices.begin(); it != mDevices.end(); ++it) { |
177 |
|
if (it->second == this) { |
178 |
|
return it->first; |
179 |
|
} |
180 |
|
} |
181 |
|
return -1; |
182 |
|
} |
183 |
|
|
184 |
void MidiInputDevice::AddMidiPortCountListener(MidiPortCountListener* l) { |
void MidiInputDevice::AddMidiPortCountListener(MidiPortCountListener* l) { |
185 |
portCountListeners.AddListener(l); |
portCountListeners.AddListener(l); |
186 |
} |
} |