From a228643e402d8f1fb07da88eba960ec368e23dda Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 9 Sep 2013 13:27:48 -0400 Subject: add can_change_{sample_rate,buffer_size}_while_running() methods to an AudioBackend Allows the GUI and other stuff to know whether or not changing the SR/bufsize is possible while running, which is about to become useful --- libs/ardour/ardour/audio_backend.h | 11 +++++++++++ libs/backends/jack/jack_audiobackend.cc | 12 ++++++++++++ libs/backends/jack/jack_audiobackend.h | 3 +++ 3 files changed, 26 insertions(+) diff --git a/libs/ardour/ardour/audio_backend.h b/libs/ardour/ardour/audio_backend.h index 77b7eadb48..4192f0ea8b 100644 --- a/libs/ardour/ardour/audio_backend.h +++ b/libs/ardour/ardour/audio_backend.h @@ -147,6 +147,17 @@ class AudioBackend { */ virtual uint32_t available_output_channel_count (const std::string& device) const = 0; + /* Return true if the derived class can change the sample rate of the + * device in use while the device is already being used. Return false + * otherwise. (example: JACK cannot do this as of September 2013) + */ + virtual bool can_change_sample_rate_when_running () const = 0; + /* Return true if the derived class can change the buffer size of the + * device in use while the device is already being used. Return false + * otherwise. + */ + virtual bool can_change_buffer_size_when_running () const = 0; + /* Set the hardware parameters. * * If called when the current state is stopped or paused, diff --git a/libs/backends/jack/jack_audiobackend.cc b/libs/backends/jack/jack_audiobackend.cc index 22e5a525ea..f452a78d49 100644 --- a/libs/backends/jack/jack_audiobackend.cc +++ b/libs/backends/jack/jack_audiobackend.cc @@ -935,3 +935,15 @@ JACKAudioBackend::n_physical (unsigned long flags) const return c; } + +bool +JACKAudioBackend::can_change_sample_rate_when_running () const +{ + return false; +} + +bool +JACKAudioBackend::can_change_buffer_size_when_running () const +{ + return true; +} diff --git a/libs/backends/jack/jack_audiobackend.h b/libs/backends/jack/jack_audiobackend.h index 5ba9ee63d7..f47b630f49 100644 --- a/libs/backends/jack/jack_audiobackend.h +++ b/libs/backends/jack/jack_audiobackend.h @@ -61,6 +61,9 @@ class JACKAudioBackend : public AudioBackend { uint32_t available_input_channel_count (const std::string& device) const; uint32_t available_output_channel_count (const std::string& device) const; + bool can_change_sample_rate_when_running() const; + bool can_change_buffer_size_when_running() const; + int set_device_name (const std::string&); int set_sample_rate (float); int set_buffer_size (uint32_t); -- cgit v1.2.3