X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fardour%2Faudio_backend.h;h=6523eb5081995535741a7dcb28e65a198bc828d3;hb=335debfa2fed045dc80c43fb2ef62d89262fc8f8;hp=73310bddb63ea1cae25e5b26e4a08b7b60413bdd;hpb=4dc63966f0872efe768dad61eb9b8785d06b92d1;p=ardour.git diff --git a/libs/ardour/ardour/audio_backend.h b/libs/ardour/ardour/audio_backend.h index 73310bddb6..6523eb5081 100644 --- a/libs/ardour/ardour/audio_backend.h +++ b/libs/ardour/ardour/audio_backend.h @@ -80,6 +80,9 @@ struct LIBARDOUR_API AudioBackendInfo { bool (*available)(); }; +/** AudioBackend is an high-level abstraction for interacting with the operating system's + * audio and midi I/O. + */ class LIBARDOUR_API AudioBackend : public PortEngine { public: @@ -199,6 +202,14 @@ class LIBARDOUR_API AudioBackend : public PortEngine { */ virtual bool use_separate_input_and_output_devices () const { return false; } + /* Return true if the backend uses separate I/O devices only for the case + * of allowing one to be "None". + * + * ie. Input Device must match Output Device, except if either of them + * is get_standard_device_name (DeviceNone). + */ + virtual bool match_input_output_devices_or_none () const { return false; } + /** Returns a collection of DeviceStatuses identifying devices discovered * by this backend since the start of the process. * @@ -228,6 +239,22 @@ class LIBARDOUR_API AudioBackend : public PortEngine { virtual std::vector enumerate_output_devices () const { return std::vector(); } + + /** An interface to set buffers/period for playback latency. + * useful for ALSA or JACK/ALSA on Linux. + * + * @return true if the backend supports period-size configuration + */ + virtual bool can_set_period_size () const { return false; } + + /** Returns a vector of supported period-sizes for the given driver */ + virtual std::vector available_period_sizes (const std::string& driver) const { return std::vector(); } + + /** Set the period size to be used. + * must be called before starting the backend. + */ + virtual int set_peridod_size (uint32_t) { return -1; } + /** * @return true if backend supports requesting an update to the device list * and any cached properties associated with the devices. @@ -242,6 +269,23 @@ class LIBARDOUR_API AudioBackend : public PortEngine { */ virtual bool update_devices () { return false; } + /** + * @return true if backend supports a blocking or buffered mode, false by + * default unless implemented by a derived class. + */ + virtual bool can_use_buffered_io () { return false; } + + /** + * Set the backend to use a blocking or buffered I/O mode + */ + virtual void set_use_buffered_io (bool) { } + + /** + * @return Set the backend to use a blocking or buffered I/O mode, false by + * default unless implemented by a derived class. + */ + virtual bool get_use_buffered_io () { return false; } + /** Returns a collection of float identifying sample rates that are * potentially usable with the hardware identified by @param device. * Any of these values may be supplied in other calls to this backend @@ -334,6 +378,11 @@ class LIBARDOUR_API AudioBackend : public PortEngine { */ virtual bool can_change_buffer_size_when_running () const = 0; + /** return true if the backend can measure and update + * systemic latencies without restart. + */ + virtual bool can_change_systemic_latency_when_running () const { return false; } + /* Set the hardware parameters. * * If called when the current state is stopped or paused, @@ -426,6 +475,7 @@ class LIBARDOUR_API AudioBackend : public PortEngine { virtual uint32_t systemic_output_latency () const = 0; virtual uint32_t systemic_midi_input_latency (std::string const) const = 0; virtual uint32_t systemic_midi_output_latency (std::string const) const = 0; + virtual uint32_t period_size () const { return 0; } /** override this if this implementation returns true from * requires_driver_selection()