Remove unused (and timestamp type nasty) last_event_time() from SMF.
authorDavid Robillard <d@drobilla.net>
Sat, 14 Feb 2009 22:40:55 +0000 (22:40 +0000)
committerDavid Robillard <d@drobilla.net>
Sat, 14 Feb 2009 22:40:55 +0000 (22:40 +0000)
I swear I already did this.

git-svn-id: svn://localhost/ardour2/branches/3.0@4564 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/ardour/ardour/smf_source.h
libs/ardour/smf_source.cc
libs/evoral/evoral/SMF.hpp
libs/evoral/src/SMF.cpp

index 470e84b0cc1b798d42c1574befc11cfab1562183..9981408abc9d4d9163338612ec3d1a4aadf14437 100644 (file)
@@ -93,6 +93,8 @@ class SMFSource : public MidiSource, public Evoral::SMF<double> {
        void load_model(bool lock=true, bool force_reload=false);
        void destroy_model();
 
+       double last_event_time() const { return _last_ev_time; }
+
        void flush_midi();
 
   private:
@@ -120,6 +122,7 @@ class SMFSource : public MidiSource, public Evoral::SMF<double> {
        Flag           _flags;
        string         _take_id;
        bool           _allow_remove_if_empty;
+       double         _last_ev_time;
 
        static string _search_path;
 };
index e160d7e277217911ce5bdd2a65ba25efbcaa47f0..64bd6874189aace0353fecce440afade69f44cf9 100644 (file)
@@ -58,6 +58,7 @@ SMFSource::SMFSource (Session& s, std::string path, Flag flags)
        , Evoral::SMF<double> ()
        , _flags (Flag(flags | Writable)) // FIXME: this needs to be writable for now
        , _allow_remove_if_empty(true)
+       , _last_ev_time(0)
 {
        /* constructor used for new internal-to-session files. file cannot exist */
 
@@ -76,6 +77,7 @@ SMFSource::SMFSource (Session& s, const XMLNode& node)
        : MidiSource (s, node)
        , _flags (Flag (Writable|CanRename))
        , _allow_remove_if_empty(true)
+       , _last_ev_time(0)
 {
        /* constructor used for existing internal-to-session files. file must exist */
 
@@ -302,6 +304,7 @@ SMFSource::append_event_unlocked(EventTimeUnit unit, const Evoral::Event<double>
        }
 
        Evoral::SMF<double>::append_event_delta(delta_time, ev);
+       _last_ev_time = ev.time();
 
        _write_data_count += ev.size();
 }
@@ -357,6 +360,7 @@ SMFSource::mark_streaming_midi_write_started (NoteMode mode, nframes_t start_fra
 {
        MidiSource::mark_streaming_midi_write_started (mode, start_frame);
        Evoral::SMF<double>::begin_write ();
+       _last_ev_time = 0;
 }
 
 void
index 59f9448b4e482878974c416dfc732bb936aa16e3..cdf3170d526ad2d2118dd0210a259106bf05d150 100644 (file)
@@ -34,7 +34,8 @@ template<typename Time> class EventRingBuffer;
 
 #define THROW_FILE_ERROR throw(typename SMF<Time>::FileError)
 
-/** Standard Midi File (Type 0)
+/** Standard Midi File.
+ * Currently only tempo-based time of a given PPQN is supported.
  */
 template<typename Time>
 class SMF {
@@ -43,7 +44,7 @@ public:
                const char* what() const throw() { return "Unknown SMF error"; }
        };
 
-       SMF() : _last_ev_time(0), _smf(0), _smf_track(0), _empty(true) {};
+       SMF() : _smf(0), _smf_track(0), _empty(true) {};
        virtual ~SMF();
        
        int  open(const std::string& path, int track=1) THROW_FILE_ERROR;
@@ -62,8 +63,6 @@ public:
        bool     is_empty()   const { return _empty; }
        bool     eof()        const { assert(false); return true; }
        
-       Time last_event_time() const { return _last_ev_time; }
-       
        void begin_write();
        void append_event_delta(uint32_t delta_t, const Event<Time>& ev);
        void end_write() THROW_FILE_ERROR;
@@ -73,8 +72,6 @@ public:
 private:
        static const uint16_t _ppqn = 19200;
        
-       Time _last_ev_time; ///< last frame time written, relative to source start
-       
        std::string  _path;
        smf_t*       _smf;
        smf_track_t* _smf_track;
index 2b47cbfe4bf74cbf1735db9e45c459bd9fba85cf..7e5e5935ce52c4eb581ac69cef909117a7f7d17b 100644 (file)
@@ -241,7 +241,6 @@ SMF<Time>::append_event_delta(uint32_t delta_t, const Event<Time>& ev)
        
        assert(_smf_track);
        smf_track_add_event_delta_pulses(_smf_track, event, int(delta_t));
-       _last_ev_time = ev.time();
        
        if (ev.size() > 0) {
                _empty = false;
@@ -260,8 +259,6 @@ SMF<Time>::begin_write()
        
        smf_add_track(_smf, _smf_track);
        assert(_smf->number_of_tracks == 1);
-       
-       _last_ev_time = 0;
 }
 
 template<typename Time>