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(); |
virtual ~LSCPServer(); |
70 |
int WaitUntilInitialized(long TimeoutSeconds = 0L, long TimeoutNanoSeconds = 0L); |
int WaitUntilInitialized(long TimeoutSeconds = 0L, long TimeoutNanoSeconds = 0L); |
71 |
|
|
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 MidiBankMSB, uint MidiBankLSB, uint MidiProg, String EngineType, String InstrumentFile, uint InstrumentIndex, float Volume, MidiInstrumentMapper::mode_t LoadMode, String Name); |
132 |
|
String RemoveMIDIInstrumentMapping(uint MidiBankMSB, uint MidiBankLSB, uint MidiProg); |
133 |
|
String GetMidiIstrumentMappings(); |
134 |
|
String GetMidiInstrumentMapping(uint MidiBankMSB, uint MidiBankLSB, uint MidiProg); |
135 |
|
String ListMidiInstrumentMappings(); |
136 |
|
String ClearMidiInstrumentMappings(); |
137 |
String ResetChannel(uint uiSamplerChannel); |
String ResetChannel(uint uiSamplerChannel); |
138 |
String ResetSampler(); |
String ResetSampler(); |
139 |
|
String GetServerInfo(); |
140 |
|
String GetTotalVoiceCount(); |
141 |
|
String GetTotalVoiceCountMax(); |
142 |
String SubscribeNotification(LSCPEvent::event_t); |
String SubscribeNotification(LSCPEvent::event_t); |
143 |
String UnsubscribeNotification(LSCPEvent::event_t); |
String UnsubscribeNotification(LSCPEvent::event_t); |
144 |
String QueryDatabase(String query); |
String QueryDatabase(String query); |
158 |
sockaddr_in SocketAddress; |
sockaddr_in SocketAddress; |
159 |
Sampler* pSampler; |
Sampler* pSampler; |
160 |
Condition Initialized; |
Condition Initialized; |
|
LSCPInstrumentLoader InstrumentLoader; ///< thread responsible for loading instruments in the background |
|
161 |
|
|
162 |
int Main(); ///< Implementation of virtual method from class Thread |
int Main(); ///< Implementation of virtual method from class Thread |
163 |
|
|
173 |
*/ |
*/ |
174 |
int GetMidiInputDeviceIndex (MidiInputDevice *pDevice); |
int GetMidiInputDeviceIndex (MidiInputDevice *pDevice); |
175 |
|
|
176 |
|
bool HasSoloChannel(); |
177 |
|
void MuteNonSoloChannels(); |
178 |
|
void UnmuteChannels(); |
179 |
|
|
180 |
static std::map<int,String> bufferedNotifies; |
static std::map<int,String> bufferedNotifies; |
181 |
static Mutex NotifyMutex; |
static Mutex NotifyMutex; |
182 |
static Mutex NotifyBufferMutex; |
static Mutex NotifyBufferMutex; |