Commit Graph

399 Commits

Author SHA1 Message Date
Paul Davis c1f92861c6 triggerbox: fix responses to "Play Cues" button being clicked
Session handles the case when the button is used to enable cue triggering, by
forcing a locate to the current transport position.

TriggerBox now connects to the correct configuration object to notice when cue
triggering is disabled, and sets _cancel_locate_armed appropriately.
2022-05-27 23:05:34 -06:00
Ben Loftis 0cfbc64e54 triggerbox: given no other info, assume a clip is 1,2,4,8 or 16 bars at 4/4
this solves the oft-recurring problem where we assign
 a beat-count of '3' or '7' because minipm  mis-detected the tempo,
 and that situation is vanishingly rare.  it's better to assume 4 or 8

the user always has the option to change the number of beats (and
 therefore the detected tempo) manually, for those clips that are
 in a different time signature.  but minibpm cannot be expected
 to help us there.

NOTE: this is a fallback to make things 'just work' lacking any other context.

* if the tempo is detected in the filename, we use that instead
* clips that were recorded to the timeline use that bpm+timesig
* in the future we can use file-metadata (acidized wave?) instead
* this is audio-only: midi files can have an embedded timesignature

but... given no other information, experience says the vast majority
of downloaded/purchased clips will be 1,2 or 4 bars at 4/4.
2022-05-14 14:16:21 -05:00
luz paz 78f1205806 Fix typos in source foward(s)->forwards(s)
Fix source typos
2022-05-12 10:15:15 -04:00
luz paz 1e640563d6
Fix source comment typos in `libs/ardour`
Found via `codespell`
2022-05-11 00:14:28 +02:00
Ben Loftis 6917a1e836 triggerbox: initialize the follow_length control from the source data length 2022-04-26 09:42:00 -05: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
Ben Loftis ea4a6f6215 triggerbox: d+d: follow count should be carried over as part of the arrangement 2022-03-21 12:07:43 -05:00
Ben Loftis 333e19a2cf triggerbox: patch_changes must also use the ui_state API 2022-03-20 15:36:07 -05:00
Ben Loftis 8cba60bfd4 triggerbox: used_channels must use ui_state API (see prior commits) 2022-03-20 15:36:07 -05:00
Ben Loftis 1b08fa1581 triggerbox: commenting the ui_state process 2022-03-20 15:36:07 -05:00
Ben Loftis ca94b63a55 triggerbox: allow-patch-changes should use DIRECT_SET 2022-03-20 15:36:07 -05:00
Ben Loftis 1a3b82a12e triggerbox: TRIGGER_DIRECT_SET should also set ui_state
bugfix: changing the FA state can overwrite the clip's name and color

Some params (like gain) can and should take effect immediately
by directly setting the properties.  TRIGGER_DIRECT_SET does that.
But we still, ALSO have to set the ui_state, because when the
triggerbox imports ui_state via update_properties() it will
overwrite your changes.

Said another way:  since we use a queued ui_state to set the properties,
you ALWAYS have to set and use the ui_state mechanism, even if you want
to short-circuit the process for specific properties.
2022-03-20 15:36:07 -05:00
Ben Loftis 0aabdc0849 remove errant stacktrace 2022-03-19 17:00:09 -05:00
Paul Davis 9f91747ac5 triggerbox: improve speed of TriggerBox::fast_forward() and handle a couple of logic errors
Having identified the trigger that will be running at a given transport position, we determine its effective
length (not necessarily its own length) and last start, then "jump" forward to the next-earliest start
point prior to the transport position. This greatly reduces the amount of actual audio processing we
need to do to prepare the trigger to run in sync at the transport position.

This commit also adjusts the targetted transport position by the processor's playback offset, so that
it is correctly prepared to run() once the transport starts again.

Logic errors when using cue-isolated or empty triggers were also fixed.
2022-03-19 15:25:14 -06:00
Paul Davis e72cff4ab1 triggerbox: reset all trigger states when locating/stopping
We also exclude anything from happening during TriggerBox::run() while locating/stopping
is taking place.
2022-03-17 12:20:34 -06:00
Paul Davis 2b630c4887 triggerbox: add TriggerBox::dump() to check trigger states 2022-03-17 12:20:34 -06:00
Paul Davis 1af0e7cc4f triggerbox: provide ::shutdown_from_fwd() method
This does the internal shutdown of a Trigger that is shared between
a normal shutdown and when stopping for a locate/stop. There's no
output to buffers possible.

This method/design may need to change if/when we add declicking for
various conditions
2022-03-17 12:20:34 -06:00
Ben Loftis 13da06feb9 triggerbox: remove debug messages 2022-03-16 11:21:29 -05:00
Ben Loftis d9773e5788 triggerbox: add PropertyChange::all_trigger_props() 2022-03-15 09:03:40 -05:00
Ben Loftis 0bfa7e1b30 triggerbox: implement allow_patch_changes 2022-03-15 09:03:40 -05:00
Paul Davis a4fd4cdaf0 triggerbox: enhance utility of a fatal message 2022-03-14 14:03:07 -06:00
Ben Loftis 7321248916 triggerbox: do not try to set the {segment} tempo if there is no region
* divide-by-zero was resulting in NaNs in the snapshot file
2022-03-13 19:42:00 -05:00
Paul Davis 81531d5763 triggerbox: improve some commented debug output 2022-03-05 11:49:55 -07:00
Paul Davis 5525c8b667 triggerbox: fix crash when using audio sample esstimated to be less than 1 beat 2022-03-05 11:48:52 -07:00
Ben Loftis 2323b08502 triggerbox: better handling for the special case of tempo=0
* audio files can be named "0bpm" to make them un-stretchable
* however they still need a sensible beatcnt, and therefore tempo
* assume tempo 120bpm and assign a beatcnt based on the file's length
* the user might later enable stretch, and we need to be sensible about it
2022-03-03 16:49:28 -06:00
Ben Loftis 618226d2bb triggerbox: avoid ridiculously small tempo settings for stretch
*this should not be possible after , but just in case....
2022-03-03 16:49:28 -06:00
Ben Loftis 58f2c074a6 triggerbox: fix another case where UIState must be cached to retain settings 2022-03-03 16:49:28 -06:00
Robin Gareus 57bf5be609
Fix use of uninitialized variable 2022-03-01 22:16:01 +01:00
Ben Loftis a1374c7a82 triggerbox: we no longer need to store Triggerbox::estimated_tempo in the snapshot file
* estimated tempo is cached in the SegmentDescriptor
* storing it in the Source's SD allows us to skip minibpm if we find a tempo there
2022-03-01 10:11:14 -06:00
Ben Loftis 2dd078aabe triggerbox: call copy_to_ui_state() after audio|midi state is recalled 2022-03-01 10:11:14 -06:00
Ben Loftis 2821ea7fc6 triggerbox: implement 'replace midi-file PGMs with the triggerbox PGMs"
* intercept {pgm|bank}-change messages, and replace them with triggerbox values
* check is_set() extensively; we have arrays of pgms but most are unused
2022-03-01 10:11:14 -06:00
Ben Loftis b62f5e2cf7 triggerbox: estimate_midi_patches tries to retain patch info across domains
* initialize patches to GM standard (drums on 10) in case file has none
* in the case where file had none, check the Auditioner to see if user set any
* in the case where a file has patches, use those instead

* also stash the UsedChannels so we can show only the used chans in the UI
2022-03-01 10:11:14 -06:00
Ben Loftis e932afaf26 triggerbox: maintain UsedChannels and Patch Change data 2022-03-01 10:11:14 -06:00
Paul Davis 8408d5916c triggerbox: if we find a cue marker, we are no longer locate armed 2022-02-22 22:00:11 -07:00
Paul Davis 4048118926 triggerbox: stop-all-cues cue event now stops all running triggers
This is done regardless of whether or not the trigger was started by a cue or individually
2022-02-21 21:06:17 -07:00
Paul Davis 28db0c1d2b triggerbox: fix logic error in handling of locate-while-playing-triggers 2022-02-21 12:45:13 -07:00
Paul Davis 47bf18101b triggerbox: don't set transition times when we are not transitioning
At some point during code refactoring, we ended up setting up the 3 transition times, intedned
to define when the *previous* transition occured, as we checked to see if a transition
would occur during this ::run() call. This led to (in particular) MIDI clips ending early,
because the transition_beats value was set to the *next* (upcoming) transition, and we used
this to define the timeline position of MIDI events
2022-02-20 11:00:01 -07:00
Paul Davis b9de15d285 triggerbox: split apart semantics of WaitingToStop
This allows for a different quantization to be used when WaitingToSwitch,
used when we explicitly start a different Trigger. When "just stopping"
we continue to use 1 bar quantization; when switching to a different
Trigger we use the quantization of the next Trigger
2022-02-20 09:20:47 -07:00
Ben Loftis b506a243a2 move cue-behavior from rc_configuration to per-session config 2022-02-19 11:48:56 -06:00
Paul Davis 3bfcfe178d triggerbox: some work towards keeping GUI state in sync with "Play Cues"
This still needs some mechanism to request a fast-forward when "Play Cues" is enabled
in a (G)UI thread
2022-02-19 08:53:30 -07:00
Paul Davis a01325c693 triggerbox: NOOP: whitespace cleanup 2022-02-18 18:02:56 -07:00
Paul Davis 1e7ca734d6 triggerbox: reapply change in 9abc4642 with more explanatory comments 2022-02-18 18:01:52 -07:00
Paul Davis 00185aadcf triggerbox: leave a possibly helpful comment 2022-02-18 12:57:14 -07:00
Paul Davis f5ef5f44a3 triggerbox: include change intended to be in cb815bf8d
This properly splits the condition into "before final beat" and
"after final beat"
2022-02-18 12:57:14 -07:00
Paul Davis 66b9bc5c40 triggerbox: alter several DEBUG_TRACE statements 2022-02-18 12:57:14 -07:00
Paul Davis fe76432061 triggerbox: help MIDITriggers find their ends consistently 2022-02-18 12:57:14 -07:00
Paul Davis 19f6a6a739 triggerbox: during fast-forward, if there's nothing to do, set_currently_playing to null
if left non-null, the next TriggerBox::run() method will start the transport
rolling.
2022-02-18 12:57:14 -07:00
Paul Davis 8a36f9fce8 triggerbox: reset _loop_cnt to zero on shutdown
This helps with preventing _loop_cnt incrementing to unintended values.
2022-02-18 12:57:14 -07:00
Paul Davis 4b7c0448e4 triggerbox: remove Playout as a possible state and use a separate bool
A trigger can be in a playout state when we decide to change its
state to WaitingToStop (e.g. due to a cue marker). This design
leaves the playout condition "in effect" despite the state changing.
2022-02-18 12:57:14 -07:00
Ben Loftis fbbe74a530 triggerbox: revert gain() as a queued UISTate value
It's impractical/impossible to set the gain if you have to wait for a retrigger
2022-02-18 11:15:43 -06:00