Reduce unnecessary non-const MIDI buffer access.
This commit is contained in:
parent
7def8de5a3
commit
8bba63282a
@ -38,7 +38,7 @@ class LIBARDOUR_API MidiStateTracker
|
|||||||
public:
|
public:
|
||||||
MidiStateTracker();
|
MidiStateTracker();
|
||||||
|
|
||||||
void track (const MidiBuffer::iterator& from, const MidiBuffer::iterator& to);
|
void track (const MidiBuffer::const_iterator& from, const MidiBuffer::const_iterator& to);
|
||||||
void add (uint8_t note, uint8_t chn);
|
void add (uint8_t note, uint8_t chn);
|
||||||
void remove (uint8_t note, uint8_t chn);
|
void remove (uint8_t note, uint8_t chn);
|
||||||
void resolve_notes (MidiBuffer& buffer, framepos_t time);
|
void resolve_notes (MidiBuffer& buffer, framepos_t time);
|
||||||
|
@ -87,9 +87,9 @@ PeakMeter::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /*end_fr
|
|||||||
// Meter MIDI in to the first n_midi peaks
|
// Meter MIDI in to the first n_midi peaks
|
||||||
for (uint32_t i = 0; i < n_midi; ++i, ++n) {
|
for (uint32_t i = 0; i < n_midi; ++i, ++n) {
|
||||||
float val = 0.0f;
|
float val = 0.0f;
|
||||||
MidiBuffer& buf (bufs.get_midi(i));
|
const MidiBuffer& buf (bufs.get_midi(i));
|
||||||
|
|
||||||
for (MidiBuffer::iterator e = buf.begin(); e != buf.end(); ++e) {
|
for (MidiBuffer::const_iterator e = buf.begin(); e != buf.end(); ++e) {
|
||||||
const Evoral::MIDIEvent<framepos_t> ev(*e, false);
|
const Evoral::MIDIEvent<framepos_t> ev(*e, false);
|
||||||
if (ev.is_note_on()) {
|
if (ev.is_note_on()) {
|
||||||
const float this_vel = ev.buffer()[2] / 127.0;
|
const float this_vel = ev.buffer()[2] / 127.0;
|
||||||
|
@ -84,9 +84,9 @@ MidiStateTracker::remove (uint8_t note, uint8_t chn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MidiStateTracker::track (const MidiBuffer::iterator &from, const MidiBuffer::iterator &to)
|
MidiStateTracker::track (const MidiBuffer::const_iterator &from, const MidiBuffer::const_iterator &to)
|
||||||
{
|
{
|
||||||
for (MidiBuffer::iterator i = from; i != to; ++i) {
|
for (MidiBuffer::const_iterator i = from; i != to; ++i) {
|
||||||
track(*i);
|
track(*i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -264,7 +264,7 @@ Plugin::connect_and_run (BufferSet& bufs,
|
|||||||
|
|
||||||
/* Track notes that we are sending to the plugin */
|
/* Track notes that we are sending to the plugin */
|
||||||
|
|
||||||
MidiBuffer& b = bufs.get_midi (0);
|
const MidiBuffer& b = bufs.get_midi (0);
|
||||||
|
|
||||||
_tracker.track (b.begin(), b.end());
|
_tracker.track (b.begin(), b.end());
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user