94 |
*/ |
*/ |
95 |
String LSCPServer::LoadInstrument(String Filename, uint uiInstrument, uint uiSamplerChannel) { |
String LSCPServer::LoadInstrument(String Filename, uint uiInstrument, uint uiSamplerChannel) { |
96 |
dmsg(2,("LSCPServer: LoadInstrument(Filename=%s,Instrument=%d,SamplerChannel=%d)\n", Filename.c_str(), uiInstrument, uiSamplerChannel)); |
dmsg(2,("LSCPServer: LoadInstrument(Filename=%s,Instrument=%d,SamplerChannel=%d)\n", Filename.c_str(), uiInstrument, uiSamplerChannel)); |
97 |
result_t result; |
LSCPResultSet result; |
98 |
try { |
try { |
99 |
SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel); |
SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel); |
100 |
if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds"); |
if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds"); |
101 |
Engine* pEngine = pSamplerChannel->GetEngine(); |
Engine* pEngine = pSamplerChannel->GetEngine(); |
102 |
if (!pEngine) throw LinuxSamplerException("No engine loaded on channel"); |
if (!pEngine) throw LinuxSamplerException("No engine loaded on channel"); |
103 |
pEngine->LoadInstrument(Filename.c_str(), uiInstrument); |
pEngine->LoadInstrument(Filename.c_str(), uiInstrument); |
|
result.type = result_type_success; |
|
104 |
} |
} |
105 |
catch (LinuxSamplerException e) { |
catch (LinuxSamplerException e) { |
106 |
e.PrintMessage(); |
result.Error(e); |
|
result.type = result_type_error; |
|
|
result.code = LSCP_ERR_UNKNOWN; |
|
|
result.message = e.Message(); |
|
107 |
} |
} |
108 |
return ConvertResult(result); |
return result.Produce(); |
109 |
} |
} |
110 |
|
|
111 |
/** |
/** |
113 |
*/ |
*/ |
114 |
String LSCPServer::LoadEngine(String EngineName, uint uiSamplerChannel) { |
String LSCPServer::LoadEngine(String EngineName, uint uiSamplerChannel) { |
115 |
dmsg(2,("LSCPServer: LoadEngine(EngineName=%s,SamplerChannel=%d)\n", EngineName.c_str(), uiSamplerChannel)); |
dmsg(2,("LSCPServer: LoadEngine(EngineName=%s,SamplerChannel=%d)\n", EngineName.c_str(), uiSamplerChannel)); |
116 |
result_t result; |
LSCPResultSet result; |
117 |
try { |
try { |
118 |
Engine::type_t type; |
Engine::type_t type; |
119 |
if (EngineName == "gig") type = Engine::type_gig; |
if ((EngineName == "GigEngine") || (EngineName == "gig")) type = Engine::type_gig; |
120 |
else throw LinuxSamplerException("Unknown engine type"); |
else throw LinuxSamplerException("Unknown engine type"); |
121 |
SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel); |
SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel); |
122 |
if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds"); |
if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds"); |
123 |
pSamplerChannel->LoadEngine(type); |
pSamplerChannel->LoadEngine(type); |
|
result.type = result_type_success; |
|
124 |
} |
} |
125 |
catch (LinuxSamplerException e) { |
catch (LinuxSamplerException e) { |
126 |
e.PrintMessage(); |
result.Error(e); |
|
result.type = result_type_error; |
|
|
result.code = LSCP_ERR_UNKNOWN; |
|
|
result.message = e.Message(); |
|
127 |
} |
} |
128 |
return ConvertResult(result); |
return result.Produce(); |
129 |
} |
} |
130 |
|
|
131 |
/** |
/** |
133 |
*/ |
*/ |
134 |
String LSCPServer::GetChannels() { |
String LSCPServer::GetChannels() { |
135 |
dmsg(2,("LSCPServer: GetChannels()\n")); |
dmsg(2,("LSCPServer: GetChannels()\n")); |
136 |
return ToString(pSampler->SamplerChannels()) + "\r\n"; |
LSCPResultSet result; |
137 |
|
result.Add(pSampler->SamplerChannels()); |
138 |
|
return result.Produce(); |
139 |
} |
} |
140 |
|
|
141 |
/** |
/** |
144 |
String LSCPServer::AddChannel() { |
String LSCPServer::AddChannel() { |
145 |
dmsg(2,("LSCPServer: AddChannel()\n")); |
dmsg(2,("LSCPServer: AddChannel()\n")); |
146 |
SamplerChannel* pSamplerChannel = pSampler->AddSamplerChannel(); |
SamplerChannel* pSamplerChannel = pSampler->AddSamplerChannel(); |
147 |
return "OK[" + ToString(pSamplerChannel->Index()) + "]\r\n"; |
LSCPResultSet result(pSamplerChannel->Index()); |
148 |
|
return result.Produce(); |
149 |
} |
} |
150 |
|
|
151 |
/** |
/** |
153 |
*/ |
*/ |
154 |
String LSCPServer::RemoveChannel(uint uiSamplerChannel) { |
String LSCPServer::RemoveChannel(uint uiSamplerChannel) { |
155 |
dmsg(2,("LSCPServer: RemoveChannel(SamplerChannel=%d)\n", uiSamplerChannel)); |
dmsg(2,("LSCPServer: RemoveChannel(SamplerChannel=%d)\n", uiSamplerChannel)); |
156 |
|
LSCPResultSet result; |
157 |
pSampler->RemoveSamplerChannel(uiSamplerChannel); |
pSampler->RemoveSamplerChannel(uiSamplerChannel); |
158 |
return "OK\r\n"; |
return result.Produce(); |
159 |
} |
} |
160 |
|
|
161 |
/** |
/** |
163 |
*/ |
*/ |
164 |
String LSCPServer::GetAvailableEngines() { |
String LSCPServer::GetAvailableEngines() { |
165 |
dmsg(2,("LSCPServer: GetAvailableEngines()\n")); |
dmsg(2,("LSCPServer: GetAvailableEngines()\n")); |
166 |
return "gig\r\n"; |
LSCPResultSet result("GigEngine"); |
167 |
|
return result.Produce(); |
168 |
} |
} |
169 |
|
|
170 |
/** |
/** |
172 |
*/ |
*/ |
173 |
String LSCPServer::GetEngineInfo(String EngineName) { |
String LSCPServer::GetEngineInfo(String EngineName) { |
174 |
dmsg(2,("LSCPServer: GetEngineInfo(EngineName=%s)\n", EngineName.c_str())); |
dmsg(2,("LSCPServer: GetEngineInfo(EngineName=%s)\n", EngineName.c_str())); |
175 |
result_t result; |
LSCPResultSet result; |
176 |
try { |
try { |
177 |
if (EngineName == "gig") { |
if ((EngineName == "GigEngine") || (EngineName == "gig")) { |
178 |
Engine* pEngine = new LinuxSampler::gig::Engine; |
Engine* pEngine = new LinuxSampler::gig::Engine; |
179 |
String info = pEngine->Description() + "\r\n"; |
result.Add(pEngine->Description()); |
180 |
delete pEngine; |
delete pEngine; |
|
return info; // success |
|
181 |
} |
} |
182 |
else throw LinuxSamplerException("Unknown engine type"); |
else throw LinuxSamplerException("Unknown engine type"); |
183 |
} |
} |
184 |
catch (LinuxSamplerException e) { |
catch (LinuxSamplerException e) { |
185 |
e.PrintMessage(); |
result.Error(e); |
|
result.type = result_type_error; |
|
|
result.code = LSCP_ERR_UNKNOWN; |
|
|
result.message = e.Message(); |
|
186 |
} |
} |
187 |
return ConvertResult(result); |
return result.Produce(); |
188 |
} |
} |
189 |
|
|
190 |
/** |
/** |
193 |
*/ |
*/ |
194 |
String LSCPServer::GetChannelInfo(uint uiSamplerChannel) { |
String LSCPServer::GetChannelInfo(uint uiSamplerChannel) { |
195 |
dmsg(2,("LSCPServer: GetChannelInfo(SamplerChannel=%d)\n", uiSamplerChannel)); |
dmsg(2,("LSCPServer: GetChannelInfo(SamplerChannel=%d)\n", uiSamplerChannel)); |
196 |
|
LSCPResultSet result; |
197 |
try { |
try { |
|
LSCPResultSet result; |
|
198 |
SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel); |
SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel); |
199 |
if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds"); |
if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds"); |
200 |
Engine* pEngine = pSamplerChannel->GetEngine(); |
Engine* pEngine = pSamplerChannel->GetEngine(); |
230 |
result.Add("MIDI_INPUT_DEVICE", "0"); |
result.Add("MIDI_INPUT_DEVICE", "0"); |
231 |
result.Add("MIDI_INPUT_PORT", "0"); |
result.Add("MIDI_INPUT_PORT", "0"); |
232 |
result.Add("MIDI_INPUT_CHANNEL", "1"); |
result.Add("MIDI_INPUT_CHANNEL", "1"); |
|
|
|
|
return result.Produce(); |
|
233 |
} |
} |
234 |
catch (LinuxSamplerException e) { |
catch (LinuxSamplerException e) { |
235 |
result_t result; |
result.Error(e); |
|
e.PrintMessage(); |
|
|
result.type = result_type_error; |
|
|
result.code = LSCP_ERR_UNKNOWN; |
|
|
result.message = e.Message(); |
|
|
return ConvertResult(result); |
|
236 |
} |
} |
237 |
|
return result.Produce(); |
238 |
} |
} |
239 |
|
|
240 |
/** |
/** |
243 |
*/ |
*/ |
244 |
String LSCPServer::GetVoiceCount(uint uiSamplerChannel) { |
String LSCPServer::GetVoiceCount(uint uiSamplerChannel) { |
245 |
dmsg(2,("LSCPServer: GetVoiceCount(SamplerChannel=%d)\n", uiSamplerChannel)); |
dmsg(2,("LSCPServer: GetVoiceCount(SamplerChannel=%d)\n", uiSamplerChannel)); |
246 |
result_t result; |
LSCPResultSet result; |
247 |
try { |
try { |
248 |
SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel); |
SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel); |
249 |
if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds"); |
if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds"); |
250 |
Engine* pEngine = pSamplerChannel->GetEngine(); |
Engine* pEngine = pSamplerChannel->GetEngine(); |
251 |
if (!pEngine) throw LinuxSamplerException("No engine loaded on channel"); |
if (!pEngine) throw LinuxSamplerException("No engine loaded on channel"); |
252 |
return ToString(pEngine->VoiceCount()) + "\r\n"; // success |
result.Add(pEngine->VoiceCount()); |
253 |
} |
} |
254 |
catch (LinuxSamplerException e) { |
catch (LinuxSamplerException e) { |
255 |
e.PrintMessage(); |
result.Error(e); |
|
result.type = result_type_error; |
|
|
result.code = LSCP_ERR_UNKNOWN; |
|
|
result.message = e.Message(); |
|
256 |
} |
} |
257 |
return ConvertResult(result); |
return result.Produce(); |
258 |
} |
} |
259 |
|
|
260 |
/** |
/** |
263 |
*/ |
*/ |
264 |
String LSCPServer::GetStreamCount(uint uiSamplerChannel) { |
String LSCPServer::GetStreamCount(uint uiSamplerChannel) { |
265 |
dmsg(2,("LSCPServer: GetStreamCount(SamplerChannel=%d)\n", uiSamplerChannel)); |
dmsg(2,("LSCPServer: GetStreamCount(SamplerChannel=%d)\n", uiSamplerChannel)); |
266 |
result_t result; |
LSCPResultSet result; |
267 |
try { |
try { |
268 |
SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel); |
SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel); |
269 |
if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds"); |
if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds"); |
270 |
Engine* pEngine = pSamplerChannel->GetEngine(); |
Engine* pEngine = pSamplerChannel->GetEngine(); |
271 |
if (!pEngine) throw LinuxSamplerException("No engine loaded on channel"); |
if (!pEngine) throw LinuxSamplerException("No engine loaded on channel"); |
272 |
return ToString(pEngine->DiskStreamCount()) + "\r\n"; // success |
result.Add(pEngine->DiskStreamCount()); |
273 |
} |
} |
274 |
catch (LinuxSamplerException e) { |
catch (LinuxSamplerException e) { |
275 |
e.PrintMessage(); |
result.Error(e); |
|
result.type = result_type_error; |
|
|
result.code = LSCP_ERR_UNKNOWN; |
|
|
result.message = e.Message(); |
|
276 |
} |
} |
277 |
return ConvertResult(result); |
return result.Produce(); |
278 |
} |
} |
279 |
|
|
280 |
/** |
/** |
283 |
*/ |
*/ |
284 |
String LSCPServer::GetBufferFill(fill_response_t ResponseType, uint uiSamplerChannel) { |
String LSCPServer::GetBufferFill(fill_response_t ResponseType, uint uiSamplerChannel) { |
285 |
dmsg(2,("LSCPServer: GetBufferFill(ResponseType=%d, SamplerChannel=%d)\n", ResponseType, uiSamplerChannel)); |
dmsg(2,("LSCPServer: GetBufferFill(ResponseType=%d, SamplerChannel=%d)\n", ResponseType, uiSamplerChannel)); |
286 |
result_t result; |
LSCPResultSet result; |
287 |
try { |
try { |
288 |
SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel); |
SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel); |
289 |
if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds"); |
if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds"); |
290 |
Engine* pEngine = pSamplerChannel->GetEngine(); |
Engine* pEngine = pSamplerChannel->GetEngine(); |
291 |
if (!pEngine) throw LinuxSamplerException("No engine loaded on channel"); |
if (!pEngine) throw LinuxSamplerException("No engine loaded on channel"); |
292 |
if (!pEngine->DiskStreamSupported()) return "NA\r\n"; |
if (!pEngine->DiskStreamSupported()) return "NA\r\n"; //FIXME: Update resultset class to support "NA" |
293 |
switch (ResponseType) { |
switch (ResponseType) { |
294 |
case fill_response_bytes: |
case fill_response_bytes: |
295 |
return ToString(pEngine->DiskStreamBufferFillBytes()) + "\r\n"; // success |
result.Add(pEngine->DiskStreamBufferFillBytes()); |
296 |
|
break; |
297 |
case fill_response_percentage: |
case fill_response_percentage: |
298 |
return ToString(pEngine->DiskStreamBufferFillPercentage()) + "\r\n"; // success |
result.Add(pEngine->DiskStreamBufferFillPercentage()); |
299 |
|
break; |
300 |
default: |
default: |
301 |
throw LinuxSamplerException("Unknown fill response type"); |
throw LinuxSamplerException("Unknown fill response type"); |
302 |
} |
} |
303 |
} |
} |
304 |
catch (LinuxSamplerException e) { |
catch (LinuxSamplerException e) { |
305 |
e.PrintMessage(); |
result.Error(e); |
|
result.type = result_type_error; |
|
|
result.code = LSCP_ERR_UNKNOWN; |
|
|
result.message = e.Message(); |
|
306 |
} |
} |
307 |
return ConvertResult(result); |
return result.Produce(); |
308 |
} |
} |
309 |
|
|
310 |
/** |
/** |
313 |
*/ |
*/ |
314 |
String LSCPServer::SetAudioOutputType(AudioOutputDevice::type_t AudioOutputType, uint uiSamplerChannel) { |
String LSCPServer::SetAudioOutputType(AudioOutputDevice::type_t AudioOutputType, uint uiSamplerChannel) { |
315 |
dmsg(2,("LSCPServer: SetAudioOutputType(AudioOutputType=%d, SamplerChannel=%d)\n", AudioOutputType, uiSamplerChannel)); |
dmsg(2,("LSCPServer: SetAudioOutputType(AudioOutputType=%d, SamplerChannel=%d)\n", AudioOutputType, uiSamplerChannel)); |
316 |
result_t result; |
LSCPResultSet result; |
317 |
try { |
try { |
318 |
SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel); |
SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel); |
319 |
if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds"); |
if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds"); |
320 |
pSamplerChannel->SetAudioOutputDevice(AudioOutputType); |
pSamplerChannel->SetAudioOutputDevice(AudioOutputType); |
|
result.type = result_type_success; |
|
321 |
} |
} |
322 |
catch (LinuxSamplerException e) { |
catch (LinuxSamplerException e) { |
323 |
e.PrintMessage(); |
result.Error(e); |
|
result.type = result_type_error; |
|
|
result.code = LSCP_ERR_UNKNOWN; |
|
|
result.message = e.Message(); |
|
324 |
} |
} |
325 |
return ConvertResult(result); |
return result.Produce(); |
326 |
} |
} |
327 |
|
|
328 |
/** |
/** |
331 |
*/ |
*/ |
332 |
String LSCPServer::SetAudioOutputChannel(uint AudioOutputChannel, uint uiSamplerChannel) { |
String LSCPServer::SetAudioOutputChannel(uint AudioOutputChannel, uint uiSamplerChannel) { |
333 |
dmsg(2,("LSCPServer: SetAudioOutputChannel(AudioOutputChannel=%d, SamplerChannel=%d)\n", AudioOutputChannel, uiSamplerChannel)); |
dmsg(2,("LSCPServer: SetAudioOutputChannel(AudioOutputChannel=%d, SamplerChannel=%d)\n", AudioOutputChannel, uiSamplerChannel)); |
334 |
return "ERR:0:Not implemented yet.\r\n"; |
return "ERR:0:Not implemented yet.\r\n"; //FIXME: Add support for this in resultset class? |
335 |
} |
} |
336 |
|
|
337 |
String LSCPServer::SetMIDIInputType(MidiInputDevice::type_t MidiInputType, uint uiSamplerChannel) { |
String LSCPServer::SetMIDIInputType(MidiInputDevice::type_t MidiInputType, uint uiSamplerChannel) { |
338 |
dmsg(2,("LSCPServer: SetMIDIInputType(MidiInputType=%d, SamplerChannel=%d)\n", MidiInputType, uiSamplerChannel)); |
dmsg(2,("LSCPServer: SetMIDIInputType(MidiInputType=%d, SamplerChannel=%d)\n", MidiInputType, uiSamplerChannel)); |
339 |
result_t result; |
LSCPResultSet result; |
340 |
try { |
try { |
341 |
SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel); |
SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel); |
342 |
if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds"); |
if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds"); |
343 |
pSamplerChannel->SetMidiInputDevice(MidiInputType); |
pSamplerChannel->SetMidiInputDevice(MidiInputType); |
|
result.type = result_type_success; |
|
344 |
} |
} |
345 |
catch (LinuxSamplerException e) { |
catch (LinuxSamplerException e) { |
346 |
e.PrintMessage(); |
result.Error(e); |
|
result.type = result_type_error; |
|
|
result.code = LSCP_ERR_UNKNOWN; |
|
|
result.message = e.Message(); |
|
347 |
} |
} |
348 |
return ConvertResult(result); |
return result.Produce(); |
349 |
} |
} |
350 |
|
|
351 |
/** |
/** |
354 |
*/ |
*/ |
355 |
String LSCPServer::SetMIDIInputPort(String MIDIInputPort, uint uiSamplerChannel) { |
String LSCPServer::SetMIDIInputPort(String MIDIInputPort, uint uiSamplerChannel) { |
356 |
dmsg(2,("LSCPServer: SetMIDIInputPort(MIDIInputPort=%s, Samplerchannel=%d)\n", MIDIInputPort.c_str(), uiSamplerChannel)); |
dmsg(2,("LSCPServer: SetMIDIInputPort(MIDIInputPort=%s, Samplerchannel=%d)\n", MIDIInputPort.c_str(), uiSamplerChannel)); |
357 |
result_t result; |
LSCPResultSet result; |
358 |
try { |
try { |
359 |
SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel); |
SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel); |
360 |
if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds"); |
if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds"); |
361 |
if (!pSamplerChannel->GetMidiInputDevice()) throw LinuxSamplerException("No MIDI input device connected yet"); |
if (!pSamplerChannel->GetMidiInputDevice()) throw LinuxSamplerException("No MIDI input device connected yet"); |
362 |
pSamplerChannel->GetMidiInputDevice()->SetInputPort(MIDIInputPort.c_str()); |
pSamplerChannel->GetMidiInputDevice()->SetInputPort(MIDIInputPort.c_str()); |
|
result.type = result_type_success; |
|
363 |
} |
} |
364 |
catch (LinuxSamplerException e) { |
catch (LinuxSamplerException e) { |
365 |
e.PrintMessage(); |
result.Error(e); |
|
result.type = result_type_error; |
|
|
result.code = LSCP_ERR_UNKNOWN; |
|
|
result.message = e.Message(); |
|
366 |
} |
} |
367 |
return ConvertResult(result); |
return result.Produce(); |
368 |
} |
} |
369 |
|
|
370 |
/** |
/** |
373 |
*/ |
*/ |
374 |
String LSCPServer::SetMIDIInputChannel(uint MIDIChannel, uint uiSamplerChannel) { |
String LSCPServer::SetMIDIInputChannel(uint MIDIChannel, uint uiSamplerChannel) { |
375 |
dmsg(2,("LSCPServer: SetMIDIInputChannel(MIDIChannel=%d, SamplerChannel=%d)\n", MIDIChannel, uiSamplerChannel)); |
dmsg(2,("LSCPServer: SetMIDIInputChannel(MIDIChannel=%d, SamplerChannel=%d)\n", MIDIChannel, uiSamplerChannel)); |
376 |
result_t result; |
LSCPResultSet result; |
377 |
try { |
try { |
378 |
SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel); |
SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel); |
379 |
if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds"); |
if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds"); |
380 |
if (!pSamplerChannel->GetMidiInputDevice()) throw LinuxSamplerException("No MIDI input device connected yet"); |
if (!pSamplerChannel->GetMidiInputDevice()) throw LinuxSamplerException("No MIDI input device connected yet"); |
381 |
MidiInputDevice::type_t oldtype = pSamplerChannel->GetMidiInputDevice()->Type(); |
MidiInputDevice::type_t oldtype = pSamplerChannel->GetMidiInputDevice()->Type(); |
382 |
pSamplerChannel->SetMidiInputDevice(oldtype, (MidiInputDevice::midi_chan_t) MIDIChannel); |
pSamplerChannel->SetMidiInputDevice(oldtype, (MidiInputDevice::midi_chan_t) MIDIChannel); |
|
|
|
|
result.type = result_type_success; |
|
383 |
} |
} |
384 |
catch (LinuxSamplerException e) { |
catch (LinuxSamplerException e) { |
385 |
e.PrintMessage(); |
result.Error(e); |
|
result.type = result_type_error; |
|
|
result.code = LSCP_ERR_UNKNOWN; |
|
|
result.message = e.Message(); |
|
386 |
} |
} |
387 |
return ConvertResult(result); |
return result.Produce(); |
388 |
} |
} |
389 |
|
|
390 |
/** |
/** |
393 |
*/ |
*/ |
394 |
String LSCPServer::SetVolume(double Volume, uint uiSamplerChannel) { |
String LSCPServer::SetVolume(double Volume, uint uiSamplerChannel) { |
395 |
dmsg(2,("LSCPServer: SetVolume(Volume=%f, SamplerChannel=%d)\n", Volume, uiSamplerChannel)); |
dmsg(2,("LSCPServer: SetVolume(Volume=%f, SamplerChannel=%d)\n", Volume, uiSamplerChannel)); |
396 |
result_t result; |
LSCPResultSet result; |
397 |
try { |
try { |
398 |
SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel); |
SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel); |
399 |
if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds"); |
if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds"); |
400 |
Engine* pEngine = pSamplerChannel->GetEngine(); |
Engine* pEngine = pSamplerChannel->GetEngine(); |
401 |
if (!pEngine) throw LinuxSamplerException("No engine loaded on channel"); |
if (!pEngine) throw LinuxSamplerException("No engine loaded on channel"); |
402 |
pEngine->Volume(Volume); |
pEngine->Volume(Volume); |
|
result.type = result_type_success; |
|
403 |
} |
} |
404 |
catch (LinuxSamplerException e) { |
catch (LinuxSamplerException e) { |
405 |
e.PrintMessage(); |
result.Error(e); |
|
result.type = result_type_error; |
|
|
result.code = LSCP_ERR_UNKNOWN; |
|
|
result.message = e.Message(); |
|
406 |
} |
} |
407 |
return ConvertResult(result); |
return result.Produce(); |
408 |
} |
} |
409 |
|
|
410 |
/** |
/** |
412 |
*/ |
*/ |
413 |
String LSCPServer::ResetChannel(uint uiSamplerChannel) { |
String LSCPServer::ResetChannel(uint uiSamplerChannel) { |
414 |
dmsg(2,("LSCPServer: ResetChannel(SamplerChannel=%d)\n", uiSamplerChannel)); |
dmsg(2,("LSCPServer: ResetChannel(SamplerChannel=%d)\n", uiSamplerChannel)); |
415 |
result_t result; |
LSCPResultSet result; |
416 |
try { |
try { |
417 |
SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel); |
SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel); |
418 |
if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds"); |
if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds"); |
419 |
Engine* pEngine = pSamplerChannel->GetEngine(); |
Engine* pEngine = pSamplerChannel->GetEngine(); |
420 |
if (!pEngine) throw LinuxSamplerException("No engine loaded on channel"); |
if (!pEngine) throw LinuxSamplerException("No engine loaded on channel"); |
421 |
pEngine->Reset(); |
pEngine->Reset(); |
|
result.type = result_type_success; |
|
422 |
} |
} |
423 |
catch (LinuxSamplerException e) { |
catch (LinuxSamplerException e) { |
424 |
e.PrintMessage(); |
result.Error(e); |
|
result.type = result_type_error; |
|
|
result.code = LSCP_ERR_UNKNOWN; |
|
|
result.message = e.Message(); |
|
425 |
} |
} |
426 |
return ConvertResult(result); |
return result.Produce(); |
427 |
} |
} |
428 |
|
|
429 |
/** |
/** |