(RegionFactory::create (sources, plist, false)));
assert(region);
- region->suspend_property_changes ();
region->set_position (_trackview.session()->transport_frame(), this);
rec_regions.push_back (make_pair(region, (RegionView*)0));
}
}
+/** @param start Start position to update in session frames */
void
-MidiStreamView::update_rec_regions (boost::shared_ptr<MidiModel> data, nframes_t start, nframes_t dur)
+MidiStreamView::update_rec_regions (boost::shared_ptr<MidiModel> data, framepos_t const start, nframes_t dur)
{
ENSURE_GUI_THREAD (*this, &MidiStreamView::update_rec_regions, data, start, dur)
((MidiRegionView*)iter->second)->begin_write();
}
- /* also update rect */
- ArdourCanvas::SimpleRect * rect = rec_rects[n].rectangle;
- gdouble xend = _trackview.editor().frame_to_pixel (region->position() + region->length());
- rect->property_x2() = xend;
-
- ARDOUR::BeatsFramesConverter tconv(_trackview.session()->tempo_map(), region->position());
- const MidiModel::TimeType start_beats = tconv.from(start);
+ ARDOUR::BeatsFramesConverter tconv(_trackview.session()->tempo_map(), region->position() - region->start());
+ const MidiModel::TimeType start_beats = tconv.from (start - tconv.origin_b ());
/* draw events */
MidiRegionView* mrv = (MidiRegionView*)iter->second;
}
}
+/** @param start Start of the range in session frames.
+ * @param cnd Number of frames in the range.
+ */
void
-MidiStreamView::rec_data_range_ready (nframes_t start, nframes_t cnt, boost::weak_ptr<Source> weak_src)
+MidiStreamView::rec_data_range_ready (framepos_t start, nframes_t cnt, boost::weak_ptr<Source> weak_src)
{
// this is called from the butler thread for now
void setup_rec_box ();
void rec_data_range_ready (
- nframes_t start,
- nframes_t dur,
- boost::weak_ptr<ARDOUR::Source> src);
-
+ ARDOUR::framepos_t start,
+ nframes_t dur,
+ boost::weak_ptr<ARDOUR::Source> src);
+
void update_rec_regions (
- boost::shared_ptr<ARDOUR::MidiModel> data,
- nframes_t start,
- nframes_t dur);
-
+ boost::shared_ptr<ARDOUR::MidiModel> data,
+ ARDOUR::framepos_t const start,
+ nframes_t dur);
+
RegionView* add_region_view_internal (
- boost::shared_ptr<ARDOUR::Region>,
- bool wait_for_waves,
- bool recording = false);
+ boost::shared_ptr<ARDOUR::Region>,
+ bool wait_for_waves,
+ bool recording = false);
void display_region(MidiRegionView* region_view, bool load_model);
void display_track (boost::shared_ptr<ARDOUR::Track> tr);
static PBD::Signal1<void,MidiSource*> MidiSourceCreated;
- // Signal a range of recorded data is available for reading from model()
+ /** Emitted when a range of recorded data is available for reading from model().
+ * First parameter is the start of the range in session frames.
+ * Second parameter is the number of frames.
+ */
mutable PBD::Signal2<void,framepos_t,nframes_t> ViewDataRangeReady;
XMLNode& get_state ();
void
MidiDiskstream::engage_record_enable ()
{
- bool rolling = _session.transport_speed() != 0.0f;
+ bool const rolling = _session.transport_speed() != 0.0f;
g_atomic_int_set (&_record_enabled, 1);
}
}
+/** Write data from a MidiRingBuffer to this source.
+ * @param source Source to read from.
+ * @param source_start This source's start position in session frames.
+ */
nframes_t
MidiSource::midi_write (MidiRingBuffer<nframes_t>& source, framepos_t source_start, nframes_t duration)
{
boost::shared_ptr<MidiSource> newsrc = boost::dynamic_pointer_cast<MidiSource>(
SourceFactory::createWritable(DataType::MIDI, _session,
newpath, false, _session.frame_rate()));
-
+
newsrc->set_timeline_position(_timeline_position);
newsrc->copy_interpolation_from (this);
newsrc->copy_automation_state_from (this);
return duration;
}
-/** All stamps in audio frames */
+/** Write data to this source from a MidiRingBuffer.
+ * @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)
{
break;
}
+ /* convert from session time to time relative to the source start */
assert(time >= position);
time -= position;
Evoral::SMF::flush();
free(buf);
- ViewDataRangeReady(position + _last_write_end, duration); /* EMIT SIGNAL */
+ ViewDataRangeReady (_last_write_end, duration); /* EMIT SIGNAL */
return duration;
}