/[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 129 by senkov, Tue Jun 15 03:30:16 2004 UTC revision 135 by senkov, Sun Jun 20 16:01:50 2004 UTC
# Line 140  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);          LSCPLoadInstrument *pLoadInstrument = new LSCPLoadInstrument(pEngine, Filename.c_str(), uiInstrument);
144            pLoadInstrument->StartThread();
145      }      }
146      catch (LinuxSamplerException e) {      catch (LinuxSamplerException e) {
147           result.Error(e);           result.Error(e);
# Line 244  String LSCPServer::GetChannelInfo(uint u Line 245  String LSCPServer::GetChannelInfo(uint u
245          String EngineName = "NONE";          String EngineName = "NONE";
246          float Volume = 0;          float Volume = 0;
247          String InstrumentFileName = "NONE";          String InstrumentFileName = "NONE";
248          int InstrumentIndex = 0;          int InstrumentIndex = -1;
249            int InstrumentStatus = -1;
250    
251          if (pEngine) {          if (pEngine) {
252              EngineName =  pEngine->EngineName();              EngineName =  pEngine->EngineName();
253              Volume = pEngine->Volume();              Volume = pEngine->Volume();
254              int iIdx = pEngine->InstrumentIndex();              InstrumentStatus = pEngine->InstrumentStatus();
255              if (iIdx != -1) {              InstrumentIndex = pEngine->InstrumentIndex();
256                if (InstrumentIndex != -1)
257                  InstrumentFileName = pEngine->InstrumentFileName();                  InstrumentFileName = pEngine->InstrumentFileName();
                 InstrumentIndex = iIdx;  
             }  
258          }          }
259    
260          result.Add("ENGINE_NAME", EngineName);          result.Add("ENGINE_NAME", EngineName);
# Line 266  String LSCPServer::GetChannelInfo(uint u Line 267  String LSCPServer::GetChannelInfo(uint u
267    
268          result.Add("INSTRUMENT_FILE", InstrumentFileName);          result.Add("INSTRUMENT_FILE", InstrumentFileName);
269          result.Add("INSTRUMENT_NR", InstrumentIndex);          result.Add("INSTRUMENT_NR", InstrumentIndex);
270            result.Add("INSTRUMENT_STATUS", InstrumentStatus);
271    
272          //Some more hardcoded stuff for now to make GUI look good          //Some more hardcoded stuff for now to make GUI look good
273          result.Add("MIDI_INPUT_DEVICE", "0");          result.Add("MIDI_INPUT_DEVICE", "0");
# Line 580  String LSCPServer::SetMIDIInputType(Stri Line 582  String LSCPServer::SetMIDIInputType(Stri
582          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);
583          if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds");          if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds");
584          // 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)          // 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)
585          if (MidiInputDriver != "ALSA") throw LinuxSamplerException("Unknown MIDI input driver '" + MidiInputDriver + "'.");          if (MidiInputDriver != "Alsa") throw LinuxSamplerException("Unknown MIDI input driver '" + MidiInputDriver + "'.");
586          MidiInputDevice::type_t MidiInputType = MidiInputDevice::type_alsa;          MidiInputDevice::type_t MidiInputType = MidiInputDevice::type_alsa;
587          pSamplerChannel->SetMidiInputDevice(MidiInputType);          pSamplerChannel->SetMidiInputDevice(MidiInputType);
588      }      }
# Line 683  String LSCPServer::ResetChannel(uint uiS Line 685  String LSCPServer::ResetChannel(uint uiS
685   * 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
686   * server for receiving event messages.   * server for receiving event messages.
687   */   */
688  String LSCPServer::SubscribeNotification(uint UDPPort) {  String LSCPServer::SubscribeNotification(event_t Event) {
689      dmsg(2,("LSCPServer: SubscribeNotification(UDPPort=%d)\n", UDPPort));      dmsg(2,("LSCPServer: SubscribeNotification(Event=%d)\n", Event));
690      return "ERR:0:Not implemented yet.\r\n";      return "ERR:0:Not implemented yet.\r\n";
691  }  }
692    
# Line 692  String LSCPServer::SubscribeNotification Line 694  String LSCPServer::SubscribeNotification
694   * 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
695   * for not receiving further event messages.   * for not receiving further event messages.
696   */   */
697  String LSCPServer::UnsubscribeNotification(String SessionID) {  String LSCPServer::UnsubscribeNotification(event_t Event) {
698      dmsg(2,("LSCPServer: UnsubscribeNotification(SessionID=%s)\n", SessionID.c_str()));      dmsg(2,("LSCPServer: UnsubscribeNotification(Event=%d)\n", Event));
699      return "ERR:0:Not implemented yet.\r\n";      return "ERR:0:Not implemented yet.\r\n";
700  }  }
701    
702    
703    // Instrument loader constructor.
704    LSCPLoadInstrument::LSCPLoadInstrument(Engine* pEngine, String Filename, uint uiInstrument)
705        : Thread(false, 0, -4)
706    {
707        this->pEngine = pEngine;
708        this->Filename = Filename;
709        this->uiInstrument = uiInstrument;
710    }
711    
712    // Instrument loader process.
713    int LSCPLoadInstrument::Main()
714    {
715        try {
716            pEngine->LoadInstrument(Filename.c_str(), uiInstrument);
717        }
718    
719        catch (LinuxSamplerException e) {
720            e.PrintMessage();
721        }
722    
723        // Always re-enable the engine.
724        pEngine->Enable();
725    
726        // FIXME: Shoot ourselves on the foot?
727        delete this;
728    }

Legend:
Removed from v.129  
changed lines
  Added in v.135

  ViewVC Help
Powered by ViewVC