/[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 1133 by iliev, Mon Mar 26 08:27:06 2007 UTC revision 1135 by iliev, Thu Mar 29 09:40:45 2007 UTC
# Line 565  String LSCPServer::DestroyMidiInputDevic Line 565  String LSCPServer::DestroyMidiInputDevic
565      return result.Produce();      return result.Produce();
566  }  }
567    
568    EngineChannel* LSCPServer::GetEngineChannel(uint uiSamplerChannel) {
569        SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);
570        if (!pSamplerChannel) throw Exception("Invalid sampler channel number " + ToString(uiSamplerChannel));
571    
572        EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel();
573        if (!pEngineChannel) throw Exception("There is no engine deployed on this sampler channel yet");
574    
575        return pEngineChannel;        
576    }
577    
578  /**  /**
579   * Will be called by the parser to load an instrument.   * Will be called by the parser to load an instrument.
580   */   */
# Line 1899  String LSCPServer::GetMidiInstrumentMap( Line 1909  String LSCPServer::GetMidiInstrumentMap(
1909      LSCPResultSet result;      LSCPResultSet result;
1910      try {      try {
1911          result.Add("NAME", MidiInstrumentMapper::MapName(MidiMapID));          result.Add("NAME", MidiInstrumentMapper::MapName(MidiMapID));
1912            result.Add("DEFAULT", MidiInstrumentMapper::GetDefaultMap() == MidiMapID);
1913      } catch (Exception e) {      } catch (Exception e) {
1914          result.Error(e);          result.Error(e);
1915      }      }
# Line 1947  String LSCPServer::CreateFxSend(uint uiS Line 1958  String LSCPServer::CreateFxSend(uint uiS
1958      dmsg(2,("LSCPServer: CreateFxSend()\n"));      dmsg(2,("LSCPServer: CreateFxSend()\n"));
1959      LSCPResultSet result;      LSCPResultSet result;
1960      try {      try {
1961          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);          EngineChannel* pEngineChannel = GetEngineChannel(uiSamplerChannel);
1962          if (!pSamplerChannel) throw Exception("Invalid sampler channel number " + ToString(uiSamplerChannel));          
   
         EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel();  
         if (!pEngineChannel) throw Exception("There is no engine deployed on this sampler channel yet");  
   
1963          FxSend* pFxSend = pEngineChannel->AddFxSend(MidiCtrl, Name);          FxSend* pFxSend = pEngineChannel->AddFxSend(MidiCtrl, Name);
1964          if (!pFxSend) throw Exception("Could not add FxSend, don't ask, I don't know why (probably a bug)");          if (!pFxSend) throw Exception("Could not add FxSend, don't ask, I don't know why (probably a bug)");
1965    
# Line 1967  String LSCPServer::DestroyFxSend(uint ui Line 1974  String LSCPServer::DestroyFxSend(uint ui
1974      dmsg(2,("LSCPServer: DestroyFxSend()\n"));      dmsg(2,("LSCPServer: DestroyFxSend()\n"));
1975      LSCPResultSet result;      LSCPResultSet result;
1976      try {      try {
1977          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);          EngineChannel* pEngineChannel = GetEngineChannel(uiSamplerChannel);
         if (!pSamplerChannel) throw Exception("Invalid sampler channel number " + ToString(uiSamplerChannel));  
   
         EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel();  
         if (!pEngineChannel) throw Exception("There is no engine deployed on this sampler channel yet");  
1978    
1979          FxSend* pFxSend = NULL;          FxSend* pFxSend = NULL;
1980          for (int i = 0; i < pEngineChannel->GetFxSendCount(); i++) {          for (int i = 0; i < pEngineChannel->GetFxSendCount(); i++) {
# Line 1992  String LSCPServer::GetFxSends(uint uiSam Line 1995  String LSCPServer::GetFxSends(uint uiSam
1995      dmsg(2,("LSCPServer: GetFxSends()\n"));      dmsg(2,("LSCPServer: GetFxSends()\n"));
1996      LSCPResultSet result;      LSCPResultSet result;
1997      try {      try {
1998          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);          EngineChannel* pEngineChannel = GetEngineChannel(uiSamplerChannel);
         if (!pSamplerChannel) throw Exception("Invalid sampler channel number " + ToString(uiSamplerChannel));  
   
         EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel();  
         if (!pEngineChannel) throw Exception("There is no engine deployed on this sampler channel yet");  
1999    
2000          result.Add(pEngineChannel->GetFxSendCount());          result.Add(pEngineChannel->GetFxSendCount());
2001      } catch (Exception e) {      } catch (Exception e) {
# Line 2010  String LSCPServer::ListFxSends(uint uiSa Line 2009  String LSCPServer::ListFxSends(uint uiSa
2009      LSCPResultSet result;      LSCPResultSet result;
2010      String list;      String list;
2011      try {      try {
2012          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);          EngineChannel* pEngineChannel = GetEngineChannel(uiSamplerChannel);
         if (!pSamplerChannel) throw Exception("Invalid sampler channel number " + ToString(uiSamplerChannel));  
   
         EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel();  
         if (!pEngineChannel) throw Exception("There is no engine deployed on this sampler channel yet");  
2013    
2014          for (int i = 0; i < pEngineChannel->GetFxSendCount(); i++) {          for (int i = 0; i < pEngineChannel->GetFxSendCount(); i++) {
2015              FxSend* pFxSend = pEngineChannel->GetFxSend(i);              FxSend* pFxSend = pEngineChannel->GetFxSend(i);
# Line 2028  String LSCPServer::ListFxSends(uint uiSa Line 2023  String LSCPServer::ListFxSends(uint uiSa
2023      return result.Produce();      return result.Produce();
2024  }  }
2025    
2026    FxSend* LSCPServer::GetFxSend(uint uiSamplerChannel, uint FxSendID) {
2027        EngineChannel* pEngineChannel = GetEngineChannel(uiSamplerChannel);
2028    
2029        FxSend* pFxSend = NULL;
2030        for (int i = 0; i < pEngineChannel->GetFxSendCount(); i++) {
2031            if (pEngineChannel->GetFxSend(i)->Id() == FxSendID) {
2032                pFxSend = pEngineChannel->GetFxSend(i);
2033                break;
2034            }
2035        }
2036        if (!pFxSend) throw Exception("There is no FxSend with that ID on the given sampler channel");
2037        return pFxSend;
2038    }
2039    
2040  String LSCPServer::GetFxSendInfo(uint uiSamplerChannel, uint FxSendID) {  String LSCPServer::GetFxSendInfo(uint uiSamplerChannel, uint FxSendID) {
2041      dmsg(2,("LSCPServer: GetFxSendInfo()\n"));      dmsg(2,("LSCPServer: GetFxSendInfo()\n"));
2042      LSCPResultSet result;      LSCPResultSet result;
2043      try {      try {
2044          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);          EngineChannel* pEngineChannel = GetEngineChannel(uiSamplerChannel);
2045          if (!pSamplerChannel) throw Exception("Invalid sampler channel number " + ToString(uiSamplerChannel));          FxSend* pFxSend = GetFxSend(uiSamplerChannel, FxSendID);
2046            
         EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel();  
         if (!pEngineChannel) throw Exception("There is no engine deployed on this sampler channel yet");  
   
         FxSend* pFxSend = NULL;  
         for (int i = 0; i < pEngineChannel->GetFxSendCount(); i++) {  
             if (pEngineChannel->GetFxSend(i)->Id() == FxSendID) {  
                 pFxSend = pEngineChannel->GetFxSend(i);  
                 break;  
             }  
         }  
         if (!pFxSend) throw Exception("There is no FxSend with that ID on the given sampler channel");  
   
2047          // gather audio routing informations          // gather audio routing informations
2048          String AudioRouting;          String AudioRouting;
2049          for (int chan = 0; chan < pEngineChannel->Channels(); chan++) {          for (int chan = 0; chan < pEngineChannel->Channels(); chan++) {
# Line 2065  String LSCPServer::GetFxSendInfo(uint ui Line 2062  String LSCPServer::GetFxSendInfo(uint ui
2062      return result.Produce();      return result.Produce();
2063  }  }
2064    
2065  String LSCPServer::SetFxSendAudioOutputChannel(uint uiSamplerChannel, uint FxSendID, uint FxSendChannel, uint DeviceChannel) {  String LSCPServer::SetFxSendName(uint uiSamplerChannel, uint FxSendID, String Name) {
2066      dmsg(2,("LSCPServer: SetFxSendAudioOutputChannel()\n"));      dmsg(2,("LSCPServer: SetFxSendName()\n"));
2067      LSCPResultSet result;      LSCPResultSet result;
2068      try {      try {
2069          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);          FxSend* pFxSend = GetFxSend(uiSamplerChannel, FxSendID);
         if (!pSamplerChannel) throw Exception("Invalid sampler channel number " + ToString(uiSamplerChannel));  
2070    
2071          EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel();          pFxSend->SetName(Name);
2072          if (!pEngineChannel) throw Exception("There is no engine deployed on this sampler channel yet");          LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_fx_send_info, uiSamplerChannel, FxSendID));
2073        } catch (Exception e) {
2074            result.Error(e);
2075        }
2076        return result.Produce();
2077    }
2078    
2079          FxSend* pFxSend = NULL;  String LSCPServer::SetFxSendAudioOutputChannel(uint uiSamplerChannel, uint FxSendID, uint FxSendChannel, uint DeviceChannel) {
2080          for (int i = 0; i < pEngineChannel->GetFxSendCount(); i++) {      dmsg(2,("LSCPServer: SetFxSendAudioOutputChannel()\n"));
2081              if (pEngineChannel->GetFxSend(i)->Id() == FxSendID) {      LSCPResultSet result;
2082                  pFxSend = pEngineChannel->GetFxSend(i);      try {
2083                  break;          FxSend* pFxSend = GetFxSend(uiSamplerChannel, FxSendID);
             }  
         }  
         if (!pFxSend) throw Exception("There is no FxSend with that ID on the given sampler channel");  
2084    
2085          pFxSend->SetDestinationChannel(FxSendChannel, DeviceChannel);          pFxSend->SetDestinationChannel(FxSendChannel, DeviceChannel);
2086          LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_fx_send_info, uiSamplerChannel, FxSendID));          LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_fx_send_info, uiSamplerChannel, FxSendID));
# Line 2096  String LSCPServer::SetFxSendMidiControll Line 2094  String LSCPServer::SetFxSendMidiControll
2094      dmsg(2,("LSCPServer: SetFxSendMidiController()\n"));      dmsg(2,("LSCPServer: SetFxSendMidiController()\n"));
2095      LSCPResultSet result;      LSCPResultSet result;
2096      try {      try {
2097          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);          FxSend* pFxSend = GetFxSend(uiSamplerChannel, FxSendID);
         if (!pSamplerChannel) throw Exception("Invalid sampler channel number " + ToString(uiSamplerChannel));  
   
         EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel();  
         if (!pEngineChannel) throw Exception("There is no engine deployed on this sampler channel yet");  
   
         FxSend* pFxSend = NULL;  
         for (int i = 0; i < pEngineChannel->GetFxSendCount(); i++) {  
             if (pEngineChannel->GetFxSend(i)->Id() == FxSendID) {  
                 pFxSend = pEngineChannel->GetFxSend(i);  
                 break;  
             }  
         }  
         if (!pFxSend) throw Exception("There is no FxSend with that ID on the given sampler channel");  
2098    
2099          pFxSend->SetMidiController(MidiController);          pFxSend->SetMidiController(MidiController);
2100          LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_fx_send_info, uiSamplerChannel, FxSendID));          LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_fx_send_info, uiSamplerChannel, FxSendID));
# Line 2123  String LSCPServer::SetFxSendLevel(uint u Line 2108  String LSCPServer::SetFxSendLevel(uint u
2108      dmsg(2,("LSCPServer: SetFxSendLevel()\n"));      dmsg(2,("LSCPServer: SetFxSendLevel()\n"));
2109      LSCPResultSet result;      LSCPResultSet result;
2110      try {      try {
2111          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);          FxSend* pFxSend = GetFxSend(uiSamplerChannel, FxSendID);
         if (!pSamplerChannel) throw Exception("Invalid sampler channel number " + ToString(uiSamplerChannel));  
   
         EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel();  
         if (!pEngineChannel) throw Exception("There is no engine deployed on this sampler channel yet");  
   
         FxSend* pFxSend = NULL;  
         for (int i = 0; i < pEngineChannel->GetFxSendCount(); i++) {  
             if (pEngineChannel->GetFxSend(i)->Id() == FxSendID) {  
                 pFxSend = pEngineChannel->GetFxSend(i);  
                 break;  
             }  
         }  
         if (!pFxSend) throw Exception("There is no FxSend with that ID on the given sampler channel");  
2112    
2113          pFxSend->SetLevel((float)dLevel);          pFxSend->SetLevel((float)dLevel);
2114          LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_fx_send_info, uiSamplerChannel, FxSendID));          LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_fx_send_info, uiSamplerChannel, FxSendID));

Legend:
Removed from v.1133  
changed lines
  Added in v.1135

  ViewVC Help
Powered by ViewVC