diff --git a/libs/ardour/ardour/audio_backend.h b/libs/ardour/ardour/audio_backend.h index 8ce99c4e93..da47004663 100644 --- a/libs/ardour/ardour/audio_backend.h +++ b/libs/ardour/ardour/audio_backend.h @@ -191,6 +191,20 @@ class LIBARDOUR_API AudioBackend : public PortEngine { */ virtual std::vector available_sample_rates (const std::string& device) const = 0; + /* backends that support separate input and output devices should + * implement this function and return an intersection (not union) of available + * sample rates valid for the given input + output device combination. + */ + virtual std::vector available_sample_rates (const std::string& input_device, const std::string& output_device) const { + std::vector input_sizes = available_sample_rates (input_device); + std::vector output_sizes = available_sample_rates (output_device); + std::vector rv; + std::set_union (input_sizes.begin (), input_sizes.end (), + output_sizes.begin (), output_sizes.end (), + std::back_inserter (rv)); + return rv; + } + /* Returns the default sample rate that will be shown to the user when * configuration options are first presented. If the derived class * needs or wants to override this, it can. It also MUST override this @@ -210,6 +224,19 @@ class LIBARDOUR_API AudioBackend : public PortEngine { */ virtual std::vector available_buffer_sizes (const std::string& device) const = 0; + /* backends that support separate input and output devices should + * implement this function and return an intersection (not union) of available + * buffer sizes valid for the given input + output device combination. + */ + virtual std::vector available_buffer_sizes (const std::string& input_device, const std::string& output_device) const { + std::vector input_rates = available_buffer_sizes (input_device); + std::vector output_rates = available_buffer_sizes (output_device); + std::vector rv; + std::set_union (input_rates.begin (), input_rates.end (), + output_rates.begin (), output_rates.end (), + std::back_inserter (rv)); + return rv; + } /* Returns the default buffer size that will be shown to the user when * configuration options are first presented. If the derived class * needs or wants to override this, it can. It also MUST override this