SMFSource::SMFSource (Session& s, const string& path, Source::Flag flags)
: Source(s, DataType::MIDI, path, flags)
, MidiSource(s, path)
- , FileSource(s, DataType::MIDI, path, flags)
+ , FileSource(s, DataType::MIDI, path, string(), flags)
, Evoral::SMF()
, _last_ev_time_beats(0.0)
, _last_ev_time_frames(0)
, _smf_last_read_end (0)
, _smf_last_read_time (0)
{
+ /* note that origin remains empty */
+
if (init(_path, false)) {
throw failed_constructor ();
}
if (create(path)) {
throw failed_constructor ();
}
-
- load_model(true, true); // FIXME
}
/** Constructor used for existing internal-to-session files. */
if (open(_path)) {
throw failed_constructor ();
}
-
- load_model(true, true); // FIXME
}
SMFSource::~SMFSource ()
}
/** All stamps in audio frames */
-nframes_t
-SMFSource::read_unlocked (Evoral::EventSink<nframes_t>& destination, framepos_t const source_start,
- framepos_t start, nframes_t duration,
+framecnt_t
+SMFSource::read_unlocked (Evoral::EventSink<framepos_t>& destination, framepos_t const source_start,
+ framepos_t start, framecnt_t duration,
MidiStateTracker* tracker) const
{
int ret = 0;
* @param source Buffer to read from.
* @param position This source's start position in session frames.
*/
-nframes_t
-SMFSource::write_unlocked (MidiRingBuffer<nframes_t>& source, framepos_t position, nframes_t duration)
+framecnt_t
+SMFSource::write_unlocked (MidiRingBuffer<framepos_t>& source, framepos_t position, framecnt_t duration)
{
_write_data_count = 0;
- nframes_t time;
+ framepos_t time;
Evoral::EventType type;
uint32_t size;
_model->start_write();
}
- Evoral::MIDIEvent<nframes_t> ev;
+ Evoral::MIDIEvent<framepos_t> ev;
while (true) {
bool ret = source.peek_time(&time);
Evoral::SMF::flush();
free(buf);
- ViewDataRangeReady (_last_write_end, duration); /* EMIT SIGNAL */
-
return duration;
}
}
-/** Append an event with a timestamp in frames (nframes_t) */
+/** Append an event with a timestamp in frames (framepos_t) */
void
-SMFSource::append_event_unlocked_frames (const Evoral::Event<nframes_t>& ev, framepos_t position)
+SMFSource::append_event_unlocked_frames (const Evoral::Event<framepos_t>& ev, framepos_t position)
{
assert(_writing);
if (ev.size() == 0) {
XMLNode&
SMFSource::get_state ()
{
- return MidiSource::get_state();
+ XMLNode& node = MidiSource::get_state();
+ node.add_property (X_("origin"), _origin);
+ return node;
}
int
return;
}
- if (! _model) {
- _model = boost::shared_ptr<MidiModel>(new MidiModel(this));
+ if (!_model) {
+ _model = boost::shared_ptr<MidiModel> (new MidiModel (shared_from_this ()));
} else {
_model->clear();
}