-
- int init (string idstr, bool must_exist);
-
- nframes_t read_unlocked (MidiRingBuffer& dst, nframes_t start, nframes_t cn, nframes_t stamp_offset, nframes_t negative_stamp_offset) const;
- nframes_t write_unlocked (MidiRingBuffer& dst, nframes_t cnt);
-
- bool find (std::string path, bool must_exist, bool& is_new);
- bool removable() const;
- bool writable() const { return _flags & Writable; }
-
- int open();
- void close();
-
- /**
- * This method is only used by flush_footer() to find the right seek position
- * for the footer (at the end after recording or -4 offset ro SEEK_END
- * if a footer is already present)
- */
- void seek_to_footer_position();
-
- /**
- * write the track footer at the current seek position
- */
- void write_footer();
-
- void write_chunk_header(const char id[4], uint32_t length);
- void write_chunk(const char id[4], uint32_t length, void* data);
- size_t write_var_len(uint32_t val);
- uint32_t read_var_len() const;
- int read_event(uint32_t* delta_t, uint32_t* size, Byte** buf) const;
-
- static const uint16_t _ppqn = 19200;
-
- Glib::ustring _path;
- Flag _flags;
- string _take_id;
- bool _allow_remove_if_empty;
- FILE* _fd;
- double _last_ev_time; // last frame time written, relative to source start
- uint32_t _track_size;
- uint32_t _header_size; // size of SMF header, including MTrk chunk header
-
- static string _search_path;
+ int open_for_write ();
+
+ framecnt_t read_unlocked (Evoral::EventSink<framepos_t>& dst,
+ framepos_t position,
+ framepos_t start,
+ framecnt_t cnt,
+ MidiStateTracker* tracker) const;
+
+ framecnt_t write_unlocked (MidiRingBuffer<framepos_t>& src,
+ framepos_t position,
+ framecnt_t cnt);
+
+ double _last_ev_time_beats;
+ framepos_t _last_ev_time_frames;
+ /** end time (start + duration) of last call to read_unlocked */
+ mutable framepos_t _smf_last_read_end;
+ /** time (in SMF ticks, 1 tick per _ppqn) of the last event read by read_unlocked */
+ mutable framepos_t _smf_last_read_time;