Commit graph

132 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
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
74c93f3ff3 coreaudio: fix dsp stats collection 2021-06-26 11:42:18 -06:00
Paul Davis
c7bed1320e adding DSP stats to coreaudio backend (uncompiled) 2021-06-26 11:25:07 -06:00
Robin Gareus
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
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
17f0b87648
Fix Apple Carbon #define interference 2020-10-11 21:40:31 +02: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
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
1e996ca45f add port connect/add/remove callbacks to CoreAudio backend 2020-04-10 10:01:04 -06:00
Paul Davis
3188fe00aa fix return value 2020-04-08 18:13:13 -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
06b2eb1c27
Explicitly use OSX
Previously this was inherited via PBD.

On MacOS/X,  this adds
  "-undefined dynamic_lookup -flat_namespace"
and various "-framework .." options to linkflags

Without this flag, .dylibs fail to link usually because
of missing `-lintl` (Undefined symbols: "_libintl_dgettext")

On other systems this is a NO-OP:
CFLAGS_OSX, CXXFLAGS_OSX and LINKFLAGS_OSX
are only set on the darwin platform.
2020-01-25 04:07:41 +01: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
2f91bdfa53
NO-OP: <tab> after <space> fixes in libs 2019-04-13 19:19:29 +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
7671268bc3 strlen is not a member of std. 2018-01-03 18:06:55 +01:00
Robin Gareus
4ebcef53f8 Relax max MIDI msg size to 256 (for long sysex)
(win-mme already used 256, CoreMIDI can handle up to 256 as can ALSA)
2017-12-19 17:41:57 +01: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
Robin Gareus
666aa5a557 More Coreaudio SDK fixes, after 30b087ab3 2017-09-19 05:20:05 +02:00
Robin Gareus
1ec471c961 partially revert 30b087ab3, CoreAudio SDK uses "Frames" 2017-09-19 04:47:10 +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
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