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 - 2007 Christian Schoenebeck * |
* Copyright (C) 2005 - 2008 Christian Schoenebeck * |
7 |
* * |
* * |
8 |
* This program is free software; you can redistribute it and/or modify * |
* This program 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 * |
34 |
|
|
35 |
#include "AudioOutputDevice.h" |
#include "AudioOutputDevice.h" |
36 |
#include "../../common/ConditionServer.h" |
#include "../../common/ConditionServer.h" |
37 |
|
#include "../midi/MidiInputDeviceJack.h" |
38 |
|
|
39 |
namespace LinuxSampler { |
namespace LinuxSampler { |
40 |
|
|
120 |
virtual AudioChannel* CreateChannel(uint ChannelNr); |
virtual AudioChannel* CreateChannel(uint ChannelNr); |
121 |
|
|
122 |
|
|
123 |
static String Name(); |
static String Name(); |
124 |
|
|
125 |
virtual String Driver(); |
virtual String Driver(); |
126 |
|
|
137 |
}; |
}; |
138 |
|
|
139 |
// Callback functions for the libjack API |
// Callback functions for the libjack API |
140 |
int __libjack_process_callback(jack_nframes_t nframes, void* arg); |
int linuxsampler_libjack_process_callback(jack_nframes_t nframes, void* arg); |
141 |
void __libjack_shutdown_callback(void* arg); |
void linuxsampler_libjack_shutdown_callback(void* arg); |
142 |
|
|
143 |
|
|
144 |
|
/** JACK client |
145 |
|
* |
146 |
|
* Represents a jack client. This class is shared by |
147 |
|
* AudioOutputDeviceJack and MidiInputDeviceJack. The jack server |
148 |
|
* calls JackClient::Process, which in turn calls |
149 |
|
* AudioOutputDeviceJack::Process and/or |
150 |
|
* MidiInputDeviceJack::Process. |
151 |
|
*/ |
152 |
|
class JackClient { |
153 |
|
public: |
154 |
|
static JackClient* CreateAudio(String Name); |
155 |
|
static JackClient* CreateMidi(String Name); |
156 |
|
static void ReleaseAudio(String Name); |
157 |
|
static void ReleaseMidi(String Name); |
158 |
|
int Process(uint Samples); |
159 |
|
void Stop(); |
160 |
|
void SetAudioOutputDevice(AudioOutputDeviceJack* device); |
161 |
|
void SetMidiInputDevice(MidiInputDeviceJack* device); |
162 |
|
|
163 |
|
jack_client_t* hJackClient; |
164 |
|
|
165 |
|
private: |
166 |
|
static std::map<String, JackClient*> Clients; |
167 |
|
struct config_t { |
168 |
|
AudioOutputDeviceJack* AudioDevice; |
169 |
|
MidiInputDeviceJack* MidiDevice; |
170 |
|
}; |
171 |
|
SynchronizedConfig<config_t> Config; |
172 |
|
SynchronizedConfig<config_t>::Reader ConfigReader; |
173 |
|
bool audio; |
174 |
|
bool midi; |
175 |
|
|
176 |
|
JackClient(String Name); |
177 |
|
~JackClient(); |
178 |
|
}; |
179 |
} |
} |
180 |
|
|
181 |
#endif // HAVE_JACK |
#endif // HAVE_JACK |