40 |
#endif |
#endif |
41 |
|
|
42 |
namespace LinuxSampler { |
namespace LinuxSampler { |
43 |
|
|
44 |
|
class JackClient; |
45 |
|
class JackListener; |
46 |
|
|
47 |
/** JACK audio output driver |
/** JACK audio output driver |
48 |
* |
* |
136 |
|
|
137 |
int Process(uint Samples); // FIXME: should be private |
int Process(uint Samples); // FIXME: should be private |
138 |
void UpdateJackBuffers(uint size); |
void UpdateJackBuffers(uint size); |
139 |
|
void addListener(JackListener* listener); |
140 |
|
jack_client_t* jackClientHandle(); |
141 |
protected: |
protected: |
142 |
AudioOutputDeviceJack(String* AutoConnectPortIDs = NULL, uint AutoConnectPorts = 0); |
AudioOutputDeviceJack(String* AutoConnectPortIDs = NULL, uint AutoConnectPorts = 0); |
143 |
private: |
private: |
144 |
ConditionServer csIsPlaying; |
ConditionServer csIsPlaying; |
145 |
uint uiMaxSamplesPerCycle; |
uint uiMaxSamplesPerCycle; |
146 |
jack_client_t* hJackClient; |
jack_client_t* hJackClient; |
147 |
|
JackClient* pJackClient; |
148 |
}; |
}; |
149 |
|
|
150 |
// Callback functions for the libjack API |
// Callback functions for the libjack API |
151 |
int linuxsampler_libjack_process_callback(jack_nframes_t nframes, void* arg); |
int linuxsampler_libjack_process_callback(jack_nframes_t nframes, void* arg); |
|
void linuxsampler_libjack_shutdown_callback(void* arg); |
|
|
|
|
152 |
|
|
153 |
/** JACK client |
/** JACK client |
154 |
* |
* |
170 |
#if HAVE_JACK_MIDI |
#if HAVE_JACK_MIDI |
171 |
void SetMidiInputDevice(MidiInputDeviceJack* device); |
void SetMidiInputDevice(MidiInputDeviceJack* device); |
172 |
#endif |
#endif |
173 |
|
void addListener(JackListener* listener); |
174 |
|
|
175 |
jack_client_t* hJackClient; |
jack_client_t* hJackClient; |
176 |
|
|
177 |
private: |
private: |
178 |
|
std::vector<JackListener*> jackListeners; |
179 |
static std::map<String, JackClient*> Clients; |
static std::map<String, JackClient*> Clients; |
180 |
struct config_t { |
struct config_t { |
181 |
AudioOutputDeviceJack* AudioDevice; |
AudioOutputDeviceJack* AudioDevice; |
192 |
~JackClient(); |
~JackClient(); |
193 |
|
|
194 |
// Callback functions for the libjack API |
// Callback functions for the libjack API |
195 |
|
static void libjackShutdownCallback(void* arg); |
196 |
static int libjackSampleRateCallback(jack_nframes_t nframes, void *arg); |
static int libjackSampleRateCallback(jack_nframes_t nframes, void *arg); |
197 |
static int libjackBufferSizeCallback(jack_nframes_t nframes, void *arg); |
static int libjackBufferSizeCallback(jack_nframes_t nframes, void *arg); |
198 |
}; |
}; |
199 |
|
|
200 |
|
/** |
201 |
|
* Currently not derived / instantiated by the sampler itself, however this |
202 |
|
* class can be subclassed and used i.e. by a GUI build on top of the sampler, |
203 |
|
* to react on JACK events. Because registering JACK callback functions through |
204 |
|
* the general JACK API is not possible after the JACK client has been activated, |
205 |
|
* and the latter is already the case as soon as an AudioOutputDeviceJack object |
206 |
|
* has been instantiated. |
207 |
|
*/ |
208 |
|
class JackListener { |
209 |
|
public: |
210 |
|
virtual void onJackShutdown() = 0; |
211 |
|
}; |
212 |
} |
} |
213 |
|
|
214 |
#endif // HAVE_JACK |
#endif // HAVE_JACK |