/[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 1005 by schoenebeck, Fri Dec 29 20:06:14 2006 UTC revision 1135 by iliev, Thu Mar 29 09:40:45 2007 UTC
# Line 3  Line 3 
3   *   LinuxSampler - modular, streaming capable sampler                     *   *   LinuxSampler - modular, streaming capable sampler                     *
4   *                                                                         *   *                                                                         *
5   *   Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck   *   *   Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck   *
6   *   Copyright (C) 2005, 2006 Christian Schoenebeck                        *   *   Copyright (C) 2005 - 2007 Christian Schoenebeck                       *
7   *                                                                         *   *                                                                         *
8   *   This library is free software; you can redistribute it and/or modify  *   *   This library is free software; you can redistribute it and/or modify  *
9   *   it under the terms of the GNU General Public License as published by  *   *   it under the terms of the GNU General Public License as published by  *
# Line 75  LSCPServer::LSCPServer(Sampler* pSampler Line 75  LSCPServer::LSCPServer(Sampler* pSampler
75      LSCPEvent::RegisterEvent(LSCPEvent::event_stream_count, "STREAM_COUNT");      LSCPEvent::RegisterEvent(LSCPEvent::event_stream_count, "STREAM_COUNT");
76      LSCPEvent::RegisterEvent(LSCPEvent::event_buffer_fill, "BUFFER_FILL");      LSCPEvent::RegisterEvent(LSCPEvent::event_buffer_fill, "BUFFER_FILL");
77      LSCPEvent::RegisterEvent(LSCPEvent::event_channel_info, "CHANNEL_INFO");      LSCPEvent::RegisterEvent(LSCPEvent::event_channel_info, "CHANNEL_INFO");
78        LSCPEvent::RegisterEvent(LSCPEvent::event_fx_send_count, "FX_SEND_COUNT");
79        LSCPEvent::RegisterEvent(LSCPEvent::event_fx_send_info, "FX_SEND_INFO");
80      LSCPEvent::RegisterEvent(LSCPEvent::event_midi_instr_map_count, "MIDI_INSTRUMENT_MAP_COUNT");      LSCPEvent::RegisterEvent(LSCPEvent::event_midi_instr_map_count, "MIDI_INSTRUMENT_MAP_COUNT");
81      LSCPEvent::RegisterEvent(LSCPEvent::event_midi_instr_map_info, "MIDI_INSTRUMENT_MAP_INFO");      LSCPEvent::RegisterEvent(LSCPEvent::event_midi_instr_map_info, "MIDI_INSTRUMENT_MAP_INFO");
82      LSCPEvent::RegisterEvent(LSCPEvent::event_midi_instr_count, "MIDI_INSTRUMENT_COUNT");      LSCPEvent::RegisterEvent(LSCPEvent::event_midi_instr_count, "MIDI_INSTRUMENT_COUNT");
83      LSCPEvent::RegisterEvent(LSCPEvent::event_midi_instr_info, "MIDI_INSTRUMENT_INFO");      LSCPEvent::RegisterEvent(LSCPEvent::event_midi_instr_info, "MIDI_INSTRUMENT_INFO");
84      LSCPEvent::RegisterEvent(LSCPEvent::event_misc, "MISCELLANEOUS");      LSCPEvent::RegisterEvent(LSCPEvent::event_misc, "MISCELLANEOUS");
85      LSCPEvent::RegisterEvent(LSCPEvent::event_total_voice_count, "TOTAL_VOICE_COUNT");      LSCPEvent::RegisterEvent(LSCPEvent::event_total_voice_count, "TOTAL_VOICE_COUNT");
86        LSCPEvent::RegisterEvent(LSCPEvent::event_global_info, "GLOBAL_INFO");
87      hSocket = -1;      hSocket = -1;
88  }  }
89    
# Line 88  LSCPServer::~LSCPServer() { Line 91  LSCPServer::~LSCPServer() {
91      if (hSocket >= 0) close(hSocket);      if (hSocket >= 0) close(hSocket);
92  }  }
93    
94    void LSCPServer::EventHandler::ChannelCountChanged(int NewCount) {
95        LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_channel_count, NewCount));
96    }
97    
98    void LSCPServer::EventHandler::AudioDeviceCountChanged(int NewCount) {
99        LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_audio_device_count, NewCount));
100    }
101    
102    void LSCPServer::EventHandler::MidiDeviceCountChanged(int NewCount) {
103        LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_midi_device_count, NewCount));
104    }
105    
106    void LSCPServer::EventHandler::MidiInstrumentCountChanged(int MapId, int NewCount) {
107        LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_midi_instr_count, MapId, NewCount));
108    }
109    
110    void LSCPServer::EventHandler::MidiInstrumentInfoChanged(int MapId, int Bank, int Program) {
111        LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_midi_instr_info, MapId, Bank, Program));
112    }
113    
114    void LSCPServer::EventHandler::MidiInstrumentMapCountChanged(int NewCount) {
115        LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_midi_instr_map_count, NewCount));
116    }
117    
118    void LSCPServer::EventHandler::MidiInstrumentMapInfoChanged(int MapId) {
119        LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_midi_instr_map_info, MapId));
120    }
121    
122    void LSCPServer::EventHandler::FxSendCountChanged(int ChannelId, int NewCount) {
123        LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_fx_send_count, ChannelId, NewCount));
124    }
125    
126    void LSCPServer::EventHandler::VoiceCountChanged(int ChannelId, int NewCount) {
127        LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_voice_count, ChannelId, NewCount));
128    }
129    
130    void LSCPServer::EventHandler::StreamCountChanged(int ChannelId, int NewCount) {
131        LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_stream_count, ChannelId, NewCount));
132    }
133    
134    void LSCPServer::EventHandler::BufferFillChanged(int ChannelId, String FillData) {
135        LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_buffer_fill, ChannelId, FillData));
136    }
137    
138    void LSCPServer::EventHandler::TotalVoiceCountChanged(int NewCount) {
139        LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_total_voice_count, NewCount));
140    }
141    
142    
143  /**  /**
144   * Blocks the calling thread until the LSCP Server is initialized and   * Blocks the calling thread until the LSCP Server is initialized and
145   * accepting socket connections, if the server is already initialized then   * accepting socket connections, if the server is already initialized then
# Line 128  int LSCPServer::Main() { Line 180  int LSCPServer::Main() {
180    
181      listen(hSocket, 1);      listen(hSocket, 1);
182      Initialized.Set(true);      Initialized.Set(true);
183        
184        // Registering event listeners
185        pSampler->AddChannelCountListener(&eventHandler);
186        pSampler->AddAudioDeviceCountListener(&eventHandler);
187        pSampler->AddMidiDeviceCountListener(&eventHandler);
188        pSampler->AddVoiceCountListener(&eventHandler);
189        pSampler->AddStreamCountListener(&eventHandler);
190        pSampler->AddBufferFillListener(&eventHandler);
191        pSampler->AddTotalVoiceCountListener(&eventHandler);
192        pSampler->AddFxSendCountListener(&eventHandler);
193        MidiInstrumentMapper::AddMidiInstrumentCountListener(&eventHandler);
194        MidiInstrumentMapper::AddMidiInstrumentInfoListener(&eventHandler);
195        MidiInstrumentMapper::AddMidiInstrumentMapCountListener(&eventHandler);
196        MidiInstrumentMapper::AddMidiInstrumentMapInfoListener(&eventHandler);
197    
198      // now wait for client connections and handle their requests      // now wait for client connections and handle their requests
199      sockaddr_in client;      sockaddr_in client;
# Line 148  int LSCPServer::Main() { Line 214  int LSCPServer::Main() {
214                  if ((*itEngineChannel)->StatusChanged()) {                  if ((*itEngineChannel)->StatusChanged()) {
215                      SendLSCPNotify(LSCPEvent(LSCPEvent::event_channel_info, (*itEngineChannel)->iSamplerChannelIndex));                      SendLSCPNotify(LSCPEvent(LSCPEvent::event_channel_info, (*itEngineChannel)->iSamplerChannelIndex));
216                  }                  }
217    
218                    for (int i = 0; i < (*itEngineChannel)->GetFxSendCount(); i++) {
219                        FxSend* fxs = (*itEngineChannel)->GetFxSend(i);
220                        if(fxs != NULL && fxs->IsInfoChanged()) {
221                            int chn = (*itEngineChannel)->iSamplerChannelIndex;
222                            LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_fx_send_info, chn, fxs->Id()));
223                            fxs->SetInfoChanged(false);
224                        }
225                    }
226              }              }
227          }          }
228    
# Line 490  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 670  String LSCPServer::GetChannelInfo(uint u Line 755  String LSCPServer::GetChannelInfo(uint u
755          String AudioRouting;          String AudioRouting;
756          int Mute = 0;          int Mute = 0;
757          bool Solo = false;          bool Solo = false;
758          String MidiInstrumentMap;          String MidiInstrumentMap = "NONE";
759    
760          if (pEngineChannel) {          if (pEngineChannel) {
761              EngineName          = pEngineChannel->EngineName();              EngineName          = pEngineChannel->EngineName();
# Line 1502  String LSCPServer::SetChannelSolo(bool b Line 1587  String LSCPServer::SetChannelSolo(bool b
1587    
1588          bool oldSolo = pEngineChannel->GetSolo();          bool oldSolo = pEngineChannel->GetSolo();
1589          bool hadSoloChannel = HasSoloChannel();          bool hadSoloChannel = HasSoloChannel();
1590            
1591          pEngineChannel->SetSolo(bSolo);          pEngineChannel->SetSolo(bSolo);
1592            
1593          if(!oldSolo && bSolo) {          if(!oldSolo && bSolo) {
1594              if(pEngineChannel->GetMute() == -1) pEngineChannel->SetMute(0);              if(pEngineChannel->GetMute() == -1) pEngineChannel->SetMute(0);
1595              if(!hadSoloChannel) MuteNonSoloChannels();              if(!hadSoloChannel) MuteNonSoloChannels();
1596          }          }
1597            
1598          if(oldSolo && !bSolo) {          if(oldSolo && !bSolo) {
1599              if(!HasSoloChannel()) UnmuteChannels();              if(!HasSoloChannel()) UnmuteChannels();
1600              else if(!pEngineChannel->GetMute()) pEngineChannel->SetMute(-1);              else if(!pEngineChannel->GetMute()) pEngineChannel->SetMute(-1);
# Line 1567  void  LSCPServer::UnmuteChannels() { Line 1652  void  LSCPServer::UnmuteChannels() {
1652      }      }
1653  }  }
1654    
1655  String LSCPServer::AddOrReplaceMIDIInstrumentMapping(uint MidiMapID, uint MidiBank, uint MidiProg, String EngineType, String InstrumentFile, uint InstrumentIndex, float Volume, MidiInstrumentMapper::mode_t LoadMode, String Name) {  String LSCPServer::AddOrReplaceMIDIInstrumentMapping(uint MidiMapID, uint MidiBank, uint MidiProg, String EngineType, String InstrumentFile, uint InstrumentIndex, float Volume, MidiInstrumentMapper::mode_t LoadMode, String Name, bool bModal) {
1656      dmsg(2,("LSCPServer: AddOrReplaceMIDIInstrumentMapping()\n"));      dmsg(2,("LSCPServer: AddOrReplaceMIDIInstrumentMapping()\n"));
1657    
1658      midi_prog_index_t idx;      midi_prog_index_t idx;
# Line 1585  String LSCPServer::AddOrReplaceMIDIInstr Line 1670  String LSCPServer::AddOrReplaceMIDIInstr
1670    
1671      LSCPResultSet result;      LSCPResultSet result;
1672      try {      try {
1673          // PERSISTENT mapping commands might bloock for a long time, so in          // PERSISTENT mapping commands might block for a long time, so in
1674          // that case we add/replace the mapping in another thread          // that case we add/replace the mapping in another thread in case
1675          bool bInBackground = (entry.LoadMode == MidiInstrumentMapper::PERSISTENT);          // the NON_MODAL argument was supplied, non persistent mappings
1676            // should return immediately, so we don't need to do that for them
1677            bool bInBackground = (entry.LoadMode == MidiInstrumentMapper::PERSISTENT && !bModal);
1678          MidiInstrumentMapper::AddOrReplaceEntry(MidiMapID, idx, entry, bInBackground);          MidiInstrumentMapper::AddOrReplaceEntry(MidiMapID, idx, entry, bInBackground);
1679      } catch (Exception e) {      } catch (Exception e) {
1680          result.Error(e);          result.Error(e);
# Line 1698  String LSCPServer::ListMidiInstrumentMap Line 1785  String LSCPServer::ListMidiInstrumentMap
1785          for (; iter != mappings.end(); iter++) {          for (; iter != mappings.end(); iter++) {
1786              if (s.size()) s += ",";              if (s.size()) s += ",";
1787              s += "{" + ToString(MidiMapID) + ","              s += "{" + ToString(MidiMapID) + ","
1788                       + ToString((int(iter->first.midi_bank_msb) << 7) & int(iter->first.midi_bank_lsb)) + ","                       + ToString((int(iter->first.midi_bank_msb) << 7) | int(iter->first.midi_bank_lsb)) + ","
1789                       + ToString(int(iter->first.midi_prog)) + "}";                       + ToString(int(iter->first.midi_prog)) + "}";
1790          }          }
1791          result.Add(s);          result.Add(s);
# Line 1720  String LSCPServer::ListAllMidiInstrument Line 1807  String LSCPServer::ListAllMidiInstrument
1807              for (; iter != mappings.end(); iter++) {              for (; iter != mappings.end(); iter++) {
1808                  if (s.size()) s += ",";                  if (s.size()) s += ",";
1809                  s += "{" + ToString(maps[i]) + ","                  s += "{" + ToString(maps[i]) + ","
1810                           + ToString((int(iter->first.midi_bank_msb) << 7) & int(iter->first.midi_bank_lsb)) + ","                           + ToString((int(iter->first.midi_bank_msb) << 7) | int(iter->first.midi_bank_lsb)) + ","
1811                           + ToString(int(iter->first.midi_prog)) + "}";                           + ToString(int(iter->first.midi_prog)) + "}";
1812              }              }
1813          }          }
# Line 1822  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 1870  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 1890  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 1915  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 1933  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 1951  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 1979  String LSCPServer::GetFxSendInfo(uint ui Line 2053  String LSCPServer::GetFxSendInfo(uint ui
2053    
2054          // success          // success
2055          result.Add("NAME", pFxSend->Name());          result.Add("NAME", pFxSend->Name());
2056            result.Add("MIDI_CONTROLLER", pFxSend->MidiController());
2057            result.Add("LEVEL", ToString(pFxSend->Level()));
2058          result.Add("AUDIO_OUTPUT_ROUTING", AudioRouting);          result.Add("AUDIO_OUTPUT_ROUTING", AudioRouting);
2059      } catch (Exception e) {      } catch (Exception e) {
2060          result.Error(e);          result.Error(e);
# Line 1986  String LSCPServer::GetFxSendInfo(uint ui Line 2062  String LSCPServer::GetFxSendInfo(uint ui
2062      return result.Produce();      return result.Produce();
2063  }  }
2064    
2065    String LSCPServer::SetFxSendName(uint uiSamplerChannel, uint FxSendID, String Name) {
2066        dmsg(2,("LSCPServer: SetFxSendName()\n"));
2067        LSCPResultSet result;
2068        try {
2069            FxSend* pFxSend = GetFxSend(uiSamplerChannel, FxSendID);
2070    
2071            pFxSend->SetName(Name);
2072            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  String LSCPServer::SetFxSendAudioOutputChannel(uint uiSamplerChannel, uint FxSendID, uint FxSendChannel, uint DeviceChannel) {  String LSCPServer::SetFxSendAudioOutputChannel(uint uiSamplerChannel, uint FxSendID, uint FxSendChannel, uint DeviceChannel) {
2080      dmsg(2,("LSCPServer: SetFxSendAudioOutputChannel()\n"));      dmsg(2,("LSCPServer: SetFxSendAudioOutputChannel()\n"));
2081      LSCPResultSet result;      LSCPResultSet result;
2082      try {      try {
2083          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);          FxSend* pFxSend = GetFxSend(uiSamplerChannel, FxSendID);
         if (!pSamplerChannel) throw Exception("Invalid sampler channel number " + ToString(uiSamplerChannel));  
2084    
2085          EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel();          pFxSend->SetDestinationChannel(FxSendChannel, DeviceChannel);
2086          if (!pEngineChannel) throw Exception("There is no engine deployed on this sampler channel yet");          LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_fx_send_info, uiSamplerChannel, FxSendID));
2087        } catch (Exception e) {
2088            result.Error(e);
2089        }
2090        return result.Produce();
2091    }
2092    
2093          FxSend* pFxSend = NULL;  String LSCPServer::SetFxSendMidiController(uint uiSamplerChannel, uint FxSendID, uint MidiController) {
2094          for (int i = 0; i < pEngineChannel->GetFxSendCount(); i++) {      dmsg(2,("LSCPServer: SetFxSendMidiController()\n"));
2095              if (pEngineChannel->GetFxSend(i)->Id() == FxSendID) {      LSCPResultSet result;
2096                  pFxSend = pEngineChannel->GetFxSend(i);      try {
2097                  break;          FxSend* pFxSend = GetFxSend(uiSamplerChannel, FxSendID);
             }  
         }  
         if (!pFxSend) throw Exception("There is no FxSend with that ID on the given sampler channel");  
2098    
2099          pFxSend->SetDestinationChannel(FxSendChannel, DeviceChannel);          pFxSend->SetMidiController(MidiController);
2100            LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_fx_send_info, uiSamplerChannel, FxSendID));
2101        } catch (Exception e) {
2102            result.Error(e);
2103        }
2104        return result.Produce();
2105    }
2106    
2107    String LSCPServer::SetFxSendLevel(uint uiSamplerChannel, uint FxSendID, double dLevel) {
2108        dmsg(2,("LSCPServer: SetFxSendLevel()\n"));
2109        LSCPResultSet result;
2110        try {
2111            FxSend* pFxSend = GetFxSend(uiSamplerChannel, FxSendID);
2112    
2113            pFxSend->SetLevel((float)dLevel);
2114            LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_fx_send_info, uiSamplerChannel, FxSendID));
2115      } catch (Exception e) {      } catch (Exception e) {
2116          result.Error(e);          result.Error(e);
2117      }      }
# Line 2085  String LSCPServer::SetGlobalVolume(doubl Line 2191  String LSCPServer::SetGlobalVolume(doubl
2191      try {      try {
2192          if (dVolume < 0) throw Exception("Volume may not be negative");          if (dVolume < 0) throw Exception("Volume may not be negative");
2193          GLOBAL_VOLUME = dVolume; // see common/global.cpp          GLOBAL_VOLUME = dVolume; // see common/global.cpp
2194            LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_global_info, "VOLUME", GLOBAL_VOLUME));
2195      } catch (Exception e) {      } catch (Exception e) {
2196          result.Error(e);          result.Error(e);
2197      }      }

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

  ViewVC Help
Powered by ViewVC