summaryrefslogtreecommitdiff
path: root/libs/ardour/midi_region.cc
AgeCommit message (Collapse)Author
2016-07-10Paste uses exact beats. rework _start_beats calculation in copy-with-offset ↵nick_m
ctor.
2016-07-10Exact beat - provide audio->music mapping for region split.nick_m
- for those not in the know, this series provides a way to remove the temporal distortion introduced when using an audio frame-based gui for music-locked objects. In short, the gui uses an audio frame representation to move objects. It displays the object using frame_at_beat(), quantizing the time value to audio frames. This is fine until the user selects that frame but expects it to be interpreted as a beat. Thus beat_at_frame() would not produce the user-expected beat (temporal quantization error of up to 0.5 audio samples). This is one method of mapping audio time to music time accurately.
2016-07-10Make some musical operations on music-locked regions operate in beats.nick_m
- use exact beats to determine frame position. - see comments in tempo.cc for more. - this hasn't been done for split yet, but dragging and trimming are supported.
2016-06-11Unused variable - no-op.nick_m
2016-06-11Fix many offset errors when drawing notes in midi regions that have been edited.nick_m
- hopefully this can close bugs such as 6270 & 6793
2016-06-07MidiRegion ctor inherits length_beats.nick_m
- fixes incorrect length on drag-copying and pasting midi regions.
2016-06-07Fix midi region split, trim and move operations.nick_m
- there is still the problem of being unable to drag a trimmed region to the left when it's source (not it's position) would end up on a negative beat.
2016-06-06Consolidate notifications when MidiRegion changes length due to position change.nick_m
2016-06-06Midi regions recalculate their length in frames when moved/copied.nick_m
- should fix 6793
2016-05-27Rwbi ramps - midi regions resize when tempo map changed.nick_m
2016-03-21Trim dependence on evoral types.hpp and Beats.hppDavid Robillard
2015-10-17Remove all the now unused functions in the MidiModel class.André Nusser
2015-03-29Fix mute of MIDI tracks with channel forcing.David Robillard
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-05Handle edits while playing precisely.David Robillard
This avoids stuck notes if active notes are edited, but without stopping all active notes in the region on any edit as before. This implementation injects note ons in places that aren't actually note starts. Depending on how percussive the instrument is, this may not be desired. In the future, an option for this would be an improvement, but there are other places where "start notes in the middle" is a reasonable option. I think that should be handled universally if we're to do it at all, so not considering it a part of this fix for now.
2015-01-07MusicalTime => Beats.David Robillard
2014-12-29Avoid another potential deadlock for good measure.David Robillard
Firing these signals while locked is not a good idea, Sequence/ControlList need a better design for this that accounts for recording and lockedness.
2014-12-29Fix deadlock while recording MIDI controllers.David Robillard
2014-12-20fix newly introduced deadlock when cloning MIDI regionsPaul Davis
2014-12-20Maintain correct tracker state on MIDI overwrite.David Robillard
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-17Fix various MIDI locking issues.David Robillard
Attempt to make mistakes much less likely in the future by statically requiring caller to pass scoped locks where necessary.
2014-11-22Wrap MusicalTime in a class.David Robillard
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-20Fix lost MIDI note offs and controllers.David Robillard
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-19Fix dropped MIDI events, especially with record enabled.David Robillard
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-14Fix crash when copying MIDI regions with midi-copy-is-fork is on (#6002).David Robillard
2014-04-14dramatic change in logic and naming for operations related to adding a MIDI ↵Paul Davis
region on demand and cloning/unlinking Existing code would cause data loss due to creation of two Source objects referring the same path, one with removable flags and one without. Careful code review suggested a variety of thinkos, function naming problems and other confusion that caused this. I have tried ot extensively comment what is going on with these operations, because it is one key area in which MIDI differs from audio: with audio, capture is the only way to add a new audio region, but for MIDI there are GUI input events that can add a new region.
2012-07-25convert from Glib:: to Glib::Threads for all thread-related APIPaul Davis
git-svn-id: svn://localhost/ardour2/branches/3.0@13084 d708f5d6-7413-0410-9779-e7cbd77b26cf
2012-06-23Replace use of pbd/filesystem.h with Glib alternativeTim Mayberry
git-svn-id: svn://localhost/ardour2/branches/3.0@12840 d708f5d6-7413-0410-9779-e7cbd77b26cf
2012-06-09Remove extra .mid suffix added to cloned MIDI region names (#4914).Carl Hetherington
git-svn-id: svn://localhost/ardour2/branches/3.0@12627 d708f5d6-7413-0410-9779-e7cbd77b26cf
2012-05-24Remove over 500 unnecessary includes (including 54 of session.h).David Robillard
It's slightly possible that this causes trivial build failures on different configurations, but otherwise shouldn't cause any problems (i.e. no actual changes other than include/naming/namespace stuff). I deliberately avoided removing libardour-config.h since this can mysteriously break things, though a few of those do seem to be unnecessary. This commit only targets includes of ardour/*.h. There is also a very large number of unnecessary includes of stuff in gtk2_ardour; tackling that should also give a big improvement in build time when things are modified. git-svn-id: svn://localhost/ardour2/branches/3.0@12420 d708f5d6-7413-0410-9779-e7cbd77b26cf
2012-05-23alter API for MIDI cloning to facilitate exportPaul Davis
git-svn-id: svn://localhost/ardour2/branches/3.0@12401 d708f5d6-7413-0410-9779-e7cbd77b26cf
2012-04-15Update MidiRegion::_start_beats on trimming the front of a MIDI region; ↵Carl Hetherington
reset _start_beats with _start on MidiRegion::fix_negative_start(). May help with #4736. git-svn-id: svn://localhost/ardour2/branches/3.0@11984 d708f5d6-7413-0410-9779-e7cbd77b26cf
2012-01-21Remove unused code.Carl Hetherington
git-svn-id: svn://localhost/ardour2/branches/3.0@11289 d708f5d6-7413-0410-9779-e7cbd77b26cf
2011-12-22main fix: when transport stops, clear per-region per-playlist note trackers ↵Paul Davis
even if there is no capture data to process; side effects: remove unused MidiBuffer::merge() and add DEBUG::MidiTrackers as well as more and better MIDI debug tracing facilities git-svn-id: svn://localhost/ardour2/branches/3.0@11057 d708f5d6-7413-0410-9779-e7cbd77b26cf
2011-12-17Remove unused code.Carl Hetherington
git-svn-id: svn://localhost/ardour2/branches/3.0@11015 d708f5d6-7413-0410-9779-e7cbd77b26cf
2011-12-12Set up region BBT time when frame position changes, if the region is glued ↵Carl Hetherington
to BBT; fixes part of #4257. git-svn-id: svn://localhost/ardour2/branches/3.0@10986 d708f5d6-7413-0410-9779-e7cbd77b26cf
2011-12-11Keep track of MIDI region's start positions in beats, toCarl Hetherington
match the source, so that starts are not corrupted when tempos change (#4494). git-svn-id: svn://localhost/ardour2/branches/3.0@10976 d708f5d6-7413-0410-9779-e7cbd77b26cf
2011-10-24Remove unused read/write data count code.Carl Hetherington
git-svn-id: svn://localhost/ardour2/branches/3.0@10300 d708f5d6-7413-0410-9779-e7cbd77b26cf
2011-10-19Trim include tree.David Robillard
git-svn-id: svn://localhost/ardour2/branches/3.0@10244 d708f5d6-7413-0410-9779-e7cbd77b26cf
2011-10-19Trim the include tree.David Robillard
git-svn-id: svn://localhost/ardour2/branches/3.0@10227 d708f5d6-7413-0410-9779-e7cbd77b26cf
2011-10-13add new per-session MIDI-region-copy-is-fork: if set, all MIDI region copies ↵Paul Davis
will be independent from each other (via MIDIRegion::clone()); visible in Session properties editor under the Misc tab git-svn-id: svn://localhost/ardour2/branches/3.0@10207 d708f5d6-7413-0410-9779-e7cbd77b26cf
2011-06-01Fix broken whitespace. I'd apologize for the compile times if it was my ↵David Robillard
fault :D git-svn-id: svn://localhost/ardour2/branches/3.0@9654 d708f5d6-7413-0410-9779-e7cbd77b26cf
2011-04-06Differentiate between pitch-shift (for audio) and transpose (for MIDI). ↵Carl Hetherington
Fixes #3940. git-svn-id: svn://localhost/ardour2/branches/3.0@9299 d708f5d6-7413-0410-9779-e7cbd77b26cf
2010-12-22Calculate length_beats of split MIDI regions from 'parent' region.David Robillard
This is probably less than ideal, since setting the properties later will recompute from frames values. It is, however, slightly more rightish :) Seemingly correct cases (i.e. where length_beats is correct): * Recording a new MIDI region * Splitting said region Broken: * Loading a region from XML Untested: * Import git-svn-id: svn://localhost/ardour2/branches/3.0@8324 d708f5d6-7413-0410-9779-e7cbd77b26cf
2010-12-21Remove confuzzling offset_relative stuff from region construction ↵David Robillard
(pre-properties "hangover"). This commit (in theory) only reorganizes code, not change actual functionality. RegionFactory now uses a distinct Region constructor for each case, which is a bit easier to wrap around. Note comment at region.cc:276, this case seems pretty weird to me (more hangover?). git-svn-id: svn://localhost/ardour2/branches/3.0@8320 d708f5d6-7413-0410-9779-e7cbd77b26cf
2010-12-21Only calculate length_beats from length (in frames) if length property (in ↵David Robillard
frames) is given, but length_beats property is not. git-svn-id: svn://localhost/ardour2/branches/3.0@8319 d708f5d6-7413-0410-9779-e7cbd77b26cf
2010-12-21Set new (recorded) MIDI source length to length of entire capture (instead ↵David Robillard
of length from start to last actual recorded event). Precisely set length_beats of newly captured MIDI regions to source length in beats (no conversion). git-svn-id: svn://localhost/ardour2/branches/3.0@8317 d708f5d6-7413-0410-9779-e7cbd77b26cf
2010-12-20Fix more broken whitespace.David Robillard
git-svn-id: svn://localhost/ardour2/branches/3.0@8314 d708f5d6-7413-0410-9779-e7cbd77b26cf
2010-12-20Fix converter origins for computing region length.Carl Hetherington
git-svn-id: svn://localhost/ardour2/branches/3.0@8309 d708f5d6-7413-0410-9779-e7cbd77b26cf
2010-12-20Fix split of midi regions after tempo / meter changes.Carl Hetherington
git-svn-id: svn://localhost/ardour2/branches/3.0@8308 d708f5d6-7413-0410-9779-e7cbd77b26cf
2010-12-20use notification of what was changed in MidiRegion::post_set() callPaul Davis
git-svn-id: svn://localhost/ardour2/branches/3.0@8307 d708f5d6-7413-0410-9779-e7cbd77b26cf