using namespace Glib;
/** Constructor used for new internal-to-session files. File cannot exist. */
-SMFSource::SMFSource (Session& s, const ustring& path, bool embedded, Source::Flag flags)
+SMFSource::SMFSource (Session& s, const ustring& path, Source::Flag flags)
: Source(s, DataType::MIDI, path, flags)
, MidiSource(s, path)
- , FileSource(s, DataType::MIDI, path, embedded, flags)
+ , FileSource(s, DataType::MIDI, path, flags)
, Evoral::SMF()
, _last_ev_time_beats(0.0)
, _last_ev_time_frames(0)
, _smf_last_read_end (0)
{
- if (init(_name, false)) {
+ if (init(_path, false)) {
throw failed_constructor ();
}
throw failed_constructor ();
}
- if (init(_name, true)) {
+ if (init(_path, true)) {
throw failed_constructor ();
}
/** All stamps in audio frames */
nframes_t
-SMFSource::read_unlocked (MidiRingBuffer<nframes_t>& destination, sframes_t source_start,
+SMFSource::read_unlocked (Evoral::EventSink<nframes_t>& destination, sframes_t source_start,
sframes_t start, nframes_t duration,
sframes_t stamp_offset, sframes_t negative_stamp_offset,
MidiStateTracker* tracker) const
size_t scratch_size = 0; // keep track of scratch to minimize reallocs
- BeatsFramesConverter converter(_session, source_start);
+ BeatsFramesConverter converter(_session.tempo_map(), source_start);
const uint64_t start_ticks = (uint64_t)(converter.from(start) * ppqn());
} else {
break;
}
-
+
_read_data_count += ev_size;
if (ev_size > scratch_size) {
void
SMFSource::append_event_unlocked_beats (const Evoral::Event<double>& ev)
{
+ assert(_writing);
if (ev.size() == 0) {
return;
}
void
SMFSource::append_event_unlocked_frames (const Evoral::Event<nframes_t>& ev, sframes_t position)
{
+ assert(_writing);
if (ev.size() == 0) {
return;
}
return;
}
- BeatsFramesConverter converter(_session, position);
+ BeatsFramesConverter converter(_session.tempo_map(), position);
_length_beats = max(_length_beats, converter.from(ev.time()));
free(buf);
}
-#define LINEAR_INTERPOLATION_MODE_WORKS_PROPERLY 0
-
void
SMFSource::set_default_controls_interpolation ()
{
Evoral::ControlSet::Controls controls = _model->controls();
for (Evoral::ControlSet::Controls::iterator c = controls.begin(); c != controls.end(); ++c) {
(*c).second->list()->set_interpolation(
- // to be enabled when ControlList::rt_safe_earliest_event_linear_unlocked works properly
- #if LINEAR_INTERPOLATION_MODE_WORKS_PROPERLY
EventTypeMap::instance().interpolation_of((*c).first));
- #else
- Evoral::ControlList::Discrete);
- #endif
}
}