Commit graph

182 commits

Author SHA1 Message Date
Paul Davis
a486fba3e9 std::atomic - 2nd batch of changes to convert from glib to std::atomic 2023-03-24 14:19:15 -06:00
Paul Davis
4ba4cd69ff switch from glib atomic to std::atomic (libs edition) 2023-03-24 14:19:15 -06:00
Paul Davis
b35518e212 switch from boost::{shared,weak}_ptr to std::{shared,weak}_ptr
This is mostly a simple lexical search+replace but the absence of operator< for
std::weak_ptr<T> leads to some complications, particularly with Evoral::Sequence
and ExportPortChannel.
2023-03-24 14:19:15 -06:00
Paul Davis
39ed528e25 std-ize: convert all boost shared/weak ptr includes to <memory>
Also fix stdint.h -> cstdint and alphabetically order std includes
2023-03-24 14:19:15 -06:00
Robin Gareus
b77eedf53e
Suggest WinMME as default (enable MIDI by default) 2022-07-11 21:45:55 +02:00
Robin Gareus
64f9829b56
AudioBackends: ignore setting latency of invalid port(s) 2022-06-24 19:55:17 +02:00
Robin Gareus
35612d26c6
Unify ::get_buffer, remove debug code 2022-06-18 22:54:09 +02:00
Robin Gareus
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
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
Robin Gareus
a393f75694
Use shared port engine MIDI event compare operator 2021-11-30 19:41:39 +01:00
Paul Davis
a9f285b82b debugging timing stats by showing how max values are computed 2021-06-29 09:46:46 -06:00
Paul Davis
9d88f370ae debug windows RunLoop timing stats 2021-06-29 09:25:38 -06:00
Paul Davis
c2f7b12b0d window compilation fix 2021-06-26 19:02:47 -06:00
Paul Davis
fb562ddb61 window compilation fix 2021-06-26 19:02:13 -06:00
Paul Davis
74538b7114 window compilation fix 2021-06-26 18:58:23 -06:00
Paul Davis
a2974b0c0b portaudio: improved compilation error fix 2021-06-26 12:56:49 -06:00
Paul Davis
8bc4464309 portaudio: compilation error fix 2021-06-26 12:51:54 -06:00
Paul Davis
7e858b9bda portaudio: add standardized DSP statistics to portaudio backend (uncompiled) 2021-06-26 12:32:23 -06: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
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
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
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
3d166c7789
Consolidate stack-size and priority of rt-threads 2020-04-23 01:28:58 +02:00
Paul Davis
78a66b7180 improved port cleanup as backend is destroyed 2020-04-07 23:26:51 -06:00
Paul Davis
32734ce53c fix portaudio backend to use shared_ptr 2020-04-07 16:00:22 -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
6a6b3f2703 fix another iterator type 2020-04-02 19:45:31 -06:00
Paul Davis
cb4997f4a4 fix iterator type 2020-04-02 19:45:31 -06:00
Paul Davis
af69ac1285 use clear_ports() 2020-04-02 19:45:31 -06:00
Paul Davis
6cdc245967 fix header name 2020-04-02 19:45:31 -06:00
Paul Davis
7fc5a6c971 initial try (not compiled) of PortAudio backend using PortEngineSharedImpl 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
e0d5c1426c
NO-OP: fix some Wimplicit-fallthrough
gcc can recognize various regexps in comments. Since C++17 provides
[[fallthrough]], using /* fallthrough */ consistently seems
appropriate until we switch to C++17.

see also https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
2019-09-18 17:37:54 +02:00
Robin Gareus
47a62b2850
Update backend GPL boilerplate and (C) from git log 2019-08-03 15:53:16 +02:00
Robin Gareus
076e9fddd4
Remove ambiguous API implementation
* PortEngine::available() implementation
* AudioEngine::connected() wrapper

Eventually we may re-introduce PortEngine::available along
with a libardour internal port-engine.
2018-11-28 15:32:40 +01:00
Robin Gareus
070f370e40 Fix copy/edit in e047b01aa2 2018-10-18 15:07:45 +02:00
Paul Davis
e047b01aa2 add new API for retrieving port flags from backend 2018-10-17 14:11:37 -04:00
Robin Gareus
e39a8b90d9 amend ab3889ff: portaudio backend uses a vector for connections 2017-09-23 01:06:10 +02:00
Robin Gareus
ab3889fff8 Propagate Latency to backend/system ports
Set accumulated capture-latency for physical-outputs
and accumulated playback-latency for physical-inputs
after Ardour is done setting all non-physical port latencies.

This will be needed for latency-compensation of the complete graph.
2017-09-23 00:34:01 +02:00
Paul Davis
30b087ab3d globally change all use of "frame" to refer to audio into "sample".
Generated by tools/f2s. Some hand-editing will be required in a few places to fix up comments related to timecode
and video in order to keep the legible
2017-09-18 12:39:17 -04:00
Robin Gareus
7258c6334d Namespace PBD::RingBuffer
class RingBuffer<> is a very generic name and should not pollute the
global namespace.
2017-09-16 16:37:29 +02:00
Robin Gareus
467c801ce8 Abstract definition of rt-scheduler policy
pthread-w32 does not support pthread_setschedparam() with
SCHED_FIFO and bails out. While pthread_create() simply ignores the policy
and sets the priority regadless.

This only affects ctrl-surface event-loops & AutomationWatch on Windows.
2017-08-29 20:35:36 +02:00
Robin Gareus
df659e91f1 Consolidate _realtime_pthread_create() into libpbd. 2017-08-29 17:25:23 +02:00
Robin Gareus
26dc287c00 Fix non-buffered PA backend. Wait for backend to become active
This hopefully fixes an issue with port-registration (new session)
being skipped because PortAudioBackend::available() still false
until the first callback.
2017-08-07 23:23:39 +02:00
Robin Gareus
fd6377a5af PortAudio: skip process callbacks until ports are established 2017-08-07 19:27:37 +02:00
Robin Gareus
fde07d4f4f amend bc46a7e2e9; fix blind coding typos 2017-08-05 16:17:31 +02:00
Robin Gareus
bc46a7e2e9 PortAudio backend RT-safe MIDI buffer allocation 2017-08-05 15:36:36 +02:00
Robin Gareus
2b7c585dba Update backend API: read-only MIDI input buffers 2017-08-05 15:36:36 +02:00