#include <glibmm/fileutils.h>
#include <glibmm/miscutils.h>
-#include "evoral/types.hpp"
+#include "evoral/Beats.hpp"
#include "pbd/xml++.h"
#include "pbd/basename.h"
namespace ARDOUR {
namespace Properties {
- PBD::PropertyDescriptor<void*> midi_data;
PBD::PropertyDescriptor<Evoral::Beats> start_beats;
PBD::PropertyDescriptor<Evoral::Beats> length_beats;
}
void
MidiRegion::make_property_quarks ()
{
- Properties::midi_data.property_id = g_quark_from_static_string (X_("midi-data"));
- DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for midi-data = %1\n", Properties::midi_data.property_id));
Properties::start_beats.property_id = g_quark_from_static_string (X_("start-beats"));
DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for start-beats = %1\n", Properties::start_beats.property_id));
Properties::length_beats.property_id = g_quark_from_static_string (X_("length-beats"));
}
framecnt_t
-MidiRegion::read_at (Evoral::EventSink<framepos_t>& out, framepos_t position, framecnt_t dur, uint32_t chan_n, NoteMode mode, MidiStateTracker* tracker) const
+MidiRegion::read_at (Evoral::EventSink<framepos_t>& out,
+ framepos_t position,
+ framecnt_t dur,
+ uint32_t chan_n,
+ NoteMode mode,
+ MidiStateTracker* tracker,
+ MidiChannelFilter* filter) const
{
- return _read_at (_sources, out, position, dur, chan_n, mode, tracker);
+ return _read_at (_sources, out, position, dur, chan_n, mode, tracker, filter);
}
framecnt_t
}
framecnt_t
-MidiRegion::_read_at (const SourceList& /*srcs*/, Evoral::EventSink<framepos_t>& dst, framepos_t position, framecnt_t dur, uint32_t chan_n,
- NoteMode mode, MidiStateTracker* tracker) const
+MidiRegion::_read_at (const SourceList& /*srcs*/,
+ Evoral::EventSink<framepos_t>& dst,
+ framepos_t position,
+ framecnt_t dur,
+ uint32_t chan_n,
+ NoteMode mode,
+ MidiStateTracker* tracker,
+ MidiChannelFilter* filter) const
{
frameoffset_t internal_offset = 0;
- framecnt_t to_read = 0;
+ framecnt_t to_read = 0;
/* precondition: caller has verified that we cover the desired section */
_start + internal_offset, // where to start reading in the source
to_read, // read duration in frames
tracker,
+ filter,
_filtered_parameters
) != to_read) {
return 0; /* "read nothing" */
midi_source()->AutomationStateChanged.connect_same_thread (
_model_connection, boost::bind (&MidiRegion::model_automation_state_changed, this, _1)
);
-
- model()->ContentsChanged.connect_same_thread (
- _model_contents_connection, boost::bind (&MidiRegion::model_contents_changed, this));
-}
-
-void
-MidiRegion::model_contents_changed ()
-{
- {
- /* Invalidate source iterator to force reading new contents even if the
- calls to read() progress linearly. Try-lock only to avoid deadlock
- when called while writing with the source already locked. */
- Glib::Threads::Mutex::Lock lm (midi_source(0)->mutex(), Glib::Threads::TRY_LOCK);
- if (lm.locked()) {
- midi_source(0)->invalidate (lm);
- }
- }
- send_change (PropertyChange (Properties::midi_data));
}
void
*/
Glib::Threads::Mutex::Lock lm (midi_source(0)->mutex(), Glib::Threads::TRY_LOCK);
if (lm.locked()) {
+ /* TODO: This is too aggressive, we need more fine-grained invalidation. */
midi_source(0)->invalidate (lm);
}
}
_start_beats = Evoral::Beats();
}
-/** Transpose the notes in this region by a given number of semitones */
-void
-MidiRegion::transpose (int semitones)
-{
- BeatsFramesConverter c (_session.tempo_map(), _start);
- model()->transpose (c.from (_start), c.from (_start + _length), semitones);
-}
-
void
MidiRegion::set_start_internal (framecnt_t s)
{