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 |
|
|
209 |
|
//Defaults values |
210 |
|
String EngineName = "NONE"; |
211 |
|
float Volume = 0; |
212 |
|
String InstrumentFileName = "NONE"; |
213 |
|
int InstrumentIndex = 0; |
214 |
|
|
215 |
|
if (pEngine) { |
216 |
|
EngineName = pEngine->EngineName(); |
217 |
|
Volume = pEngine->Volume(); |
218 |
|
int iIdx = pEngine->InstrumentIndex(); |
219 |
|
if (iIdx != -1) { |
220 |
|
InstrumentFileName = pEngine->InstrumentFileName(); |
221 |
|
InstrumentIndex = iIdx; |
222 |
|
} |
223 |
|
} |
224 |
|
|
225 |
|
result.Add("ENGINE_NAME", EngineName); |
226 |
|
result.Add("VOLUME", Volume); |
227 |
|
|
228 |
|
//Some hardcoded stuff for now to make GUI look good |
229 |
|
result.Add("AUDIO_OUTPUT_DEVICE", "0"); |
230 |
|
result.Add("AUDIO_OUTPUT_CHANNELS", "2"); |
231 |
|
result.Add("AUDIO_OUTPUT_ROUTING", "0,1"); |
232 |
|
|
233 |
|
result.Add("INSTRUMENT_FILE", InstrumentFileName); |
234 |
|
result.Add("INSTRUMENT_NR", InstrumentIndex); |
235 |
|
|
236 |
|
//Some more hardcoded stuff for now to make GUI look good |
237 |
|
result.Add("MIDI_INPUT_DEVICE", "0"); |
238 |
|
result.Add("MIDI_INPUT_PORT", "0"); |
239 |
|
result.Add("MIDI_INPUT_CHANNEL", "1"); |
240 |
|
|
241 |
|
return result.Produce(); |
242 |
|
} |
243 |
|
catch (LinuxSamplerException e) { |
244 |
|
result_t result; |
245 |
|
e.PrintMessage(); |
246 |
|
result.type = result_type_error; |
247 |
|
result.code = LSCP_ERR_UNKNOWN; |
248 |
|
result.message = e.Message(); |
249 |
|
return ConvertResult(result); |
250 |
|
} |
251 |
} |
} |
252 |
|
|
253 |
/** |
/** |
411 |
if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds"); |
if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds"); |
412 |
if (!pSamplerChannel->GetMidiInputDevice()) throw LinuxSamplerException("No MIDI input device connected yet"); |
if (!pSamplerChannel->GetMidiInputDevice()) throw LinuxSamplerException("No MIDI input device connected yet"); |
413 |
MidiInputDevice::type_t oldtype = pSamplerChannel->GetMidiInputDevice()->Type(); |
MidiInputDevice::type_t oldtype = pSamplerChannel->GetMidiInputDevice()->Type(); |
414 |
pSamplerChannel->SetMidiInputDevice(oldtype, (MidiInputDevice::midi_chan_t) uiSamplerChannel); |
pSamplerChannel->SetMidiInputDevice(oldtype, (MidiInputDevice::midi_chan_t) MIDIChannel); |
415 |
|
|
416 |
result.type = result_type_success; |
result.type = result_type_success; |
417 |
} |
} |