525 |
try { |
try { |
526 |
if ((EngineName == "GigEngine") || (EngineName == "gig")) { |
if ((EngineName == "GigEngine") || (EngineName == "gig")) { |
527 |
Engine* pEngine = new LinuxSampler::gig::Engine; |
Engine* pEngine = new LinuxSampler::gig::Engine; |
528 |
result.Add(pEngine->Description()); |
result.Add("DESCRIPTION", pEngine->Description()); |
529 |
result.Add(pEngine->Version()); |
result.Add("VERSION", pEngine->Version()); |
530 |
delete pEngine; |
delete pEngine; |
531 |
} |
} |
532 |
else throw LinuxSamplerException("Unknown engine type"); |
else throw LinuxSamplerException("Unknown engine type"); |
551 |
|
|
552 |
//Defaults values |
//Defaults values |
553 |
String EngineName = "NONE"; |
String EngineName = "NONE"; |
554 |
float Volume = 0; |
float Volume = 0.0f; |
555 |
String InstrumentFileName = "NONE"; |
String InstrumentFileName = "NONE"; |
556 |
int InstrumentIndex = -1; |
int InstrumentIndex = -1; |
557 |
int InstrumentStatus = -1; |
int InstrumentStatus = -1; |
558 |
|
int AudioOutputChannels = 0; |
559 |
|
String AudioRouting; |
560 |
|
|
561 |
if (pEngine) { |
if (pEngine) { |
562 |
EngineName = pEngine->EngineName(); |
EngineName = pEngine->EngineName(); |
563 |
|
AudioOutputChannels = pEngine->Channels(); |
564 |
Volume = pEngine->Volume(); |
Volume = pEngine->Volume(); |
565 |
InstrumentStatus = pEngine->InstrumentStatus(); |
InstrumentStatus = pEngine->InstrumentStatus(); |
566 |
InstrumentIndex = pEngine->InstrumentIndex(); |
InstrumentIndex = pEngine->InstrumentIndex(); |
567 |
if (InstrumentIndex != -1) |
if (InstrumentIndex != -1) |
568 |
InstrumentFileName = pEngine->InstrumentFileName(); |
InstrumentFileName = pEngine->InstrumentFileName(); |
569 |
|
for (int chan = 0; chan < pEngine->Channels(); chan++) { |
570 |
|
if (AudioRouting != "") AudioRouting += ","; |
571 |
|
AudioRouting += ToString(pEngine->OutputChannel(chan)); |
572 |
|
} |
573 |
} |
} |
574 |
|
|
575 |
result.Add("ENGINE_NAME", EngineName); |
result.Add("ENGINE_NAME", EngineName); |
577 |
|
|
578 |
//Some not-so-hardcoded stuff to make GUI look good |
//Some not-so-hardcoded stuff to make GUI look good |
579 |
result.Add("AUDIO_OUTPUT_DEVICE", GetAudioOutputDeviceIndex(pSamplerChannel->GetAudioOutputDevice())); |
result.Add("AUDIO_OUTPUT_DEVICE", GetAudioOutputDeviceIndex(pSamplerChannel->GetAudioOutputDevice())); |
580 |
result.Add("AUDIO_OUTPUT_CHANNELS", "2"); |
result.Add("AUDIO_OUTPUT_CHANNELS", AudioOutputChannels); |
581 |
result.Add("AUDIO_OUTPUT_ROUTING", "0,1"); |
result.Add("AUDIO_OUTPUT_ROUTING", AudioRouting); |
582 |
|
|
583 |
result.Add("MIDI_INPUT_DEVICE", GetMidiInputDeviceIndex(pSamplerChannel->GetMidiInputDevice())); |
result.Add("MIDI_INPUT_DEVICE", GetMidiInputDeviceIndex(pSamplerChannel->GetMidiInputDevice())); |
584 |
result.Add("MIDI_INPUT_PORT", pSamplerChannel->GetMidiInputPort()); |
result.Add("MIDI_INPUT_PORT", pSamplerChannel->GetMidiInputPort()); |
585 |
result.Add("MIDI_INPUT_CHANNEL", pSamplerChannel->GetMidiInputChannel()); |
if (pSamplerChannel->GetMidiInputChannel()) result.Add("MIDI_INPUT_CHANNEL", pSamplerChannel->GetMidiInputChannel()); |
586 |
|
else result.Add("MIDI_INPUT_CHANNEL", "ALL"); |
587 |
|
|
588 |
result.Add("INSTRUMENT_FILE", InstrumentFileName); |
result.Add("INSTRUMENT_FILE", InstrumentFileName); |
589 |
result.Add("INSTRUMENT_NR", InstrumentIndex); |
result.Add("INSTRUMENT_NR", InstrumentIndex); |
1098 |
*/ |
*/ |
1099 |
String LSCPServer::SetAudioOutputChannel(uint ChannelAudioOutputChannel, uint AudioOutputDeviceInputChannel, uint uiSamplerChannel) { |
String LSCPServer::SetAudioOutputChannel(uint ChannelAudioOutputChannel, uint AudioOutputDeviceInputChannel, uint uiSamplerChannel) { |
1100 |
dmsg(2,("LSCPServer: SetAudioOutputChannel(ChannelAudioOutputChannel=%d, AudioOutputDeviceInputChannel=%d, SamplerChannel=%d)\n",ChannelAudioOutputChannel,AudioOutputDeviceInputChannel,uiSamplerChannel)); |
dmsg(2,("LSCPServer: SetAudioOutputChannel(ChannelAudioOutputChannel=%d, AudioOutputDeviceInputChannel=%d, SamplerChannel=%d)\n",ChannelAudioOutputChannel,AudioOutputDeviceInputChannel,uiSamplerChannel)); |
1101 |
return "ERR:0:Not implemented yet.\r\n"; //FIXME: Add support for this in resultset class? |
LSCPResultSet result; |
1102 |
|
try { |
1103 |
|
SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel); |
1104 |
|
if (!pSamplerChannel) throw LinuxSamplerException("Invalid channel number " + ToString(uiSamplerChannel)); |
1105 |
|
Engine* pEngine = pSamplerChannel->GetEngine(); |
1106 |
|
if (!pEngine) throw LinuxSamplerException("No engine deployed on sampler channel " + ToString(uiSamplerChannel)); |
1107 |
|
pEngine->SetOutputChannel(ChannelAudioOutputChannel, AudioOutputDeviceInputChannel); |
1108 |
|
} |
1109 |
|
catch (LinuxSamplerException e) { |
1110 |
|
result.Error(e); |
1111 |
|
} |
1112 |
|
return result.Produce(); |
1113 |
} |
} |
1114 |
|
|
1115 |
String LSCPServer::SetAudioOutputDevice(uint AudioDeviceId, uint uiSamplerChannel) { |
String LSCPServer::SetAudioOutputDevice(uint AudioDeviceId, uint uiSamplerChannel) { |
1275 |
* Will be called by the parser to change the global volume factor on a |
* Will be called by the parser to change the global volume factor on a |
1276 |
* particular sampler channel. |
* particular sampler channel. |
1277 |
*/ |
*/ |
1278 |
String LSCPServer::SetVolume(double Volume, uint uiSamplerChannel) { |
String LSCPServer::SetVolume(double dVolume, uint uiSamplerChannel) { |
1279 |
dmsg(2,("LSCPServer: SetVolume(Volume=%f, SamplerChannel=%d)\n", Volume, uiSamplerChannel)); |
dmsg(2,("LSCPServer: SetVolume(Volume=%f, SamplerChannel=%d)\n", dVolume, uiSamplerChannel)); |
1280 |
LSCPResultSet result; |
LSCPResultSet result; |
1281 |
try { |
try { |
1282 |
SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel); |
SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel); |
1283 |
if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds"); |
if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds"); |
1284 |
Engine* pEngine = pSamplerChannel->GetEngine(); |
Engine* pEngine = pSamplerChannel->GetEngine(); |
1285 |
if (!pEngine) throw LinuxSamplerException("No engine loaded on channel"); |
if (!pEngine) throw LinuxSamplerException("No engine loaded on channel"); |
1286 |
pEngine->Volume(Volume); |
pEngine->Volume(dVolume); |
1287 |
} |
} |
1288 |
catch (LinuxSamplerException e) { |
catch (LinuxSamplerException e) { |
1289 |
result.Error(e); |
result.Error(e); |