Towards fixing AU preset invalidation
[ardour.git] / libs / ardour / midi_playlist_source.cc
index cd5362c3dafb822d166519e19f935e6120f97ca1..86bc2b6344bc70b65d25e4123a2eb04072672010 100644 (file)
@@ -25,7 +25,7 @@
 #include "ardour/midi_playlist.h"
 #include "ardour/midi_playlist_source.h"
 
-#include "i18n.h"
+#include "pbd/i18n.h"
 
 using namespace std;
 using namespace ARDOUR;
@@ -54,7 +54,7 @@ on other ways to approach this issue.
 ********************************************************************************/
 
 MidiPlaylistSource::MidiPlaylistSource (Session& s, const ID& orig, const std::string& name, boost::shared_ptr<MidiPlaylist> p,
-                                       uint32_t /*chn*/, frameoffset_t begin, framecnt_t len, Source::Flag flags)
+                                       uint32_t /*chn*/, sampleoffset_t begin, samplecnt_t len, Source::Flag flags)
        : Source (s, DataType::MIDI, name)
        , MidiSource (s, name, flags)
        , PlaylistSource (s, orig, name, p, DataType::MIDI, begin, len, flags)
@@ -114,18 +114,22 @@ MidiPlaylistSource::set_state (const XMLNode& node, int version, bool with_desce
        return 0;
 }
 
-framecnt_t
-MidiPlaylistSource::length (framepos_t)  const
+samplecnt_t
+MidiPlaylistSource::length (samplepos_t)  const
 {
-       pair<framepos_t,framepos_t> extent = _playlist->get_extent();
+       pair<samplepos_t,samplepos_t> extent = _playlist->get_extent();
        return extent.second - extent.first;
 }
 
-framecnt_t
-MidiPlaylistSource::read_unlocked (Evoral::EventSink<framepos_t>& dst,
-                                  framepos_t /*position*/,
-                                  framepos_t start, framecnt_t cnt,
-                                  MidiStateTracker*) const
+samplecnt_t
+MidiPlaylistSource::read_unlocked (const Lock& lock,
+                                  Evoral::EventSink<samplepos_t>& dst,
+                                  samplepos_t /*position*/,
+                                  samplepos_t start,
+                                   samplecnt_t cnt,
+                                   Evoral::Range<samplepos_t>* loop_range,
+                                  MidiStateTracker*,
+                                  MidiChannelFilter*) const
 {
        boost::shared_ptr<MidiPlaylist> mp = boost::dynamic_pointer_cast<MidiPlaylist> (_playlist);
 
@@ -133,13 +137,14 @@ MidiPlaylistSource::read_unlocked (Evoral::EventSink<framepos_t>& dst,
                return 0;
        }
 
-       return mp->read (dst, start, cnt);
+       return mp->read (dst, start, cnt, loop_range);
 }
 
-framecnt_t
-MidiPlaylistSource::write_unlocked (MidiRingBuffer<framepos_t>&,
-                                    framepos_t,
-                                    framecnt_t)
+samplecnt_t
+MidiPlaylistSource::write_unlocked (const Lock&,
+                                    MidiRingBuffer<samplepos_t>&,
+                                    samplepos_t,
+                                    samplecnt_t)
 {
        fatal << string_compose (_("programming error: %1"), "MidiPlaylistSource::write_unlocked() called - should be impossible") << endmsg;
        abort(); /*NOTREACHED*/
@@ -147,33 +152,33 @@ MidiPlaylistSource::write_unlocked (MidiRingBuffer<framepos_t>&,
 }
 
 void
-MidiPlaylistSource::append_event_unlocked_beats(const Evoral::Event<Evoral::MusicalTime>& /*ev*/)
+MidiPlaylistSource::append_event_beats(const Glib::Threads::Mutex::Lock& /*lock*/, const Evoral::Event<Temporal::Beats>& /*ev*/)
 {
-       fatal << string_compose (_("programming error: %1"), "MidiPlaylistSource::append_event_unlocked_beats() called - should be impossible") << endmsg;
+       fatal << string_compose (_("programming error: %1"), "MidiPlaylistSource::append_event_beats() called - should be impossible") << endmsg;
        abort(); /*NOTREACHED*/
 }
 
 void
-MidiPlaylistSource::append_event_unlocked_frames(const Evoral::Event<framepos_t>& /* ev */, framepos_t /*source_start*/)
+MidiPlaylistSource::append_event_samples(const Glib::Threads::Mutex::Lock& /*lock*/, const Evoral::Event<samplepos_t>& /* ev */, samplepos_t /*source_start*/)
 {
-       fatal << string_compose (_("programming error: %1"), "MidiPlaylistSource::append_event_unlocked_frames() called - should be impossible") << endmsg;
+       fatal << string_compose (_("programming error: %1"), "MidiPlaylistSource::append_event_samples() called - should be impossible") << endmsg;
        abort(); /*NOTREACHED*/
 }
 
 void
-MidiPlaylistSource::load_model (bool, bool)
+MidiPlaylistSource::load_model (const Glib::Threads::Mutex::Lock&, bool)
 {
        /* nothing to do */
 }
 
 void
-MidiPlaylistSource::destroy_model ()
+MidiPlaylistSource::destroy_model (const Glib::Threads::Mutex::Lock&)
 {
        /* nothing to do */
 }
 
 void
-MidiPlaylistSource::flush_midi ()
+MidiPlaylistSource::flush_midi (const Lock& lock)
 {
 }