Commit graph

106 commits

Author SHA1 Message Date
Robin Gareus
f589aedcfe
Fix Windows builds (pthread_t) 2023-05-04 21:13:17 +02:00
Robin Gareus
617caf9e98
CPM: precent concurrent protocol activision
This can happen when a device is already connected
while Arodur is stating. The butler thread may activate it
(immediately post-engine), while the GUI thread tries
to do the same later when restoring state.
2023-05-04 18:44:02 +02:00
Robin Gareus
34ec1e57ac Fix macOS builds (libusb_hotplug_event parameters) 2023-05-04 02:49:33 +02:00
Robin Gareus
97272481b8
CPM: Activate hotplugged libusb ctrl-surface 2023-05-04 00:20:31 +02:00
Robin Gareus
161d82869a
CPM: Implement automatic ctrl-surface activision 2023-05-04 00:20:15 +02:00
Robin Gareus
65346496f5
Refactor Ctrl Surface API
* reserve "probe" to actually probe for devices
* use separate probe for libusb and MIDI port devices
* use "available" to check if surface can be used
* allow both methods to be NULL
* remove unused ControlProtocolDescriptor* argument

Most surface just return `true` for available.
2023-05-03 15:38:42 +02:00
Robin Gareus
7c02ab9937
CPM: fix locks, do not reacquire descriptor 2023-05-03 02:05:58 +02:00
Robin Gareus
847f1e54c1
Clean up ctrl surface API
Remove unused fields, no mandatory surfaces
2023-05-01 02:22:45 +02:00
Paul Davis
b0586763ba libpbd: changes to pre-registration of signal emitting threads
There is no need to preallocate request buffers for these threads - the event
loops that require them can allocate them when they discover and register the
pre-registered threads. This also means that event loops do not need to
register request buffer factories.
2023-04-21 13:43:46 -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
7bf89ce109 Constification: make Stateful::get_state() const, with all other required const-ness added (libs) 2022-04-06 21:56:59 -06:00
Paul Davis
d95d10eb55 sort control protocols in name order after discovery 2020-06-01 13:06:23 -06:00
Robin Gareus
1d49696379
Reduce stdout/stderr clutter, prefer DEBUG_TRACE 2019-09-05 19:29:19 +02:00
Robin Gareus
9bb2f2bb69
Prevent duplicate Ctrl-protocol instances
ControlProtocols are single instance.

Activating an already active protocol leads to crashes due to
various rasons (e.g. port already registered), re-used singleton
event_loop_name and request-buffers, duplicate free of
AbstractUI request buffers during deactivate,..
2019-09-05 18:59:26 +02:00
Robin Gareus
a22f918d9d
Update libardour GPL boilerplate and (C) from git log 2019-08-03 15:53:16 +02:00
Johannes Mueller
6d4d4ccc78 Fix crash when destroying session while control protocol is selected in preferences
The GUI should be notified about the tearing down of the control
surfaces *before* the protocols are actually destroyed.

On ProtocolStatusChange ControlSurfacesOptions::selection_changed() might try
to access protocol->has_editor() of a protocol that happens to be selected in
the preferences GUI. I this protocol already has been destroyed, a crash will
occur.
2019-04-17 13:53:45 +02:00
Robin Gareus
b6b353d452 Handle generic-midi bindings per session.
This allows to special-cases session-specific control-surface state.
e.g. midi-learn.

Only restore midi-learned, session-specific, bindings when loading a
session with generic-midi enabled.

Also dis/re-enable generic-midi resets midi-learned, but no other
session-independent settings.

This also handles the edge case:
 1) load global config, generic-midi = ON, w/ bindings.
    state is remembered as cpi->state
 2) load session-condig, generic-midi = OFF, cpi->state is retained
 3) user enables the surface, cpi->state from (1) is applied.
 -> invalid bindings applied -> fail
2018-10-04 02:30:21 +02:00
Robin Gareus
9df6e334fc Persistent ctrl-surface state
Keep latest surface configuration, regardless if surface is active
or being deactivated. Current state after de-activation is retained.

Currently state loaded from a session overrides global state from
global preferences, if the surface is marked active in the session.
This is to allow midi-learn.

generic-midi and session-specific midi-learn will require additional
work.
2018-10-04 01:36:51 +02:00
Robin Gareus
515bd5ad4d Remove some debug output 2017-08-06 14:48:18 +02:00
Robin Gareus
d0c934a9de Fix crash when cleaning up w/o destroying session
- Control-protocols may transmit data during cleanup
 (e.g. reset surface), and need the Audio-engine to do so.
- destroying the ControlProtocolManager w/o the Session calling
 ::drop_protocols(), lead to a double free.
2017-08-03 19:25:14 +02:00
Paul Davis
ae837b49ed semantically more correct ordering of previous commit 2017-06-10 12:04:27 -04:00
Paul Davis
0f20819c86 linker-agnostic version of recent commit to get ControlProtocol selection state set correctly 2017-06-10 11:53:37 -04:00
Paul Davis
d0307e10c9 set first selected stripable for control protocols before they are instantiated 2017-06-09 17:55:11 -04:00
Paul Davis
b23d7d9170 change ControlProtocolManager protocol mutex into a RW lock.
Probably not gaining much in terms of contention, but there's really no reason to be using a mutex
2017-05-12 20:09:40 +01:00
Paul Davis
7021d02782 don't actually use a method from libardourcp inside libardour; use a PBD::Signal to avoid linker issues 2017-05-12 17:49:09 +01:00
Paul Davis
eb3f50e15c change the way ControlProtocols (control surfaces) are notified and handle Stripable selection changes
The Editor continues to notify them, but via a direct call to ControlProtocolManager, not a signal.
The CP Manager calls the ControlProtocol static method to set up static data structures holding
selection info for all surfaces and then notifies each surface/protocol that selection has changed.
2017-05-12 14:51:39 +01:00
Robin Gareus
44cec18516 Retain state of disabled ctrl-surfaces 2017-04-21 04:08:08 +02:00
Robin Gareus
661d258687 Fix adeadlock (or rather NDEADLCK)
ControlProtocolManager::set_state() already takes the protocols_lock.
However effectively this is a NO-OP. During ::set_state no CPI should
be instantiated and  ControlProtocolManager::teardown() returns early.
2017-04-21 04:08:05 +02:00
Robin Gareus
7d5b7d538e Notify GUI when tearing down ctrl-surfaces 2017-04-21 02:53:51 +02:00
Robin Gareus
c8aa78af07 Prefer boolean over literal 2017-04-19 12:51:11 +02:00
Tim Mayberry
9f43d94d07 Use XMLNode::get/set_property API in ARDOUR::ControlProtocolManager 2017-04-19 09:36:50 +10:00
Paul Davis
8fb8e1bbde make ControlProtocolManager actually handle control protocols that fail to activate 2016-11-03 20:24:09 +00:00
Paul Davis
6946bdc083 send a slightly more useful message if a control protocol's probe() method fails 2016-09-27 14:59:31 -05:00
Paul Davis
4991bf5a1a push2: working bidirectional communication, some transport control/display (LED only); some scrolling 2016-09-27 14:59:29 -05:00
Robin Gareus
eec294a97e the endless quest to plug memory leaks -- episode 378 2016-07-25 17:16:32 +02:00
Paul Davis
cf52d6e4b4 enough with umpteen "i18n.h" files. Consolidate on pbd/i18n.h 2016-07-14 14:45:23 -04:00
Paul Davis
17ace643e4 OMNIBUS COMMIT: prefer const XMLNode::property method (and provide a real one) 2016-05-04 23:09:45 -04:00
Paul Davis
b5ed8495fb remove debug output 2016-01-01 06:58:56 -05:00
Paul Davis
b390d8c8a6 possible extra housekeeping for control protocol modules.
Currently this code isn't reached because we never call ControlProtocolManager::teardown() on inactive protocols. But at some point it might be appropriate to unload modules (.so/.dll/.dylib) even if the protocol was never instantiated
2015-12-30 04:11:14 -05:00
Paul Davis
2c6d92ec96 safer housekeeping for control protocol descriptors 2015-12-30 03:51:00 -05:00
Robin Gareus
75021abfd6 some good practice. 2015-12-30 00:45:24 +01:00
Robin Gareus
d58f68ae97 fix control surface discovery crash:
On OSX unloading a module deletes all references to it and
the descriptor becomes invalid.
2015-12-30 00:41:33 +01:00
Paul Davis
6a8b8c8523 add check for descriptor when deciding whether to register a control surface request buffer factory 2015-12-29 05:20:50 -05:00
Paul Davis
0d9efc1148 redesign cross-thread registration/signalling system
This new design will work even when threads that need to receive
messages from RT threads are created *after* the RT threads. The
existing design would fail because the RT thread(s) would never
be known the later created threads, and so signals emitted by the
RT thread and causing call_slot() in the receiver would end up
being enqueued using a lock-protected list. The new design ensures
that communication always uses a lock-free FIFO instead
2015-12-28 10:14:17 -05:00
Robin Gareus
22b07e0233 NOOP, remove trailing tabs/whitespace. 2015-10-05 16:17:49 +02:00
Paul Davis
4dc63966f0 globally remove all trailing whitespace from ardour code base.
Paul Davis was responsible for introducing almost all of this.
2015-10-04 14:51:05 -04:00
Paul Davis
3bc7f863ca explicitly drop control surface protocols before disconnecting from engine.
This is not bomb/thread proof yet, because it still requires at least one process callback to function
2015-10-02 22:08:14 -04:00
Tim Mayberry
8d0cba3384 Use PBD::find_files_matching_pattern instead of other variations 2014-06-25 12:40:10 -04:00
John Emmas
0daae2ec91 When finding the control surface DLLs (MSVC built), make sure we only find ones that match our build target 2014-03-21 14:54:21 +00:00
John Emmas
75c55b0aa0 Transfer 'control_protocol_search_path()' into 'libs/ardour/search_paths.cc' 2014-03-10 16:24:05 +00:00