/[svn]/linuxsampler/trunk/src/network/lscpserver.cpp
ViewVC logotype

Diff of /linuxsampler/trunk/src/network/lscpserver.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 64 by schoenebeck, Thu May 6 20:06:20 2004 UTC revision 117 by senkov, Tue Jun 8 01:29:08 2004 UTC
# Line 21  Line 21 
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    
# Line 199  String LSCPServer::GetEngineInfo(String Line 200  String LSCPServer::GetEngineInfo(String
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  /**  /**
# Line 332  String LSCPServer::SetMIDIInputType(Midi Line 380  String LSCPServer::SetMIDIInputType(Midi
380   * 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
381   * engine of a particular sampler channel should listen to.   * engine of a particular sampler channel should listen to.
382   */   */
383  String LSCPServer::SetMIDIInputPort(String MIDIInputPort, uint uiSamplerchannel) {  String LSCPServer::SetMIDIInputPort(String MIDIInputPort, uint uiSamplerChannel) {
384      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));
385      return "ERR:0:Not implemented yet.\r\n";      result_t result;
386        try {
387            SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);
388            if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds");
389            if (!pSamplerChannel->GetMidiInputDevice()) throw LinuxSamplerException("No MIDI input device connected yet");
390            pSamplerChannel->GetMidiInputDevice()->SetInputPort(MIDIInputPort.c_str());
391            result.type = result_type_success;
392        }
393        catch (LinuxSamplerException e) {
394             e.PrintMessage();
395             result.type    = result_type_error;
396             result.code    = LSCP_ERR_UNKNOWN;
397             result.message = e.Message();
398        }
399        return ConvertResult(result);
400  }  }
401    
402  /**  /**
# Line 349  String LSCPServer::SetMIDIInputChannel(u Line 411  String LSCPServer::SetMIDIInputChannel(u
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      }      }

Legend:
Removed from v.64  
changed lines
  Added in v.117

  ViewVC Help
Powered by ViewVC