/[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 121 by senkov, Sat Jun 12 07:46:02 2004 UTC revision 137 by capela, Sun Jun 20 16:49:47 2004 UTC
# Line 24  Line 24 
24  #include "lscpresultset.h"  #include "lscpresultset.h"
25    
26  #include "../engines/gig/Engine.h"  #include "../engines/gig/Engine.h"
27    #include "../audiodriver/AudioOutputDeviceFactory.h"
28    
29  LSCPServer::LSCPServer(Sampler* pSampler) : Thread(false, 0, -4) {  LSCPServer::LSCPServer(Sampler* pSampler) : Thread(false, 0, -4) {
30      this->pSampler = pSampler;      this->pSampler = pSampler;
# Line 89  void LSCPServer::AnswerClient(String Ret Line 90  void LSCPServer::AnswerClient(String Ret
90      send(hSession, ReturnMessage.c_str(), ReturnMessage.size(), 0);      send(hSession, ReturnMessage.c_str(), ReturnMessage.size(), 0);
91  }  }
92    
93    String LSCPServer::CreateAudioOutputDevice(String Driver, std::map<String,String> Parameters) {
94        dmsg(2,("LSCPServer: CreateAudioOutputDevice(Driver=%s)\n", Driver.c_str()));
95        LSCPResultSet result;
96        try {
97            AudioOutputDevice* pDevice = pSampler->CreateAudioOutputDevice(Driver, Parameters);
98            std::map<uint, AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices();
99            // search for the created device to get its index
100            int index = -1;
101            std::map<uint, AudioOutputDevice*>::iterator iter = devices.begin();
102            for (; iter != devices.end(); iter++) {
103                if (iter->second == pDevice) {
104                    index = iter->first;
105                    break;
106                }
107            }
108            if (index == -1) throw LinuxSamplerException("Internal error: could not find created audio output device.");
109            result = index; // success
110        }
111        catch (LinuxSamplerException e) {
112            result.Error(e);
113        }
114        return result.Produce();
115    }
116    
117    String LSCPServer::DestroyAudioOutputDevice(uint DeviceIndex) {
118        dmsg(2,("LSCPServer: DestroyAudioOutputDevice(DeviceIndex=%d)\n", DeviceIndex));
119        LSCPResultSet result;
120        try {
121            std::map<uint, AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices();
122            if (!devices[DeviceIndex]) throw LinuxSamplerException("There is no audio output device with index " + ToString(DeviceIndex) + ".");
123            AudioOutputDevice* pDevice = devices[DeviceIndex];
124            pSampler->DestroyAudioOutputDevice(pDevice);
125        }
126        catch (LinuxSamplerException e) {
127            result.Error(e);
128        }
129        return result.Produce();
130    }
131    
132  /**  /**
133   * Will be called by the parser to load an instrument.   * Will be called by the parser to load an instrument.
134   */   */
135  String LSCPServer::LoadInstrument(String Filename, uint uiInstrument, uint uiSamplerChannel) {  String LSCPServer::LoadInstrument(String Filename, uint uiInstrument, uint uiSamplerChannel, bool bBackground) {
136      dmsg(2,("LSCPServer: LoadInstrument(Filename=%s,Instrument=%d,SamplerChannel=%d)\n", Filename.c_str(), uiInstrument, uiSamplerChannel));      dmsg(2,("LSCPServer: LoadInstrument(Filename=%s,Instrument=%d,SamplerChannel=%d)\n", Filename.c_str(), uiInstrument, uiSamplerChannel));
137      LSCPResultSet result;      LSCPResultSet result;
138      try {      try {
# Line 100  String LSCPServer::LoadInstrument(String Line 140  String LSCPServer::LoadInstrument(String
140          if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds");          if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds");
141          Engine* pEngine = pSamplerChannel->GetEngine();          Engine* pEngine = pSamplerChannel->GetEngine();
142          if (!pEngine) throw LinuxSamplerException("No engine loaded on channel");          if (!pEngine) throw LinuxSamplerException("No engine loaded on channel");
143          pEngine->LoadInstrument(Filename.c_str(), uiInstrument);          if (bBackground) {
144                LSCPLoadInstrument *pLoadInstrument = new LSCPLoadInstrument(pEngine, Filename.c_str(), uiInstrument);
145                pLoadInstrument->StartThread();
146            }
147            else pEngine->LoadInstrument(Filename.c_str(), uiInstrument);
148      }      }
149      catch (LinuxSamplerException e) {      catch (LinuxSamplerException e) {
150           result.Error(e);           result.Error(e);
# Line 177  String LSCPServer::GetEngineInfo(String Line 221  String LSCPServer::GetEngineInfo(String
221          if ((EngineName == "GigEngine") || (EngineName == "gig")) {          if ((EngineName == "GigEngine") || (EngineName == "gig")) {
222              Engine* pEngine = new LinuxSampler::gig::Engine;              Engine* pEngine = new LinuxSampler::gig::Engine;
223              result.Add(pEngine->Description());              result.Add(pEngine->Description());
224                result.Add(pEngine->Version());
225              delete pEngine;              delete pEngine;
226          }          }
227          else throw LinuxSamplerException("Unknown engine type");          else throw LinuxSamplerException("Unknown engine type");
# Line 198  String LSCPServer::GetChannelInfo(uint u Line 243  String LSCPServer::GetChannelInfo(uint u
243          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);
244          if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds");          if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds");
245          Engine* pEngine = pSamplerChannel->GetEngine();          Engine* pEngine = pSamplerChannel->GetEngine();
246            
247          //Defaults values          //Defaults values
248          String EngineName = "NONE";          String EngineName = "NONE";
249          float Volume = 0;          float Volume = 0;
250          String InstrumentFileName = "NONE";          String InstrumentFileName = "NONE";
251          int InstrumentIndex = 0;          int InstrumentIndex = -1;
252                    int InstrumentStatus = -1;
253    
254          if (pEngine) {          if (pEngine) {
255              EngineName =  pEngine->EngineName();              EngineName =  pEngine->EngineName();
256              Volume = pEngine->Volume();              Volume = pEngine->Volume();
257              int iIdx = pEngine->InstrumentIndex();              InstrumentStatus = pEngine->InstrumentStatus();
258              if (iIdx != -1) {              InstrumentIndex = pEngine->InstrumentIndex();
259                if (InstrumentIndex != -1)
260                  InstrumentFileName = pEngine->InstrumentFileName();                  InstrumentFileName = pEngine->InstrumentFileName();
                 InstrumentIndex = iIdx;  
             }  
261          }          }
262    
263          result.Add("ENGINE_NAME", EngineName);          result.Add("ENGINE_NAME", EngineName);
# Line 225  String LSCPServer::GetChannelInfo(uint u Line 270  String LSCPServer::GetChannelInfo(uint u
270    
271          result.Add("INSTRUMENT_FILE", InstrumentFileName);          result.Add("INSTRUMENT_FILE", InstrumentFileName);
272          result.Add("INSTRUMENT_NR", InstrumentIndex);          result.Add("INSTRUMENT_NR", InstrumentIndex);
273                    result.Add("INSTRUMENT_STATUS", InstrumentStatus);
274    
275          //Some more hardcoded stuff for now to make GUI look good          //Some more hardcoded stuff for now to make GUI look good
276          result.Add("MIDI_INPUT_DEVICE", "0");          result.Add("MIDI_INPUT_DEVICE", "0");
277          result.Add("MIDI_INPUT_PORT", "0");          result.Add("MIDI_INPUT_PORT", "0");
# Line 289  String LSCPServer::GetBufferFill(fill_re Line 335  String LSCPServer::GetBufferFill(fill_re
335          if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds");          if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds");
336          Engine* pEngine = pSamplerChannel->GetEngine();          Engine* pEngine = pSamplerChannel->GetEngine();
337          if (!pEngine) throw LinuxSamplerException("No engine loaded on channel");          if (!pEngine) throw LinuxSamplerException("No engine loaded on channel");
338          if (!pEngine->DiskStreamSupported()) return "NA\r\n"; //FIXME: Update resultset class to support "NA"          if (!pEngine->DiskStreamSupported())
339          switch (ResponseType) {              result.Add("NA");
340              case fill_response_bytes:          else {
341                  result.Add(pEngine->DiskStreamBufferFillBytes());              switch (ResponseType) {
342                  break;                  case fill_response_bytes:
343              case fill_response_percentage:                      result.Add(pEngine->DiskStreamBufferFillBytes());
344                  result.Add(pEngine->DiskStreamBufferFillPercentage());                      break;
345                  break;                  case fill_response_percentage:
346              default:                      result.Add(pEngine->DiskStreamBufferFillPercentage());
347                  throw LinuxSamplerException("Unknown fill response type");                      break;
348          }                  default:
349                        throw LinuxSamplerException("Unknown fill response type");
350                }
351            }
352      }      }
353      catch (LinuxSamplerException e) {      catch (LinuxSamplerException e) {
354           result.Error(e);           result.Error(e);
# Line 307  String LSCPServer::GetBufferFill(fill_re Line 356  String LSCPServer::GetBufferFill(fill_re
356      return result.Produce();      return result.Produce();
357  }  }
358    
359  /**  String LSCPServer::GetAvailableAudioOutputDrivers() {
360   * Will be called by the parser to change the audio output type on a      dmsg(2,("LSCPServer: GetAvailableAudioOutputDrivers()\n"));
  * particular sampler channel.  
  */  
 String LSCPServer::SetAudioOutputType(AudioOutputDevice::type_t AudioOutputType, uint uiSamplerChannel) {  
     dmsg(2,("LSCPServer: SetAudioOutputType(AudioOutputType=%d, SamplerChannel=%d)\n", AudioOutputType, uiSamplerChannel));  
361      LSCPResultSet result;      LSCPResultSet result;
362      try {      try {
363          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);          String s = AudioOutputDeviceFactory::AvailableDriversAsString();
364          if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds");          result.Add(s);
         pSamplerChannel->SetAudioOutputDevice(AudioOutputType);  
365      }      }
366      catch (LinuxSamplerException e) {      catch (LinuxSamplerException e) {
367           result.Error(e);          result.Error(e);
368        }
369        return result.Produce();
370    }
371    
372    String LSCPServer::GetAudioOutputDriverInfo(String Driver) {
373        dmsg(2,("LSCPServer: GetAudioOutputDriverInfo(Driver=%s)\n",Driver.c_str()));
374        LSCPResultSet result;
375        try {
376            result.Add("DESCRIPTION", AudioOutputDeviceFactory::GetDriverDescription(Driver));
377            result.Add("VERSION",     AudioOutputDeviceFactory::GetDriverVersion(Driver));
378    
379            std::map<String,DeviceCreationParameter*> parameters = AudioOutputDeviceFactory::GetAvailableDriverParameters(Driver);
380            if (parameters.size()) { // if there are parameters defined for this driver
381                String s;
382                std::map<String,DeviceCreationParameter*>::iterator iter = parameters.begin();
383                for (;iter != parameters.end(); iter++) {
384                    if (s != "") s += ",";
385                    s += iter->first;
386                }
387                result.Add("PARAMETERS", s);
388            }
389        }
390        catch (LinuxSamplerException e) {
391            result.Error(e);
392        }
393        return result.Produce();
394    }
395    
396    String LSCPServer::GetAudioOutputDriverParameterInfo(String Driver, String Parameter, std::map<String,String> DependencyList) {
397        dmsg(2,("LSCPServer: GetAudioOutputDriverParameterInfo(Driver=%s,Parameter=%s)\n",Driver.c_str(),Parameter.c_str()));
398        LSCPResultSet result;
399        try {
400            DeviceCreationParameter* pParameter = AudioOutputDeviceFactory::GetDriverParameter(Driver, Parameter);
401            result.Add("TYPE",         pParameter->Type());
402            result.Add("DESCRIPTION",  pParameter->Description());
403            result.Add("MANDATORY",    pParameter->Mandatory());
404            result.Add("FIX",          pParameter->Fix());
405            result.Add("MULTIPLICITY", pParameter->Multiplicity());
406            if (pParameter->Depends())       result.Add("DEPENDS",       pParameter->Depends());
407            if (pParameter->Default())       result.Add("DEFAULT",       pParameter->Default());
408            if (pParameter->RangeMin())      result.Add("RANGE_MIN",     pParameter->RangeMin());
409            if (pParameter->RangeMax())      result.Add("RANGE_MAX",     pParameter->RangeMax());
410            if (pParameter->Possibilities()) result.Add("POSSIBILITIES", pParameter->Possibilities());
411        }
412        catch (LinuxSamplerException e) {
413            result.Error(e);
414        }
415        return result.Produce();
416    }
417    
418    String LSCPServer::GetAudioOutputDeviceCount() {
419        dmsg(2,("LSCPServer: GetAudioOutputDeviceCount()\n"));
420        LSCPResultSet result;
421        try {
422            uint count = pSampler->AudioOutputDevices();
423            result = count; // success
424        }
425        catch (LinuxSamplerException e) {
426            result.Error(e);
427        }
428        return result.Produce();
429    }
430    
431    String LSCPServer::GetAudioOutputDevices() {
432        dmsg(2,("LSCPServer: GetAudioOutputDevices()\n"));
433        LSCPResultSet result;
434        try {
435            String s;
436            std::map<uint, AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices();
437            std::map<uint, AudioOutputDevice*>::iterator iter = devices.begin();
438            for (; iter != devices.end(); iter++) {
439                if (s != "") s += ",";
440                s += ToString(iter->first);
441            }
442            result.Add(s);
443        }
444        catch (LinuxSamplerException e) {
445            result.Error(e);
446        }
447        return result.Produce();
448    }
449    
450    String LSCPServer::GetAudioOutputDeviceInfo(uint DeviceIndex) {
451        dmsg(2,("LSCPServer: GetAudioOutputDeviceInfo(DeviceIndex=%d)\n",DeviceIndex));
452        LSCPResultSet result;
453        try {
454            std::map<uint,AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices();
455            if (!devices[DeviceIndex]) throw LinuxSamplerException("There is no audio output device with index " + ToString(DeviceIndex) + ".");
456            AudioOutputDevice* pDevice = devices[DeviceIndex];
457            std::map<String,DeviceCreationParameter*> parameters = pDevice->DeviceParameters();
458            std::map<String,DeviceCreationParameter*>::iterator iter = parameters.begin();
459            for (; iter != parameters.end(); iter++) {
460                result.Add(iter->first, iter->second->Value());
461            }
462        }
463        catch (LinuxSamplerException e) {
464            result.Error(e);
465        }
466        return result.Produce();
467    }
468    
469    String LSCPServer::GetAudioOutputChannelInfo(uint DeviceId, uint ChannelId) {
470        dmsg(2,("LSCPServer: GetAudioOutputChannelInfo(DeviceId=%d,ChannelId)\n",DeviceId,ChannelId));
471        LSCPResultSet result;
472        try {
473            // get audio output device
474            std::map<uint,AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices();
475            if (!devices[DeviceId]) throw LinuxSamplerException("There is no audio output device with index " + ToString(DeviceId) + ".");
476            AudioOutputDevice* pDevice = devices[DeviceId];
477    
478            // get audio channel
479            AudioChannel* pChannel = pDevice->Channel(ChannelId);
480            if (!pChannel) throw LinuxSamplerException("Audio ouotput device does not have channel " + ToString(ChannelId) + ".");
481    
482            // return the values of all audio channel parameters
483            std::map<String,DeviceRuntimeParameter*> parameters = pChannel->ChannelParameters();
484            std::map<String,DeviceRuntimeParameter*>::iterator iter = parameters.begin();
485            for (; iter != parameters.end(); iter++) {
486                result.Add(iter->first, iter->second->Value());
487            }
488        }
489        catch (LinuxSamplerException e) {
490            result.Error(e);
491        }
492        return result.Produce();
493    }
494    
495    String LSCPServer::GetAudioOutputChannelParameterInfo(uint DeviceId, uint ChannelId, String ParameterName) {
496        dmsg(2,("LSCPServer: GetAudioOutputChannelParameterInfo(DeviceId=%d,ChannelId=%d,ParameterName=%s)\n",DeviceId,ChannelId,ParameterName.c_str()));
497        LSCPResultSet result;
498        try {
499            // get audio output device
500            std::map<uint,AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices();
501            if (!devices[DeviceId]) throw LinuxSamplerException("There is no audio output device with index " + ToString(DeviceId) + ".");
502            AudioOutputDevice* pDevice = devices[DeviceId];
503    
504            // get audio channel
505            AudioChannel* pChannel = pDevice->Channel(ChannelId);
506            if (!pChannel) throw LinuxSamplerException("Audio output device does not have channel " + ToString(ChannelId) + ".");
507    
508            // get desired audio channel parameter
509            std::map<String,DeviceRuntimeParameter*> parameters = pChannel->ChannelParameters();
510            if (!parameters[ParameterName]) throw LinuxSamplerException("Audio channel does not provide a parameter '" + ParameterName + "'.");
511            DeviceRuntimeParameter* pParameter = parameters[ParameterName];
512    
513            // return all fields of this audio channel parameter
514            result.Add("TYPE",         pParameter->Type());
515            result.Add("DESCRIPTION",  pParameter->Description());
516            result.Add("FIX",          pParameter->Fix());
517            result.Add("MULTIPLICITY", pParameter->Multiplicity());
518            if (pParameter->RangeMin())      result.Add("RANGE_MIN",     pParameter->RangeMin());
519            if (pParameter->RangeMax())      result.Add("RANGE_MAX",     pParameter->RangeMax());
520            if (pParameter->Possibilities()) result.Add("POSSIBILITIES", pParameter->Possibilities());
521        }
522        catch (LinuxSamplerException e) {
523            result.Error(e);
524        }
525        return result.Produce();
526    }
527    
528    String LSCPServer::SetAudioOutputChannelParameter(uint DeviceId, uint ChannelId, String ParamKey, String ParamVal) {
529        dmsg(2,("LSCPServer: SetAudioOutputChannelParameter(DeviceId=%d,ChannelId=%d,ParamKey=%s,ParamVal=%s)\n",DeviceId,ChannelId,ParamKey.c_str(),ParamVal.c_str()));
530        LSCPResultSet result;
531        try {
532            // get audio output device
533            std::map<uint,AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices();
534            if (!devices[DeviceId]) throw LinuxSamplerException("There is no audio output device with index " + ToString(DeviceId) + ".");
535            AudioOutputDevice* pDevice = devices[DeviceId];
536    
537            // get audio channel
538            AudioChannel* pChannel = pDevice->Channel(ChannelId);
539            if (!pChannel) throw LinuxSamplerException("Audio output device does not have channel " + ToString(ChannelId) + ".");
540    
541            // get desired audio channel parameter
542            std::map<String,DeviceRuntimeParameter*> parameters = pChannel->ChannelParameters();
543            if (!parameters[ParamKey]) throw LinuxSamplerException("Audio channel does not provide a parameter '" + ParamKey + "'.");
544            DeviceRuntimeParameter* pParameter = parameters[ParamKey];
545    
546            // set new channel parameter value
547            pParameter->SetValue(ParamVal);
548        }
549        catch (LinuxSamplerException e) {
550            result.Error(e);
551        }
552        return result.Produce();
553    }
554    
555    String LSCPServer::SetAudioOutputDeviceParameter(uint DeviceIndex, String ParamKey, String ParamVal) {
556        dmsg(2,("LSCPServer: SetAudioOutputDeviceParameter(DeviceIndex=%d,ParamKey=%s,ParamVal=%s)\n",DeviceIndex,ParamKey.c_str(),ParamVal.c_str()));
557        LSCPResultSet result;
558        try {
559            std::map<uint,AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices();
560            if (!devices[DeviceIndex]) throw LinuxSamplerException("There is no audio output device with index " + ToString(DeviceIndex) + ".");
561            AudioOutputDevice* pDevice = devices[DeviceIndex];
562            std::map<String,DeviceCreationParameter*> parameters = pDevice->DeviceParameters();
563            if (!parameters[ParamKey]) throw LinuxSamplerException("Audio output device " + ToString(DeviceIndex) + " does not have a device parameter '" + ParamKey + "'");
564            parameters[ParamKey]->SetValue(ParamVal);
565        }
566        catch (LinuxSamplerException e) {
567            result.Error(e);
568      }      }
569      return result.Produce();      return result.Produce();
570  }  }
# Line 329  String LSCPServer::SetAudioOutputType(Au Line 573  String LSCPServer::SetAudioOutputType(Au
573   * Will be called by the parser to change the audio output channel for   * Will be called by the parser to change the audio output channel for
574   * playback on a particular sampler channel.   * playback on a particular sampler channel.
575   */   */
576  String LSCPServer::SetAudioOutputChannel(uint AudioOutputChannel, uint uiSamplerChannel) {  String LSCPServer::SetAudioOutputChannel(uint ChannelAudioOutputChannel, uint AudioOutputDeviceInputChannel, uint uiSamplerChannel) {
577      dmsg(2,("LSCPServer: SetAudioOutputChannel(AudioOutputChannel=%d, SamplerChannel=%d)\n", AudioOutputChannel, uiSamplerChannel));      dmsg(2,("LSCPServer: SetAudioOutputChannel(ChannelAudioOutputChannel=%d, AudioOutputDeviceInputChannel=%d, SamplerChannel=%d)\n",ChannelAudioOutputChannel,AudioOutputDeviceInputChannel,uiSamplerChannel));
578      return "ERR:0:Not implemented yet.\r\n"; //FIXME: Add support for this in resultset class?      return "ERR:0:Not implemented yet.\r\n"; //FIXME: Add support for this in resultset class?
579  }  }
580    
581  String LSCPServer::SetMIDIInputType(MidiInputDevice::type_t MidiInputType, uint uiSamplerChannel) {  String LSCPServer::SetMIDIInputType(String MidiInputDriver, uint uiSamplerChannel) {
582      dmsg(2,("LSCPServer: SetMIDIInputType(MidiInputType=%d, SamplerChannel=%d)\n", MidiInputType, uiSamplerChannel));      dmsg(2,("LSCPServer: SetMIDIInputType(String MidiInputDriver=%s, SamplerChannel=%d)\n",MidiInputDriver.c_str(),uiSamplerChannel));
583      LSCPResultSet result;      LSCPResultSet result;
584      try {      try {
585          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);
586          if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds");          if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds");
587            // FIXME: workaround until MIDI driver configuration is implemented (using a Factory class for the MIDI input drivers then, like its already done for audio output drivers)
588            if (MidiInputDriver != "Alsa") throw LinuxSamplerException("Unknown MIDI input driver '" + MidiInputDriver + "'.");
589            MidiInputDevice::type_t MidiInputType = MidiInputDevice::type_alsa;
590          pSamplerChannel->SetMidiInputDevice(MidiInputType);          pSamplerChannel->SetMidiInputDevice(MidiInputType);
591      }      }
592      catch (LinuxSamplerException e) {      catch (LinuxSamplerException e) {
# Line 387  String LSCPServer::SetMIDIInputChannel(u Line 634  String LSCPServer::SetMIDIInputChannel(u
634      return result.Produce();      return result.Produce();
635  }  }
636    
637    String LSCPServer::SetAudioOutputDevice(uint AudioDeviceId, uint SamplerChannel) {
638        LSCPResultSet result;
639        try {
640            throw LinuxSamplerException("Command not yet implemented");
641        }
642        catch (LinuxSamplerException e) {
643             result.Error(e);
644        }
645        return result.Produce();
646    }
647    
648  /**  /**
649   * 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
650   * particular sampler channel.   * particular sampler channel.
# Line 430  String LSCPServer::ResetChannel(uint uiS Line 688  String LSCPServer::ResetChannel(uint uiS
688   * Will be called by the parser to subscribe a client (frontend) on the   * Will be called by the parser to subscribe a client (frontend) on the
689   * server for receiving event messages.   * server for receiving event messages.
690   */   */
691  String LSCPServer::SubscribeNotification(uint UDPPort) {  String LSCPServer::SubscribeNotification(event_t Event) {
692      dmsg(2,("LSCPServer: SubscribeNotification(UDPPort=%d)\n", UDPPort));      dmsg(2,("LSCPServer: SubscribeNotification(Event=%d)\n", Event));
693      return "ERR:0:Not implemented yet.\r\n";      return "ERR:0:Not implemented yet.\r\n";
694  }  }
695    
# Line 439  String LSCPServer::SubscribeNotification Line 697  String LSCPServer::SubscribeNotification
697   * Will be called by the parser to unsubscribe a client on the server   * Will be called by the parser to unsubscribe a client on the server
698   * for not receiving further event messages.   * for not receiving further event messages.
699   */   */
700  String LSCPServer::UnsubscribeNotification(String SessionID) {  String LSCPServer::UnsubscribeNotification(event_t Event) {
701      dmsg(2,("LSCPServer: UnsubscribeNotification(SessionID=%s)\n", SessionID.c_str()));      dmsg(2,("LSCPServer: UnsubscribeNotification(Event=%d)\n", Event));
702      return "ERR:0:Not implemented yet.\r\n";      return "ERR:0:Not implemented yet.\r\n";
703  }  }
704    
705    
706    // Instrument loader constructor.
707    LSCPLoadInstrument::LSCPLoadInstrument(Engine* pEngine, String Filename, uint uiInstrument)
708        : Thread(false, 0, -4)
709    {
710        this->pEngine = pEngine;
711        this->Filename = Filename;
712        this->uiInstrument = uiInstrument;
713    }
714    
715    // Instrument loader process.
716    int LSCPLoadInstrument::Main()
717    {
718        try {
719            pEngine->LoadInstrument(Filename.c_str(), uiInstrument);
720        }
721    
722        catch (LinuxSamplerException e) {
723            e.PrintMessage();
724        }
725    
726        // Always re-enable the engine.
727        pEngine->Enable();
728    
729        // FIXME: Shoot ourselves on the foot?
730        delete this;
731    }

Legend:
Removed from v.121  
changed lines
  Added in v.137

  ViewVC Help
Powered by ViewVC