Commit Graph

399 Commits

Author SHA1 Message Date
Paul Davis c09ffd4fcd triggerbox: consolidate ::start_and_roll_to() across Audio & MIDI triggers
This uses a mild trick to pass both the object and ptr-to-member-function from the child class
to the parent class.

Note: before this commit, both instances of ::start_and_roll_to() were identical.
2022-02-15 16:24:01 -07:00
Paul Davis e75a8ab77c triggerbox: clarify handling of end-of-clip conditions
This doesn't enter Playout state, when the final event matches the predicted
final beat, but also returns the correct number of frames covered
2022-02-15 15:28:01 -07:00
Ben Loftis 9abc4642ed triggerbox: fix midi timing in the case where a note-off arrives exactly at the end of the clip (amends cbbe5) 2022-02-14 21:30:23 -06:00
Paul Davis 8741c4cc5d triggerbox: NOOP - rename template parameter for *_run<bool> to be more clear about its purpose 2022-02-14 18:13:06 -07:00
Paul Davis cb815bf8dd triggerbox: drop useless computation 2022-02-14 18:09:03 -07:00
Paul Davis cbbe595162 triggerbox: fix end-handling of MIDI triggers (again)
If we reach the last event in a MIDI file, the test to enter Playout
is whether the last event is *before* not at or later to our computed
final beat.
2022-02-14 18:07:54 -07:00
Paul Davis 91e7361e08 triggerbox: ensure _currently_playing reflects fast_forward logic
If we decide after fast forwarding that this TriggerBox has no triggers
active at the transport position, we must mark _currently_playing as null,
because otherwise the TB can still start the transport (in error) during
run()
2022-02-14 12:59:24 -07:00
Paul Davis 511b09b3d6 triggerbox: avoid double-accounting for buffer offset in MIDI triggers
Because MIDI triggers compute buffer-relative timestamps using
timeline_samples - start_sample, this already takes into account
any offset to the start of the trigger. We still need to use dest_offset
if a non-zero value was passed into ::midi_run(), but we do NOT
want to have it contain the "offset to start of trigger in process
cycle" as well. Instead of trying to special case
::maybe_compute_next_transition(), we just pass a dummy pframes_t
to that method, leaving dest_offset as it was passed into ::midi_run()
2022-02-14 12:56:18 -07:00
Paul Davis 374fa48fad triggerbox: consolidate position-as-fraction code
Both trigger types now use a process_index and final_processed_sample value
to compute their current position-as-fraction
2022-02-14 09:53:00 -07:00
Ben Loftis e41729d10c triggerbox: remove excess debug printouts 2022-02-12 11:14:12 -06:00
Ben Loftis 8a3b5751fb triggerbox: initialize follow-count more reliably. this way queues a UIState 2022-02-12 11:13:30 -06:00
Ben Loftis ad7db33666 triggerbox: remove redundant code; set_segment_tempo takes care of this later 2022-02-12 11:12:33 -06:00
Ben Loftis 563dc9ae21 triggerbox: setup_stretcher must be called for stretch_mode to have any effect 2022-02-12 11:12:08 -06:00
Ben Loftis 227815ebab fix crash introduced in d8b3 2022-02-12 09:34:42 -06:00
Ben Loftis d8b3fbb94e beatcnt is a derived property from tempo and segment-length 2022-02-12 09:04:48 -06:00
Paul Davis b3ec5df8a8 triggerbox: some additional DEBUG_TRACE messages 2022-02-11 15:22:45 -07:00
Ben Loftis 40a1997c0e triggerbox: reimplement enqueue_trigger_source using a map of UISTate entries
* "Range->Bounce to Trigger Clip" needs to set tempo
* Range->bounce can operate on multiple tracks (regions) in one operation
2022-02-11 15:31:54 -06:00
Paul Davis 1777f9af0c triggerbox: working (?) "stop all cues" cue marker 2022-02-11 13:36:58 -07:00
Paul Davis 98f1b4364d triggerbox: implement function for translatable marker names 2022-02-11 11:33:27 -07:00
Paul Davis 914b2447b8 triggerbox: a cue marker/event with cue-id < 0 means "stop all" 2022-02-11 11:33:06 -07:00
Paul Davis a1384d2789 triggerbox; fast-forward should do nothing if we are not use cue markers 2022-02-11 10:33:11 -07:00
Paul Davis d18426ee95 debug output to show contents of trigger property changes 2022-02-11 10:32:50 -07:00
Paul Davis f7881af554 do not recurse 2022-02-11 10:21:48 -07:00
Paul Davis 008f0d4e4c triggerbox: do not send Trigger property updates while fast forwarding 2022-02-11 10:16:04 -07:00
Paul Davis e14b8a142d triggerbox: a cue marker that refers to an empty slot ends a previously playing slot (in fast forward) 2022-02-11 09:11:43 -07:00
Paul Davis 9f39cca21f remove debug output 2022-02-11 08:47:59 -07:00
Paul Davis 2bf8b7ce11 triggerbox: mostly working fast-forward for MIDI triggers 2022-02-10 19:59:48 -07:00
Paul Davis 771db9e238 NOOP: remove blank lines 2022-02-09 17:26:25 -07:00
Paul Davis f941041805 triggerbox: use C++11 syntax for iteration 2022-02-09 17:26:25 -07:00
Paul Davis 439e112d32 triggerbox: pay attention to the fact that a trigger may have Stopped while fast-forwarding 2022-02-09 17:26:25 -07:00
Paul Davis baacd3bb50 triggerbox: no need to call reset_stretcher() explicitly in ::_startuo()
Trigger::_startup() calls ::retrigger() and that will call reset_stretcher()
2022-02-09 17:26:25 -07:00
Paul Davis 0b5d449686 triggerbox: slightly improved DEBUG_TRACE output for property setters 2022-02-09 17:26:25 -07:00
Paul Davis 0ad90f826e triggerbox: handle realtime part of transport stop explicitly in TriggerBox 2022-02-09 17:26:25 -07:00
Paul Davis 19b844e054 triggerbox: sync ui property state with internal for inactive triggers 2022-02-09 16:34:03 -07:00
Paul Davis beffc7eb7f fix another ordering change introduced during a manual rebase fixup 2022-02-08 21:08:15 -07:00
Paul Davis 93e1b77fe2 fix mistake introduced during rebase fixup 2022-02-08 21:07:07 -07:00
Paul Davis 11042914e1 triggerbox: remove a bunch of cerr output and fix up audio stretcher reinitialization 2022-02-08 20:58:27 -07:00
Paul Davis 629efe29f4 triggerbox: initial implementation of start_and_roll_to () for AudioTriggers.
This also required a mechanism to prevent the fact of a non-null "currently_playing" value in
the TriggerBox from starting the transport, which is handled with Triggerbox::_locate_armed. This
is set when _currently_playing is set from TriggerBox::fast_forward()
2022-02-08 20:58:27 -07:00
Paul Davis e8b6728d2e triggerbox: fix looping of MIDI triggers
Problems were caused by a variety of interlocking errors.
DEBUG_TRACE() output has also been enhanced and added.
2022-02-08 20:57:32 -07:00
Paul Davis f77e9aa6c8 triggerbox: architectural changes to facilitate fast-forward 2022-02-08 20:57:32 -07:00
Robin Gareus 19a4f6a437
Fix restoring Trigger state 2022-02-09 02:30:40 +01:00
Robin Gareus 5f84209c30
Add API to ignore PC per TriggerBox 2022-02-09 02:30:40 +01:00
Ben Loftis 54b3a3bf6b less marimbas! 2022-02-07 19:43:34 -06:00
Robin Gareus 77bca98fc0
Revert "Triggerbox: revert test-code"
This reverts commit 220b1386ab.
because it causes crashes when saving sessions.

_channel_map[] must not be empty, otherwise

Program terminated with signal SIGSEGV, Segmentation fault.
snprintf (buf, sizeof (buf), "%d", _channel_map[chn]);
#0  ARDOUR::MIDITrigger::get_state() (this=0x55d676b4c600) at ../libs/ardour/triggerbox.cc:1962
#1  0x00007f58ccb40b12 in ARDOUR::TriggerBox::get_state() (this=0x55d676b4d720) at ../libs/ardour/triggerbox.cc:33
2022-02-05 19:19:37 +01:00
Ben Loftis 220b1386ab Triggerbox: revert test-code 2022-02-04 21:48:45 -06:00
Robin Gareus 18207c6896
Fix Triggerbox empty(), active-slots count on session load 2022-02-04 01:40:54 +01:00
Paul Davis 3c2fdab1ce triggerbox: add Properties::channel_map (and sent it); save/restore channel map state (untested) 2022-02-03 13:07:04 -07:00
Paul Davis bce4eb36ad triggerbox: add MIDITrigger channel mapping 2022-02-03 12:37:49 -07:00
Paul Davis ead02f50b1 triggerbox: save/restore state for assigned patch changes in MIDITrigger 2022-02-03 09:24:30 -07:00
Paul Davis fd3d17562c triggerbox: do not send embedded patch change events if Trigger has its own 2022-02-02 16:05:17 -07:00
Paul Davis c7b8faad5a MidiStateTrack: use correct hex values to manage set/unset state 2022-02-02 15:06:11 -07:00
Paul Davis 6175af002c triggerbox: MIDITriggers get 16 patch changes, 1 per channel
These can be set, fetched and queried but at this point they do nothing
2022-02-02 15:06:11 -07:00
Paul Davis 0b395c161d triggerbox: apply gain to MIDI note events 2022-02-02 09:58:57 -07:00
Paul Davis fec679c602 triggerbox: refactor ::maybe_compute_next_transition() so that we can use the same code when fast-forwarding 2022-02-01 19:55:37 -07:00
Paul Davis f5d5ecffbb triggerbox: change note tracker to a full state tracker, and move it up to the TriggerBox
We don't need one state tracker per trigger, one per box is more appropriate
2022-02-01 18:06:40 -07:00
Paul Davis 8e4fdb071b triggerbox: keep track of, and make available, "empty" status for a triggerbox.
Includes PBD::Signal that notifies when a TriggerBox's empty status changes
2022-01-31 22:40:05 -07:00
Robin Gareus b55ef8543d
Fix compilation of triggerbox.cc (amend ca6c99586f) 2022-02-01 03:50:23 +01:00
Paul Davis ca6c99586f triggerbox: minor arithmetic fix to help with clicks at clip end
process_index should not be compared/combined with expected_end_sample, since
the former is a process-cycle count and the latter is a timeline position.
2022-01-31 15:57:13 -07:00
Paul Davis d43e2c25bc triggerbox: remove passthru property and everything related.
TriggerBox is always a passthru processor now. Monitoring (or not) is intended
to be controlled via other means
2022-01-30 13:37:52 -07:00
Ben Loftis 4450b5be2c triggerbox: potentially useful comment about the process of slot property-setting
* first the region is scanned for bpm and one-shot status
* then we handle properties that should be applied from a drag&drop
* then we handle the existing arrangement-style slot properties that should persist
2022-01-30 13:44:41 -06:00
Robin Gareus 7eb53828a9
Do not warn about TB sidechain connection when preference is unset 2022-01-27 23:04:30 +01:00
Ben Loftis 7a3624af6f TriggerBox: copy over a subset of user-settings into a dropped slot using a static variable (@robin) 2022-01-27 13:22:46 -06:00
Ben Loftis 3605f51e7e TriggerBox: trigger_by_id searches the box for a trigger with matching pbd::id 2022-01-27 13:15:27 -06:00
Paul Davis 15f0e4dbbf triggerbox: fix cue playback and recording
Somewhat alarmed that gcc (at least) allows if (cue_recording ...) to be
used just like if (_cue_recording) even though the former is a class method
and the latter is a class member.
2022-01-27 11:36:04 -07:00
Paul Davis 0dc19a2b31 triggerbox: allow setting of start to work correctly (for audio triggers) 2022-01-26 21:23:40 -07:00
Paul Davis fdf0c069ca triggerbox: take start offset into account when computing ends 2022-01-26 21:22:40 -07:00
Ben Loftis a274c1473a Triggerbox: Preserve some settings when dragging a new clip into a slot 2022-01-26 17:57:55 -06:00
Ben Loftis b1c04f1108 Triggerbox: Empty slots act as a Stop unless cue_isolated is set (TODO: can we report this to user?) 2022-01-26 17:57:55 -06:00
Ben Loftis 3362f7d4fa Triggerbox: support for files that use a space between bpm value and bpm text 2022-01-26 11:51:08 -06:00
Ben Loftis efb44fc640 triggerbox: barcnt -> beatcnt (libardour part) 2022-01-26 11:51:07 -06:00
Paul Davis f20966cbad triggerbox: formalize setter/getter methods for Trigger properties
These are all defined via macros now. We send PropertyChange notifications when the value is set
even though it may not yet be in use.

This also changes the std::atomic used to protect the UIState<->Properties interlocking to
unsigned, to get defined behavior when the generation counter wraps
2022-01-26 10:12:13 -07:00
Paul Davis 9ac93a4792 triggerbox: sidechain should only process "its" MIDI buffer when looking for events 2022-01-26 07:57:32 -07:00
Paul Davis a7645022e1 triggerbox; fix i/o configuration of sidechain 2022-01-26 07:57:05 -07:00
Paul Davis ccf90a9181 triggerbox: change to a CAS-based mechanism for setting UI-controlled properties
UIs only set a "shadow" value of most trigger properties, and use CAS to interlock (contention
is not expected to ever be an issue, it would imply two UIs being used to control this at
precisely the same time. The actual properties are updated whenever the trigger calls ::retrigger()
2022-01-25 18:07:21 -07:00
Robin Gareus 7128c9958f
Fix crash when duplicating track(s)
Compare to PluginInsert::set_state(). The sidechain must not
inherit the name from the template track. That leads
to port-name ambiguities.

Also later there will be a crash when ::update_sidechain_name()
calls IO::set_name since: _name is not found in _current_name.
2022-01-24 21:25:20 +01:00
Ben Loftis f35cb6da8f trigger page: cue recording should be disabled by default 2022-01-23 20:24:44 -06:00
Paul Davis fd3ddce80a do not play existing cue markers while recording cues 2022-01-21 10:55:55 -07:00
Paul Davis 76f4813ee6 triggerbox: experimentally enable cue recording by default 2022-01-21 10:55:55 -07:00
Paul Davis 9abf6bc260 triggerbox: introduce member var to control cue recording 2022-01-21 10:55:54 -07:00
Paul Davis f63c049d87 triggerbox: add struct and ringbuffer for recording cues 2022-01-21 10:55:54 -07:00
Paul Davis 5ade0927dd remove Other/Any follow action types 2022-01-20 18:56:07 -07:00
Paul Davis b94c5dcec7 remove Next/Prev (Live-style) follow action types 2022-01-20 18:56:07 -07:00
Paul Davis bbdfc5e777 remove FollowAction type "QueuedTrigger" 2022-01-20 18:56:07 -07:00
Paul Davis 90e6107972 triggerbox: left follow action == None means "no follow action at all" 2022-01-20 14:15:45 -07:00
Paul Davis 8ddf057553 triggerbox: fix enum (compiler should have noticed this) 2022-01-20 14:15:25 -07:00
Paul Davis b884f7c534 triggerbox: do not use follow length when (left) follow action is None 2022-01-20 14:03:40 -07:00
Paul Davis 68c87c3f29 triggerbox: fix various errors caused by not setting transition_bbt
In cases where no quantization is done, transition_bbt was not set,
and this led to expected_end_sample being incorrect.
2022-01-20 13:57:47 -07:00
Paul Davis 413f2e9d1b triggerbox: implement (?) JumpTrigger follow action 2022-01-20 11:01:00 -07:00
Paul Davis 95edfbac4a triggerbox: change FollowActions into an object with a target list
Should be no functional changes in this commit, but older sessions will likely not
load.
2022-01-19 15:50:55 -07:00
Ben Loftis 9be853d555 triggerbox: initialize the follow_count value as well as barcnt 2022-01-18 16:33:45 -06:00
Ben Loftis 6cdeed8945 triggerbox: first draft: allow gui access to audio-segment meter and barcnt 2022-01-17 18:04:43 -06:00
Ben Loftis 3e0bb03363 triggerbox: defensive coding changes 2022-01-16 10:57:07 -06:00
Ben Loftis 869a862c86 triggerbox: use_follow_length should be an explicit property
this allows you to enable/disable the follow-length without starting from 0 every time
2022-01-16 10:57:01 -06:00
Paul Davis f339c0b5f9 triggerbox: remove "use follow action" as an explicit property of a trigger 2022-01-14 17:39:27 -07:00
Paul Davis de9322e0d3 triggerbox: cleanup some DEBUG_TRACE statements and convert some debug output to trace statements 2022-01-14 14:39:16 -07:00
Paul Davis 6a6a42c272 triggerbox: another important tweak for trigger behavior
This fixes another code point where we realize that there is nothing to do
within a triggerbox, but we failed to reset _stop_all to false, causing
misbehavior until the next trigger plays to completion with no subsequent
trigger.
2022-01-14 14:37:53 -07:00
Paul Davis 8e9c4f6a67 triggerbox: fixes to get follow length to do what is intended to do
Hard to explain more concisely than the code changes, so please read.
2022-01-14 14:36:38 -07:00
Paul Davis 787a66815d triggerbox: fix initialization warning 2022-01-14 14:35:51 -07:00
Paul Davis 9ccaab5deb working segment descriptor save/restore/set/fetch and use by triggerbox 2022-01-14 12:22:34 -07:00
Paul Davis 6d2a124f5e triggerbox: fix newline in debug trace output 2022-01-14 12:21:56 -07:00