Commit graph

264 commits

Author SHA1 Message Date
Robin Gareus
60be0c27a1
Use updated temporal API 1/2 2021-12-11 14:42:36 +01:00
Paul Davis
a72108636b remove another instance of std::numeric_limits<timecnt_t>::max() 2021-12-05 09:23:05 -07:00
Ben Loftis
3f69e8e329 MIDI Import: implement missing SMFSource::update_length
Provides intended behavior: imported midi region length should be rounded to the nearest beat

ToDo: add options to round to Bar/Beat/None ?
2021-11-14 14:25:31 -06:00
Paul Davis
fad71ce748 when creating new MIDI sources, be sure that we create a stub file on disk
These files will be removed at session close if they are still empty. Their existence prevents
collisions across snapshots and likely some other wierdness that relied on file existence for
various tests and conditions
2021-08-27 16:52:53 -06:00
Paul Davis
5838bcbe7c clean up unsafe use of printf() by commenting it out 2021-08-13 12:51:35 -06:00
Paul Davis
a7535ae8aa clang knows that we cannot use printf() to print Evoral::Event::time() ...
(why doesn't gcc?)
2021-08-13 12:51:35 -06:00
Paul Davis
56cde042cd Region::_start should be a timepos_t not a timecnt_t
It is an offset from an *implicit* origin (the source zero), not from an explicit origin,
and this fits with the concept underlying timepos_t. A timecnt_t requires an explicit origin,
which makes no sense in this context (just as it doesn't for the timeline as a whole).
2021-08-13 12:51:34 -06:00
Paul Davis
34d798327b libardour: cleanup for explicit Beats::operator bool() 2021-08-13 12:51:31 -06:00
Paul Davis
a01bb90c04 libardour: remove _length_beats member from MidiSource and use Source::_length
timecnt_t can represent either time domain
2021-08-13 12:51:31 -06:00
Paul Davis
6c6d7fa874 fix 2 NUTEMPO #warnings in smf_source.cc 2021-08-13 12:51:31 -06:00
Paul Davis
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
Paul Davis
eae9d276fe libardour: conversion to use timeline types (mega-commit) 2021-08-13 12:51:29 -06:00
Paul Davis
4dc048b28a update Temporal::Beats to merge master/nutempo versions, notably with private from-double constructor
This is the libraries-only edition. It still features liberal use of Beats::from_double() but this is now
explicit and will be easier to locate the calls and remove them. Several classes that were using
Beats::to_double() have been (temporarily) made friends of Beats to allow them to keep using it,
pending the much more widespread redesigns of several structures. Once this is done, the friend
relationships can (mostly) be removed. It is expected the ARDOUR::Variant will need to continue
as a friend because it is used to pass beat counts to LV2 as doubles
2021-08-13 12:51:28 -06:00
Robin Gareus
4bb3a896b4
Potential fix for lost/empty MIDI files when using snapshots #8552
* Copy flags of referenced file
* Do not share model with copied source!
2021-03-19 20:05:42 +01:00
Robin Gareus
4887350e0d
API consistency, prefer typedef'ed event_id_t 2021-03-19 06:29:03 +01:00
Robin Gareus
6f205f857b
Replace missing .mid files with silence
This fixes a crash: missing playlist due to missing .mid,
and retains regions for missing MIDI files.

As opposed to missing Audio, we cannot use a SilentFileSource,
because MIDI files are destructive.

This also adds an API to query missing files that have been replaced
with silence to report them to the user.
2020-02-18 01:26:20 +01:00
Paul Davis
a855119bdd rename all Evoral source from .(hpp|cpp)$ to .(h|cc) 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
Robin Gareus
a22f918d9d
Update libardour GPL boilerplate and (C) from git log 2019-08-03 15:53:16 +02:00
Ben Loftis
ca3c191d7c (Source List) Source property signals (libardour part) 2019-08-01 12:11:31 -05:00
Paul Davis
b4b2fbb6ed remove debug output 2018-07-05 13:49:27 -04:00
Paul Davis
027d0efc2d catch various libsmf errors rethrown as exceptions 2018-07-05 13:45:17 -04:00
Paul Davis
7db12f6b12 convert codebase to use Temporal for various time types 2017-09-24 12:03:54 -04:00
Paul Davis
30b087ab3d globally change all use of "frame" to refer to audio into "sample".
Generated by tools/f2s. Some hand-editing will be required in a few places to fix up comments related to timecode
and video in order to keep the legible
2017-09-18 12:39:17 -04:00
Tim Mayberry
baf0cf9393 Use XMLNode::set_property API in ARDOUR::SMFSource class 2017-04-19 09:36:53 +10:00
David Robillard
398a318934 Fix event type and parameter type confusion
I'm not sure if this is really the best way to do event types (should it
just be a completely static enum in evoral, or completely dynamic and
provided by the type map, or a mix like currently?), but previously the
event type was frequently set to either total garbage, or parameter
types, which are a different thing.

This fixes all those cases, and makes Evoral::EventType an enum so the
compiler will warn about implicit conversions from int.
2016-12-03 15:28:19 -05:00
David Robillard
08fffeffec Remove Evoral::MIDIEvent
It is slightly questionable whether type specific methods like
velocity() belong on Event at all, these may be better off as free
functions.  However the code currently uses them as methods in many
places, and it seems like a step in the right direction, since, for
example, we might some day have events that have a velocity but aren't
stored as MIDI messages (e.g. if Ardour uses an internal musical model
that is more expressive).

In any case, the former inheritance and plethora of sloppy casts is
definitely not the right thing.
2016-12-03 15:18:21 -05:00
David Robillard
0f5a73a7fd Fix Sequence/Event const-correctness issues 2016-12-03 15:18:20 -05:00
John Emmas
ddd79819dc Correct the #includes for 'ardour/midi_cursor.h' (see commit #ec12fccf08)
There are a couple of header files where we use a reference to class ARDOUR::MidiCursor (rather than a pointer). To keep MSVC happy we need to #include its header file, rather than simply using a forward reference.
2016-11-10 19:31:26 +00:00
John Emmas
ec12fccf08 #include <ardour/midi_cursor.h> in a couple of places
I'm not entirely sure why it's needed in 'smf_source.cc' but MSVC fails to link the compiled module if I don't #include it ?!?
2016-11-10 12:20:53 +00:00
nick_m
dcae6c42b6 Remove _length_pulse from MidiSource. 2016-09-29 01:27:42 +10:00
Paul Davis
f41bc70ee9 change all MIDI read-from-source to map all events into the loop-range for seamless looping (if using) 2016-09-13 14:11:29 -05:00
nick_m
21054f6d8d Add length_pulse to MidiSource, usr quarter-notes in midi_read().
- MidiSource _length_beats is in quarter notes.
	  Here we duplicate length_beats for backwards compatibility
2016-08-31 23:12:11 +10:00
Paul Davis
cf52d6e4b4 enough with umpteen "i18n.h" files. Consolidate on pbd/i18n.h 2016-07-14 14:45:23 -04:00
Robin Gareus
2397429e99 use quotes for in-tree pbd/glib wrapper include 2015-10-05 22:15:18 +02:00
Robin Gareus
22b07e0233 NOOP, remove trailing tabs/whitespace. 2015-10-05 16:17:49 +02:00
Paul Davis
4dc63966f0 globally remove all trailing whitespace from ardour code base.
Paul Davis was responsible for introducing almost all of this.
2015-10-04 14:51:05 -04:00
Robin Gareus
a5141fdaf3 NOOP - SMF debugging. 2015-09-18 17:37:36 +02:00
Robin Gareus
7ac691ec82 use pbd's gstdio compatibility wrapper 2015-09-17 14:37:57 +02:00
Paul Davis
d5be54080f add a pure virtual FileSource::close() method so that FileSource::set_path() can ensure we no longer have a handle open 2015-04-20 16:31:06 -04:00
Paul Davis
d263cf7ded remove _file_path member from Evoral::SMF 2015-04-20 15:44:20 -04:00
David Robillard
c9023ae73d Fix mute of MIDI tracks with channel forcing.
This moves MIDI channel filtering into a reusable class and moves filtering to
the source, rather than modifying the buffer afterwards.  This is necessary so
that the playlist trackers reflect the emitted notes (and thus are able to stop
them in situations like mute).

As a perk, this is also faster because events are just dropped on read, rather
than pushed into a buffer then later removed (which is very slow).

Really hammering on mute or solo still seems to produce stuck notes
occasionally (perhaps related to multiple-on warnings).  I am not yet sure why,
but occasional beats always.
2015-03-29 00:51:56 -04:00
David Robillard
2a251b4570 MusicalTime => Beats. 2015-01-07 00:12:07 -05:00
David Robillard
5d8021bf44 Maintain correct tracker state on MIDI overwrite.
This is a little hard-edged in that edits while rolling will prematurely chop
off any playing notes, but at least the state of things actually reflects
reality.  More sophisticated solution hopefully to come...
2014-12-20 01:13:25 -05:00
David Robillard
a706755710 Fix various MIDI locking issues.
Attempt to make mistakes much less likely in the future by statically requiring
caller to pass scoped locks where necessary.
2014-12-17 16:07:29 -05:00
Paul Davis
294b99aabf remove file manager LRU cache from code.
This was a very clever attempt to fix a non-problem. If the platform doesn't have enough file descriptors available
then the platform is broken and we're not going to hack around trying to fix it.
2014-12-10 18:28:55 -05:00
David Robillard
eb86971d2d Invalidate iterator whenever model changes.
I suspect this is an underlying cause of several tricky to reproduce bugs, but
we'll have to wait around and see...
2014-12-06 22:43:06 -05:00
David Robillard
cf537b97f5 Add missing namespace qualifiers. 2014-11-30 23:56:19 -05:00
David Robillard
c1cfa12d6e Wrap MusicalTime in a class.
This lets us get a more explicit handle on time conversions, and is the main
step towards using actual beat:tick time and getting away from floating point
precision problems.
2014-11-22 04:05:42 -05:00
David Robillard
4bc0d1c475 Fix lost MIDI note offs and controllers.
Fix initial read of discrete MIDI controllers.

Fix spurious note offs when starting to play in the middle of a note.

Faster search for initial event when cached iterator is invalid.

So much for dropping the cached iterator.  The iterator is responsible for
handling note offs, so that doesn't work.  This design means we have some stuck
note issues at the source read level, but they should be taken care of by the
state tracker anyway.
2014-11-20 15:36:11 -05:00