/[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 133 by capela, Fri Jun 18 14:29:02 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 696  String LSCPServer::UnsubscribeNotificati Line 698  String LSCPServer::UnsubscribeNotificati
698      dmsg(2,("LSCPServer: UnsubscribeNotification(SessionID=%s)\n", SessionID.c_str()));      dmsg(2,("LSCPServer: UnsubscribeNotification(SessionID=%s)\n", SessionID.c_str()));
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.133

  ViewVC Help
Powered by ViewVC