MidiRegionView::update_note (CanvasNote* ev, bool update_ghost_regions)
{
boost::shared_ptr<NoteType> note = ev->note();
-
const double x = trackview.editor().frame_to_pixel (source_beats_to_region_frames (note->time()));
const double y1 = midi_stream_view()->note_to_y(note->note());
start_note_diff_command (_("move notes"));
for (Selection::iterator i = _selection.begin(); i != _selection.end() ; ++i) {
-
- cerr << "Note dropped, was at " << (*i)->note()->time() << " now + " << dt << endl;
- cerr << "original pos as frames " << source_beats_to_absolute_frames ((*i)->note()->time()) << endl;
- Evoral::MusicalTime new_time = absolute_frames_to_source_beats (source_beats_to_absolute_frames ((*i)->note()->time()) + dt);
-
- cerr << "new time in beats = " << new_time << endl;
+ framepos_t new_frames = source_beats_to_absolute_frames ((*i)->note()->time()) + dt;
+ Evoral::MusicalTime new_time = absolute_frames_to_source_beats (new_frames);
if (new_time < 0) {
continue;
namespace ARDOUR {
-/** Takes a duration in beats and considers it as a distance from the origin
+/** Takes a positive duration in beats and considers it as a distance from the origin
* supplied to the constructor. Returns the equivalent number of frames,
* taking tempo changes into account.
*/
BeatsFramesConverter::to (double beats) const
{
assert (beats >= 0);
-
return _tempo_map.framepos_plus_beats (_origin_b, beats) - _origin_b;
}
Glib::RWLock::ReaderLock lm (map_lock);
BBTPointList::const_iterator i;
framecnt_t extra_frames = 0;
+ bool had_bars = (op.bars != 0);
/* start from the bar|beat right before (or at) pos */
while (i != _map->begin() && (op.bars || op.beats)) {
--i;
- if ((*i).is_bar()) {
- if (op.bars) {
- op.bars--;
+
+ if (had_bars) {
+ if ((*i).is_bar()) {
+ if (op.bars) {
+ op.bars--;
+ }
}
- } else {
+ }
+
+ if ((had_bars && op.bars == 0) || !had_bars) {
+ /* finished counting bars, or none to count,
+ so decrement beat count
+ */
if (op.beats) {
op.beats--;
}
int additional_minutes = 1;
BBTPointList::const_iterator i;
framecnt_t backup_frames = 0;
-
+ bool had_bars = (op.bars != 0);
+
while (true) {
i = bbt_before_or_at (pos);
-
+
op = op_copy;
/* we know that (*i).frame is before or equal to pos */
backup_frames = pos - (*i).frame;
while (i != _map->end() && (op.bars || op.beats)) {
+
++i;
- if ((*i).is_bar()) {
- if (op.bars) {
- op.bars--;
+
+ if (had_bars) {
+ if ((*i).is_bar()) {
+ if (op.bars) {
+ op.bars--;
+ }
}
- } else {
+ }
+
+ if ((had_bars && op.bars == 0) || !had_bars) {
+ /* finished counting bars, or none to count,
+ so decrement beat count
+ */
+
if (op.beats) {
op.beats--;
}