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 Christian Schoenebeck * |
* Copyright (C) 2005, 2006 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 * |
40 |
#include "lscpparser.h" |
#include "lscpparser.h" |
41 |
#include "lscp.h" |
#include "lscp.h" |
42 |
#include "lscpevent.h" |
#include "lscpevent.h" |
|
#include "lscpinstrumentloader.h" |
|
43 |
#include "../Sampler.h" |
#include "../Sampler.h" |
44 |
#include "../common/Thread.h" |
#include "../common/Thread.h" |
45 |
#include "../common/Mutex.h" |
#include "../common/Mutex.h" |
46 |
#include "../common/Condition.h" |
#include "../common/Condition.h" |
47 |
|
|
48 |
|
#include "../drivers/midi/MidiInstrumentMapper.h" |
49 |
|
|
50 |
/// TCP Port on which the server should listen for connection requests. |
/// TCP Port on which the server should listen for connection requests. |
51 |
|
#define LSCP_ADDR INADDR_ANY |
52 |
#define LSCP_PORT 8888 |
#define LSCP_PORT 8888 |
53 |
|
|
54 |
/// try up to 3 minutes to bind server socket |
/// try up to 3 minutes to bind server socket |
65 |
*/ |
*/ |
66 |
class LSCPServer : public Thread { |
class LSCPServer : public Thread { |
67 |
public: |
public: |
68 |
LSCPServer(Sampler* pSampler); |
LSCPServer(Sampler* pSampler, long int addr, short int port); |
69 |
|
virtual ~LSCPServer(); |
70 |
int WaitUntilInitialized(long TimeoutSeconds = 0L, long TimeoutNanoSeconds = 0L); |
int WaitUntilInitialized(long TimeoutSeconds = 0L, long TimeoutNanoSeconds = 0L); |
71 |
|
|
72 |
// Methods called by the parser |
// Methods called by the parser |
73 |
String DestroyAudioOutputDevice(uint DeviceIndex); |
String DestroyAudioOutputDevice(uint DeviceIndex); |
74 |
String DestroyMidiInputDevice(uint DeviceIndex); |
String DestroyMidiInputDevice(uint DeviceIndex); |
75 |
String LoadInstrument(String Filename, uint uiInstrument, uint uiSamplerChannel, bool bBackground = false); |
String LoadInstrument(String Filename, uint uiInstrument, uint uiSamplerChannel, bool bBackground = false); |
76 |
String LoadEngine(String EngineName, uint uiSamplerChannel); |
String SetEngineType(String EngineName, uint uiSamplerChannel); |
77 |
String GetChannels(); |
String GetChannels(); |
78 |
String ListChannels(); |
String ListChannels(); |
79 |
String AddChannel(); |
String AddChannel(); |
80 |
String RemoveChannel(uint uiSamplerChannel); |
String RemoveChannel(uint uiSamplerChannel); |
81 |
String GetAvailableEngines(); |
String GetAvailableEngines(); |
82 |
|
String ListAvailableEngines(); |
83 |
String GetEngineInfo(String EngineName); |
String GetEngineInfo(String EngineName); |
84 |
String GetChannelInfo(uint uiSamplerChannel); |
String GetChannelInfo(uint uiSamplerChannel); |
85 |
String GetVoiceCount(uint uiSamplerChannel); |
String GetVoiceCount(uint uiSamplerChannel); |
86 |
String GetStreamCount(uint uiSamplerChannel); |
String GetStreamCount(uint uiSamplerChannel); |
87 |
String GetBufferFill(fill_response_t ResponseType, uint uiSamplerChannel); |
String GetBufferFill(fill_response_t ResponseType, uint uiSamplerChannel); |
88 |
String GetAvailableAudioOutputDrivers(); |
String GetAvailableAudioOutputDrivers(); |
89 |
|
String ListAvailableAudioOutputDrivers(); |
90 |
String GetAvailableMidiInputDrivers(); |
String GetAvailableMidiInputDrivers(); |
91 |
|
String ListAvailableMidiInputDrivers(); |
92 |
String GetAudioOutputDriverInfo(String Driver); |
String GetAudioOutputDriverInfo(String Driver); |
93 |
String GetMidiInputDriverInfo(String Driver); |
String GetMidiInputDriverInfo(String Driver); |
94 |
#ifdef __GNUC__ |
#ifdef __GNUC__ |
126 |
String SetMIDIInputType(String MidiInputDriver, uint uiSamplerChannel); |
String SetMIDIInputType(String MidiInputDriver, uint uiSamplerChannel); |
127 |
String SetMIDIInput(uint MIDIDeviceId, uint MIDIPort, uint MIDIChannel, uint uiSamplerChannel); |
String SetMIDIInput(uint MIDIDeviceId, uint MIDIPort, uint MIDIChannel, uint uiSamplerChannel); |
128 |
String SetVolume(double dVolume, uint uiSamplerChannel); |
String SetVolume(double dVolume, uint uiSamplerChannel); |
129 |
|
String SetChannelMute(bool bMute, uint uiSamplerChannel); |
130 |
|
String SetChannelSolo(bool bSolo, uint uiSamplerChannel); |
131 |
|
String AddOrReplaceMIDIInstrumentMapping(uint MidiMapID, uint MidiBank, uint MidiProg, String EngineType, String InstrumentFile, uint InstrumentIndex, float Volume, MidiInstrumentMapper::mode_t LoadMode, String Name); |
132 |
|
String RemoveMIDIInstrumentMapping(uint MidiMapID, uint MidiBank, uint MidiProg); |
133 |
|
String GetMidiInstrumentMappings(uint MidiMapID); |
134 |
|
String GetAllMidiInstrumentMappings(); |
135 |
|
String GetMidiInstrumentMapping(uint MidiMapID, uint MidiBank, uint MidiProg); |
136 |
|
String ListMidiInstrumentMappings(uint MidiMapID); |
137 |
|
String ListAllMidiInstrumentMappings(); |
138 |
|
String ClearMidiInstrumentMappings(uint MidiMapID); |
139 |
|
String ClearAllMidiInstrumentMappings(); |
140 |
|
String AddMidiInstrumentMap(String MapName = ""); |
141 |
|
String RemoveMidiInstrumentMap(uint MidiMapID); |
142 |
|
String RemoveAllMidiInstrumentMaps(); |
143 |
|
String GetMidiInstrumentMaps(); |
144 |
|
String ListMidiInstrumentMaps(); |
145 |
|
String GetMidiInstrumentMap(uint MidiMapID); |
146 |
|
String SetMidiInstrumentMapName(uint MidiMapID, String NewName); |
147 |
|
String SetChannelMap(uint uiSamplerChannel, int MidiMapID); |
148 |
|
String CreateFxSend(uint uiSamplerChannel, uint MidiCtrl, String Name = ""); |
149 |
|
String DestroyFxSend(uint uiSamplerChannel, uint FxSendID); |
150 |
|
String GetFxSends(uint uiSamplerChannel); |
151 |
|
String ListFxSends(uint uiSamplerChannel); |
152 |
|
String GetFxSendInfo(uint uiSamplerChannel, uint FxSendID); |
153 |
|
String SetFxSendAudioOutputChannel(uint uiSamplerChannel, uint FxSendID, uint FxSendChannel, uint DeviceChannel); |
154 |
String ResetChannel(uint uiSamplerChannel); |
String ResetChannel(uint uiSamplerChannel); |
155 |
String ResetSampler(); |
String ResetSampler(); |
156 |
|
String GetServerInfo(); |
157 |
|
String GetTotalVoiceCount(); |
158 |
|
String GetTotalVoiceCountMax(); |
159 |
String SubscribeNotification(LSCPEvent::event_t); |
String SubscribeNotification(LSCPEvent::event_t); |
160 |
String UnsubscribeNotification(LSCPEvent::event_t); |
String UnsubscribeNotification(LSCPEvent::event_t); |
161 |
String QueryDatabase(String query); |
String QueryDatabase(String query); |
175 |
sockaddr_in SocketAddress; |
sockaddr_in SocketAddress; |
176 |
Sampler* pSampler; |
Sampler* pSampler; |
177 |
Condition Initialized; |
Condition Initialized; |
|
LSCPInstrumentLoader InstrumentLoader; ///< thread responsible for loading instruments in the background |
|
178 |
|
|
179 |
int Main(); ///< Implementation of virtual method from class Thread |
int Main(); ///< Implementation of virtual method from class Thread |
180 |
|
|
190 |
*/ |
*/ |
191 |
int GetMidiInputDeviceIndex (MidiInputDevice *pDevice); |
int GetMidiInputDeviceIndex (MidiInputDevice *pDevice); |
192 |
|
|
193 |
|
bool HasSoloChannel(); |
194 |
|
void MuteNonSoloChannels(); |
195 |
|
void UnmuteChannels(); |
196 |
|
|
197 |
static std::map<int,String> bufferedNotifies; |
static std::map<int,String> bufferedNotifies; |
198 |
static Mutex NotifyMutex; |
static Mutex NotifyMutex; |
199 |
static Mutex NotifyBufferMutex; |
static Mutex NotifyBufferMutex; |