21 |
***************************************************************************/ |
***************************************************************************/ |
22 |
|
|
23 |
#include "lscpserver.h" |
#include "lscpserver.h" |
24 |
|
#include "lscpresultset.h" |
25 |
|
|
26 |
#include "../engines/gig/Engine.h" |
#include "../engines/gig/Engine.h" |
27 |
|
|
200 |
*/ |
*/ |
201 |
String LSCPServer::GetChannelInfo(uint uiSamplerChannel) { |
String LSCPServer::GetChannelInfo(uint uiSamplerChannel) { |
202 |
dmsg(2,("LSCPServer: GetChannelInfo(SamplerChannel=%d)\n", uiSamplerChannel)); |
dmsg(2,("LSCPServer: GetChannelInfo(SamplerChannel=%d)\n", uiSamplerChannel)); |
203 |
return "ERR:0:Not implemented yet.\r\n"; |
try { |
204 |
|
LSCPResultSet result; |
205 |
|
SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel); |
206 |
|
if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds"); |
207 |
|
Engine* pEngine = pSamplerChannel->GetEngine(); |
208 |
|
if (pEngine) { |
209 |
|
result.Add("ENGINE_NAME", pEngine->EngineName()); |
210 |
|
result.Add("VOLUME", pEngine->Volume()); |
211 |
|
} |
212 |
|
//Some hardcoded stuff for now to make GUI look good |
213 |
|
result.Add("AUDIO_OUTPUT_DEVICE", "0"); |
214 |
|
result.Add("AUDIO_OUTPUT_CHANNELS", "2"); |
215 |
|
result.Add("AUDIO_OUTPUT_ROUTING", "0,1"); |
216 |
|
|
217 |
|
if (pEngine) { |
218 |
|
int iIdx = pEngine->InstrumentIndex(); |
219 |
|
if (iIdx != -1) { |
220 |
|
result.Add("INSTRUMENT_FILE", pEngine->InstrumentFileName()); |
221 |
|
result.Add("INSTRUMENT_NR", iIdx); |
222 |
|
} |
223 |
|
} |
224 |
|
//Some hardcoded stuff for now to make GUI look good |
225 |
|
result.Add("MIDI_INPUT_DEVICE", "0"); |
226 |
|
result.Add("MIDI_INPUT_PORT", "0"); |
227 |
|
result.Add("MIDI_INPUT_CHANNEL", "1"); |
228 |
|
|
229 |
|
return result.Produce(); |
230 |
|
} |
231 |
|
catch (LinuxSamplerException e) { |
232 |
|
result_t result; |
233 |
|
e.PrintMessage(); |
234 |
|
result.type = result_type_error; |
235 |
|
result.code = LSCP_ERR_UNKNOWN; |
236 |
|
result.message = e.Message(); |
237 |
|
return ConvertResult(result); |
238 |
|
} |
239 |
} |
} |
240 |
|
|
241 |
/** |
/** |
368 |
* 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 |
369 |
* engine of a particular sampler channel should listen to. |
* engine of a particular sampler channel should listen to. |
370 |
*/ |
*/ |
371 |
String LSCPServer::SetMIDIInputPort(String MIDIInputPort, uint uiSamplerchannel) { |
String LSCPServer::SetMIDIInputPort(String MIDIInputPort, uint uiSamplerChannel) { |
372 |
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)); |
373 |
return "ERR:0:Not implemented yet.\r\n"; |
result_t result; |
374 |
|
try { |
375 |
|
SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel); |
376 |
|
if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds"); |
377 |
|
if (!pSamplerChannel->GetMidiInputDevice()) throw LinuxSamplerException("No MIDI input device connected yet"); |
378 |
|
pSamplerChannel->GetMidiInputDevice()->SetInputPort(MIDIInputPort.c_str()); |
379 |
|
result.type = result_type_success; |
380 |
|
} |
381 |
|
catch (LinuxSamplerException e) { |
382 |
|
e.PrintMessage(); |
383 |
|
result.type = result_type_error; |
384 |
|
result.code = LSCP_ERR_UNKNOWN; |
385 |
|
result.message = e.Message(); |
386 |
|
} |
387 |
|
return ConvertResult(result); |
388 |
} |
} |
389 |
|
|
390 |
/** |
/** |
399 |
if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds"); |
if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds"); |
400 |
if (!pSamplerChannel->GetMidiInputDevice()) throw LinuxSamplerException("No MIDI input device connected yet"); |
if (!pSamplerChannel->GetMidiInputDevice()) throw LinuxSamplerException("No MIDI input device connected yet"); |
401 |
MidiInputDevice::type_t oldtype = pSamplerChannel->GetMidiInputDevice()->Type(); |
MidiInputDevice::type_t oldtype = pSamplerChannel->GetMidiInputDevice()->Type(); |
402 |
pSamplerChannel->SetMidiInputDevice(oldtype, (MidiInputDevice::midi_chan_t) uiSamplerChannel); |
pSamplerChannel->SetMidiInputDevice(oldtype, (MidiInputDevice::midi_chan_t) MIDIChannel); |
403 |
|
|
404 |
result.type = result_type_success; |
result.type = result_type_success; |
405 |
} |
} |