mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-14 10:36:34 +01:00
Interpret tempo time based on read position (not source timeline position which is more or less meaningless).
Move time conversion into the region view rather than the source. Adapt MIDI (including controllers) regions to the destination tempo when moved (e.g. dragging a region to a location with half the tempo will make the notes twice as long). git-svn-id: svn://localhost/ardour2/branches/3.0@4635 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
8f572c3d3f
commit
0f71728a92
12 changed files with 92 additions and 82 deletions
|
|
@ -53,7 +53,6 @@ MidiSource::MidiSource (Session& s, string name, Source::Flag flags)
|
|||
: Source (s, DataType::MIDI, name, flags)
|
||||
, _read_data_count(0)
|
||||
, _write_data_count(0)
|
||||
, _converter(s, _timeline_position)
|
||||
, _writing (false)
|
||||
, _last_read_end(0)
|
||||
{
|
||||
|
|
@ -63,7 +62,6 @@ MidiSource::MidiSource (Session& s, const XMLNode& node)
|
|||
: Source (s, node)
|
||||
, _read_data_count(0)
|
||||
, _write_data_count(0)
|
||||
, _converter(s, _timeline_position)
|
||||
, _writing (false)
|
||||
, _last_read_end(0)
|
||||
{
|
||||
|
|
@ -110,13 +108,16 @@ MidiSource::invalidate ()
|
|||
}
|
||||
|
||||
nframes_t
|
||||
MidiSource::midi_read (MidiRingBuffer<nframes_t>& dst, nframes_t start, nframes_t cnt,
|
||||
MidiSource::midi_read (MidiRingBuffer<nframes_t>& dst, nframes_t position,
|
||||
nframes_t start, nframes_t cnt,
|
||||
nframes_t stamp_offset, nframes_t negative_stamp_offset) const
|
||||
{
|
||||
|
||||
Glib::Mutex::Lock lm (_lock);
|
||||
|
||||
BeatsFramesConverter converter(_session, position);
|
||||
|
||||
if (_model) {
|
||||
#define BEATS_TO_FRAMES(t) (_converter.to(t) + stamp_offset - negative_stamp_offset)
|
||||
#define BEATS_TO_FRAMES(t) (converter.to(t) + stamp_offset - negative_stamp_offset)
|
||||
|
||||
Evoral::Sequence<double>::const_iterator& i = _model_iter;
|
||||
|
||||
|
|
@ -141,15 +142,15 @@ MidiSource::midi_read (MidiRingBuffer<nframes_t>& dst, nframes_t start, nframes_
|
|||
}
|
||||
return cnt;
|
||||
} else {
|
||||
return read_unlocked (dst, start, cnt, stamp_offset, negative_stamp_offset);
|
||||
return read_unlocked (dst, position, start, cnt, stamp_offset, negative_stamp_offset);
|
||||
}
|
||||
}
|
||||
|
||||
nframes_t
|
||||
MidiSource::midi_write (MidiRingBuffer<nframes_t>& dst, nframes_t cnt)
|
||||
MidiSource::midi_write (MidiRingBuffer<nframes_t>& dst, nframes_t position, nframes_t cnt)
|
||||
{
|
||||
Glib::Mutex::Lock lm (_lock);
|
||||
return write_unlocked (dst, cnt);
|
||||
return write_unlocked (dst, position, cnt);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
@ -162,17 +163,10 @@ MidiSource::file_changed (string path)
|
|||
return !e1;
|
||||
}
|
||||
|
||||
void
|
||||
MidiSource::set_timeline_position (int64_t pos)
|
||||
{
|
||||
Source::set_timeline_position(pos);
|
||||
_converter.set_origin(pos);
|
||||
}
|
||||
|
||||
void
|
||||
MidiSource::mark_streaming_midi_write_started (NoteMode mode, nframes_t start_frame)
|
||||
{
|
||||
set_timeline_position(start_frame); // why do I have a feeling this can break somehow...
|
||||
set_timeline_position(start_frame);
|
||||
|
||||
if (_model) {
|
||||
_model->set_note_mode(mode);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue