Commit graph

91 commits

Author SHA1 Message Date
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
Paul Davis
c7bed1320e adding DSP stats to coreaudio backend (uncompiled) 2021-06-26 11:25:07 -06:00
Robin Gareus
438b1e5eab
Cont'd work to improve macOS rt priority 2021-05-02 20:24:10 +02: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
5e76d63c06
Resolve some Xcode12 C++11, sigc++ issues 2020-12-12 04:46:22 +01:00
Robin Gareus
802ddf344a
Remove unused mutex (amend a80064981e) 2020-09-06 05:43:03 +02:00
Robin Gareus
a80064981e
NO-OP: Consolidate PortConnect code into shared parent class 2020-09-05 23:05:57 +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
1e996ca45f add port connect/add/remove callbacks to CoreAudio backend 2020-04-10 10:01:04 -06:00
Paul Davis
78a66b7180 improved port cleanup as backend is destroyed 2020-04-07 23:26:51 -06:00
Paul Davis
ff41232d16 fix CoreAudio backend to use shared_ptr 2020-04-07 13:52:35 -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
30766c75e8 buildable version of CoreAudio backend using PortEngineSharedImpl 2020-04-02 19:45:31 -06:00
Paul Davis
a31d3689bf tentative changes to extend port engine shared impl to coreaudio 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
c365c6cdb2
Set thread-names (libs) 2020-03-29 14:56:22 +02:00
Robin Gareus
140a3f4a10 Fix Coreaudio buffersize changes 2020-03-06 05:52:55 +01:00
Robin Gareus
a9c75f9760
Fix CoreAudio systemic latency, implement hw latency report 2020-02-24 04:24:50 +01: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
Paul Davis
e047b01aa2 add new API for retrieving port flags from backend 2018-10-17 14:11:37 -04:00
Robin Gareus
37df98d0af CoreAudio/MIDI: add locks for port-registration
CoreMIDI ports are dynamic. When dis/connecting a device CoreAudio's
AudioHardware-PropertyListener triggers a callback which can
add/remove ports.

This can not happen concurrently with processing, but it may happen
concurrently with a user creating tracks using Ardour's UI
and/or session-load/setup.
2018-03-29 18:15:20 +02:00
Robin Gareus
c0dbe8eaaf Move coreaudio_set_realtime_policy into libpbd 2017-10-30 16:31:38 +01: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
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
e0a83a758e Redesign Session+Route Template Meta Script API
Remove special-cased script types. Allow Action-Scripts to be re-used
for session-setup or route-templates.
2017-08-18 20:42:55 +02:00
Robin Gareus
8c61c7f14a amend f4c76f89d3; fix blind coding typos 2017-08-05 16:06:15 +02:00
Robin Gareus
f4c76f89d3 Coreaudio 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
Robin Gareus
c125cd2647 Reduce DSP thread priority (main-i/o > midi i/o > computation) 2017-08-05 01:28:11 +02:00
Robin Gareus
38c5e9de6d CoreAudio: Set MachThread RT Priority 2017-08-04 06:25:23 +02:00
Robin Gareus
6b5d374352 Some more assert() debugging 2017-08-03 23:46:05 +02:00
Robin Gareus
f9db9bf5fd Retain order of concurrent MIDI events
This fixes an issue with FaderPort8 (and maybe other surfaces or synths).
2017-04-08 23:43:50 +02:00
Robin Gareus
355fa64c79 fix Coreaudio Aggregate for separate devices with identical names 2016-08-28 13:44:30 +02:00
Robin Gareus
957f59f351 print a warning if CoreAudio falls back to non realtime priority 2016-08-22 17:38:45 +02:00
Paul Davis
cf52d6e4b4 enough with umpteen "i18n.h" files. Consolidate on pbd/i18n.h 2016-07-14 14:45:23 -04:00
Robin Gareus
ac923be7af fix port-sort order for good.
TODO find out how to make std::set::find() work with custom sort order,
as std::find may only be O(N) and not O(log (N)).
2016-07-08 21:37:42 +02:00
Robin Gareus
43e620504a port 93eac8b0 to ALSA and CoreAudio 2016-04-26 18:19:48 +02:00
Robin Gareus
2169de3975 keep portmap & portindex in sync when renaming ports
Fixes crash on session re-load (introduced in 800c8182 and fde99e68)
2016-04-26 02:26:20 +02:00
Robin Gareus
fde99e68f7 ..and CoreAudio. 2016-04-24 20:45:50 +02:00
Robin Gareus
9840a11537 implement metadata-set for remaining backends 2016-04-18 00:35:51 +02:00
Robin Gareus
0fc06b4a1b fix warning message typo 2016-01-11 11:45:44 +01:00
Paul Davis
a9995c59cc coremidi: do not clear port buffer for every call to parse_events()
This was limiting the data flow to 1 MIDI event per process cycle.
2016-01-10 17:46:36 -05:00
Paul Davis
4a99727dea coremidi: be sure to mark _event._pending false after queueing, so that it doesn't get queued up again later 2016-01-09 13:53:17 -05:00
Paul Davis
ef45a6c84b coreaudio: remove debug output 2016-01-08 09:43:33 -05:00
Paul Davis
63cbe11c67 coreaudio: remove debug output 2016-01-08 09:39:55 -05:00