13
0

change MidiStateTracker to MidiNoteTracker

The old name will become a bigger class/object that tracks all MIDI state,
not just notes
This commit is contained in:
Paul Davis 2022-02-01 16:20:28 -07:00
parent 77a60d9e2d
commit 1ab49bcc32
27 changed files with 54 additions and 54 deletions

View File

@ -50,7 +50,7 @@ class LIBARDOUR_API AudioTrack : public Track
std::string const& name);
int export_stuff (BufferSet& bufs, samplepos_t start_sample, samplecnt_t nframes,
boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export, bool for_freeze,
MidiStateTracker&);
MidiNoteTracker&);
int set_state (const XMLNode&, int version);

View File

@ -87,7 +87,7 @@ public:
return boost::shared_ptr<Region> ();
}
int export_stuff (BufferSet&, samplepos_t, samplecnt_t, boost::shared_ptr<Processor>, bool, bool, bool, MidiStateTracker&) { return -1; }
int export_stuff (BufferSet&, samplepos_t, samplecnt_t, boost::shared_ptr<Processor>, bool, bool, bool, MidiNoteTracker&) { return -1; }
void set_audition_synth_info(PluginInfoPtr in) { audition_synth_info = in; }

View File

@ -66,7 +66,7 @@ class BeatBox : public ARDOUR::Processor {
private:
StepSequencer* _sequencer;
ARDOUR::MidiStateTracker inbound_tracker;
ARDOUR::MidiNoteTracker inbound_tracker;
bool fill_midi_source (boost::shared_ptr<SMFSource>);

View File

@ -207,7 +207,7 @@ private:
DeclickAmp _declick_amp;
sampleoffset_t _declick_offs;
bool _declick_enabled;
MidiStateTracker _tracker;
MidiNoteTracker _tracker;
boost::optional<bool> _last_read_reversed;
boost::optional<bool> _last_read_loop;

View File

@ -46,7 +46,7 @@ class MidiChannelFilter;
class MidiFilter;
class MidiModel;
class MidiSource;
class MidiStateTracker;
class MidiNoteTracker;
class Playlist;
class Route;
class Session;
@ -71,7 +71,7 @@ class LIBARDOUR_API MidiRegion : public Region
MidiCursor& cursor,
uint32_t chan_n = 0,
NoteMode mode = Sustained,
MidiStateTracker* tracker = 0,
MidiNoteTracker* tracker = 0,
MidiChannelFilter* filter = 0) const;
timecnt_t master_read_at (MidiRingBuffer<samplepos_t>& dst,
@ -136,7 +136,7 @@ class LIBARDOUR_API MidiRegion : public Region
MidiCursor& cursor,
uint32_t chan_n = 0,
NoteMode mode = Sustained,
MidiStateTracker* tracker = 0,
MidiNoteTracker* tracker = 0,
MidiChannelFilter* filter = 0) const;
void register_properties ();

View File

@ -61,7 +61,7 @@ public:
void resolve_tracker (Evoral::EventSink<samplepos_t>& dst, samplepos_t);
private:
MidiStateTracker _tracker;
MidiNoteTracker _tracker;
};

View File

@ -44,7 +44,7 @@ namespace ARDOUR {
class MidiChannelFilter;
class MidiModel;
class MidiStateTracker;
class MidiNoteTracker;
template<typename T> class MidiRingBuffer;
@ -96,7 +96,7 @@ class LIBARDOUR_API MidiSource : virtual public Source
* @param loop_range If non-null, all event times will be mapped into this loop range.
* @param cursor Cached iterator to start copying events
* @param filter Channel filter to apply or NULL to disable filter
* @param tracker an optional pointer to MidiStateTracker object, for note on/off tracking.
* @param tracker an optional pointer to MidiNoteTracker object, for note on/off tracking.
* @param filtered Parameters whose MIDI messages will not be returned.
*/
virtual timecnt_t midi_read (const Lock& lock,
@ -106,7 +106,7 @@ class LIBARDOUR_API MidiSource : virtual public Source
timecnt_t const & cnt,
Temporal::Range* loop_range,
MidiCursor& cursor,
MidiStateTracker* tracker,
MidiNoteTracker* tracker,
MidiChannelFilter* filter,
const std::set<Evoral::Parameter>& filtered);
@ -212,7 +212,7 @@ class LIBARDOUR_API MidiSource : virtual public Source
timepos_t const & start,
timecnt_t const & cnt,
Temporal::Range* loop_range,
MidiStateTracker* tracker,
MidiNoteTracker* tracker,
MidiChannelFilter* filter) const = 0;
/** Write data to this source from a MidiRingBuffer.

View File

@ -37,10 +37,10 @@ class MidiSource;
/** Tracks played notes, so they can be resolved in potential stuck note
* situations (e.g. looping, transport stop, etc).
*/
class LIBARDOUR_API MidiStateTracker
class LIBARDOUR_API MidiNoteTracker
{
public:
MidiStateTracker();
MidiNoteTracker();
void track (const MidiBuffer::const_iterator& from, const MidiBuffer::const_iterator& to);
void track (const uint8_t* evbuf);

View File

@ -68,7 +68,7 @@ public:
bool include_endpoint,
bool for_export,
bool for_freeze,
MidiStateTracker& tracker);
MidiNoteTracker& tracker);
int set_state (const XMLNode&, int version);

View File

@ -398,7 +398,7 @@ private:
virtual void add_state (XMLNode*) const = 0;
bool _have_presets;
MidiStateTracker _tracker;
MidiNoteTracker _tracker;
BufferSet _pending_stop_events;
bool _have_pending_stop_events;
PresetRecord _last_preset;

View File

@ -36,7 +36,7 @@
namespace ARDOUR {
class MidiBuffer;
class MidiStateTracker;
class MidiNoteTracker;
/** */
class LIBARDOUR_API RTMidiBuffer : public Evoral::EventSink<samplepos_t>
@ -61,7 +61,7 @@ class LIBARDOUR_API RTMidiBuffer : public Evoral::EventSink<samplepos_t>
samplecnt_t span() const;
uint32_t write (TimeType time, Evoral::EventType type, uint32_t size, const uint8_t* buf);
uint32_t read (MidiBuffer& dst, samplepos_t start, samplepos_t end, MidiStateTracker& tracker, samplecnt_t offset = 0);
uint32_t read (MidiBuffer& dst, samplepos_t start, samplepos_t end, MidiNoteTracker& tracker, samplecnt_t offset = 0);
void dump (uint32_t);
void reverse ();

View File

@ -99,7 +99,7 @@ public:
timepos_t const & start,
timecnt_t const & cnt,
Temporal::Range* loop_range,
MidiStateTracker* tracker,
MidiNoteTracker* tracker,
MidiChannelFilter* filter) const;
timecnt_t write_unlocked (const Lock& lock,

View File

@ -44,7 +44,7 @@
namespace ARDOUR {
class MidiBuffer;
class MidiStateTracker;
class MidiNoteTracker;
class StepSequencer;
class StepSequence;
class TempoMap;
@ -105,7 +105,7 @@ class Step : public PBD::Stateful {
void set_beat (Temporal::Beats const & beat);
Temporal::Beats beat () const { return _nominal_beat; }
bool run (MidiBuffer& buf, bool running, samplepos_t, samplepos_t, MidiStateTracker&);
bool run (MidiBuffer& buf, bool running, samplepos_t, samplepos_t, MidiNoteTracker&);
bool skipped() const { return _skipped; }
void set_skipped (bool);
@ -158,7 +158,7 @@ class Step : public PBD::Stateful {
ParameterValue _parameters[_parameters_per_step];
size_t _repeat;
void check_note (size_t n, MidiBuffer& buf, bool, samplepos_t, samplepos_t, MidiStateTracker&);
void check_note (size_t n, MidiBuffer& buf, bool, samplepos_t, samplepos_t, MidiNoteTracker&);
void check_parameter (size_t n, MidiBuffer& buf, bool, samplepos_t, samplepos_t);
void dump_note (MusicTimeEvents&, size_t n, Temporal::Beats const &) const;
void dump_parameter (MusicTimeEvents&, size_t n, Temporal::Beats const &) const;
@ -204,7 +204,7 @@ class StepSequence : public PBD::Stateful
void reschedule (Temporal::Beats const &, Temporal::Beats const &);
void schedule (Temporal::Beats const &);
bool run (MidiBuffer& buf, bool running, samplepos_t, samplepos_t, MidiStateTracker&);
bool run (MidiBuffer& buf, bool running, samplepos_t, samplepos_t, MidiNoteTracker&);
StepSequencer& sequencer() const { return _sequencer; }
@ -281,7 +281,7 @@ class StepSequencer : public PBD::Stateful
bool _running;
size_t _step_capacity;
ARDOUR::MidiStateTracker outbound_tracker;
ARDOUR::MidiNoteTracker outbound_tracker;
struct Request {

View File

@ -42,7 +42,7 @@ class DiskWriter;
class IO;
class RecordEnableControl;
class RecordSafeControl;
class MidiStateTracker;
class MidiNoteTracker;
/** A track is an route (bus) with a recordable diskstream and
* related objects relevant to recording, playback and editing.
@ -112,7 +112,7 @@ public:
virtual int export_stuff (BufferSet& bufs, samplepos_t start_sample, samplecnt_t nframes,
boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export, bool for_freeze,
MidiStateTracker&) = 0;
MidiNoteTracker&) = 0;
virtual int set_state (const XMLNode&, int version);
static void zero_diskstream_id_in_xml (XMLNode&);

View File

@ -494,7 +494,7 @@ class LIBARDOUR_API MIDITrigger : public Trigger {
private:
PBD::ID data_source;
MidiStateTracker tracker;
MidiNoteTracker tracker;
PBD::ScopedConnection content_connection;
Temporal::Beats final_beat;

View File

@ -202,7 +202,7 @@ AudioTrack::get_input_monitoring_state (bool recording, bool talkback) const
int
AudioTrack::export_stuff (BufferSet& buffers, samplepos_t start, samplecnt_t nframes,
boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export, bool for_freeze,
MidiStateTracker& /* ignored, this is audio */)
MidiNoteTracker& /* ignored, this is audio */)
{
boost::scoped_array<gain_t> gain_buffer (new gain_t[nframes]);
boost::scoped_array<Sample> mix_buffer (new Sample[nframes]);

View File

@ -1299,7 +1299,7 @@ MidiModel::write_section_to (boost::shared_ptr<MidiSource> source,
bool offset_events)
{
ReadLock lock(read_lock());
MidiStateTracker mst;
MidiNoteTracker mst;
const bool old_percussive = percussive();
set_percussive(false);

View File

@ -287,7 +287,7 @@ MidiPlaylist::contained_automation()
void
MidiPlaylist::render (MidiChannelFilter* filter)
{
typedef pair<MidiStateTracker*,samplepos_t> TrackerInfo;
typedef pair<MidiNoteTracker*,samplepos_t> TrackerInfo;
Playlist::RegionReadLock rl (this);

View File

@ -179,7 +179,7 @@ MidiRegion::read_at (Evoral::EventSink<samplepos_t>& out,
MidiCursor& cursor,
uint32_t chan_n,
NoteMode mode,
MidiStateTracker* tracker,
MidiNoteTracker* tracker,
MidiChannelFilter* filter) const
{
return _read_at (_sources, out, position, dur, loop_range, cursor, chan_n, mode, tracker, filter);
@ -206,7 +206,7 @@ MidiRegion::_read_at (const SourceList& /*srcs*/,
MidiCursor& cursor,
uint32_t chan_n,
NoteMode mode,
MidiStateTracker* tracker,
MidiNoteTracker* tracker,
MidiChannelFilter* filter) const
{
timecnt_t dur (xdur);
@ -320,7 +320,7 @@ MidiRegion::render_range (Evoral::EventSink<samplepos_t>& dst,
#endif
MidiCursor cursor;
MidiStateTracker tracker;
MidiNoteTracker tracker;
/* This call reads events from a source and writes them to `dst' timed in session samples */

View File

@ -180,7 +180,7 @@ MidiSource::midi_read (const Lock& lm,
timecnt_t const & cnt,
Temporal::Range* loop_range,
MidiCursor& cursor,
MidiStateTracker* tracker,
MidiNoteTracker* tracker,
MidiChannelFilter* filter,
const std::set<Evoral::Parameter>& filtered)
{

View File

@ -33,13 +33,13 @@ using namespace std;
using namespace ARDOUR;
MidiStateTracker::MidiStateTracker ()
MidiNoteTracker::MidiNoteTracker ()
{
reset ();
}
void
MidiStateTracker::reset ()
MidiNoteTracker::reset ()
{
DEBUG_TRACE (PBD::DEBUG::MidiTrackers, string_compose ("%1: reset\n", this));
memset (_active_notes, 0, sizeof (_active_notes));
@ -47,7 +47,7 @@ MidiStateTracker::reset ()
}
void
MidiStateTracker::add (uint8_t note, uint8_t chn)
MidiNoteTracker::add (uint8_t note, uint8_t chn)
{
if (_active_notes[note+128 * chn] == 0) {
++_on;
@ -64,7 +64,7 @@ MidiStateTracker::add (uint8_t note, uint8_t chn)
}
void
MidiStateTracker::remove (uint8_t note, uint8_t chn)
MidiNoteTracker::remove (uint8_t note, uint8_t chn)
{
switch (_active_notes[note + 128 * chn]) {
case 0:
@ -84,7 +84,7 @@ MidiStateTracker::remove (uint8_t note, uint8_t chn)
}
void
MidiStateTracker::track (const MidiBuffer::const_iterator &from, const MidiBuffer::const_iterator &to)
MidiNoteTracker::track (const MidiBuffer::const_iterator &from, const MidiBuffer::const_iterator &to)
{
for (MidiBuffer::const_iterator i = from; i != to; ++i) {
track(*i);
@ -92,7 +92,7 @@ MidiStateTracker::track (const MidiBuffer::const_iterator &from, const MidiBuffe
}
void
MidiStateTracker::track (const uint8_t* evbuf)
MidiNoteTracker::track (const uint8_t* evbuf)
{
const uint8_t type = evbuf[0] & 0xF0;
const uint8_t chan = evbuf[0] & 0x0F;
@ -110,7 +110,7 @@ MidiStateTracker::track (const uint8_t* evbuf)
}
void
MidiStateTracker::resolve_notes (MidiBuffer &dst, samplepos_t time)
MidiNoteTracker::resolve_notes (MidiBuffer &dst, samplepos_t time)
{
DEBUG_TRACE (PBD::DEBUG::MidiTrackers, string_compose ("%1 MB-resolve notes @ %2 on = %3\n", this, time, _on));
@ -138,7 +138,7 @@ MidiStateTracker::resolve_notes (MidiBuffer &dst, samplepos_t time)
}
void
MidiStateTracker::resolve_notes (Evoral::EventSink<samplepos_t> &dst, samplepos_t time)
MidiNoteTracker::resolve_notes (Evoral::EventSink<samplepos_t> &dst, samplepos_t time)
{
uint8_t buf[3];
@ -168,7 +168,7 @@ MidiStateTracker::resolve_notes (Evoral::EventSink<samplepos_t> &dst, samplepos_
}
void
MidiStateTracker::resolve_notes (MidiSource& src, const MidiSource::Lock& lock, Temporal::Beats time)
MidiNoteTracker::resolve_notes (MidiSource& src, const MidiSource::Lock& lock, Temporal::Beats time)
{
DEBUG_TRACE (PBD::DEBUG::MidiTrackers, string_compose ("%1 MS-resolve notes @ %2 on = %3\n", this, time, _on));
@ -199,7 +199,7 @@ MidiStateTracker::resolve_notes (MidiSource& src, const MidiSource::Lock& lock,
}
void
MidiStateTracker::dump (ostream& o)
MidiNoteTracker::dump (ostream& o)
{
o << "******\n";
for (int c = 0; c < 16; ++c) {

View File

@ -528,7 +528,7 @@ MidiTrack::export_stuff (BufferSet& buffers,
bool include_endpoint,
bool for_export,
bool for_freeze,
MidiStateTracker& tracker)
MidiNoteTracker& tracker)
{
if (buffers.count().n_midi() == 0) {
return -1;
@ -547,7 +547,7 @@ MidiTrack::export_stuff (BufferSet& buffers,
* subsequent call
*/
MidiStateTracker ignored;
MidiNoteTracker ignored;
/* XXX this doesn't fail, other than if the lock cannot be obtained */
mpl->rendered()->read (buffers.get_midi(0), start, start+nframes, ignored, start);

View File

@ -252,7 +252,7 @@ item_item_earlier (ARDOUR::RTMidiBuffer::Item const & item, ARDOUR::RTMidiBuffer
}
uint32_t
RTMidiBuffer::read (MidiBuffer& dst, samplepos_t start, samplepos_t end, MidiStateTracker& tracker, samplecnt_t offset)
RTMidiBuffer::read (MidiBuffer& dst, samplepos_t start, samplepos_t end, MidiNoteTracker& tracker, samplecnt_t offset)
{
Glib::Threads::RWLock::ReaderLock lm (_lock, Glib::Threads::TRY_LOCK);

View File

@ -5730,7 +5730,7 @@ Session::write_one_track (Track& track, samplepos_t start, samplepos_t end,
string legal_playlist_name;
string possible_path;
MidiBuffer resolved (256);
MidiStateTracker tracker;
MidiNoteTracker tracker;
DataType data_type = track.data_type();
std::vector<MidiSourceLockMap*> midi_source_locks;

View File

@ -216,7 +216,7 @@ SMFSource::read_unlocked (const Lock& lock,
timepos_t const & start,
timecnt_t const & duration,
Temporal::Range* loop_range,
MidiStateTracker* tracker,
MidiNoteTracker* tracker,
MidiChannelFilter* filter) const
{
int ret = 0;

View File

@ -224,7 +224,7 @@ Step::adjust_octave (int amt)
}
bool
Step::run (MidiBuffer& buf, bool running, samplepos_t start_sample, samplepos_t end_sample, MidiStateTracker& tracker)
Step::run (MidiBuffer& buf, bool running, samplepos_t start_sample, samplepos_t end_sample, MidiNoteTracker& tracker)
{
for (size_t n = 0; n < _parameters_per_step; ++n) {
check_parameter (n, buf, running, start_sample, end_sample);
@ -264,7 +264,7 @@ Step::dump_parameter (MusicTimeEvents& events, size_t n, Temporal::Beats const &
}
void
Step::check_note (size_t n, MidiBuffer& buf, bool running, samplepos_t start_sample, samplepos_t end_sample, MidiStateTracker& tracker)
Step::check_note (size_t n, MidiBuffer& buf, bool running, samplepos_t start_sample, samplepos_t end_sample, MidiNoteTracker& tracker)
{
Note& note (_notes[n]);
@ -518,7 +518,7 @@ StepSequence::set_channel (int c)
}
bool
StepSequence::run (MidiBuffer& buf, bool running, samplepos_t start_sample, samplepos_t end_sample, MidiStateTracker& tracker)
StepSequence::run (MidiBuffer& buf, bool running, samplepos_t start_sample, samplepos_t end_sample, MidiNoteTracker& tracker)
{
const size_t s = _sequencer.start_step();
const size_t e = _sequencer.end_step();

View File

@ -64,8 +64,8 @@ class BeatBox {
superclock_t measure_superclocks;
int _quantize_divisor;
bool clear_pending;
ARDOUR::MidiStateTracker inbound_tracker;
ARDOUR::MidiStateTracker outbound_tracker;
ARDOUR::MidiNoteTracker inbound_tracker;
ARDOUR::MidiNoteTracker outbound_tracker;
struct Event {
superclock_t time;