2 |
* * |
* * |
3 |
* LinuxSampler - modular, streaming capable sampler * |
* LinuxSampler - modular, streaming capable sampler * |
4 |
* * |
* * |
5 |
* Copyright (C) 2003 by Benno Senoner and Christian Schoenebeck * |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
6 |
* * |
* * |
7 |
* This program is free software; you can redistribute it and/or modify * |
* This program is free software; you can redistribute it and/or modify * |
8 |
* 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 * |
118 |
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)); |
119 |
result_t result; |
result_t result; |
120 |
try { |
try { |
121 |
engine_type_t type; |
Engine::type_t type; |
122 |
if (EngineName == "gig") type = engine_type_gig; |
if (EngineName == "gig") type = Engine::type_gig; |
123 |
else throw LinuxSamplerException("Unknown engine type"); |
else throw LinuxSamplerException("Unknown engine type"); |
124 |
SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel); |
SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel); |
125 |
if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds"); |
if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds"); |
283 |
* Will be called by the parser to change the audio output type on a |
* Will be called by the parser to change the audio output type on a |
284 |
* particular sampler channel. |
* particular sampler channel. |
285 |
*/ |
*/ |
286 |
String LSCPServer::SetAudioOutputType(audio_output_type_t AudioOutputType, uint uiSamplerChannel) { |
String LSCPServer::SetAudioOutputType(AudioOutputDevice::type_t AudioOutputType, uint uiSamplerChannel) { |
287 |
dmsg(2,("LSCPServer: SetAudioOutputType(AudioOutputType=%d, SamplerChannel=%d)\n", AudioOutputType, uiSamplerChannel)); |
dmsg(2,("LSCPServer: SetAudioOutputType(AudioOutputType=%d, SamplerChannel=%d)\n", AudioOutputType, uiSamplerChannel)); |
288 |
result_t result; |
result_t result; |
289 |
try { |
try { |
310 |
return "ERR:0:Not implemented yet.\r\n"; |
return "ERR:0:Not implemented yet.\r\n"; |
311 |
} |
} |
312 |
|
|
313 |
String LSCPServer::SetMIDIInputType(midi_input_type_t MidiInputType, uint uiSamplerChannel) { |
String LSCPServer::SetMIDIInputType(MidiInputDevice::type_t MidiInputType, uint uiSamplerChannel) { |
314 |
dmsg(2,("LSCPServer: SetMIDIInputType(MidiInputType=%d, SamplerChannel=%d)\n", MidiInputType, uiSamplerChannel)); |
dmsg(2,("LSCPServer: SetMIDIInputType(MidiInputType=%d, SamplerChannel=%d)\n", MidiInputType, uiSamplerChannel)); |
315 |
result_t result; |
result_t result; |
316 |
try { |
try { |
332 |
* Will be called by the parser to change the MIDI input port on which the |
* Will be called by the parser to change the MIDI input port on which the |
333 |
* engine of a particular sampler channel should listen to. |
* engine of a particular sampler channel should listen to. |
334 |
*/ |
*/ |
335 |
String LSCPServer::SetMIDIInputPort(String MIDIInputPort, uint uiSamplerchannel) { |
String LSCPServer::SetMIDIInputPort(String MIDIInputPort, uint uiSamplerChannel) { |
336 |
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)); |
337 |
return "ERR:0:Not implemented yet.\r\n"; |
result_t result; |
338 |
|
try { |
339 |
|
SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel); |
340 |
|
if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds"); |
341 |
|
if (!pSamplerChannel->GetMidiInputDevice()) throw LinuxSamplerException("No MIDI input device connected yet"); |
342 |
|
pSamplerChannel->GetMidiInputDevice()->SetInputPort(MIDIInputPort.c_str()); |
343 |
|
result.type = result_type_success; |
344 |
|
} |
345 |
|
catch (LinuxSamplerException e) { |
346 |
|
e.PrintMessage(); |
347 |
|
result.type = result_type_error; |
348 |
|
result.code = LSCP_ERR_UNKNOWN; |
349 |
|
result.message = e.Message(); |
350 |
|
} |
351 |
|
return ConvertResult(result); |
352 |
} |
} |
353 |
|
|
354 |
/** |
/** |
357 |
*/ |
*/ |
358 |
String LSCPServer::SetMIDIInputChannel(uint MIDIChannel, uint uiSamplerChannel) { |
String LSCPServer::SetMIDIInputChannel(uint MIDIChannel, uint uiSamplerChannel) { |
359 |
dmsg(2,("LSCPServer: SetMIDIInputChannel(MIDIChannel=%d, SamplerChannel=%d)\n", MIDIChannel, uiSamplerChannel)); |
dmsg(2,("LSCPServer: SetMIDIInputChannel(MIDIChannel=%d, SamplerChannel=%d)\n", MIDIChannel, uiSamplerChannel)); |
360 |
return "ERR:0:Not implemented yet.\r\n"; |
result_t result; |
361 |
|
try { |
362 |
|
SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel); |
363 |
|
if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds"); |
364 |
|
if (!pSamplerChannel->GetMidiInputDevice()) throw LinuxSamplerException("No MIDI input device connected yet"); |
365 |
|
MidiInputDevice::type_t oldtype = pSamplerChannel->GetMidiInputDevice()->Type(); |
366 |
|
pSamplerChannel->SetMidiInputDevice(oldtype, (MidiInputDevice::midi_chan_t) MIDIChannel); |
367 |
|
|
368 |
|
result.type = result_type_success; |
369 |
|
} |
370 |
|
catch (LinuxSamplerException e) { |
371 |
|
e.PrintMessage(); |
372 |
|
result.type = result_type_error; |
373 |
|
result.code = LSCP_ERR_UNKNOWN; |
374 |
|
result.message = e.Message(); |
375 |
|
} |
376 |
|
return ConvertResult(result); |
377 |
} |
} |
378 |
|
|
379 |
/** |
/** |