optimize some performance bottlenecks; remove jack_nframes_t that crept back into...
[ardour.git] / libs / ardour / ardour / midi_playlist.h
index da3a72a3fd69b398e0267bd46bdc8211719b881e..44f04b781b2c5810a18bf007d43721d5ee7cb997 100644 (file)
@@ -33,73 +33,43 @@ class Session;
 class Region;
 class MidiRegion;
 class Source;
+class MidiRingBuffer;
 
 class MidiPlaylist : public ARDOUR::Playlist
 {
-private:
-
-       struct State : public ARDOUR::StateManager::State
-       {
-               RegionList regions;
-               std::list<UndoAction> region_states;
-
-               State (std::string why) : ARDOUR::StateManager::State (why)
-               {}
-               ~State ();
-       };
-
 public:
        MidiPlaylist (Session&, const XMLNode&, bool hidden = false);
        MidiPlaylist (Session&, string name, bool hidden = false);
-       MidiPlaylist (const MidiPlaylist&, string name, bool hidden = false);
-       MidiPlaylist (const MidiPlaylist&, jack_nframes_t start, jack_nframes_t cnt,
+       MidiPlaylist (boost::shared_ptr<const MidiPlaylist> other, string name, bool hidden = false);
+       MidiPlaylist (boost::shared_ptr<const MidiPlaylist> other, nframes_t start, nframes_t cnt,
                      string name, bool hidden = false);
 
-       jack_nframes_t read (unsigned char *dst, unsigned char *mixdown,
-                            char * workbuf, jack_nframes_t start, jack_nframes_t cnt, uint32_t chan_n=0);
+       ~MidiPlaylist ();
+
+       nframes_t read (MidiRingBuffer& buf,
+                       nframes_t start, nframes_t cnt, uint32_t chan_n=0);
 
        int set_state (const XMLNode&);
        UndoAction get_memento() const;
 
-       template<class T>
-       void apply_to_history (T& obj, void (T::*method)(const ARDOUR::StateManager::StateMap&, state_id_t))
-       {
-               RegionLock rlock (this);
-               (obj.*method) (states, _current_state_id);
-       }
-
-       bool destroy_region (Region*);
-
-       void get_equivalent_regions (const MidiRegion&, std::vector<MidiRegion*>&);
-       void get_region_list_equivalent_regions (const MidiRegion&, std::vector<MidiRegion*>&);
-
-       void drop_all_states ();
+       bool destroy_region (boost::shared_ptr<Region>);
 
 protected:
 
-       /* state management */
-
-       StateManager::State* state_factory (std::string) const;
-       Change restore_state (StateManager::State&);
-       void send_state_change (Change);
-
        /* playlist "callbacks" */
        void flush_notifications ();
 
-       void finalize_split_region (Region *orig, Region *left, Region *right);
-
-       void refresh_dependents (Region& region);
-       void check_dependents (Region& region, bool norefresh);
-       void remove_dependents (Region& region);
-
-protected:
-       ~MidiPlaylist (); /* public should use unref() */
+       void finalize_split_region (boost::shared_ptr<Region> original, boost::shared_ptr<Region> left, boost::shared_ptr<Region> right);
+       
+       void check_dependents (boost::shared_ptr<Region> region, bool norefresh);
+       void refresh_dependents (boost::shared_ptr<Region> region);
+       void remove_dependents (boost::shared_ptr<Region> region);
 
 private:
        XMLNode& state (bool full_state);
        void dump () const;
 
-       bool region_changed (Change, Region*);
+       bool region_changed (Change, boost::shared_ptr<Region>);
 };
 
 } /* namespace ARDOUR */