De-templatify Evoral::SMF which has no concept of time other than SMF time.

git-svn-id: svn://localhost/ardour2/branches/3.0@4571 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
David Robillard 2009-02-15 01:32:41 +00:00
parent 5a48f99f72
commit 5d519f8bb1
7 changed files with 33 additions and 51 deletions

View file

@ -50,7 +50,7 @@ string SMFSource::_search_path;
SMFSource::SMFSource (Session& s, std::string path, Flag flags)
: MidiSource (s, region_name_from_path(path, false))
, Evoral::SMF<double> ()
, Evoral::SMF ()
, _flags (Flag(flags | Writable)) // FIXME: this needs to be writable for now
, _allow_remove_if_empty(true)
, _last_ev_time(0)
@ -144,7 +144,7 @@ SMFSource::read_unlocked (MidiRingBuffer<nframes_t>& dst, nframes_t start, nfram
size_t scratch_size = 0; // keep track of scratch to minimize reallocs
// FIXME: don't seek to start and search every read (brutal!)
Evoral::SMF<double>::seek_to_start();
Evoral::SMF::seek_to_start();
// FIXME: assumes tempo never changes after start
const double frames_per_beat = _session.tempo_map().tempo_at(_timeline_position).frames_per_beat(
@ -153,7 +153,7 @@ SMFSource::read_unlocked (MidiRingBuffer<nframes_t>& dst, nframes_t start, nfram
const uint64_t start_ticks = (uint64_t)((start / frames_per_beat) * ppqn());
while (!Evoral::SMF<double>::eof()) {
while (!Evoral::SMF::eof()) {
int ret = read_event(&ev_delta_t, &ev_size, &ev_buffer);
if (ret == -1) { // EOF
//cerr << "SMF - EOF\n";
@ -250,7 +250,7 @@ SMFSource::write_unlocked (MidiRingBuffer<nframes_t>& src, nframes_t cnt)
set_default_controls_interpolation();
}
Evoral::SMF<double>::flush();
Evoral::SMF::flush();
free(buf);
const nframes_t oldlen = _length;
@ -300,7 +300,7 @@ SMFSource::append_event_unlocked(EventTimeUnit unit, const Evoral::Event<double>
delta_time = (uint32_t)((ev.time() - last_event_time()) * ppqn());
}
Evoral::SMF<double>::append_event_delta(delta_time, ev.size(), ev.buffer());
Evoral::SMF::append_event_delta(delta_time, ev.size(), ev.buffer());
_last_ev_time = ev.time();
_write_data_count += ev.size();
@ -356,7 +356,7 @@ void
SMFSource::mark_streaming_midi_write_started (NoteMode mode, nframes_t start_frame)
{
MidiSource::mark_streaming_midi_write_started (mode, start_frame);
Evoral::SMF<double>::begin_write ();
Evoral::SMF::begin_write ();
_last_ev_time = 0;
}
@ -370,7 +370,7 @@ SMFSource::mark_streaming_write_completed ()
}
_model->set_edited(false);
Evoral::SMF<double>::end_write ();
Evoral::SMF::end_write ();
}
void
@ -634,7 +634,7 @@ SMFSource::load_model(bool lock, bool force_reload)
}
_model->start_write();
Evoral::SMF<double>::seek_to_start();
Evoral::SMF::seek_to_start();
uint64_t time = 0; /* in SMF ticks */
Evoral::Event<double> ev;
@ -706,6 +706,6 @@ SMFSource::destroy_model()
void
SMFSource::flush_midi()
{
Evoral::SMF<double>::end_write();
Evoral::SMF::end_write();
}