13
0

Improve GUI display during MIDI record in various ways.

git-svn-id: svn://localhost/ardour2/branches/3.0@7875 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2010-10-05 00:27:26 +00:00
parent 22ffdfa6ad
commit 8222348761
6 changed files with 35 additions and 26 deletions

View File

@ -459,7 +459,6 @@ MidiStreamView::setup_rec_box ()
(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));
@ -553,8 +552,9 @@ MidiStreamView::setup_rec_box ()
}
}
/** @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)
@ -602,13 +602,8 @@ MidiStreamView::update_rec_regions (boost::shared_ptr<MidiModel> data, nframes_t
((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;
@ -693,8 +688,11 @@ MidiStreamView::update_rec_regions (boost::shared_ptr<MidiModel> data, nframes_t
}
}
/** @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

View File

@ -102,13 +102,13 @@ class MidiStreamView : public StreamView
void setup_rec_box ();
void rec_data_range_ready (
nframes_t start,
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,
ARDOUR::framepos_t const start,
nframes_t dur);
RegionView* add_region_view_internal (

View File

@ -91,7 +91,10 @@ class MidiSource : virtual public Source
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 ();

View File

@ -1143,7 +1143,7 @@ MidiDiskstream::set_record_enabled (bool yn)
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);

View File

@ -251,6 +251,10 @@ MidiSource::midi_read (Evoral::EventSink<nframes_t>& dst, framepos_t source_star
}
}
/** 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)
{

View File

@ -201,7 +201,10 @@ SMFSource::read_unlocked (Evoral::EventSink<nframes_t>& destination, framepos_t
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)
{
@ -243,6 +246,7 @@ SMFSource::write_unlocked (MidiRingBuffer<nframes_t>& source, framepos_t positio
break;
}
/* convert from session time to time relative to the source start */
assert(time >= position);
time -= position;
@ -262,7 +266,7 @@ SMFSource::write_unlocked (MidiRingBuffer<nframes_t>& source, framepos_t positio
Evoral::SMF::flush();
free(buf);
ViewDataRangeReady(position + _last_write_end, duration); /* EMIT SIGNAL */
ViewDataRangeReady (_last_write_end, duration); /* EMIT SIGNAL */
return duration;
}