13
0
Commit Graph

696 Commits

Author SHA1 Message Date
eced764480 smf_source: implement SMF::UsedChannels as a bitset; move midi screening into load_model()
we screen midi files for some aggregate info:
 used channels, used patches, and note-count

you can't do this from open() because there are cases (after importing)
 when the source exists but it is not yet written to disk
2022-03-01 10:11:14 -06:00
b96b97c439 PatchChange: fix set_channel() 2022-03-01 10:11:14 -06:00
fc3abecca0 PatchChange: yet more checks to keep patch state in sync (is_set())
* fix the case for creating an empty, unset patch
* fix is_set() for bank changes: 2nd byte is the one that gets 'set'
2022-03-01 10:11:14 -06:00
f9dbe34900
Add missing include 2022-02-08 21:24:54 +01:00
cd53301d06
Significantly speed up loading SMF tempo-maps
Files that have many tracks, each with tempo information
were near impossible to load (30+ mins on modern 4.2Ghz CPU!),
because tempo is parsed incrementally:

```
For each new track:
  for each new tempo-event:
    rewind()
    for each loaded track so far:
      for each event on this track so far
```

This reduces the complexity from O(tracks^2 * tempos^2)
to O(tracks * tempos).

"Come Thou Fount Tempo Map.mid" has 238 Tracks and 56168 total
Tempo Changes (236 per track). This now requires only 56168 iterations
in smf_create_tempo_map_and_compute_seconds, rather than 1.64e+9
iterations
2022-02-05 17:33:21 +01:00
207ad2d369
Add API to query SMF note-count and pgm-changes
This information is useful for trigger-clips, in particular
if the file can change synth-settings via patch-changes.
2022-02-05 17:33:21 +01:00
12e8235193
Add API to query set of used MIDI channels in a SMF 2022-02-05 00:13:27 +01:00
374faa0d5c PatchChange: use correct hwx constants to detect/set "unset" byte values 2022-02-02 15:06:11 -07:00
31f4d8a2ca PatchChange: fix operator=() implementation which failed to manage event buffer ownership correctly 2022-02-02 15:06:11 -07:00
603d1f1f57 evoral: some changes/extensions to Evoral::PatchChange to make it more useful
The concept of an "unset" PatchChange now exists, and thus a default constructor that constructs
such a thing
2022-02-02 15:06:11 -07:00
2eadb75bd1 move static scale_midi_velocity() function from Amp to Evoral::Event 2022-02-02 09:58:57 -07:00
Mads Kiilerich
8bb91099c5 wscript: drop configure statements already present in the top level wscript
Avoid repeated pointless configure messages like:
Checking for 'g++' (C++ compiler!)                   : /usr/lib64/ccache/g++
Checking for 'gcc' (C compiler)                      : /usr/lib64/ccache/gcc
2022-01-22 22:19:03 +01:00
16511974e2
Fix class/struct mismatch C++ ABI [-Wmismatched-tags] 2022-01-10 00:06:24 +01:00
e295e1c8d7
Disable evoral unit-tests -- nutempo update is needed 2022-01-03 01:11:54 +01:00
60be0c27a1
Use updated temporal API 1/2 2021-12-11 14:42:36 +01:00
0733b2d9e2 SMF: Often files don't have Track+Instr names. Make something up to avoid file collisions. 2021-11-13 15:54:11 -06:00
35312dc85c SMF: API change: report format (0,1 or2) and total channels used 2021-11-13 15:54:11 -06:00
c74f80caa4
NO-OP: clean up maths, remove extra brackets
This may also help due to huge xdelta numbers.
2021-09-02 20:45:30 +02:00
940f3022c1 prevent addition of events to a ControlList whose time-domain does not match the ControlList's own time-domain 2021-08-30 15:15:14 -06:00
4fb3e24bd6 evoral: tentative fix for problems with Curve::multipoint_eval()
Now that we use superclock_t for audio time, it is possible for the square of an audio time value to overflow int64_t quite easily.
This change fixes that (and cleans up other code a little), but probably a different solution would be a good idea
2021-08-30 14:29:11 -06:00
0699449f29 evoral: debugging curve errors 2021-08-30 09:04:27 -06:00
4cef8c681c evoral: fix for Curve coefficient computation 2021-08-30 09:04:27 -06:00
9a53ef4020 libevoral: fix some existing or potential issues with time domains 2021-08-13 12:51:34 -06:00
e11ecd56a9 libevoral: avoid use of std::numeric_limits<timepos_t> which does not (or should not) exist 2021-08-13 12:51:34 -06:00
87e56f28e9 libevoral: remove semi-shadow local variable 2021-08-13 12:51:34 -06:00
6d154c14b4 libevoral: add a new method to set the time domain that can be used from ::set_state(), when the event list is not (yet) empty 2021-08-13 12:51:34 -06:00
1a41e98c1c improve comment for future readers 2021-08-13 12:51:33 -06:00
068cc4135f remove another NUTEMPO #warning (see comment) 2021-08-13 12:51:33 -06:00
7c10cf1d54 Automatable now requires (and owns) a time domain to be used by automation data 2021-08-13 12:51:32 -06:00
1a5e2aacff remove another NUTEMPO warning 2021-08-13 12:51:32 -06:00
7c61fe405c Evoral: cleanup for explicit Beats::operator bool() 2021-08-13 12:51:31 -06:00
779a04b0ce Evoral: alter ControlList::paste() to internally change time domain of pasted events 2021-08-13 12:51:31 -06:00
bed76798f3 manual fixups after rebase against master (general libs edition) 2021-08-13 12:51:31 -06:00
18fea5c7a9 changes required by fixing ambiguities in timepos_t/timecnt_t API (evoral edition) 2021-08-13 12:51:31 -06:00
def35cf043 mark BBT_Offset (double) constructor explicit to avoid implicit conversion in timeline expressions.
Also clean up the mess this had caused.
2021-08-13 12:51:30 -06:00
ebd8704f9d libevoral: tweaks related to timeline types based on libardour conversion 2021-08-13 12:51:29 -06:00
6b09642406 changes to compile against libtemporal and use of timepos_t/timecnt_t 2021-08-13 12:51:28 -06:00
f4490f54c5 change Timecode::BBT_Time to use Temporal namespace, plus a couple of other minor changes to enable compilation
This still uses the tempo map object in libs/ardour, not the new one in libs/temporal, and isn't likely to be functional
(though it could be)
2021-08-13 12:51:28 -06:00
d58e7c7ee4 Revert "fix handling of SMF files with consecutive noteOn events"
This breaks MIDI files that have events ordered On,On,Off,Off, and only fixes
the "malformed" On,On,Off. Correct fix requires collecting all events occuring
yat one time, sorting into Off,On and then merging.

This reverts commit 5c3e5f9afb.
2021-06-29 17:29:29 -06:00
5c3e5f9afb fix handling of SMF files with consecutive noteOn events
We no longer store nascent notes when noteOn is received, but wait till noteOff arrives. We also
ignore all other noteOn events between the earliest received and the noteOff.

Potentially we may want to use the _overlap_pitch_resolution member at some point
to offer control of this behavior.
2021-06-28 08:30:38 -06:00
336319a1df SMF meta-events do not set running status while parsing the file 2021-06-22 14:18:03 -06:00
c45be2266e support SMF markers without labels 2021-05-09 17:52:29 -06:00
f689e9ecab Evoral: add methods to SMF to load and access markers/cues in SMF files 2021-05-07 14:58:16 -06:00
cc7b8b1bc5
gcc-11 compat, volatile atomic variables (1/2)
"While 'atomic' has a volatile qualifier, this is a historical
artifact and the pointer passed to it should not be volatile."

Furthermore "It is very important that all accesses to a
particular integer or pointer be performed using only this API"
(from https://developer.gnome.org/glib/2.68/glib-Atomic-Operations.html)

Hence initialization of atomic variables is changed to also use
this API, instead of directly initializing the value.

This also fixes a few cases where atomic variables were
accessed directly.

see also libs/pbd/pbd/g_atomic_compat.h
2021-03-22 15:30:07 +01:00
7e1ce160e9
ARM 32bit enum alignment (used in MIDIBuffer)
Evoral::EventType is written directly into a uint8_t buffer
by dereferncing a pointer-type:
*(reinterpret_cast<Evoral::EventType*>((uintptr_t)...)
2020-09-28 01:21:43 +02:00
472fe2b556
Prepare for distinct live-midi event type
The motivation for this is to determine if a given event
originates from a user-controlled live input controller or
from playback from disk or a MIDI file.

This distinction is required for VST3 MIDI learn.
2020-09-20 17:16:53 +02:00
b9cfb31205
Fix control-list editing (#8384)
This fixes segfaults as well as corrupt listes when copy/pasting
due to invalid iterators.

::mark_dirty() must be called with WriterLock, and
::rt_safe_earliest_event_linear_unlocked() must not be called
while _events is being modified. The Sequence iterator
(only user of that function) does not ensure this. Only the
sequence read-lock is taken.
2020-08-31 07:39:45 +02:00
65ecc1b40e
Do not interpolate away explicit MIDI automation points #8362 2020-08-15 01:57:01 +02:00
e4c56a0371
Remove unused API
These are longer be used since Seuqnce has a "force_discrete"
boolen that needs to be taken into account in addition to
user-configurable ControlList _interpolation mode.
2020-08-15 01:56:42 +02:00
c6b87972b1
Remove unused libsmf seconds/time API
This significantly speeds up parsing MIDI files with complex
tempo-maps. e.g. "Black MIDI Trilogy_2.mid" has 24134 Tempo
changes. Prior to this commit parsing that file took over 5 minutes.
now it loads in under one seconds (libsmf only; libardour still
add overhead, and now needs about 30-40 seconds, previously
it took about 10 mins).

The problem was that every call to `smf_track_add_event_pulses()`
calls `seconds_from_pulses()` which calls `smf_get_tempo_by_seconds()`
which iterates over the tempo-map:

  for every midi-event { for ever tempo until that midi-event {..} }

This does not scale to 3.5M events and 24k tempo-changes.
2020-07-16 18:38:03 +02:00