Merge branch 'master' into windows

This commit is contained in:
Paul Davis 2013-09-17 21:22:56 -04:00
commit 302b08c059
13 changed files with 525 additions and 213 deletions

View file

@ -57,8 +57,8 @@ JACKAudioBackend::JACKAudioBackend (AudioEngine& e, boost::shared_ptr<JackConnec
, _target_buffer_size (1024)
, _target_sample_format (FormatFloat)
, _target_interleaved (false)
, _target_input_channels (-1)
, _target_output_channels (-1)
, _target_input_channels (0)
, _target_output_channels (0)
, _target_systemic_input_latency (0)
, _target_systemic_output_latency (0)
, _current_sample_rate (0)
@ -292,7 +292,10 @@ int
JACKAudioBackend::set_input_channels (uint32_t cnt)
{
if (available()) {
return -1;
if (cnt != 0) {
/* can't set a real value for this while JACK runs */
return -1;
}
}
_target_input_channels = cnt;
@ -304,7 +307,10 @@ int
JACKAudioBackend::set_output_channels (uint32_t cnt)
{
if (available()) {
return -1;
if (cnt != 0) {
/* can't set a real value for this while JACK runs */
return -1;
}
}
_target_output_channels = cnt;
@ -316,6 +322,7 @@ int
JACKAudioBackend::set_systemic_input_latency (uint32_t l)
{
if (available()) {
/* can't do this while JACK runs */
return -1;
}
@ -328,6 +335,7 @@ int
JACKAudioBackend::set_systemic_output_latency (uint32_t l)
{
if (available()) {
/* can't do this while JACK runs */
return -1;
}
@ -341,18 +349,34 @@ JACKAudioBackend::set_systemic_output_latency (uint32_t l)
std::string
JACKAudioBackend::device_name () const
{
if (available()) {
return "???";
if (!_jack_connection->in_control()) {
return "???"; // JACK has no way (as of fall 2013) to return
// the device name
}
return _target_device;
}
std::string
JACKAudioBackend::driver_name() const
{
if (!_jack_connection->in_control()) {
return "???"; // JACK has no way (as of fall 2013) to return
// the driver name
}
return _target_driver;
}
float
JACKAudioBackend::sample_rate () const
{
if (available()) {
return _current_sample_rate;
if (!_jack_connection->in_control()) {
if (available()) {
return _current_sample_rate;
} else {
return 0;
}
}
return _target_sample_rate;
}
@ -360,8 +384,12 @@ JACKAudioBackend::sample_rate () const
uint32_t
JACKAudioBackend::buffer_size () const
{
if (available()) {
return _current_buffer_size;
if (!_jack_connection->in_control()) {
if (available()) {
return _current_buffer_size;
} else {
return 0;
}
}
return _target_buffer_size;
}
@ -381,19 +409,37 @@ JACKAudioBackend::interleaved () const
uint32_t
JACKAudioBackend::input_channels () const
{
if (available()) {
return n_physical (JackPortIsInput).n_audio();
}
return _target_input_channels;
if (!_jack_connection->in_control()) {
if (available()) {
return n_physical (JackPortIsInput).n_audio();
} else {
return 0;
}
} else {
if (available()) {
return n_physical (JackPortIsInput).n_audio();
} else {
return _target_input_channels;
}
}
}
uint32_t
JACKAudioBackend::output_channels () const
{
if (available()) {
return n_physical (JackPortIsOutput).n_audio();
}
return _target_output_channels;
if (!_jack_connection->in_control()) {
if (available()) {
return n_physical (JackPortIsOutput).n_audio();
} else {
return 0;
}
} else {
if (available()) {
return n_physical (JackPortIsOutput).n_audio();
} else {
return _target_output_channels;
}
}
}
uint32_t

View file

@ -85,6 +85,7 @@ class JACKAudioBackend : public AudioBackend {
uint32_t output_channels () const;
uint32_t systemic_input_latency () const;
uint32_t systemic_output_latency () const;
std::string driver_name() const;
std::string control_app_name () const;
void launch_control_app ();

View file

@ -54,6 +54,7 @@ JackConnection::JackConnection (const std::string& arg1, const std::string& arg2
, _client_name (arg1)
, session_uuid (arg2)
{
_in_control = !server_running();
}
JackConnection::~JackConnection ()
@ -105,6 +106,19 @@ JackConnection::open ()
global_epa->restore ();
}
/* check to see if the server is already running so that we know if we
* are starting it.
*/
jack_client_t* c = jack_client_open ("ardourprobe", JackNoStartServer, &status);
if (status == 0) {
_in_control = false;
jack_client_close (c);
} else {
_in_control = true;
}
/* ensure that PATH or equivalent includes likely locations of the JACK
* server, in case the user's default does not.
*/

View file

@ -27,12 +27,15 @@ class JackConnection {
void halted_callback ();
void halted_info_callback (jack_status_t, const char*);
static bool server_running();
bool in_control() const { return _in_control; }
static bool server_running();
private:
jack_client_t* volatile _jack;
std::string _client_name;
std::string session_uuid;
bool _in_control;
};
} // namespace