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 * |
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 |
} |
} |
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) { |
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 |
|
|
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) { |
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 |