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 - 2013 Christian Schoenebeck * |
* Copyright (C) 2005 - 2014 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 * |
172 |
} |
} |
173 |
|
|
174 |
|
|
175 |
|
|
176 |
|
// *************** AudioOutputDeviceJack::ParameterSampleRate *************** |
177 |
|
// * |
178 |
|
|
179 |
|
AudioOutputDeviceJack::ParameterSampleRate::ParameterSampleRate() : AudioOutputDevice::ParameterSampleRate() { |
180 |
|
} |
181 |
|
|
182 |
|
AudioOutputDeviceJack::ParameterSampleRate::ParameterSampleRate(String s) : AudioOutputDevice::ParameterSampleRate(s) { |
183 |
|
} |
184 |
|
|
185 |
|
optional<int> AudioOutputDeviceJack::ParameterSampleRate::DefaultAsInt(std::map<String,String> Parameters) { |
186 |
|
static int i = 0; |
187 |
|
// arbitrary JACK client name, that shall not clash with other ones |
188 |
|
String name = "LinSmPSR" + ToString(i++); |
189 |
|
#if HAVE_JACK_CLIENT_OPEN |
190 |
|
jack_client_t* hClient = jack_client_open(name.c_str(), JackNullOption, NULL); |
191 |
|
#else |
192 |
|
jack_client_t* hClient = jack_client_new(name.c_str()); |
193 |
|
#endif |
194 |
|
// Better return "nothing" instead of i.e. 44100 here, so a frontend |
195 |
|
// like QSampler will not be tempted to pass SAMPLERATE as creation |
196 |
|
// parameter when creating a new JACK audio device instance. |
197 |
|
if (!hClient) return optional<int>::nothing; |
198 |
|
int sampleRate = jack_get_sample_rate(hClient); |
199 |
|
jack_client_close(hClient); |
200 |
|
return sampleRate; |
201 |
|
} |
202 |
|
|
203 |
|
void AudioOutputDeviceJack::ParameterSampleRate::OnSetValue(int i) throw (Exception) { |
204 |
|
// nothing to do: the JACK API does currently not allow JACK clients to |
205 |
|
// change the sample rate |
206 |
|
} |
207 |
|
|
208 |
|
|
209 |
|
|
210 |
// *************** AudioOutputDeviceJack *************** |
// *************** AudioOutputDeviceJack *************** |
211 |
// * |
// * |