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 - 2008 Christian Schoenebeck * |
* Copyright (C) 2005 - 2014 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 * |
79 |
LSCPServer(Sampler* pSampler, long int addr, short int port); |
LSCPServer(Sampler* pSampler, long int addr, short int port); |
80 |
virtual ~LSCPServer(); |
virtual ~LSCPServer(); |
81 |
int WaitUntilInitialized(long TimeoutSeconds = 0L, long TimeoutNanoSeconds = 0L); |
int WaitUntilInitialized(long TimeoutSeconds = 0L, long TimeoutNanoSeconds = 0L); |
82 |
|
void RemoveListeners(); |
83 |
|
|
84 |
// Methods called by the parser |
// Methods called by the parser |
85 |
String DestroyAudioOutputDevice(uint DeviceIndex); |
String DestroyAudioOutputDevice(uint DeviceIndex); |
132 |
String SetAudioOutputChannel(uint ChannelAudioOutputChannel, uint AudioOutputDeviceInputChannel, uint uiSamplerChannel); |
String SetAudioOutputChannel(uint ChannelAudioOutputChannel, uint AudioOutputDeviceInputChannel, uint uiSamplerChannel); |
133 |
String SetAudioOutputDevice(uint AudioDeviceId, uint SamplerChannel); |
String SetAudioOutputDevice(uint AudioDeviceId, uint SamplerChannel); |
134 |
String SetAudioOutputType(String AudioOutputDriver, uint uiSamplerChannel); |
String SetAudioOutputType(String AudioOutputDriver, uint uiSamplerChannel); |
135 |
|
String AddChannelMidiInput(uint uiSamplerChannel, uint MIDIDeviceId, uint MIDIPort = 0); |
136 |
|
String RemoveChannelMidiInput(uint uiSamplerChannel); |
137 |
|
String RemoveChannelMidiInput(uint uiSamplerChannel, uint MIDIDeviceId); |
138 |
|
String RemoveChannelMidiInput(uint uiSamplerChannel, uint MIDIDeviceId, uint MIDIPort); |
139 |
|
String ListChannelMidiInputs(uint uiSamplerChannel); |
140 |
String SetMIDIInputPort(uint MIDIPort, uint uiSamplerChannel); |
String SetMIDIInputPort(uint MIDIPort, uint uiSamplerChannel); |
141 |
String SetMIDIInputChannel(uint MIDIChannel, uint uiSamplerChannel); |
String SetMIDIInputChannel(uint MIDIChannel, uint uiSamplerChannel); |
142 |
String SetMIDIInputDevice(uint MIDIDeviceId, uint uiSamplerChannel); |
String SetMIDIInputDevice(uint MIDIDeviceId, uint uiSamplerChannel); |
171 |
String SetFxSendAudioOutputChannel(uint uiSamplerChannel, uint FxSendID, uint FxSendChannel, uint DeviceChannel); |
String SetFxSendAudioOutputChannel(uint uiSamplerChannel, uint FxSendID, uint FxSendChannel, uint DeviceChannel); |
172 |
String SetFxSendMidiController(uint uiSamplerChannel, uint FxSendID, uint MidiController); |
String SetFxSendMidiController(uint uiSamplerChannel, uint FxSendID, uint MidiController); |
173 |
String SetFxSendLevel(uint uiSamplerChannel, uint FxSendID, double dLevel); |
String SetFxSendLevel(uint uiSamplerChannel, uint FxSendID, double dLevel); |
174 |
|
String SetFxSendEffect(uint uiSamplerChannel, uint FxSendID, int iSendEffectChain, int iEffectChainPosition); |
175 |
|
|
176 |
|
// effect commands |
177 |
|
String GetAvailableEffects(); |
178 |
|
String ListAvailableEffects(); |
179 |
|
String GetEffectInfo(int iEffectIndex); |
180 |
|
String CreateEffectInstance(int iEffectIndex); |
181 |
|
String CreateEffectInstance(String effectSystem, String module, String effectName); |
182 |
|
String DestroyEffectInstance(int iEffectInstance); |
183 |
|
String GetEffectInstances(); |
184 |
|
String ListEffectInstances(); |
185 |
|
String GetEffectInstanceInfo(int iEffectInstance); |
186 |
|
String GetEffectInstanceInputControlInfo(int iEffectInstance, int iInputControlIndex); |
187 |
|
String SetEffectInstanceInputControlValue(int iEffectInstance, int iInputControlIndex, double dValue); |
188 |
|
String GetSendEffectChains(int iAudioOutputDevice); |
189 |
|
String ListSendEffectChains(int iAudioOutputDevice); |
190 |
|
String AddSendEffectChain(int iAudioOutputDevice); |
191 |
|
String RemoveSendEffectChain(int iAudioOutputDevice, int iSendEffectChain); |
192 |
|
String GetSendEffectChainInfo(int iAudioOutputDevice, int iSendEffectChain); |
193 |
|
String AppendSendEffectChainEffect(int iAudioOutputDevice, int iSendEffectChain, int iEffectInstance); |
194 |
|
String InsertSendEffectChainEffect(int iAudioOutputDevice, int iSendEffectChain, int iEffectChainPosition, int iEffectInstance); |
195 |
|
String RemoveSendEffectChainEffect(int iAudioOutputDevice, int iSendEffectChain, int iEffectChainPosition); |
196 |
|
|
197 |
String AddDbInstrumentDirectory(String Dir); |
String AddDbInstrumentDirectory(String Dir); |
198 |
String RemoveDbInstrumentDirectory(String Dir, bool Force = false); |
String RemoveDbInstrumentDirectory(String Dir, bool Force = false); |
199 |
String GetDbInstrumentDirectoryCount(String Dir, bool Recursive = false); |
String GetDbInstrumentDirectoryCount(String Dir, bool Recursive = false); |
205 |
String SetDbInstrumentDirectoryDescription(String Dir, String Desc); |
String SetDbInstrumentDirectoryDescription(String Dir, String Desc); |
206 |
String FindDbInstrumentDirectories(String Dir, std::map<String,String> Parameters, bool Recursive = true); |
String FindDbInstrumentDirectories(String Dir, std::map<String,String> Parameters, bool Recursive = true); |
207 |
String AddDbInstruments(String DbDir, String FilePath, int Index = -1, bool bBackground = false); |
String AddDbInstruments(String DbDir, String FilePath, int Index = -1, bool bBackground = false); |
208 |
String AddDbInstruments(String ScanMode, String DbDir, String FsDir, bool bBackground = false); |
String AddDbInstruments(String ScanMode, String DbDir, String FsDir, bool bBackground = false, bool insDir = false); |
209 |
String RemoveDbInstrument(String Instr); |
String RemoveDbInstrument(String Instr); |
210 |
String GetDbInstrumentCount(String Dir, bool Recursive = false); |
String GetDbInstrumentCount(String Dir, bool Recursive = false); |
211 |
String GetDbInstruments(String Dir, bool Recursive = false); |
String GetDbInstruments(String Dir, bool Recursive = false); |
226 |
String GetTotalStreamCount(); |
String GetTotalStreamCount(); |
227 |
String GetTotalVoiceCount(); |
String GetTotalVoiceCount(); |
228 |
String GetTotalVoiceCountMax(); |
String GetTotalVoiceCountMax(); |
229 |
|
String GetGlobalMaxVoices(); |
230 |
|
String SetGlobalMaxVoices(int iVoices); |
231 |
|
String GetGlobalMaxStreams(); |
232 |
|
String SetGlobalMaxStreams(int iStreams); |
233 |
String GetGlobalVolume(); |
String GetGlobalVolume(); |
234 |
String SetGlobalVolume(double dVolume); |
String SetGlobalVolume(double dVolume); |
235 |
String GetFileInstruments(String Filename); |
String GetFileInstruments(String Filename); |
236 |
String ListFileInstruments(String Filename); |
String ListFileInstruments(String Filename); |
237 |
String GetFileInstrumentInfo(String Filename, uint InstrumentID); |
String GetFileInstrumentInfo(String Filename, uint InstrumentID); |
238 |
|
String SendChannelMidiData(String MidiMsg, uint uiSamplerChannel, uint Arg1, uint Arg2); |
239 |
String SubscribeNotification(LSCPEvent::event_t); |
String SubscribeNotification(LSCPEvent::event_t); |
240 |
String UnsubscribeNotification(LSCPEvent::event_t); |
String UnsubscribeNotification(LSCPEvent::event_t); |
241 |
String SetEcho(yyparse_param_t* pSession, double boolean_value); |
String SetEcho(yyparse_param_t* pSession, double boolean_value); |
242 |
void AnswerClient(String ReturnMessage); |
void AnswerClient(String ReturnMessage); |
243 |
|
void CloseAllConnections(); |
244 |
|
|
245 |
static int currentSocket; |
static int currentSocket; |
246 |
static std::map<int,String> bufferedCommands; |
static std::map<int,String> bufferedCommands; |
247 |
|
|
248 |
static void SendLSCPNotify( LSCPEvent Event ); |
static void SendLSCPNotify( LSCPEvent Event ); |
249 |
static int EventSubscribers( std::list<LSCPEvent::event_t> events ); |
static int EventSubscribers( std::list<LSCPEvent::event_t> events ); |
250 |
static void LockRTNotify(); |
static String FilterEndlines(String s); |
251 |
static void UnlockRTNotify(); |
|
252 |
static String FilterEndlines(String s); |
//Protect main thread that generates real time notify messages |
253 |
|
//like voice count, stream count and buffer fill |
254 |
|
//from LSCP server removing engines and channels from underneath |
255 |
|
static Mutex RTNotifyMutex; |
256 |
|
|
257 |
protected: |
protected: |
258 |
int hSocket; |
int hSocket; |
301 |
static std::map< LSCPEvent::event_t, std::list<int> > eventSubscriptions; |
static std::map< LSCPEvent::event_t, std::list<int> > eventSubscriptions; |
302 |
static fd_set fdSet; |
static fd_set fdSet; |
303 |
|
|
|
//Protect main thread that generates real time notify messages |
|
|
//like voice count, stream count and buffer fill |
|
|
//from LSCP server removing engines and channels from underneath |
|
|
static Mutex RTNotifyMutex; |
|
|
|
|
304 |
class EventHandler : public ChannelCountListener, public AudioDeviceCountListener, |
class EventHandler : public ChannelCountListener, public AudioDeviceCountListener, |
305 |
public MidiDeviceCountListener, public MidiInstrumentCountListener, |
public MidiDeviceCountListener, public MidiInstrumentCountListener, |
306 |
public MidiInstrumentInfoListener, public MidiInstrumentMapCountListener, |
public MidiInstrumentInfoListener, public MidiInstrumentMapCountListener, |