13
0
Commit Graph

962 Commits

Author SHA1 Message Date
Mads Kiilerich
ba5ca2de05
PulseAudio: always log error reason in error handling
It adds some new strings to translate. These strings might be so rare
and technical that it is a bit pointless to translate them. But let's
stay consistent...
2022-11-02 02:24:35 +01:00
Mads Kiilerich
3fbbef3038
PulseAudio: fix "already active" message emitted when not active
Apparently just a missing fixup after copy-paste.
2022-11-02 02:24:34 +01:00
Mads Kiilerich
2666dfe900
PulseAudio: add missing return in error handling
Don't try to continue if the initial uncorking fails.
2022-11-02 02:24:34 +01:00
Mads Kiilerich
06b3d5ba33
PulseAudio: spin waiting for enough capacity to write
pa_threaded_mainloop_wait might wake up for several reasons. And there
is no point (but possibly harm) in moving on before we have verified
that PA actually is ready to receive our write without overflow.
2022-11-02 02:24:34 +01:00
Mads Kiilerich
27a2bf1f59
PulseAudio: clean up freewheeling transitions
ae3c8b19c6 and 03a17df68c reworked the transitions to and from
freewheeling. Some of it seems to have been experiments that tried
several things out, and generally it seems to have worked. It left some
commented out code. Clean that up.
2022-11-02 02:24:34 +01:00
Mads Kiilerich
04c24be2db
PulseAudio: don't drain the stream right after initial uncorking
The draining was introduced in ae3c8b19c6, apparently as an experiment
doing several changes. But the drain is outside the loop where
freewheeling changes, so the fix must have worked for other reasons.

There doesn't seem to be any benefit from draining at that point. The
stream is already empty. If not, we could have flushed it.

Draining right after uncorking will conceptualy create an intentional
underflow, even though it isn't reported as such. PipeWire seems to
(something like 6-12 months ago) have regressed in handling of that grey
area, causing that *underflow* to cause a request for too much data, and
thus causing constant *overflows* and unusable playback.

This change makes PulseAudio playback work for me again.
2022-11-02 02:24:34 +01:00
1eaaf4303b jack backend: catch some possible errors in ::get_port_name() 2022-10-29 09:37:17 -06:00
+merlan #flirora
79f55742d6
JACKAudioBackend::join_process_threads: Don’t pass NULL for jack_client_stop_thread
This is needed for PipeWire’s JACK frontend, which implements this
function and expects the first argument to be non-null.
2022-10-24 04:45:08 +02:00
7e5fe695d0 Increase coreMIDI robustness, do not drop late events
see also https://discourse.ardour.org/t/ardour-not-getting-all-messages-from-midi-keyboard/107618/13
2022-09-24 02:29:50 +02:00
9b65be0e17
Add debug information for coreMIDI events 2022-09-22 00:42:56 +02:00
46deb15d12
ALSA: request device to query its settings
Querying available buffersizes and sample-rates requires access
to the device. Almost all ALSA devices are limited to
a single user-space application so we unconditionally try
to request access to the device.
2022-09-12 16:34:25 +02:00
48dbd5801a
Coreaudio: enable MIDI by default 2022-07-27 15:31:20 +02:00
b77eedf53e
Suggest WinMME as default (enable MIDI by default) 2022-07-11 21:45:55 +02:00
fe6aa0610c
ALSA: suggest ALSA Sequencer by default 2022-07-11 21:45:54 +02:00
13de664ae6
Provide jack2 compatible implementation for jack1
jack1 (which is Linux only) does not have a jack_client_stop_thread
API, and expects the application to call pthread_join().

This fixes an issue when the application is compiled using jack2 headers
but the application later runs using jack1's library.
2022-06-30 17:19:57 +02:00
64f9829b56
AudioBackends: ignore setting latency of invalid port(s) 2022-06-24 19:55:17 +02:00
fe0e997335
Backend: prefer debug_msg over PBD::Transmitter in threads
PBD::Transmitter is neither thread-safe nor rt-safe. This likely
fixes a crash on macOS when process-threads are started.
Many threads simultaneously enter coreaudio_process_thread() and
log a message calling `PBD::info << .. << endmsg` simultaneously.
2022-06-24 19:27:57 +02:00
35612d26c6
Unify ::get_buffer, remove debug code 2022-06-18 22:54:09 +02:00
99e785541a
Coreaudio/M1: prefer device IOThread Workgroup 2022-06-03 22:50:13 +02:00
fa8f75c145
Fix yet another oversight when coding blindly in 6a513a11f 2022-06-03 07:29:23 +02:00
5417ddd792
Fix typo in 6a513a11f 2022-06-03 07:24:42 +02:00
58979af4f2
Coreaudio: update workgroup query 2022-06-03 06:42:42 +02:00
6a513a11fa
Coreaudio: set real-time constraint before joining the workgroup
The worker thread needs to have a real-time constraint set,
before it cab be joined to the workgroup.
2022-06-03 06:42:38 +02:00
74ee7ee091
Add parallel realtime threads to CoreAudio workgroup
This API is only available since BigSur (11.0), see also
https://developer.apple.com/documentation/audiotoolbox/workgroup_management/adding_parallel_real-time_threads_to_audio_workgroups?language=objc
2022-06-03 04:56:28 +02:00
88e9fc3e22
Remove unneccesary include (now handled by libpbd) 2022-06-03 04:52:38 +02:00
226dadbd19
Further reduce DSP load of debug builds
In all years of using these assert()s never triggered. Besides
there are valid_port() tests in other strategic locations that
are not periodically hit in realtime context.
2022-05-06 02:04:55 +02:00
96c138c985
ALSA: prevent excessive slave-device latency updates on underrun 2022-05-04 05:57:52 +02:00
Mads Kiilerich
5b7431f243 wscript: drop unnecessary trailing ";" 2022-04-09 12:16:41 +02:00
Mads Kiilerich
bac32a8c2d wscript: consistently use 4 spaces for indentation 2022-04-09 12:16:40 +02:00
Mads Kiilerich
06f8936a73 wscript: remove trailing whitespace 2022-04-09 12:16:37 +02:00
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
Mads Kiilerich
8bb91099c5 wscript: drop configure statements already present in the top level wscript
Avoid repeated pointless configure messages like:
Checking for 'g++' (C++ compiler!)                   : /usr/lib64/ccache/g++
Checking for 'gcc' (C compiler)                      : /usr/lib64/ccache/gcc
2022-01-22 22:19:03 +01:00
Houston4444
36a2fb1ba8
JACK: re-create backend when re-connecting to the server
This updates the client-name when re-connecting to the
server, which is apparently useful with NSM.
2021-12-04 14:39:22 +01:00
a393f75694
Use shared port engine MIDI event compare operator 2021-11-30 19:41:39 +01:00
83225886a1
Fix gcc4 builds ('EEXIST' was not declared in this scope) 2021-11-15 19:12:00 +01:00
79330f909e
Work around connection loss when re-starting JACK backend
If connecting ports using the port-engine fails,
ardour forgets the connection.

Internal backends only produced an error if a port was already
connected, when using ::connect (handle, other), but
ignore already existing connection when using port-names.

Various ports are connected twice when the engine connects
at session load. This worked fine for as long as the engine
was never stopped (saving the session asks the port-engine),
but failed when the engine went away and internal representation
is used.
2021-11-01 23:11:41 +01:00
8bada4b5e1 remove public ::bbt_at (INTEGER) methods, because of superclock_t/samplepos_t confusion
libtemporal still needs ::bbt_at (superclock_t) fairly often so retain it as a private method, but public
interfaces take either Beats or timepos_t
2021-08-13 12:51:35 -06:00
bed76798f3 manual fixups after rebase against master (general libs edition) 2021-08-13 12:51:31 -06:00
79763893b3 remove/hide Session::tempo_map() and use TempoMap::use() instead (thread local shared ptr) 2021-08-13 12:51:30 -06:00
f67029bd02 random commit to facilitate trivial move of work from laptop back to main system 2021-08-13 12:51:29 -06:00
f4490f54c5 change Timecode::BBT_Time to use Temporal namespace, plus a couple of other minor changes to enable compilation
This still uses the tempo map object in libs/ardour, not the new one in libs/temporal, and isn't likely to be functional
(though it could be)
2021-08-13 12:51:28 -06:00
38a4bb6736
Fix prev commit (properly stop pulse) 2021-07-21 05:56:42 +02:00
03a17df68c
Pulseaudio: tweak freewheel recovery
Always cork stream before calling pa_stream_flush.
2021-07-21 05:03:54 +02:00
bf43c8d2d4
Set thread names 2021-06-30 17:15:27 +02:00
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
a9f285b82b debugging timing stats by showing how max values are computed 2021-06-29 09:46:46 -06:00
9d88f370ae debug windows RunLoop timing stats 2021-06-29 09:25:38 -06:00
c2f7b12b0d window compilation fix 2021-06-26 19:02:47 -06:00
fb562ddb61 window compilation fix 2021-06-26 19:02:13 -06:00
74538b7114 window compilation fix 2021-06-26 18:58:23 -06:00
a2974b0c0b portaudio: improved compilation error fix 2021-06-26 12:56:49 -06:00
8bc4464309 portaudio: compilation error fix 2021-06-26 12:51:54 -06:00
7e858b9bda portaudio: add standardized DSP statistics to portaudio backend (uncompiled) 2021-06-26 12:32:23 -06:00
74c93f3ff3 coreaudio: fix dsp stats collection 2021-06-26 11:42:18 -06:00
c7bed1320e adding DSP stats to coreaudio backend (uncompiled) 2021-06-26 11:25:07 -06:00
ad9ac0911e remove some timing stats that it seems unlikely we will use 2021-06-15 14:03:55 -06:00
e511cd2cb7 JACK backend: "fix" RunLoop timing 2021-06-13 11:11:03 -06:00
a5f7c793e3 add a new "Run Loop" timing stats for ALSA and JACK backends 2021-06-13 10:28:51 -06:00
95215ff405 JACK backend: avoid deadlock if a port is unregistered that is not known to Ardour 2021-06-13 07:59:14 -06:00
4c76ff503f measure backend process callback duration in ALSA backend 2021-06-12 15:00:46 -06:00
8afc994177 add some DSP stats to the JACK backend 2021-06-12 09:20:28 -06:00
1777cf8f69 add some initial timing points for dsp stats 2021-06-11 18:55:24 -06:00
a67a475480 dramtically improve performance of ::get_port_by_name() for JACK backend 2021-06-11 10:41:41 -06:00
2c8916310a
Consistent env variable naming (see also 6801c2cac2) 2021-06-10 03:17:49 +02:00
bc4ef3ff3d
Update weakjack, alternative macOS libjack paths
see also https://github.com/x42/weakjack/pull/13
2021-06-02 17:42:01 +02:00
8d471e6761 Remove extraneous parentheses (Wparentheses-equality) 2021-05-30 20:09:35 -04:00
df0571892f Coreaudio: fix duplicates in device list
This is an edge-case only, some devices may
dis and reconnect with different IDs.
2021-05-29 17:54:39 +02:00
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
6801c2cac2
ALSA: add option to prefer interleaved access 2021-05-15 23:10:14 +02:00
e2bac27885
Remove unused API 2021-05-15 23:09:21 +02:00
5957e14259
Remove unused #include<> (2/2)
PBD::stacktrace() is not used nor needed by default.
It should be used sparingly.
2021-05-05 17:57:16 +02:00
438b1e5eab
Cont'd work to improve macOS rt priority 2021-05-02 20:24:10 +02:00
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
cc7b8b1bc5
gcc-11 compat, volatile atomic variables (1/2)
"While 'atomic' has a volatile qualifier, this is a historical
artifact and the pointer passed to it should not be volatile."

Furthermore "It is very important that all accesses to a
particular integer or pointer be performed using only this API"
(from https://developer.gnome.org/glib/2.68/glib-Atomic-Operations.html)

Hence initialization of atomic variables is changed to also use
this API, instead of directly initializing the value.

This also fixes a few cases where atomic variables were
accessed directly.

see also libs/pbd/pbd/g_atomic_compat.h
2021-03-22 15:30:07 +01:00
John Emmas
a2b1482cad Fix a problem with ASIO buffer sizes on Windows
PortAudio uses what it calls 'default suggested latencies' but in callback streaming mode, they can result in wildly inaccurate buffer sizing (e.g. the user requests a buffer size of 128 but PortAudio actually instructs ASIO to use a much bigger size).

What we do now is to improve PortAudio's suggested latency calculation by basing it on the actual buffer size requested by the user.
2021-03-18 16:12:28 +00:00
291de1d277
Fix OSX and non GCC builds 2021-03-01 16:20:38 +01:00
7195ca20e0
Update weak_libjack - https://github.com/x42/weakjack/
This fixes an issue with recent MSVC causing a compile-error
due to __attribute__((constructor))
2021-02-28 16:27:22 +01:00
ace11bd243
Consistency: replace "x-run" with "xrun" (1/2) 2021-02-26 22:22:08 +01:00
John Emmas
d2cb383965 MSVC changes to support the new code modules (Tabbable API stuff) 2021-02-24 14:32:23 +00:00
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
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
f0a89c4f1d
ALSA: allow to select clock-source when using multiple devices 2021-01-24 18:23:37 +01:00
8426bb3aaf
ALSA: explicitly list millisecond buffer-sizes 2021-01-22 16:07:33 +01:00
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
cff58bd9da
ALSA: Fix slave device lookup 2021-01-22 16:07:24 +01:00
c5b986f420
ALSA: set pretty port names for audio I/O 2021-01-18 03:18:21 +01:00
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
0c81ba33d2
JACK latency compensation for newly created tracks #8472
Ardour native backends trigger a latency-callback when ports_changed.
This was lost for JACK when the shared port engine was implemented.
2021-01-14 03:22:25 +01:00
5e76d63c06
Resolve some Xcode12 C++11, sigc++ issues 2020-12-12 04:46:22 +01:00
60901d26b7
ALSA: improve debug output 2020-12-03 21:29:21 +01:00
80e3c191e4
Pulseaudio: allow steam being suspended during export
When exporting long sessions with freewheeling, pulseaudio
may meanwhile suspend the corked audio device. The "FAIL_ON_SUSPEND"
option then prevents ardour to uncork it after export, and the
audio-backend is halted.
2020-11-22 21:41:47 +01:00
81862f8c30
Allow to move pulse stream #8467
This potentially breaks various assumptions (e.g. no resampling,
fixed buffersize) when the stream is moved to a different device.
Then again it's pulseaudio, which is unsuitable for pro-audio to
begin with.
2020-11-11 15:59:26 +01:00
bb468ee4de
Update jackd.exe registry key
This ensures compatibility with upcoming jack > 1.9.16,
current jack 1.9.16, as well as older versions.
2020-11-09 20:06:49 +01:00
c87ef15e82
ALSA: configure capture settings before playback
This fixes an issue with some soundcards e.g. "AxeFx III".
Device configuration fails unless set_hwpar() is performed
for the capture device before configuring the playack
device (half duplex is fine, too).
2020-11-04 14:46:49 +01:00
cf0904f752
Handle vfork/exec failure
Don't call atexit, exit without cleanup.
2020-10-31 22:33:10 +01:00
a9bd7b2848
Remove unused compile-time option to not use vfork 2020-10-31 22:30:45 +01:00
7896c30508
Fix cmdline parameter escape 2020-10-31 13:42:14 +01:00
John Emmas
40ed19767a In a Windows build, support launching both older and newer versions of Jack (Stephane's + Filipe's) 2020-10-31 08:01:55 +00:00
John Emmas
5c06fdf1de In an MSVC build, modify our VC project to use weak Jack
(needed to support Jack v1.9.16)
2020-10-31 07:59:09 +00:00
f7cc5e1f38
Search for JACK on windows using the registry 2020-10-24 04:01:54 +02:00