13
0
Commit Graph

115 Commits

Author SHA1 Message Date
ab0d2dce6f
Fix reduced channelcount when restarting engine with different device
1. Start engine with a stereo soundcard (n_inputs was set to 2)
2. Restart engine with multi-channel soundcard, n_inputs remained a 2)
2024-07-10 15:39:01 +02:00
d6b14e761b
Remove unused backend channel count config API 2024-07-10 15:39:01 +02:00
dacf488c86
Fix callback order of port-dis/connections
Previously the port-engine was a LIFO. Changes were pushed back
and then popped-back. This causes issues when re-connecting
Transport Masters.

The GUI does the following when changing connections:
1. disconnect all
2. connect to new port

which lead to TransportMaster::connection_handler being called
in reverse order: connect, disconnect, and the transport
master was assumed to not be connected.

--

Now connections queue is a FIFO and code was consolidated.

(Note, we cannot use a std::deque because it does not support
memory pre-allocation with ::reserve)
2023-12-02 23:34:58 +01:00
00b2f5696c
PortAudio: implement MIDI device config 2023-06-18 02:35:03 +02:00
9b797dc4c1
PortAudio: fix latency reporting, disable custom MIDI cfg
This correctly sets audio port I/O latency using the
portaudio API.

Per MIDI device port settings are not completely implemented.
En/disabling MIDI devices or setting custom MIDI port latency
is not functional as-is.
2023-06-17 05:49:11 +02:00
e938d4936f
Further speed up Windows freewheel export 2023-06-05 01:42:24 +02:00
c24b456211
Windows: unconditionally request high timer resolution
Previously timeBeginPeriod() was only called when MIDI
system was set to WinMME. It was also possible that
it was never unset in case starting the engine failed.

This significantly speeds up freewheel export which uses
Glib::usleep(100) when MIDI is disabled.

see also: https://randomascii.wordpress.com/2020/10/04/windows-timer-resolution-the-great-rule-change/
2023-06-05 00:02:54 +02:00
c56313cea0
Fix setting pretty-names when engine is restarted
port-meta-data depends on the audioengine backend/device
settings. Those are only available after the engine is started,
not from within the backend's _start() method.

This is is only relevant for callback based backends.

Backends with a blocking process thread explicitly emit
port-manager callbacks there before entering the main loop.
2023-06-02 00:29:03 +02:00
a486fba3e9 std::atomic - 2nd batch of changes to convert from glib to std::atomic 2023-03-24 14:19:15 -06:00
4ba4cd69ff switch from glib atomic to std::atomic (libs edition) 2023-03-24 14:19:15 -06:00
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
b77eedf53e
Suggest WinMME as default (enable MIDI by default) 2022-07-11 21:45:55 +02:00
64f9829b56
AudioBackends: ignore setting latency of invalid port(s) 2022-06-24 19:55:17 +02:00
35612d26c6
Unify ::get_buffer, remove debug code 2022-06-18 22:54:09 +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
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
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
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
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
a80064981e
NO-OP: Consolidate PortConnect code into shared parent class 2020-09-05 23:05:57 +02:00
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
3d166c7789
Consolidate stack-size and priority of rt-threads 2020-04-23 01:28:58 +02:00
78a66b7180 improved port cleanup as backend is destroyed 2020-04-07 23:26:51 -06:00
32734ce53c fix portaudio backend to use shared_ptr 2020-04-07 16:00:22 -06:00
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
6a6b3f2703 fix another iterator type 2020-04-02 19:45:31 -06:00
cb4997f4a4 fix iterator type 2020-04-02 19:45:31 -06:00
af69ac1285 use clear_ports() 2020-04-02 19:45:31 -06:00
7fc5a6c971 initial try (not compiled) of PortAudio backend using PortEngineSharedImpl 2020-04-02 19:45:31 -06:00
a8ff35accb
Reset DSP load on backend re-start and after freewheeling 2020-03-30 16:58:55 +02:00
47a62b2850
Update backend GPL boilerplate and (C) from git log 2019-08-03 15:53:16 +02:00
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
070f370e40 Fix copy/edit in e047b01aa2 2018-10-18 15:07:45 +02:00
e047b01aa2 add new API for retrieving port flags from backend 2018-10-17 14:11:37 -04:00
e39a8b90d9 amend ab3889ff: portaudio backend uses a vector for connections 2017-09-23 01:06:10 +02:00
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
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
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
df659e91f1 Consolidate _realtime_pthread_create() into libpbd. 2017-08-29 17:25:23 +02:00
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
fd6377a5af PortAudio: skip process callbacks until ports are established 2017-08-07 19:27:37 +02:00
fde07d4f4f amend bc46a7e2e9; fix blind coding typos 2017-08-05 16:17:31 +02:00
bc46a7e2e9 PortAudio backend RT-safe MIDI buffer allocation 2017-08-05 15:36:36 +02:00
2b7c585dba Update backend API: read-only MIDI input buffers 2017-08-05 15:36:36 +02:00
c125cd2647 Reduce DSP thread priority (main-i/o > midi i/o > computation) 2017-08-05 01:28:11 +02:00
6b5d374352 Some more assert() debugging 2017-08-03 23:46:05 +02:00