Commit Graph

436 Commits

Author SHA1 Message Date
Ben Loftis 29dc388bbc triggerbox: change bang/unbang semantics. UnBang != Stop
'unbang' is better described as a mouse-up or button-release event

* if launch-style is Gate or Repeat, then UnBang will stop the playing clip
* in other launch-styles, UnBang is ignored

some prior code using UnBang will change to
  stop_quantized()  or  request_stop()
2022-10-01 09:13:14 -05:00
Ben Loftis 07f47ff6a5 remove unimplemented bang_trigger() and replace with bang_trigger_at(n)
normally we operate on TriggerPtr's which are a safe way to track
 trigger lifetime, safely modify their properties, and launch them.

bang_trigger_at() is a convenience function to look up a trigger by index,
 and launch it, in one step.  Potentially useful for control surfaces.
2022-10-01 09:13:14 -05:00
Paul Davis b2145521d9 triggerbox: handle tempo map changes better inside and around MIDI triggers
We now try to get to the right location within the MIDI data and continue
playing, rather than pretending that we reached the end.

This also fixes a thinko that caused only the first few notes of a
MIDI trigger to play.

This may also solve cases where due to length, sample rate and tempo
settings, a trigger finished precisely on a ::run() call boundary.
2022-09-30 17:23:41 -06:00
Paul Davis 6ff57ca37b improve accuracy of DEBUG_TRACE output 2022-09-26 16:40:08 -06:00
Robin Gareus be096edd8c
Use rubberband 3.0 API if available 2022-09-13 06:44:41 +02:00
Paul Davis 9781c1baca triggerbox: prevent downstream crashes if a tempo map or other change invalidates MidiTrigger iter
The iterator into the model can become incorrect in the sense that it is no longer the correct
next event to play. This can happen at least with a tempo map change, and possible under other
conditions. Catch this when it happens, and act as if we reached the end of the trigger
2022-09-09 09:21:43 -06:00
Paul Davis 406080f1b8 triggerbox: sort-of NOOP - fix null return object in ::get_next_trigger() 2022-08-28 18:58:12 -06:00
Paul Davis aef1adc6f0 triggerbox: implement TriggerBox::peek_next_trigger() 2022-08-28 18:57:39 -06:00
Paul Davis 45144d841e triggerbox: add new "queued" property for Trigger and properly register it
Also register "currently_playing"
2022-08-28 18:56:56 -06:00
Paul Davis f96946d566 remove more debugging output 2022-08-09 12:54:45 -06:00
Paul Davis 5cc28b4024 remove debug output 2022-08-09 12:37:48 -06:00
Paul Davis 1c59a2dff0 triggerbox/route: a cleaner method of ensuring trigger alignment
This change still runs the triggerbox during latency-preroll, but as with the disk reader,
the transport speed argument is set to zero. The triggerbox notices this and behaves
appropriately (I think !)
2022-08-09 12:33:37 -06:00
Paul Davis bedb94e534 triggerbox: do absolutely nothing if transport is moving backwards 2022-08-09 12:31:37 -06:00
Paul Davis fab0cacb2c triggerbox: marginally more useful debugging output 2022-08-08 09:13:04 -06:00
Paul Davis 34c6931807 triggerbox: fix up post-locate behavior following fix in Route 2022-08-08 09:13:04 -06:00
Paul Davis 774268ada8 triggerbox: fix use of cues container without checking for content (and drop goto) 2022-08-05 07:15:52 -06:00
Paul Davis 32d99aa64f triggerbox: convert fast forward (and other) cerr output to DEBUG_TRACE 2022-08-03 17:15:58 -06:00
Paul Davis dc5737a3bf replace INT32_MAX with CueRecord::stop_all (libs) 2022-08-03 11:42:51 -06:00
Paul Davis c25e96b545 triggerbox: rework fast_fwd code into a simpler design
Rather than start at zero, we now search backwards for the first relevant cue
before the locate position, making our task in ffwd'ing from there much simpler
since there are no other cues to consider
2022-08-03 11:00:37 -06:00
Ben Loftis 22faf6f426 fix transport-freeze in some cases of MIDI cue ffwding
* there are rare cases where a midi clip would not advance the ffwd position, looping endlessly
* this problem did not occur when the user chose an explicit Follow Length (different code path)
2022-08-01 14:52:16 -05:00
Robin Gareus e04311b647
Work around cleanup unused regions removing trigger-regions
This workaround bypasses RegionMap and SessionPlaylist APIs
(region_use_count, destroy_region) which are not directly
applicable to Triggerboxes. There are likely various edge
cases until TriggerBoxes integrate with Session Playlist.

e.g. whole file regions generated for regions/source used by
triggerboxes are cleaned up.
2022-08-01 20:48:02 +02:00
Paul Davis 371f386b8b improve comment accuracy 2022-07-29 14:04:28 -06:00
Paul Davis 81f22662c0 some more logic changes to triggerbox fast forward to try to make it reliable 2022-07-29 14:04:28 -06:00
Paul Davis ae7b39022e triggerbox: improve fast forward behavior
There was a logic error previously which failed to consider follow actions (and follow count).
Now we find a relevant cue, and use follow actions and follow counts as we move forward
in time
2022-07-25 22:02:12 -06:00
Paul Davis b0b5ec1c89 non-compilable, non-functioning branch to make work on the road possible.
Laptop is already packed
2022-07-25 22:02:12 -06:00
Ben Loftis 82bdddb829 fix Follow-Count widget in clip properties GUI
* add follow_count to all_trigger_props so widget gets updated on selection
2022-07-08 11:10:46 -05:00
Paul Davis 97317f3f86 triggerbox: correct an error in the computation of "frames covered" for audio triggers 2022-07-07 16:45:01 -06:00
Paul Davis 4a30d8cebb NO-OP: add copyright notice 2022-07-07 16:45:01 -06:00
Paul Davis d932d9365f fix crash in a debug build caused by trying to print debug info about a negative time value that will never be used 2022-07-03 16:53:30 -06:00
Paul Davis 0d9656ef82 use new macros to cleanup #ifndef NDEBUG as much as possible (libs edition) 2022-06-22 13:31:08 -06:00
Paul Davis 4ee854e7df fix optimized unused variable warnings 2022-06-22 13:31:08 -06:00
Paul Davis 123cc92fff fix may-be-used-unset warning 2022-06-22 13:31:08 -06:00
Paul Davis 7436a110dc fix optimized unused variable warning 2022-06-22 13:31:08 -06:00
Robin Gareus 7e039d4f3f
Cleanup: retain sources used by triggers in this session
Note that ::find_all_sources_across_snapshots() finds and retains
all sources in the SourceList of other snapshots regardless
if they are used in those snapshots.
2022-06-16 20:03:58 +02:00
Paul Davis 5567f30213 triggerbox: output information rather than abort 2022-06-10 13:01:56 -06:00
Paul Davis 6bef80ae60 triggerbox: use regular transport request mechanism to get transport started
if a slot becomes active, and the transport is not rolling, it still
asks the transport to roll. however, (1) there's only 1 request across
all triggerboxen (2) the request will not be handled till the next
process cycle (3) the triggerbox returns after the request i.e. it
waits until the transport is rolling
2022-06-10 11:59:12 -06:00
Robin Gareus 5658e18815
Fix occasional crash at end of clip playback
Previously it was possible to cause a 64bit signed to 32bit
unsigned overflow. `from_stretcher` is pframes_t aka. uint32_t.
With int64_t arguments a std::min() expression producing negative
result will result in large 32bit values:

(pframes_t) std::min<int64_t>(1024, 176400 - 187392) = 4294956304

This produced a segfault when used as n_samples to copy in
buf.accumulate_from()
2022-05-29 23:35:51 +02:00
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