Commit Graph

34 Commits

Author SHA1 Message Date
Paul Davis
cbc0021182 fix typo (| instead of ||) 2024-10-17 07:44:32 -06:00
Paul Davis
ac4bb55f13 first functioning MIDI clip recording (libs) 2024-10-17 07:44:32 -06:00
Paul Davis
86b01a5d2f provide an interesting method to convert an RTMidiBuffer<samples> to RTMidiBuffer<beats> without any memory reallocation 2024-10-17 07:44:32 -06:00
Paul Davis
a4a277c141 templatize RTMidiBuffer to allow use in different time domains
Also add ::track_state() method to configue a MidiStateTracker
to correspond to the state implied by an RTMidiBuffer<T,D>
at a given point in time.
2024-10-17 07:44:28 -06:00
Paul Davis
f01f4eeded MIDI state tracking doesn't care about size 2023-11-20 21:40:12 -07:00
Paul Davis
cb91334cc6 basic work to permit "MIDI catchup" for MIDI state at any point on the timeline
This currently does nothing and cannot be enabled
2023-11-20 21:32:49 -07:00
Robin Gareus
b8c3f9342a Fix typo for ARM MIDI ringbuffer alignment 2022-06-07 23:49:42 +02:00
Paul Davis
1ab49bcc32 change MidiStateTracker to MidiNoteTracker
The old name will become a bigger class/object that tracks all MIDI state,
not just notes
2022-02-01 18:06:40 -07:00
Paul Davis
2b754568a0 changes/extensions to RTMidiBuffer API to make it more suitable for slots/triggers 2021-10-24 09:26:35 -06:00
Robin Gareus
5957e14259 Remove unused #include<> (2/2)
PBD::stacktrace() is not used nor needed by default.
It should be used sparingly.
2021-05-05 17:57:16 +02:00
Robin Gareus
ff26258461 Fix sloppy typing 2020-09-28 03:41:48 +02:00
Robin Gareus
117184c3bd Fix 32bit alignment in prev commits
this amends
  f52c5ca3ac
and
  5abe677fea
2020-09-28 03:20:14 +02:00
Robin Gareus
f52c5ca3ac ARM RTMidiBuffer alignment 2020-09-28 03:12:38 +02:00
Robin Gareus
f9cdf533ba Event API consistency; reorder arguments (time, type, payload) 2020-09-20 19:18:09 +02:00
Robin Gareus
0d4ea1e61f Fix reverse MIDI playback
upper_bound() returns the first element that is **greater** than
the given value. So during reverse playback we need the value
before that.

Likewise for forward playback, lower_bound() returns an iterator
pointing to the element before the one that need to be played.
2020-05-25 17:19:44 +02:00
Paul Davis
7644168536 add some (commented/ifdef'ed) debugging for RTMidiBuffer::read() 2020-05-04 18:48:17 -06:00
John Emmas
9a3159c2c0 Remove a suspected C99-ism
'lower_bound()' iterates between param #1 and param #2, comparing the result
with param #3 - either by making the comparison internally or by deferring to
an external comparator function. Prior to C99 however, BOTH cases required
param #3 to match the type being iterated.

In the case of a deferred comparison, there was apparently a proposal to
relax this restriction in C99, though I'm not sure if it in fact got
implemented (can't find any examples of it anywhere...)
2020-03-05 12:52:22 +00:00
Robin Gareus
f101a657f2 Fix two more clang static analysis warnings 2020-01-27 17:42:28 +01:00
Paul Davis
0ac09d1f67 fix serious but rare error in RTMidiBuffer's storage of MIDI events with size > 3
sizeof (T) is in units of bytes, not bits. Use C++ standard CHAR_BITS instead.
2020-01-07 19:27:04 -07:00
Paul Davis
c07db6d655 unset _reversed whenever RTMidiBuffer gets ::clear()'ed 2019-11-18 15:38:18 -07:00
Paul Davis
725a6fc67f support backwards reading of MIDI from RTMidiBuffer 2019-11-18 12:01:43 -07:00
Paul Davis
625b8297ea fix unconditional note resolution during DiskReader::realtime_locate()
When looping, we do not want to resolve notes at the end of the loop via ::realtime_locate() -
::get_midi_playback() has already taken care of this. But when not looping, we need this. So,
add an argument to tell all interested parties whether the locate is for a loop end or not
2019-11-06 22:12:40 -07:00
Paul Davis
62c4e88a9d avoid use of Port::port_offset() everywhere except Port::flush_buffers() and Port::get_buffer()
Split cycles are run as if they are an entire self-contained cycle, starting at zero and running for "nframes".

We adjust the timing and position of data only when retrieving and writing it to Port buffers.
2019-11-04 12:57:19 -07:00
Paul Davis
e8a12a1a29 clarify clarifying comment 2019-11-02 16:32:18 -06:00
Paul Davis
17ba6d319f use a different MidiBuffer API to move data from RT MidiBuffer into MidiBuffer during ::read() 2019-11-02 16:32:18 -06:00
Paul Davis
addebc3240 move ownership of an RT MIDI buffer from DiskIO to MidiPlaylist 2019-11-02 16:32:18 -06:00
Paul Davis
5c0fd05c52 fix reallocation/copy sizes for direct index and blob pool 2019-11-02 16:32:18 -06:00
Paul Davis
5cd9c86d58 add RAII-style write protection while rendering MIDI playlist into RTMidiBuffer 2019-11-02 16:32:18 -06:00
Paul Davis
73e9560eef add extra info to output of RTMidiBuffer::dump() 2019-11-02 16:32:18 -06:00
Paul Davis
b017f20141 correct size computation for RTMidiBuffer, and reduce expansion amount 2019-11-02 16:32:18 -06:00
Paul Davis
088e4bca5a reimplement RTMidiBuffer using a highly optimized data structure
Reduces load time of Glass MIDI piece with 48k note events by about 35%. Improves data
locality. Omits size for all 3 byte or less MIDI events, uses implicit size. No limit
on size of sysex.

Relies on the fact that the data structure is always filled linearly in time, and
never modified.
2019-11-02 16:32:18 -06:00
Paul Davis
e87e0ec028 add a MidiStateTracker to DiskReader and use to handle transport stop note resolving 2019-11-02 16:32:18 -06:00
Paul Davis
67beff22ce trivial cleanups 2019-11-02 16:32:18 -06:00
Paul Davis
22da779322 introduce new all-in-RAM MIDI datastructure and use it for MIDI playback 2019-11-02 16:32:18 -06:00