diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2019-10-17 23:16:55 -0600 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2019-11-02 16:32:18 -0600 |
commit | c0a1aec51693a87cacfe12ec0bafda38d42a9ef5 (patch) | |
tree | ca571b61493250dad6847d75f9fac08d0959f66c /libs/ardour/ardour | |
parent | addebc3240e9f2f9f76defad680e310939b1d269 (diff) |
start removal of NoteFixer code
Plan is to always read MIDI directly from rendered version. MidiPlaylistSource needs
attention before MidiPlaylist::read() can be removed
Diffstat (limited to 'libs/ardour/ardour')
-rw-r--r-- | libs/ardour/ardour/midi_playlist.h | 15 | ||||
-rw-r--r-- | libs/ardour/ardour/note_fixer.h | 104 |
2 files changed, 2 insertions, 117 deletions
diff --git a/libs/ardour/ardour/midi_playlist.h b/libs/ardour/ardour/midi_playlist.h index ddbbcf7b5e..83ba5ecb61 100644 --- a/libs/ardour/ardour/midi_playlist.h +++ b/libs/ardour/ardour/midi_playlist.h @@ -28,11 +28,12 @@ #include <boost/utility.hpp> +#include "evoral/Parameter.hpp" + #include "ardour/ardour.h" #include "ardour/midi_cursor.h" #include "ardour/midi_model.h" #include "ardour/midi_state_tracker.h" -#include "ardour/note_fixer.h" #include "ardour/playlist.h" #include "evoral/Note.hpp" #include "evoral/Parameter.hpp" @@ -116,20 +117,8 @@ protected: void region_going_away (boost::weak_ptr<Region> region); private: - typedef Evoral::Note<Temporal::Beats> Note; - typedef Evoral::Event<samplepos_t> Event; - - struct RegionTracker : public boost::noncopyable { - MidiCursor cursor; ///< Cursor (iterator and read state) - MidiStateTracker tracker; ///< Active note tracker - NoteFixer fixer; ///< Edit compensation - }; - - typedef std::map< Region*, boost::shared_ptr<RegionTracker> > NoteTrackers; - void dump () const; - NoteTrackers _note_trackers; NoteMode _note_mode; samplepos_t _read_end; diff --git a/libs/ardour/ardour/note_fixer.h b/libs/ardour/ardour/note_fixer.h deleted file mode 100644 index 3e6fea6551..0000000000 --- a/libs/ardour/ardour/note_fixer.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (C) 2017 Paul Davis <paul@linuxaudiosystems.com> - * Copyright (C) 2019 Robin Gareus <robin@gareus.org> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef __ardour_note_fixer_h__ -#define __ardour_note_fixer_h__ - -#include <list> - -#include <boost/utility.hpp> - -#include "temporal/beats.h" - -#include "evoral/Note.hpp" - -#include "ardour/midi_model.h" -#include "ardour/types.h" - -namespace Evoral { template<typename Time> class EventSink; } - -namespace ARDOUR { - -class BeatsSamplesConverter; -class MidiStateTracker; -class TempoMap; - -/** A tracker and compensator for note edit operations. - * - * This monitors edit operations sent to a model that affect active notes - * during a read, and maintains a queue of synthetic events that should be sent - * at the start of the next read to maintain coherent MIDI state. - */ -class NoteFixer : public boost::noncopyable -{ -public: - typedef Evoral::Note<Temporal::Beats> Note; - - ~NoteFixer(); - - /** Clear all internal state. */ - void clear(); - - /** Handle a region edit during read. - * - * This must be called before the command is applied to the model. Events - * are enqueued to compensate for edits which should be later sent with - * emit() at the start of the next read. - * - * @param tempo_map The tempo-map - * @param cmd Command to compensate for. - * @param origin Timeline position of edited source. - * @param pos Current read position (last read end). - * @param active_notes currently active notes (read/write) - */ - void prepare(TempoMap& tempo_map, - const MidiModel::NoteDiffCommand* cmd, - samplepos_t origin, - samplepos_t pos, - std::set< boost::weak_ptr<Note> >& active_notes); - - /** Emit any pending edit compensation events. - * - * @param dst Destination for events. - * @param pos Timestamp to be used for every event, should be the start of - * the read block immediately following any calls to prepare(). - * @param tracker Tracker to update with emitted events. - */ - void emit(Evoral::EventSink<samplepos_t>& dst, - samplepos_t pos, - MidiStateTracker& tracker); - -private: - typedef Evoral::Event<samplepos_t> Event; - typedef std::list<Event*> Events; - - /** Copy a beats event to a samples event with the given time stamp. */ - Event* copy_event(samplepos_t time, const Evoral::Event<Temporal::Beats>& ev); - - /** Return true iff `note` is active at `pos`. */ - bool note_is_active(const BeatsSamplesConverter& converter, - boost::shared_ptr<Note> note, - samplepos_t pos); - - Events _events; -}; - -} /* namespace ARDOUR */ - -#endif /* __ardour_note_fixer_h__ */ |