/[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 973 by schoenebeck, Fri Dec 15 21:40:27 2006 UTC revision 1108 by iliev, Thu Mar 22 20:39:04 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 24  Line 24 
24  #include "lscpserver.h"  #include "lscpserver.h"
25  #include "lscpresultset.h"  #include "lscpresultset.h"
26  #include "lscpevent.h"  #include "lscpevent.h"
27  //#include "../common/global.h"  #include "../common/global.h"
28    
29  #include <fcntl.h>  #include <fcntl.h>
30    
# Line 66  LSCPServer::LSCPServer(Sampler* pSampler Line 66  LSCPServer::LSCPServer(Sampler* pSampler
66      SocketAddress.sin_addr.s_addr = addr;      SocketAddress.sin_addr.s_addr = addr;
67      SocketAddress.sin_port        = port;      SocketAddress.sin_port        = port;
68      this->pSampler = pSampler;      this->pSampler = pSampler;
69        LSCPEvent::RegisterEvent(LSCPEvent::event_audio_device_count, "AUDIO_OUTPUT_DEVICE_COUNT");
70        LSCPEvent::RegisterEvent(LSCPEvent::event_audio_device_info, "AUDIO_OUTPUT_DEVICE_INFO");
71        LSCPEvent::RegisterEvent(LSCPEvent::event_midi_device_count, "MIDI_INPUT_DEVICE_COUNT");
72        LSCPEvent::RegisterEvent(LSCPEvent::event_midi_device_info, "MIDI_INPUT_DEVICE_INFO");
73      LSCPEvent::RegisterEvent(LSCPEvent::event_channel_count, "CHANNEL_COUNT");      LSCPEvent::RegisterEvent(LSCPEvent::event_channel_count, "CHANNEL_COUNT");
74      LSCPEvent::RegisterEvent(LSCPEvent::event_voice_count, "VOICE_COUNT");      LSCPEvent::RegisterEvent(LSCPEvent::event_voice_count, "VOICE_COUNT");
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");
81        LSCPEvent::RegisterEvent(LSCPEvent::event_midi_instr_map_info, "MIDI_INSTRUMENT_MAP_INFO");
82        LSCPEvent::RegisterEvent(LSCPEvent::event_midi_instr_count, "MIDI_INSTRUMENT_COUNT");
83        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 140  int LSCPServer::Main() { Line 151  int LSCPServer::Main() {
151                  if ((*itEngineChannel)->StatusChanged()) {                  if ((*itEngineChannel)->StatusChanged()) {
152                      SendLSCPNotify(LSCPEvent(LSCPEvent::event_channel_info, (*itEngineChannel)->iSamplerChannelIndex));                      SendLSCPNotify(LSCPEvent(LSCPEvent::event_channel_info, (*itEngineChannel)->iSamplerChannelIndex));
153                  }                  }
154    
155                    for (int i = 0; i < (*itEngineChannel)->GetFxSendCount(); i++) {
156                        FxSend* fxs = (*itEngineChannel)->GetFxSend(i);
157                        if(fxs != NULL && fxs->IsInfoChanged()) {
158                            int chn = (*itEngineChannel)->iSamplerChannelIndex;
159                            LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_fx_send_info, chn, fxs->Id()));
160                            fxs->SetInfoChanged(false);
161                        }
162                    }
163              }              }
164          }          }
165    
# Line 1185  String LSCPServer::SetAudioOutputChannel Line 1205  String LSCPServer::SetAudioOutputChannel
1205    
1206          // set new channel parameter value          // set new channel parameter value
1207          pParameter->SetValue(ParamVal);          pParameter->SetValue(ParamVal);
1208            LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_audio_device_info, DeviceId));
1209      }      }
1210      catch (Exception e) {      catch (Exception e) {
1211          result.Error(e);          result.Error(e);
# Line 1202  String LSCPServer::SetAudioOutputDeviceP Line 1223  String LSCPServer::SetAudioOutputDeviceP
1223          std::map<String,DeviceCreationParameter*> parameters = pDevice->DeviceParameters();          std::map<String,DeviceCreationParameter*> parameters = pDevice->DeviceParameters();
1224          if (!parameters.count(ParamKey)) throw Exception("Audio output device " + ToString(DeviceIndex) + " does not have a device parameter '" + ParamKey + "'");          if (!parameters.count(ParamKey)) throw Exception("Audio output device " + ToString(DeviceIndex) + " does not have a device parameter '" + ParamKey + "'");
1225          parameters[ParamKey]->SetValue(ParamVal);          parameters[ParamKey]->SetValue(ParamVal);
1226            LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_audio_device_info, DeviceIndex));
1227      }      }
1228      catch (Exception e) {      catch (Exception e) {
1229          result.Error(e);          result.Error(e);
# Line 1219  String LSCPServer::SetMidiInputDevicePar Line 1241  String LSCPServer::SetMidiInputDevicePar
1241          std::map<String,DeviceCreationParameter*> parameters = pDevice->DeviceParameters();          std::map<String,DeviceCreationParameter*> parameters = pDevice->DeviceParameters();
1242          if (!parameters.count(ParamKey)) throw Exception("MIDI input device " + ToString(DeviceIndex) + " does not have a device parameter '" + ParamKey + "'");          if (!parameters.count(ParamKey)) throw Exception("MIDI input device " + ToString(DeviceIndex) + " does not have a device parameter '" + ParamKey + "'");
1243          parameters[ParamKey]->SetValue(ParamVal);          parameters[ParamKey]->SetValue(ParamVal);
1244            LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_midi_device_info, DeviceIndex));
1245      }      }
1246      catch (Exception e) {      catch (Exception e) {
1247          result.Error(e);          result.Error(e);
# Line 1243  String LSCPServer::SetMidiInputPortParam Line 1266  String LSCPServer::SetMidiInputPortParam
1266          std::map<String,DeviceRuntimeParameter*> parameters = pMidiInputPort->PortParameters();          std::map<String,DeviceRuntimeParameter*> parameters = pMidiInputPort->PortParameters();
1267          if (!parameters.count(ParamKey)) throw Exception("MIDI input device " + ToString(PortIndex) + " does not have a parameter '" + ParamKey + "'");          if (!parameters.count(ParamKey)) throw Exception("MIDI input device " + ToString(PortIndex) + " does not have a parameter '" + ParamKey + "'");
1268          parameters[ParamKey]->SetValue(ParamVal);          parameters[ParamKey]->SetValue(ParamVal);
1269            LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_midi_device_info, DeviceIndex));
1270      }      }
1271      catch (Exception e) {      catch (Exception e) {
1272          result.Error(e);          result.Error(e);
# Line 1490  String LSCPServer::SetChannelSolo(bool b Line 1514  String LSCPServer::SetChannelSolo(bool b
1514    
1515          bool oldSolo = pEngineChannel->GetSolo();          bool oldSolo = pEngineChannel->GetSolo();
1516          bool hadSoloChannel = HasSoloChannel();          bool hadSoloChannel = HasSoloChannel();
1517            
1518          pEngineChannel->SetSolo(bSolo);          pEngineChannel->SetSolo(bSolo);
1519            
1520          if(!oldSolo && bSolo) {          if(!oldSolo && bSolo) {
1521              if(pEngineChannel->GetMute() == -1) pEngineChannel->SetMute(0);              if(pEngineChannel->GetMute() == -1) pEngineChannel->SetMute(0);
1522              if(!hadSoloChannel) MuteNonSoloChannels();              if(!hadSoloChannel) MuteNonSoloChannels();
1523          }          }
1524            
1525          if(oldSolo && !bSolo) {          if(oldSolo && !bSolo) {
1526              if(!HasSoloChannel()) UnmuteChannels();              if(!HasSoloChannel()) UnmuteChannels();
1527              else if(!pEngineChannel->GetMute()) pEngineChannel->SetMute(-1);              else if(!pEngineChannel->GetMute()) pEngineChannel->SetMute(-1);
# Line 1555  void  LSCPServer::UnmuteChannels() { Line 1579  void  LSCPServer::UnmuteChannels() {
1579      }      }
1580  }  }
1581    
1582  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) {
1583      dmsg(2,("LSCPServer: AddOrReplaceMIDIInstrumentMapping()\n"));      dmsg(2,("LSCPServer: AddOrReplaceMIDIInstrumentMapping()\n"));
1584    
1585      midi_prog_index_t idx;      midi_prog_index_t idx;
# Line 1573  String LSCPServer::AddOrReplaceMIDIInstr Line 1597  String LSCPServer::AddOrReplaceMIDIInstr
1597    
1598      LSCPResultSet result;      LSCPResultSet result;
1599      try {      try {
1600          // PERSISTENT mapping commands might bloock for a long time, so in          // PERSISTENT mapping commands might block for a long time, so in
1601          // that case we add/replace the mapping in another thread          // that case we add/replace the mapping in another thread in case
1602          bool bInBackground = (entry.LoadMode == MidiInstrumentMapper::PERSISTENT);          // the NON_MODAL argument was supplied, non persistent mappings
1603            // should return immediately, so we don't need to do that for them
1604            bool bInBackground = (entry.LoadMode == MidiInstrumentMapper::PERSISTENT && !bModal);
1605          MidiInstrumentMapper::AddOrReplaceEntry(MidiMapID, idx, entry, bInBackground);          MidiInstrumentMapper::AddOrReplaceEntry(MidiMapID, idx, entry, bInBackground);
1606      } catch (Exception e) {      } catch (Exception e) {
1607          result.Error(e);          result.Error(e);
# Line 1686  String LSCPServer::ListMidiInstrumentMap Line 1712  String LSCPServer::ListMidiInstrumentMap
1712          for (; iter != mappings.end(); iter++) {          for (; iter != mappings.end(); iter++) {
1713              if (s.size()) s += ",";              if (s.size()) s += ",";
1714              s += "{" + ToString(MidiMapID) + ","              s += "{" + ToString(MidiMapID) + ","
1715                       + 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)) + ","
1716                       + ToString(int(iter->first.midi_prog)) + "}";                       + ToString(int(iter->first.midi_prog)) + "}";
1717          }          }
1718          result.Add(s);          result.Add(s);
# Line 1708  String LSCPServer::ListAllMidiInstrument Line 1734  String LSCPServer::ListAllMidiInstrument
1734              for (; iter != mappings.end(); iter++) {              for (; iter != mappings.end(); iter++) {
1735                  if (s.size()) s += ",";                  if (s.size()) s += ",";
1736                  s += "{" + ToString(maps[i]) + ","                  s += "{" + ToString(maps[i]) + ","
1737                           + 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)) + ","
1738                           + ToString(int(iter->first.midi_prog)) + "}";                           + ToString(int(iter->first.midi_prog)) + "}";
1739              }              }
1740          }          }
# Line 1854  String LSCPServer::SetChannelMap(uint ui Line 1880  String LSCPServer::SetChannelMap(uint ui
1880      return result.Produce();      return result.Produce();
1881  }  }
1882    
1883    String LSCPServer::CreateFxSend(uint uiSamplerChannel, uint MidiCtrl, String Name) {
1884        dmsg(2,("LSCPServer: CreateFxSend()\n"));
1885        LSCPResultSet result;
1886        try {
1887            SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);
1888            if (!pSamplerChannel) throw Exception("Invalid sampler channel number " + ToString(uiSamplerChannel));
1889    
1890            EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel();
1891            if (!pEngineChannel) throw Exception("There is no engine deployed on this sampler channel yet");
1892    
1893            FxSend* pFxSend = pEngineChannel->AddFxSend(MidiCtrl, Name);
1894            if (!pFxSend) throw Exception("Could not add FxSend, don't ask, I don't know why (probably a bug)");
1895    
1896            result = LSCPResultSet(pFxSend->Id()); // success
1897        } catch (Exception e) {
1898            result.Error(e);
1899        }
1900        return result.Produce();
1901    }
1902    
1903    String LSCPServer::DestroyFxSend(uint uiSamplerChannel, uint FxSendID) {
1904        dmsg(2,("LSCPServer: DestroyFxSend()\n"));
1905        LSCPResultSet result;
1906        try {
1907            SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);
1908            if (!pSamplerChannel) throw Exception("Invalid sampler channel number " + ToString(uiSamplerChannel));
1909    
1910            EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel();
1911            if (!pEngineChannel) throw Exception("There is no engine deployed on this sampler channel yet");
1912    
1913            FxSend* pFxSend = NULL;
1914            for (int i = 0; i < pEngineChannel->GetFxSendCount(); i++) {
1915                if (pEngineChannel->GetFxSend(i)->Id() == FxSendID) {
1916                    pFxSend = pEngineChannel->GetFxSend(i);
1917                    break;
1918                }
1919            }
1920            if (!pFxSend) throw Exception("There is no FxSend with that ID on the given sampler channel");
1921            pEngineChannel->RemoveFxSend(pFxSend);
1922        } catch (Exception e) {
1923            result.Error(e);
1924        }
1925        return result.Produce();
1926    }
1927    
1928    String LSCPServer::GetFxSends(uint uiSamplerChannel) {
1929        dmsg(2,("LSCPServer: GetFxSends()\n"));
1930        LSCPResultSet result;
1931        try {
1932            SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);
1933            if (!pSamplerChannel) throw Exception("Invalid sampler channel number " + ToString(uiSamplerChannel));
1934    
1935            EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel();
1936            if (!pEngineChannel) throw Exception("There is no engine deployed on this sampler channel yet");
1937    
1938            result.Add(pEngineChannel->GetFxSendCount());
1939        } catch (Exception e) {
1940            result.Error(e);
1941        }
1942        return result.Produce();
1943    }
1944    
1945    String LSCPServer::ListFxSends(uint uiSamplerChannel) {
1946        dmsg(2,("LSCPServer: ListFxSends()\n"));
1947        LSCPResultSet result;
1948        String list;
1949        try {
1950            SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);
1951            if (!pSamplerChannel) throw Exception("Invalid sampler channel number " + ToString(uiSamplerChannel));
1952    
1953            EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel();
1954            if (!pEngineChannel) throw Exception("There is no engine deployed on this sampler channel yet");
1955    
1956            for (int i = 0; i < pEngineChannel->GetFxSendCount(); i++) {
1957                FxSend* pFxSend = pEngineChannel->GetFxSend(i);
1958                if (list != "") list += ",";
1959                list += ToString(pFxSend->Id());
1960            }
1961            result.Add(list);
1962        } catch (Exception e) {
1963            result.Error(e);
1964        }
1965        return result.Produce();
1966    }
1967    
1968    String LSCPServer::GetFxSendInfo(uint uiSamplerChannel, uint FxSendID) {
1969        dmsg(2,("LSCPServer: GetFxSendInfo()\n"));
1970        LSCPResultSet result;
1971        try {
1972            SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);
1973            if (!pSamplerChannel) throw Exception("Invalid sampler channel number " + ToString(uiSamplerChannel));
1974    
1975            EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel();
1976            if (!pEngineChannel) throw Exception("There is no engine deployed on this sampler channel yet");
1977    
1978            FxSend* pFxSend = NULL;
1979            for (int i = 0; i < pEngineChannel->GetFxSendCount(); i++) {
1980                if (pEngineChannel->GetFxSend(i)->Id() == FxSendID) {
1981                    pFxSend = pEngineChannel->GetFxSend(i);
1982                    break;
1983                }
1984            }
1985            if (!pFxSend) throw Exception("There is no FxSend with that ID on the given sampler channel");
1986    
1987            // gather audio routing informations
1988            String AudioRouting;
1989            for (int chan = 0; chan < pEngineChannel->Channels(); chan++) {
1990                if (AudioRouting != "") AudioRouting += ",";
1991                AudioRouting += ToString(pFxSend->DestinationChannel(chan));
1992            }
1993    
1994            // success
1995            result.Add("NAME", pFxSend->Name());
1996            result.Add("MIDI_CONTROLLER", pFxSend->MidiController());
1997            result.Add("LEVEL", ToString(pFxSend->Level()));
1998            result.Add("AUDIO_OUTPUT_ROUTING", AudioRouting);
1999        } catch (Exception e) {
2000            result.Error(e);
2001        }
2002        return result.Produce();
2003    }
2004    
2005    String LSCPServer::SetFxSendAudioOutputChannel(uint uiSamplerChannel, uint FxSendID, uint FxSendChannel, uint DeviceChannel) {
2006        dmsg(2,("LSCPServer: SetFxSendAudioOutputChannel()\n"));
2007        LSCPResultSet result;
2008        try {
2009            SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);
2010            if (!pSamplerChannel) throw Exception("Invalid sampler channel number " + ToString(uiSamplerChannel));
2011    
2012            EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel();
2013            if (!pEngineChannel) throw Exception("There is no engine deployed on this sampler channel yet");
2014    
2015            FxSend* pFxSend = NULL;
2016            for (int i = 0; i < pEngineChannel->GetFxSendCount(); i++) {
2017                if (pEngineChannel->GetFxSend(i)->Id() == FxSendID) {
2018                    pFxSend = pEngineChannel->GetFxSend(i);
2019                    break;
2020                }
2021            }
2022            if (!pFxSend) throw Exception("There is no FxSend with that ID on the given sampler channel");
2023    
2024            pFxSend->SetDestinationChannel(FxSendChannel, DeviceChannel);
2025            LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_fx_send_info, uiSamplerChannel, FxSendID));
2026        } catch (Exception e) {
2027            result.Error(e);
2028        }
2029        return result.Produce();
2030    }
2031    
2032    String LSCPServer::SetFxSendMidiController(uint uiSamplerChannel, uint FxSendID, uint MidiController) {
2033        dmsg(2,("LSCPServer: SetFxSendMidiController()\n"));
2034        LSCPResultSet result;
2035        try {
2036            SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);
2037            if (!pSamplerChannel) throw Exception("Invalid sampler channel number " + ToString(uiSamplerChannel));
2038    
2039            EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel();
2040            if (!pEngineChannel) throw Exception("There is no engine deployed on this sampler channel yet");
2041    
2042            FxSend* pFxSend = NULL;
2043            for (int i = 0; i < pEngineChannel->GetFxSendCount(); i++) {
2044                if (pEngineChannel->GetFxSend(i)->Id() == FxSendID) {
2045                    pFxSend = pEngineChannel->GetFxSend(i);
2046                    break;
2047                }
2048            }
2049            if (!pFxSend) throw Exception("There is no FxSend with that ID on the given sampler channel");
2050    
2051            pFxSend->SetMidiController(MidiController);
2052            LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_fx_send_info, uiSamplerChannel, FxSendID));
2053        } catch (Exception e) {
2054            result.Error(e);
2055        }
2056        return result.Produce();
2057    }
2058    
2059    String LSCPServer::SetFxSendLevel(uint uiSamplerChannel, uint FxSendID, double dLevel) {
2060        dmsg(2,("LSCPServer: SetFxSendLevel()\n"));
2061        LSCPResultSet result;
2062        try {
2063            SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);
2064            if (!pSamplerChannel) throw Exception("Invalid sampler channel number " + ToString(uiSamplerChannel));
2065    
2066            EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel();
2067            if (!pEngineChannel) throw Exception("There is no engine deployed on this sampler channel yet");
2068    
2069            FxSend* pFxSend = NULL;
2070            for (int i = 0; i < pEngineChannel->GetFxSendCount(); i++) {
2071                if (pEngineChannel->GetFxSend(i)->Id() == FxSendID) {
2072                    pFxSend = pEngineChannel->GetFxSend(i);
2073                    break;
2074                }
2075            }
2076            if (!pFxSend) throw Exception("There is no FxSend with that ID on the given sampler channel");
2077    
2078            pFxSend->SetLevel((float)dLevel);
2079            LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_fx_send_info, uiSamplerChannel, FxSendID));
2080        } catch (Exception e) {
2081            result.Error(e);
2082        }
2083        return result.Produce();
2084    }
2085    
2086  /**  /**
2087   * Will be called by the parser to reset a particular sampler channel.   * Will be called by the parser to reset a particular sampler channel.
2088   */   */
# Line 1916  String LSCPServer::GetTotalVoiceCountMax Line 2145  String LSCPServer::GetTotalVoiceCountMax
2145      return result.Produce();      return result.Produce();
2146  }  }
2147    
2148    String LSCPServer::GetGlobalVolume() {
2149        LSCPResultSet result;
2150        result.Add(ToString(GLOBAL_VOLUME)); // see common/global.cpp
2151        return result.Produce();
2152    }
2153    
2154    String LSCPServer::SetGlobalVolume(double dVolume) {
2155        LSCPResultSet result;
2156        try {
2157            if (dVolume < 0) throw Exception("Volume may not be negative");
2158            GLOBAL_VOLUME = dVolume; // see common/global.cpp
2159            LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_global_info, "VOLUME", GLOBAL_VOLUME));
2160        } catch (Exception e) {
2161            result.Error(e);
2162        }
2163        return result.Produce();
2164    }
2165    
2166  /**  /**
2167   * 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
2168   * server for receiving event messages.   * server for receiving event messages.

Legend:
Removed from v.973  
changed lines
  Added in v.1108

  ViewVC Help
Powered by ViewVC