13
0

probe buffersize if jackd is already running.

This commit is contained in:
Robin Gareus 2015-06-14 18:10:31 +02:00
parent b86a8edcff
commit 573ec69a9a
3 changed files with 11 additions and 2 deletions

View File

@ -362,7 +362,7 @@ JACKAudioBackend::sample_rate () const
if (available()) {
return _current_sample_rate;
} else {
return 0;
return _jack_connection->probed_sample_rate ();
}
}
return _target_sample_rate;
@ -375,7 +375,7 @@ JACKAudioBackend::buffer_size () const
if (available()) {
return _current_buffer_size;
} else {
return 0;
return _jack_connection->probed_buffer_size ();
}
}
return _target_buffer_size;

View File

@ -56,6 +56,8 @@ JackConnection::JackConnection (const std::string& arg1, const std::string& arg2
: _jack (0)
, _client_name (arg1)
, session_uuid (arg2)
, _probed_buffer_size (0)
, _probed_sample_rate (0)
{
/* See if the server is already up
*/
@ -77,6 +79,8 @@ JackConnection::JackConnection (const std::string& arg1, const std::string& arg2
jack_client_t* c = jack_client_open ("ardourprobe", JackNoStartServer, &status);
if (status == 0) {
_probed_buffer_size = jack_get_buffer_size(c);
_probed_sample_rate = jack_get_sample_rate(c);
jack_client_close (c);
_in_control = false;
} else {

View File

@ -29,11 +29,16 @@ class JackConnection {
static bool in_control() { return _in_control; }
uint32_t probed_buffer_size () const { assert (!connected ()); return _probed_buffer_size; }
uint32_t probed_sample_rate () const { assert (!connected ()); return _probed_sample_rate; }
private:
jack_client_t* volatile _jack;
std::string _client_name;
std::string session_uuid;
static bool _in_control;
uint32_t _probed_buffer_size; // when not in control
uint32_t _probed_sample_rate; // when not in control
};
} // namespace