Add API to query if systemic latency can be measured

This commit is contained in:
Robin Gareus 2020-06-30 03:34:26 +02:00
parent a0bdf87720
commit 92f54b3e98
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
8 changed files with 20 additions and 0 deletions

View File

@ -432,6 +432,12 @@ public:
*/
virtual bool can_change_buffer_size_when_running () const = 0;
/** return true if the backend is configured using a single
* full-duplex device and measuring systemic latency can
* produce meaningful results.
*/
virtual bool can_measure_systemic_latency () const = 0;
/** return true if the backend can measure and update
* systemic latencies without restart.
*/

View File

@ -375,6 +375,12 @@ AlsaAudioBackend::set_device_name (const std::string& d)
return rv;
}
bool
AlsaAudioBackend::can_measure_systemic_latency () const
{
return _input_audio_device == _output_audio_device && _input_audio_device != get_standard_device_name (DeviceNone);
}
int
AlsaAudioBackend::set_sample_rate (float sr)
{

View File

@ -147,6 +147,7 @@ class AlsaAudioBackend : public AudioBackend, public PortEngineSharedImpl
bool can_change_sample_rate_when_running () const;
bool can_change_buffer_size_when_running () const;
bool can_measure_systemic_latency () const;
bool can_change_systemic_latency_when_running () const { return true; }
bool can_request_update_devices () { return true; }

View File

@ -179,6 +179,7 @@ class CoreAudioBackend : public AudioBackend, public PortEngineSharedImpl {
bool can_change_sample_rate_when_running () const;
bool can_change_buffer_size_when_running () const;
bool can_measure_systemic_latency () const { return true; }
int set_device_name (const std::string&);
int set_input_device_name (const std::string&);

View File

@ -212,6 +212,7 @@ class DummyAudioBackend : public AudioBackend, public PortEngineSharedImpl {
bool can_change_sample_rate_when_running () const;
bool can_change_buffer_size_when_running () const;
bool can_measure_systemic_latency () const { return true; }
int set_device_name (const std::string&);
int set_sample_rate (float);

View File

@ -190,6 +190,9 @@ class JACKAudioBackend : public AudioBackend {
bool can_set_period_size () const {
return true;
}
bool can_measure_systemic_latency () const {
return false;
}
int midi_event_get (pframes_t& timestamp, size_t& size, uint8_t const** buf, void* port_buffer, uint32_t event_index);
int midi_event_put (void* port_buffer, pframes_t timestamp, const uint8_t* buffer, size_t size);

View File

@ -158,6 +158,7 @@ class PortAudioBackend : public AudioBackend, public PortEngineSharedImpl {
uint32_t systemic_midi_input_latency (std::string const) const;
uint32_t systemic_midi_output_latency (std::string const) const;
bool can_measure_systemic_latency () const { return true; }
bool can_set_systemic_midi_latencies () const { return true; }
/* External control app */

View File

@ -116,6 +116,7 @@ public:
bool can_change_sample_rate_when_running () const;
bool can_change_buffer_size_when_running () const;
bool can_measure_systemic_latency () const { return false; }
int set_device_name (const std::string&);
int set_sample_rate (float);