13
0
Commit Graph

33755 Commits

Author SHA1 Message Date
a393f75694
Use shared port engine MIDI event compare operator 2021-11-30 19:41:39 +01:00
dbd8089fb8
Sort concurrent MIDI events on port-level #8828
See also 8dbbc19567 as well as
Evoral::Sequence<Time>::const_iterator::choose_next
ARDOUR::MidiBuffer::second_simultaneous_midi_byte_is_first
2021-11-30 19:41:39 +01:00
e56085b581 triggerbox; quick pass at fixing up MIDI triggers to work with the new scheme (untested)
This also removes the call to the now-removed ::peek_next_trigger()
2021-11-30 07:57:34 -07:00
8fa62eac7a triggerbox: significant redesign of trigger mechanisms
Changes include workarounds for weird Rubberband API (pad, drop, truncate requirements),
and a shift to push logic after a slot is finished back up into the TriggerBox.

Not finished yet, some easily encountered bugs remain
2021-11-29 21:50:29 -07:00
f584335f28 follow Beats API change in MidiRegionView::paste_internal() 2021-11-29 21:50:29 -07:00
940d8844e3 temporal: fix implementation of Beats::snap_to(), and add variants
::snap_to() was intended to round a Beats value to the nearest multiple
of another Beats value. It did not do that, but instead rounded down.
Worse, it used Beats::operator/ which in turn uses int_div_round(),
which is incorrect for a situation where we need integer truncation.

The changes fix the actual arithmetic and add 2 variant functions so that the
API includes round down, round up and round to nearest.
2021-11-29 21:50:29 -07:00
83c7ac4f38 libardour: use Processor::check_active() in all Processors instead of per-processor code
There are a few exceptions where the semantics make this too complex to be worth forcing check_active()
2021-11-29 21:50:29 -07:00
59ac52f113 libardour: provide Processor::check_active() as a standard way to handle Processor::_{pending_,}active 2021-11-29 21:50:29 -07:00
797bc1a162
Correct namespace of constants in some Lua scripts 2021-11-28 21:10:32 +01:00
d3fe3ab866
Fix Lua namespace -- correctly close Tempo.Type 2021-11-28 21:10:29 +01:00
60e522f4ee MIDI Program Changes: Fix some thinkos in patch-change flag locations
Program Changes are stored as an offset from the 'source' start, and must be translated to/from region time.

Better locating of patches wrt the grid:
You can't assume time_to_pixel is steady across the timeline
* calculate position of the patch-change flag
* calculate region start position, and set flag's x offset from there

also: consolidate patch-location code into display_patch_changes()
2021-11-23 14:14:35 -06:00
c27bfde045 MIDI Program Changes: prevent patch-changes from moving after every edit by the dialog.
The clock widget shows absolute time but must be converted to+from source time
2021-11-23 14:14:35 -06:00
5212fc9677 MIDI Program Changes: dragging patches was resulting in the wrong location or disappearing altogether
a Program Change's position is referenced from the midi Source which might not be the same as the region start
2021-11-23 14:14:35 -06:00
878393e68b temporal: fix construction of timepos_t and timecnt_t with max_sample{pos,cnt}
max_samplepos and max_samplecnt and both INT64_MAX which is (a) too large to fit into a signed 62 bit
integer and (b) definitely too large to be represented in a signed 62 bit superclock value.

Move the constructors that use samplepos_t into the .cc file, and treat these two values as special
cases that mean "as large/late/huge/long as possible".
2021-11-22 10:35:52 -07:00
d71b3100d8 temporal: handle negative positional values that somehow appear in older sessions 2021-11-22 10:28:13 -07:00
f112697be8
Spice up signal-test tool 2021-11-21 18:29:38 +01:00
beddcf1a01
Test cross thread invalidation-record
This also tests 2 receivers connected to the same signal
2021-11-21 04:12:27 +01:00
b2f0d31630
Cont'd work on concurrent Signal, Connection destruction
see also 992c727959
and 7580d6aba7

Spin to prevent race between d'tor setting `in_dtor`
and acquiring Signal::_mutex.
2021-11-21 04:12:24 +01:00
992c727959
Cont'd work on concurrent Signal, Connection destruction
See also 7580d6aba7
2021-11-21 03:27:50 +01:00
031b858f47
LV2: check parent class/category -- not child categories 2021-11-21 03:27:43 +01:00
ba1e2d13c5
Add tool to test PBD::signal d'tor race-condition 2021-11-20 23:15:02 +01:00
7580d6aba7
Fix race condition when ~Signal and ~ScopedConnection run concurrently
Previously a deadlock was possible:

Thread 1:
  ~ScopedConnection ()
  -> Connection::disconnect ()
     takes Connection::_mutex             <<<< 1
  -> _signal->disconnect (shared_from_this ())
  -> Signal::disconnect ()
     takes Signal::_mutex                 <<<< 2

Thread 2:
 ~Signal ()
     takes Signal::_mutex                 <<<< 2
  -> Connection::signal_going_away ()
     takes Connection::_mutex             <<<< 1
2021-11-20 23:14:59 +01:00
ee8e8da614
Stop auto-connect thread before terminating ctrl surfaces
This works around a race-condition, calling d'tors from
two threads concurrently.

The GUI thread destroys ctrl surfaces. ~~MIDIControllable()
calls ::drop_external_control() -> ::midi_forget()
This unsubscribes from signals (notably MIDI::Parser events)
by calling ScopedConnection::disconnect(), Connection::disconnect().

At the same time auto_connect_thread can call
PortManager::clear_pending_port_deletions() which removes
the MIDI port and destorys the MIDI::Parser.

~Parser() calls Connection::signal_going_away() to invalidate
connected signals.

This can deadlock if it is called concurrently with
Connection::disconnect() on the same signal.

see also
https://discourse.ardour.org/t/ardour-session-close-hangs/106523/10
2021-11-20 23:14:42 +01:00
0837449749 triggerbox: handle MIDI trigger timing in realtime, not pre-rendered
This allows MIDI to follow the tempo map
2021-11-19 14:50:55 -07:00
ec88635555 MIDI Draw: potential workaround for sticky menu items at startup 2021-11-19 13:01:54 -06:00
84111a343e Deinterlace MIDI: gui part 2021-11-19 10:28:37 -06:00
11543b1c9b Deinterlace MIDI: split a midi region into per-channel regions (libardour part)
code is similar-but-different-from Importing with split-midi-channels enabled
2021-11-19 10:28:37 -06:00
ca7e133e3d MIDI Draw: fix thinko in length=Auto 2021-11-19 10:28:37 -06:00
bc6766fc3f midi region view: fix crashes when adding notes
A region may have no notes, or none in the correct time range. Finding
a note to get channel or velocity info from may fail
2021-11-18 10:03:34 -07:00
252ae56a08 MIDI Draw: change behavior regarding MIDI Channel of new notes
When adding a note, use these criteria to choose the channel number:
* if the user has explicitly specified a note in the pulldown, use that
* if the user has AUTO selected and we are in a region, choose the nearest note's channel (consistent with velocity behavior)
* as a fallback, query the track for its channel-filter (old behavior)
2021-11-18 08:23:08 -06:00
eebf3717e3 MIDI Draw: note-length-auto means 'use the Grid for note-length' (prior behavior) 2021-11-18 07:35:13 -06:00
93e68a5a00 MIDI Draw: provide a menu for Channel and Velocity 2021-11-18 07:35:13 -06:00
2a6da0113f MIDI Draw: Provide a menu to explicitly select note-length
ToDo: 3,5,7's?  keyboard shortcuts?
2021-11-18 07:35:13 -06:00
5ba6e14310 triggerbox: catch a very strange condition via abort(), to help with debugging.
Not easily reproducable, but definitely a bug somewhere.
2021-11-17 21:16:38 -07:00
ddf93aca19 triggerbox: make a somewhat half-baked attempt to resync a trigger that ended too early.
Instead of just restarting it inside the same ::run() call, mark it as waiting,
so that it will restart at the next quantization point.

This isn't a final or even fully correct solution, but it's a useful test of
the idea.
2021-11-17 21:14:56 -07:00
6e404ea7bf tempomap: reimplement TempoMap::bbt_walk()
This still needs work to deal correctly with negative (backwards/earlier)
walks.
2021-11-17 15:59:03 -07:00
b1b5553d1d tempomap: allow access to TempoMap::bbt_at () variant 2021-11-17 15:58:33 -07:00
fcf0c253ad control surface changes to follow TempoMap::sample_at() API change 2021-11-17 15:57:54 -07:00
c24cabead0 GUI changes to follow TempoMap::sample_at() API changes 2021-11-17 15:57:30 -07:00
2aefb472e2 temporal: change API of TempoMap::sample_at() to not require an explicit sample rate
We have a mechanism to get the engine sample rate and use that widely. We
should use it here also.
2021-11-17 15:56:06 -07:00
3c9bebda00 remove debug output 2021-11-17 12:16:39 -07:00
180c1d7759 tempo map: slight reorganization of ::get_grid
This avoids resetting beats based on superclocks in case where we
already do the opposite.
2021-11-17 12:16:39 -07:00
7dbf2445f5 tempo map: NOOP: expand comment to explain more 2021-11-17 12:16:39 -07:00
a5ccb521e6 tempo map: NOOP helpful comment, perhaps 2021-11-17 12:16:39 -07:00
73c87064a5 tempo map: NOOP correct comment text 2021-11-17 12:16:39 -07:00
c7adea3ec0 tempo map: really no-op code change to provide another useless compiler const hint 2021-11-17 12:16:39 -07:00
d9b1d2ccc8 temporal: NOOP add helpful comment about bar_mod argument 2021-11-17 12:16:39 -07:00
b3451f4055 tempo map: fix computation of superclocks_per_note_type_at()
Code used position as an absolute, rather than offset from the point
that defines tempo. It worked if the point was at zero, but not
otherwise.
2021-11-17 12:16:39 -07:00
a417cbae4b tempo map: fix a potential bug (not seen in the wild) when generating the grid
the "p" variable could point to _points.end(), so we cannot indirect and use
p->sclock() value unconditionally.
2021-11-17 12:16:39 -07:00
1ba2e28d6f tempo map: fix grid generation with ramped tempos
The old code used the instantaneous tempo at T0 to compute where the next
quarter note would be. This is incorrect, since the tempo is
changing (continuously, for now) during the time represented by that quarter
note. Instead, we need to add a quarter note (or technically, whatever the
tempo note type is) to get a new position in beats, then compute the superclock
time at that location (which will use our equations for tempo, including the
use of omega, the ramp factor).
2021-11-17 12:16:39 -07:00