13
0

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
This commit is contained in:
Paul Davis 2013-09-09 13:27:48 -04:00
parent 56465fda10
commit a228643e40
3 changed files with 26 additions and 0 deletions

View File

@ -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,

View File

@ -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;
}

View File

@ -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);