Commit Graph

148 Commits

Author SHA1 Message Date
luz paz 3d395585c1
Fix various typos
Found via `codespell -q 3 -S *.po,./share/patchfiles,./libs -L ba,buss,busses,doubleclick,hsi,ontop,ro,seh,siz,sord,sur,te,trough,ue`  
Follow-up to 364f2f078
2022-04-08 19:51:02 +02:00
Robin Gareus bf43c8d2d4
Set thread names 2021-06-30 17:15:27 +02:00
Robin Gareus 0f6e34a697
ALSA: fix idempotent device name setup
This fixes an edge case where available buffersizes are
not not correctly set because the device info was never queried.
2021-06-30 04:10:48 +02:00
Paul Davis ad9ac0911e remove some timing stats that it seems unlikely we will use 2021-06-15 14:03:55 -06:00
Paul Davis a5f7c793e3 add a new "Run Loop" timing stats for ALSA and JACK backends 2021-06-13 10:28:51 -06:00
Paul Davis 4c76ff503f measure backend process callback duration in ALSA backend 2021-06-12 15:00:46 -06:00
Paul Davis 1777cf8f69 add some initial timing points for dsp stats 2021-06-11 18:55:24 -06:00
Robin Gareus 2c8916310a
Consistent env variable naming (see also 6801c2cac2) 2021-06-10 03:17:49 +02:00
Robin Gareus 14961e6bc7
ALSA backend: code cleanup and scoping and indent
This is combination of clang-format and manual edits.
The latter mainly to add braces and reduce scope of variables.
2021-05-16 00:49:06 +02:00
Robin Gareus 8661aa1809
ALSA: Fix swapped systemic latencies
This went unnoticed since measured systemic latency
is equally distributes between input and output.
2021-04-11 15:15:17 +02:00
Robin Gareus ace11bd243
Consistency: replace "x-run" with "xrun" (1/2) 2021-02-26 22:22:08 +01:00
Robin Gareus 3f4e2fa348
ALSA: retain port-connections of slave devices
When the engine is re-started, ports should only be reconnected
when all slave devices are running. Previously those connections
were lost.
2021-02-19 14:03:37 +01:00
Robin Gareus 634d325e5d
Prevent deadlock when disconnecting
The backend holds `_port_callback_mutex` while disconnecting ports.
In some cases disconnecting a port can drop the last reference
resulting in a port-deletion from the connection handler.
This in turn will eventually aquire the `_port_callback_mutex`
and deadlock.

This is now circumvented by using atomic operations instead of
taking a lock to set the `_port_change_flag`.

The flag is also used to trigger a latency update in some cases,
atomic is preferable to taking a lock to set this flag.

--

Full bt: https://paste.debian.net/1184056/
Short:

#1  in pthread_mutex_lock ()
#2  in ARDOUR::PortEngineSharedImpl::port_connect_add_remove_callback()
#3  in ARDOUR::BackendPort::~BackendPort()
#4  in ARDOUR::DummyPort::~DummyPort()
#6  in ARDOUR::DummyAudioPort::~DummyAudioPort()
#7  in boost::checked_delete<ARDOUR::BackendPort>(ARDOUR::BackendPort*)
#12 in boost::shared_ptr<ARDOUR::ProtoPort>::reset()
#13 in ARDOUR::Port::drop()
#14 in ARDOUR::Port::~Port()
#15 in ARDOUR::AudioPort::~AudioPort()
#17 in ARDOUR::AudioEngine::add_pending_port_deletion(ARDOUR::Port*)
#20 in boost::detail::sp_counted_base::release()
#37 in ARDOUR::PortManager::connect_callback() at libs/ardour/port_manager.cc:788
#38 in ARDOUR::DummyAudioBackend::main_process_thread() at libs/backends/dummy/dummy_audiobackend.cc:1018
2021-02-04 21:06:20 +01:00
Robin Gareus f0a89c4f1d
ALSA: allow to select clock-source when using multiple devices 2021-01-24 18:23:37 +01:00
Robin Gareus 8426bb3aaf
ALSA: explicitly list millisecond buffer-sizes 2021-01-22 16:07:33 +01:00
Robin Gareus 0b97175d49
ALSA: fall back to nearest available buffer-size
The warning "samples per period does not match." never triggered.
Previously not being able to set the requested buffersize was a
fatal error.

This adds support for soundcards that only support msec.
e.g. recent HDA Intel via SOF (Sound Open Firmware)
2021-01-22 16:07:29 +01:00
Robin Gareus cff58bd9da
ALSA: Fix slave device lookup 2021-01-22 16:07:24 +01:00
Robin Gareus c5b986f420
ALSA: set pretty port names for audio I/O 2021-01-18 03:18:21 +01:00
Robin Gareus 21e66216be
Separate user-set pretty-names from hardware I/O names
This allow to restore original engine port-names as set
by the backend. ALSA MIDI, CoreAudio, CoreMIDI and PortAudio
drivers can provide human readable physical port names for
some devices.
2021-01-18 03:18:20 +01:00
Robin Gareus 60901d26b7
ALSA: improve debug output 2020-12-03 21:29:21 +01:00
Robin Gareus 216935f16e
Remove ALSA debug message in optimized builds 2020-09-18 15:40:44 +02:00
Robin Gareus a80064981e
NO-OP: Consolidate PortConnect code into shared parent class 2020-09-05 23:05:57 +02:00
Robin Gareus 92f54b3e98
Add API to query if systemic latency can be measured 2020-06-30 03:34:26 +02:00
Robin Gareus 09aa0a3d1a
Consolidate code using pthread_attr_setstacksize
This also adds some stack constraint to rt and fallback threads
that didn't have those before (ALSA MIDI for example)
2020-06-06 18:35:44 +02:00
Robin Gareus 4ff6fbe6b8
ALSA: Use same period for in+out #8075
Since the input is never flushed, capture latency is still
only one cycle.
2020-05-10 22:28:40 +02:00
Robin Gareus abe23b5885
ALSA backend: ignore idempotent latency settings 2020-05-09 01:22:18 +02:00
Robin Gareus 3a6a9cfa6c
Tweak ALSA nperiod setting, fallback to nearest
This is mainly for RME RayDAT that has a fixed buffersize of 16k:

  dev_name : hw:HDSPMxc2f6c5,0
  channels : 36
  min_rate : 32000
  max_rate : 192000
  min_bufz : 16384
  max_bufz : 16384
  min_nper : 4
  max_nper : 512

However nperiod configuration determines the effective latency
regardless.

This is similar to https://github.com/jackaudio/jack1/blob/master/drivers/alsa/alsa_driver.c#L476-L486
2020-04-29 23:56:24 +02:00
Robin Gareus 8e482ef0fb
Con't work on ALSA nperiod selection (see also d3d120fa) 2020-04-28 17:56:17 +02:00
Robin Gareus d3d120fa28
Prepare to allow using ALSA backend with nperiods > 3
This will still need an update for Alsa_pcmi::set_hwpar() capture
channel (which is fixed at 2, unless FRAG_NEAR is used).
2020-04-28 03:28:34 +02:00
Robin Gareus 3d166c7789
Consolidate stack-size and priority of rt-threads 2020-04-23 01:28:58 +02:00
Robin Gareus daf9fe2550
Tweak engine startup, shorten initial silence timeout
see also 23baeee829
2020-04-16 16:47:08 +02:00
Paul Davis 2a80832243 add port connect/add/remove callbacks to the ALSA backend
This fixes issues with new ports not (always) appearing in port matrices (and presumably
elsewhere too)
2020-04-10 09:53:44 -06:00
Robin Gareus b943cec756
ALSA: allow to select different I/O devices
This adds a basic support to use multiple sound-cards, currently
limited to two devices: In/Out with shared settings.

Advanced setups still have to resort to using the ARDOUR_ALSA_EXT
environment variable
2020-04-10 05:01:33 +02:00
Robin Gareus 62e2ec49ce
ALSA: ignore systemic MIDI latencies during measurement 2020-04-10 01:43:11 +02:00
Paul Davis 69b4c5108b ALSA backend: fix incorrect pointer cast (fixes #7998) 2020-04-09 15:40:23 -06:00
Paul Davis 78a66b7180 improved port cleanup as backend is destroyed 2020-04-07 23:26:51 -06:00
Paul Davis b9cb306e8b use shared_ptr to manage backend port lifetimes (Pulse,ALSA,Dummy,JACK)
JACK is not yet finished.

Changes also include minor reformatting and a spelling correction (latecies to latencies)
2020-04-07 13:23:49 -06:00
Paul Davis 6c2e30b790 use new PortEngineSharedImpl in AlsaAudioBackend 2020-04-02 19:45:31 -06:00
Paul Davis 9ac0d5b60f add RCU to manage _ports and _portmap in AlsaAudioBackend
This is intended to prevent crashes when unregister_port() modifies the contents of these
two members at the same time that something else is iterating over them.
2020-04-02 19:45:31 -06:00
Robin Gareus a8ff35accb
Reset DSP load on backend re-start and after freewheeling 2020-03-30 16:58:55 +02:00
Robin Gareus 23baeee829
Tweak engine startup, initial silence
This can help when running with very low latency and the
initial process callback is [indirectly] expensive.

E.g. load a heavy session the a RPi4, initial setup can pull
in a lot of data, which blocks the bus.

In particular with the ALSA backend this can lead to poll timeout
which effectively stops the backend.
2020-03-30 15:20:54 +02:00
Robin Gareus 7c381dab6e
Downgrade "using all channels" warning to info - part 2 2020-01-25 04:17:53 +01:00
Robin Gareus f9e7f10695
Downgrade "using all channels" warning to info message 2020-01-24 21:16:40 +01:00
Robin Gareus 8fadf44978
Fix possible segfault when ALSA MIDI port registration fails 2019-08-23 04:39:12 +02:00
Robin Gareus 47a62b2850
Update backend GPL boilerplate and (C) from git log 2019-08-03 15:53:16 +02:00
Robin Gareus 78fc6d6651
Prefix all env variable with "ARDOUR_"
In particular "CONCURRENCY" can be problematic. But in general
it's good practice to use a namespace prefix for app-specifics.
2019-07-26 16:44:29 +02:00
Robin Gareus 771f2d2499
ALSA backend: fix play/capture device param detection 2019-07-24 16:40:40 +02:00
Robin Gareus 00e226e3c6
Fix ALSA MIDI latency update call (playback/capture direction mismatch) 2019-05-06 00:14:27 +02:00
Robin Gareus ddd1cda260
Remove outdated comment 2019-05-05 18:07:21 +02:00
Robin Gareus c5346f5c15
Fix add/remove ALSA-MIDI ports bug 2019-05-05 18:06:37 +02:00