Commit graph

239 commits

Author SHA1 Message Date
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
David Robillard
a9936205b1 Fix dropped MIDI events, especially with record enabled.
I am not precisely sure why the cached iterator was causing this problem, it
shouldn't be invalidated, and the times make sense.  It may be some lock
related issue since the iterator holds a lock on the source.

In any case, this cached iterator was just to avoid repeated linear search of
the model, but since the model has a logarithmic search, instead just scrap all
this problematic persistent state and search for the appropriate start time
every read.  No need to be careful about invalidating when anything changes.
2014-11-19 19:24:16 -05:00
David Robillard
94954f852e Fix out of order event errors on save with overlapping notes.
Another consequence of fuzzy Sequence timing, but if the difference is less
than a tick this should handle things correctly.  If the difference is more
than a tick, something's wrong, and it might be okay to just bump forward
anyway, but I can't reproduce this and it could lead to corruption so I'm
leaving that case noisy.
2014-11-14 21:19:09 -05:00
David Robillard
8a128b33d3 Automation of LV2 plugin properties.
Work towards ParameterDescriptor being used more universally to describe control characteristics.
2014-11-02 02:10:24 -05:00
Paul Davis
9a3cf7a10b fix up condition where a MIDI filesource is marked empty, not found, and its _path member is not set correctly 2014-09-15 14:09:12 -04:00
Paul Davis
c96ec968c7 tentative fix for losing (empty) MIDI files. Incomplete because testing shows issues with some workflows 2014-09-15 14:09:12 -04:00
Paul Davis
fcabd5d8ee initial implementation of "bring all media into session folder". Incomplete but basically functional for audio files 2014-07-08 00:53:13 -04:00
Paul Davis
23e7cf1019 merge with master.
Manually resolved conflicts in import.cc and session.cc
2014-07-01 09:46:18 -04:00
Tim Mayberry
cb6934a189 Remove unused header includes 2014-06-17 21:30:51 +10:00
John Emmas
fd50cf14dd Keep this #include consistent with similar ones
(evoral/evoral doesn't get used anywhere else)
2014-06-03 14:02:05 +01:00
Paul Davis
8c9749e42f merge with master and fix 4 conflicts by hand 2014-06-02 11:32:13 -04:00
Paul Davis
74bc0c8468 substantive changes to the logic and safety for naming of (audio/MIDI) sources, especially when created via import 2014-06-02 11:20:37 -04:00
Damien Zammit
2f6065b32c Fixed problem where importing invalid midi files caused crash. 2014-04-29 06:48:29 +10:00
Paul Davis
f5276a104c add new SMFSource constructor to be used for existing-external files. Fixes #5919. Needs merging with CC 2014-04-28 10:37:17 -04:00
Paul Davis
be0da8ff5c merge 5764970709 from cairocanvas as final(?) change related to data loss 2014-04-14 13:07:07 -04:00
Paul Davis
b49bb451d2 further code simplification and rationalization related to MIDI source/file renaming 2014-04-14 13:05:21 -04:00
Paul Davis
e1bf151ab0 after cloning a MIDI region, mark the source file as non-removable. Fixes reports about missing MIDI files on the forums and IRC 2014-04-14 13:00:24 -04:00
Paul Davis
5764970709 more work on linking file existence and removability 2014-04-14 03:03:35 -04:00
Paul Davis
b81d57f049 further code simplification and rationalization related to MIDI source/file renaming 2014-04-14 02:17:30 -04:00
Paul Davis
fc691cb3ba after cloning a MIDI region, mark the source file as non-removable. Fixes reports about missing MIDI files on the forums and IRC 2014-04-04 15:26:44 -04:00
Paul Davis
713a375011 (backport from cairocanvas branch) do not crash when considering a directory called midi (with any case) as an apparent MIDI file 2014-02-27 20:37:17 -05:00
Paul Davis
dc4bb5b758 do not crash when considering a directory called midi (with any case) as an apparent MIDI file 2014-02-27 20:35:52 -05:00
Paul Davis
7000afdc66 fix merge conflict with master 2014-01-23 13:41:20 -05:00
Robin Gareus
1e3ad60eb6 take all tracks inside a midi-file into account when loading model
* fixes [region] length calculation,
* prepare for auditioning midi files (one track plays it all)
2014-01-22 15:30:14 +01:00
Robin Gareus
9e799c6146 open external [read-only] midi-files on construction 2014-01-22 15:30:09 +01:00
Paul Davis
15be154515 use g_unlink() rather than unlink() universally, requires <glib/gstdio.h> in several files 2013-07-15 14:29:00 -04:00