mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 14:54:56 +01:00
NO-OP: whitespace (use tab to indent)
This commit is contained in:
parent
959a37144b
commit
6c83b6f47d
1 changed files with 648 additions and 550 deletions
|
|
@ -29,10 +29,10 @@
|
|||
|
||||
#include <boost/function.hpp>
|
||||
|
||||
#include "ardour/libardour_visibility.h"
|
||||
#include "ardour/types.h"
|
||||
#include "ardour/audioengine.h"
|
||||
#include "ardour/libardour_visibility.h"
|
||||
#include "ardour/port_engine.h"
|
||||
#include "ardour/types.h"
|
||||
|
||||
#ifdef ARDOURBACKEND_DLL_EXPORTS // defined if we are building the ARDOUR Panners DLLs (instead of using them)
|
||||
# define ARDOURBACKEND_API LIBARDOUR_DLL_EXPORT
|
||||
|
|
@ -41,8 +41,8 @@
|
|||
#endif
|
||||
#define ARDOURBACKEND_LOCAL LIBARDOUR_DLL_LOCAL
|
||||
|
||||
namespace ARDOUR {
|
||||
|
||||
namespace ARDOUR
|
||||
{
|
||||
struct LIBARDOUR_API AudioBackendInfo {
|
||||
const char* name;
|
||||
|
||||
|
|
@ -52,8 +52,7 @@ struct LIBARDOUR_API AudioBackendInfo {
|
|||
*/
|
||||
int (*instantiate) (const std::string& arg1, const std::string& arg2);
|
||||
|
||||
/** Release all resources associated with this audiobackend
|
||||
*/
|
||||
/** Release all resources associated with this audiobackend */
|
||||
int (*deinstantiate) (void);
|
||||
|
||||
/** Factory method to create an AudioBackend-derived class.
|
||||
|
|
@ -84,10 +83,15 @@ struct LIBARDOUR_API AudioBackendInfo {
|
|||
/** AudioBackend is an high-level abstraction for interacting with the operating system's
|
||||
* audio and midi I/O.
|
||||
*/
|
||||
class LIBARDOUR_API AudioBackend : public PortEngine {
|
||||
class LIBARDOUR_API AudioBackend : public PortEngine
|
||||
{
|
||||
public:
|
||||
AudioBackend (AudioEngine& e, AudioBackendInfo& i)
|
||||
: PortEngine (e)
|
||||
, _info (i)
|
||||
, engine (e)
|
||||
{}
|
||||
|
||||
AudioBackend (AudioEngine& e, AudioBackendInfo& i) : PortEngine (e), _info (i), engine (e) {}
|
||||
virtual ~AudioBackend () {}
|
||||
|
||||
enum ErrorCode {
|
||||
|
|
@ -137,9 +141,12 @@ class LIBARDOUR_API AudioBackend : public PortEngine {
|
|||
static std::string get_standard_device_name (StandardDeviceName);
|
||||
|
||||
/** Return the AudioBackendInfo object from which this backend
|
||||
was constructed.
|
||||
* was constructed.
|
||||
*/
|
||||
AudioBackendInfo& info() const { return _info; }
|
||||
AudioBackendInfo& info () const
|
||||
{
|
||||
return _info;
|
||||
}
|
||||
|
||||
/** Return the name of this backend.
|
||||
*
|
||||
|
|
@ -164,7 +171,10 @@ class LIBARDOUR_API AudioBackend : public PortEngine {
|
|||
* or FFADO or netjack) and those like ASIO or CoreAudio which
|
||||
* do not.
|
||||
*/
|
||||
virtual bool requires_driver_selection() const { return false; }
|
||||
virtual bool requires_driver_selection () const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/** If the return value of requires_driver_selection() is true,
|
||||
* then this function can return the list of known driver names.
|
||||
|
|
@ -173,7 +183,10 @@ class LIBARDOUR_API AudioBackend : public PortEngine {
|
|||
* then this function should not be called. If it is called
|
||||
* its return value is an empty vector of strings.
|
||||
*/
|
||||
virtual std::vector<std::string> enumerate_drivers() const { return std::vector<std::string>(); }
|
||||
virtual std::vector<std::string> enumerate_drivers () const
|
||||
{
|
||||
return std::vector<std::string> ();
|
||||
}
|
||||
|
||||
/** Returns zero if the backend can successfully use \param drivername
|
||||
* as the driver, non-zero otherwise.
|
||||
|
|
@ -181,7 +194,10 @@ class LIBARDOUR_API AudioBackend : public PortEngine {
|
|||
* Should not be used unless the backend returns true from
|
||||
* requires_driver_selection()
|
||||
*/
|
||||
virtual int set_driver (const std::string& drivername) { return 0; }
|
||||
virtual int set_driver (const std::string& drivername)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** used to list device names along with whether or not they are currently
|
||||
* available.
|
||||
|
|
@ -190,7 +206,10 @@ class LIBARDOUR_API AudioBackend : public PortEngine {
|
|||
std::string name;
|
||||
bool available;
|
||||
|
||||
DeviceStatus (const std::string& s, bool avail) : name (s), available (avail) {}
|
||||
DeviceStatus (const std::string& s, bool avail)
|
||||
: name (s)
|
||||
, available (avail)
|
||||
{}
|
||||
};
|
||||
|
||||
/** An optional alternate interface for backends to provide a facility to
|
||||
|
|
@ -201,7 +220,10 @@ class LIBARDOUR_API AudioBackend : public PortEngine {
|
|||
* to enumerate devices. Similarly set_input/output_device_name() should
|
||||
* be used to set devices instead of set_device_name().
|
||||
*/
|
||||
virtual bool use_separate_input_and_output_devices () const { return false; }
|
||||
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".
|
||||
|
|
@ -209,7 +231,10 @@ class LIBARDOUR_API AudioBackend : public PortEngine {
|
|||
* 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; }
|
||||
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,7 +253,9 @@ class LIBARDOUR_API AudioBackend : public PortEngine {
|
|||
* invalid at any time.
|
||||
*/
|
||||
virtual std::vector<DeviceStatus> enumerate_input_devices () const
|
||||
{ return std::vector<DeviceStatus>(); }
|
||||
{
|
||||
return std::vector<DeviceStatus> ();
|
||||
}
|
||||
|
||||
/** Returns a collection of DeviceStatuses identifying output devices
|
||||
* discovered by this backend since the start of the process.
|
||||
|
|
@ -238,29 +265,42 @@ class LIBARDOUR_API AudioBackend : public PortEngine {
|
|||
* invalid at any time.
|
||||
*/
|
||||
virtual std::vector<DeviceStatus> enumerate_output_devices () const
|
||||
{ return std::vector<DeviceStatus>(); }
|
||||
|
||||
{
|
||||
return std::vector<DeviceStatus> ();
|
||||
}
|
||||
|
||||
/** 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; }
|
||||
virtual bool can_set_period_size () const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Returns a vector of supported period-sizes for the given driver */
|
||||
virtual std::vector<uint32_t> available_period_sizes (const std::string& driver) const { return std::vector<uint32_t>(); }
|
||||
virtual std::vector<uint32_t> available_period_sizes (const std::string& driver) const
|
||||
{
|
||||
return std::vector<uint32_t> ();
|
||||
}
|
||||
|
||||
/** Set the period size to be used.
|
||||
* must be called before starting the backend.
|
||||
*/
|
||||
virtual int set_peridod_size (uint32_t) { return -1; }
|
||||
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.
|
||||
*/
|
||||
virtual bool can_request_update_devices () { return false; }
|
||||
virtual bool can_request_update_devices ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Request an update to the list of devices returned in the enumerations.
|
||||
|
|
@ -268,13 +308,19 @@ class LIBARDOUR_API AudioBackend : public PortEngine {
|
|||
* this interface.
|
||||
* @return true if the devices were updated
|
||||
*/
|
||||
virtual bool update_devices () { return false; }
|
||||
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; }
|
||||
virtual bool can_use_buffered_io ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the backend to use a blocking or buffered I/O mode
|
||||
|
|
@ -285,7 +331,10 @@ class LIBARDOUR_API AudioBackend : public PortEngine {
|
|||
* @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; }
|
||||
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 .
|
||||
|
|
@ -300,7 +349,8 @@ class LIBARDOUR_API AudioBackend : public PortEngine {
|
|||
* implement this function and return an intersection (not union) of available
|
||||
* sample rates valid for the given input + output device combination.
|
||||
*/
|
||||
virtual std::vector<float> available_sample_rates2 (const std::string& input_device, const std::string& output_device) const {
|
||||
virtual std::vector<float> available_sample_rates2 (const std::string& input_device, const std::string& output_device) const
|
||||
{
|
||||
std::vector<float> input_sizes = available_sample_rates (input_device);
|
||||
std::vector<float> output_sizes = available_sample_rates (output_device);
|
||||
std::vector<float> rv;
|
||||
|
|
@ -316,7 +366,8 @@ class LIBARDOUR_API AudioBackend : public PortEngine {
|
|||
* if there is any chance that an SR of 44.1kHz is not in the list
|
||||
* returned by available_sample_rates()
|
||||
*/
|
||||
virtual float default_sample_rate () const {
|
||||
virtual float default_sample_rate () const
|
||||
{
|
||||
return 44100.0;
|
||||
}
|
||||
|
||||
|
|
@ -333,7 +384,8 @@ class LIBARDOUR_API AudioBackend : public PortEngine {
|
|||
* implement this function and return an intersection (not union) of available
|
||||
* buffer sizes valid for the given input + output device combination.
|
||||
*/
|
||||
virtual std::vector<uint32_t> available_buffer_sizes2 (const std::string& input_device, const std::string& output_device) const {
|
||||
virtual std::vector<uint32_t> available_buffer_sizes2 (const std::string& input_device, const std::string& output_device) const
|
||||
{
|
||||
std::vector<uint32_t> input_rates = available_buffer_sizes (input_device);
|
||||
std::vector<uint32_t> output_rates = available_buffer_sizes (output_device);
|
||||
std::vector<uint32_t> rv;
|
||||
|
|
@ -348,7 +400,8 @@ class LIBARDOUR_API AudioBackend : public PortEngine {
|
|||
* if there is any chance that a buffer size of 1024 is not in the list
|
||||
* returned by available_buffer_sizes()
|
||||
*/
|
||||
virtual uint32_t default_buffer_size (const std::string& device) const {
|
||||
virtual uint32_t default_buffer_size (const std::string& device) const
|
||||
{
|
||||
return 1024;
|
||||
}
|
||||
|
||||
|
|
@ -382,7 +435,10 @@ class LIBARDOUR_API AudioBackend : public PortEngine {
|
|||
/** return true if the backend can measure and update
|
||||
* systemic latencies without restart.
|
||||
*/
|
||||
virtual bool can_change_systemic_latency_when_running () const { return false; }
|
||||
virtual bool can_change_systemic_latency_when_running () const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Set the hardware parameters.
|
||||
*
|
||||
|
|
@ -395,8 +451,7 @@ class LIBARDOUR_API AudioBackend : public PortEngine {
|
|||
* All set_*() methods return zero on success, non-zero otherwise.
|
||||
*/
|
||||
|
||||
/** Set the name of the device to be used
|
||||
*/
|
||||
/** Set the name of the device to be used */
|
||||
virtual int set_device_name (const std::string&) = 0;
|
||||
|
||||
/** Set the name of the input device to be used if using separate
|
||||
|
|
@ -404,21 +459,30 @@ class LIBARDOUR_API AudioBackend : public PortEngine {
|
|||
*
|
||||
* @see use_separate_input_and_output_devices()
|
||||
*/
|
||||
virtual int set_input_device_name (const std::string&) { return 0;}
|
||||
virtual int set_input_device_name (const std::string&)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Set the name of the output device to be used if using separate
|
||||
* input/output devices.
|
||||
*
|
||||
* @see use_separate_input_and_output_devices()
|
||||
*/
|
||||
virtual int set_output_device_name (const std::string&) { return 0;}
|
||||
virtual int set_output_device_name (const std::string&)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Deinitialize and destroy current device
|
||||
*/
|
||||
virtual int drop_device() {return 0;};
|
||||
/** Set the sample rate to be used
|
||||
*/
|
||||
/** Deinitialize and destroy current device */
|
||||
virtual int drop_device ()
|
||||
{
|
||||
return 0;
|
||||
};
|
||||
|
||||
/** Set the sample rate to be used */
|
||||
virtual int set_sample_rate (float) = 0;
|
||||
|
||||
/** Set the buffer size to be used.
|
||||
*
|
||||
* The device is assumed to use a double buffering scheme, so that one
|
||||
|
|
@ -428,6 +492,7 @@ class LIBARDOUR_API AudioBackend : public PortEngine {
|
|||
* doesn't directly expose the concept).
|
||||
*/
|
||||
virtual int set_buffer_size (uint32_t) = 0;
|
||||
|
||||
/** Set the preferred underlying hardware data layout.
|
||||
* If \param yn is true, then the hardware will interleave
|
||||
* samples for successive channels; otherwise, the hardware will store
|
||||
|
|
@ -437,26 +502,30 @@ class LIBARDOUR_API AudioBackend : public PortEngine {
|
|||
* to and from Ports are mono (essentially, non-interleaved)
|
||||
*/
|
||||
virtual int set_interleaved (bool yn) = 0;
|
||||
/** Set the number of input channels that should be used
|
||||
*/
|
||||
|
||||
/** Set the number of input channels that should be used */
|
||||
virtual int set_input_channels (uint32_t) = 0;
|
||||
/** Set the number of output channels that should be used
|
||||
*/
|
||||
|
||||
/** Set the number of output channels that should be used */
|
||||
virtual int set_output_channels (uint32_t) = 0;
|
||||
|
||||
/** Set the (additional) input latency that cannot be determined via
|
||||
* the implementation's underlying code (e.g. latency from
|
||||
* external D-A/D-A converters. Units are samples.
|
||||
*/
|
||||
virtual int set_systemic_input_latency (uint32_t) = 0;
|
||||
|
||||
/** Set the (additional) output latency that cannot be determined via
|
||||
* the implementation's underlying code (e.g. latency from
|
||||
* external D-A/D-A converters. Units are samples.
|
||||
*/
|
||||
virtual int set_systemic_output_latency (uint32_t) = 0;
|
||||
|
||||
/** Set the (additional) input latency for a specific midi device,
|
||||
* or if the identifier is empty, apply to all midi devices.
|
||||
*/
|
||||
virtual int set_systemic_midi_input_latency (std::string const, uint32_t) = 0;
|
||||
|
||||
/** Set the (additional) output latency for a specific midi device,
|
||||
* or if the identifier is empty, apply to all midi devices.
|
||||
*/
|
||||
|
|
@ -465,8 +534,16 @@ class LIBARDOUR_API AudioBackend : public PortEngine {
|
|||
/* Retrieving parameters */
|
||||
|
||||
virtual std::string device_name () const = 0;
|
||||
virtual std::string input_device_name () const { return std::string(); }
|
||||
virtual std::string output_device_name () const { return std::string(); }
|
||||
virtual std::string input_device_name () const
|
||||
{
|
||||
return std::string ();
|
||||
}
|
||||
|
||||
virtual std::string output_device_name () const
|
||||
{
|
||||
return std::string ();
|
||||
}
|
||||
|
||||
virtual float sample_rate () const = 0;
|
||||
virtual uint32_t buffer_size () const = 0;
|
||||
virtual bool interleaved () const = 0;
|
||||
|
|
@ -476,12 +553,16 @@ 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()
|
||||
*/
|
||||
virtual std::string driver_name() const { return std::string(); }
|
||||
virtual std::string driver_name () const
|
||||
{
|
||||
return std::string ();
|
||||
}
|
||||
|
||||
/** Return the name of a control application for the
|
||||
* selected/in-use device. If no such application exists,
|
||||
|
|
@ -489,6 +570,7 @@ class LIBARDOUR_API AudioBackend : public PortEngine {
|
|||
* return an empty string.
|
||||
*/
|
||||
virtual std::string control_app_name () const = 0;
|
||||
|
||||
/** Launch the control app for the currently in-use or
|
||||
* selected device. May do nothing if the control
|
||||
* app is undefined or cannot be launched.
|
||||
|
|
@ -557,7 +639,8 @@ class LIBARDOUR_API AudioBackend : public PortEngine {
|
|||
*
|
||||
* http://stackoverflow.com/questions/12139786/good-pratice-default-arguments-for-pure-virtual-method
|
||||
*/
|
||||
int start (bool for_latency_measurement=false) {
|
||||
int start (bool for_latency_measurement = false)
|
||||
{
|
||||
return _start (for_latency_measurement);
|
||||
}
|
||||
|
||||
|
|
@ -618,22 +701,28 @@ class LIBARDOUR_API AudioBackend : public PortEngine {
|
|||
* the concept of shared transport control)
|
||||
*/
|
||||
|
||||
/** Attempt to change the transport state to TransportRolling.
|
||||
*/
|
||||
/** Attempt to change the transport state to TransportRolling. */
|
||||
virtual void transport_start () {}
|
||||
/** Attempt to change the transport state to TransportStopped.
|
||||
*/
|
||||
|
||||
/** Attempt to change the transport state to TransportStopped. */
|
||||
virtual void transport_stop () {}
|
||||
/** return the current transport state
|
||||
*/
|
||||
virtual TransportState transport_state () const { return TransportStopped; }
|
||||
/** Attempt to locate the transport to \param pos
|
||||
*/
|
||||
|
||||
/** return the current transport state */
|
||||
virtual TransportState transport_state () const
|
||||
{
|
||||
return TransportStopped;
|
||||
}
|
||||
|
||||
/** Attempt to locate the transport to \param pos */
|
||||
virtual void transport_locate (samplepos_t pos) {}
|
||||
|
||||
/** Return the current transport location, in samples measured
|
||||
* from the origin (defined by the transport time master)
|
||||
*/
|
||||
virtual samplepos_t transport_sample() const { return 0; }
|
||||
virtual samplepos_t transport_sample () const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** If \param yn is true, become the time master for any inter-application transport
|
||||
* timebase, otherwise cease to be the time master for the same.
|
||||
|
|
@ -643,9 +732,15 @@ class LIBARDOUR_API AudioBackend : public PortEngine {
|
|||
* JACK is the only currently known audio API with the concept of a shared
|
||||
* transport timebase.
|
||||
*/
|
||||
virtual int set_time_master (bool yn) { return 0; }
|
||||
virtual int set_time_master (bool yn)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual int usecs_per_cycle () const { return 1000000 * (buffer_size() / sample_rate()); }
|
||||
virtual int usecs_per_cycle () const
|
||||
{
|
||||
return 1000000 * (buffer_size () / sample_rate ());
|
||||
}
|
||||
virtual size_t raw_buffer_size (DataType t) = 0;
|
||||
|
||||
/* Process time */
|
||||
|
|
@ -691,7 +786,10 @@ class LIBARDOUR_API AudioBackend : public PortEngine {
|
|||
* Can ONLY be called from within a process() callback tree (which implies
|
||||
* that it can only be called by a process thread)
|
||||
*/
|
||||
virtual bool get_sync_offset (pframes_t& offset) const { return false; }
|
||||
virtual bool get_sync_offset (pframes_t& offset) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Create a new thread suitable for running part of the buffer process
|
||||
* cycle (i.e. Realtime scheduling, memory allocation, stacksize, etc.
|
||||
|
|
@ -709,16 +807,16 @@ class LIBARDOUR_API AudioBackend : public PortEngine {
|
|||
*/
|
||||
virtual int join_process_threads () = 0;
|
||||
|
||||
/** Return true if execution context is in a backend thread
|
||||
*/
|
||||
/** Return true if execution context is in a backend thread */
|
||||
virtual bool in_process_thread () = 0;
|
||||
|
||||
/** Return the minimum stack size of audio threads in bytes
|
||||
*/
|
||||
static size_t thread_stack_size () { return 100000; }
|
||||
/** Return the minimum stack size of audio threads in bytes */
|
||||
static size_t thread_stack_size ()
|
||||
{
|
||||
return 100000;
|
||||
}
|
||||
|
||||
/** Return number of processing threads
|
||||
*/
|
||||
/** Return number of processing threads */
|
||||
virtual uint32_t process_thread_count () = 0;
|
||||
|
||||
virtual void update_latencies () = 0;
|
||||
|
|
@ -732,7 +830,8 @@ class LIBARDOUR_API AudioBackend : public PortEngine {
|
|||
* handled by Ardour itself (LTC and MTC are both handled by Ardour).
|
||||
* The canonical example is JACK Transport.
|
||||
*/
|
||||
virtual bool speed_and_position (double& speed, samplepos_t& position) {
|
||||
virtual bool speed_and_position (double& speed, samplepos_t& position)
|
||||
{
|
||||
speed = 0.0;
|
||||
position = 0;
|
||||
return false;
|
||||
|
|
@ -745,7 +844,6 @@ class LIBARDOUR_API AudioBackend : public PortEngine {
|
|||
virtual int _start (bool for_latency_measurement) = 0;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
} // namespace ARDOUR
|
||||
|
||||
#endif /* __libardour_audiobackend_h__ */
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue