(optionally) play note(s) as they are moved around on the pitch axis (finishes #3446)
authorPaul Davis <paul@linuxaudiosystems.com>
Wed, 15 Sep 2010 16:16:37 +0000 (16:16 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Wed, 15 Sep 2010 16:16:37 +0000 (16:16 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@7782 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/editor_drag.cc
gtk2_ardour/midi_region_view.cc
gtk2_ardour/midi_region_view.h

index e3e2f3a5195e50850c9da232ccb646f22e3fcf05..35183c59f5d82f7cbb34a895b03e2000c30d120e 100644 (file)
@@ -3722,7 +3722,14 @@ NoteDrag::motion (GdkEvent *, bool)
                 char buf[12];
                 snprintf (buf, sizeof (buf), "%s (%d)", Evoral::midi_note_name (_primary->note()->note() + dy).c_str(),
                           (int) floor (_primary->note()->note() + dy));
-               
+                
+                if (dy) {
+                        boost::shared_ptr<Evoral::Note<Evoral::MusicalTime> > 
+                                moved_note (new Evoral::Note<Evoral::MusicalTime> (*(_primary->note())));
+                        moved_note->set_note (moved_note->note() + dy);
+                        _region->play_midi_note (moved_note);
+                }
+
                _editor->show_verbose_canvas_cursor_with (buf);
         }
 }
index 6aa83acf1140b5b2642d75e97ee47b6f9fd8f83c..ee86a3869721deb9f025a88b9c92fa0ec7dd5eed 100644 (file)
@@ -1324,6 +1324,11 @@ MidiRegionView::play_midi_note(boost::shared_ptr<NoteType> note)
        const double note_length_beats = (note->off_event().time() - note->on_event().time());
        nframes_t note_length_ms = beats_to_frames(note_length_beats)
                        * (1000 / (double)route_ui->session()->nominal_frame_rate());
+
+        /* note: we probably should not be binding a shared_ptr<NoteType> 
+           here. Since its a one-shot timeout, its sort of OK, but ...
+        */
+
        Glib::signal_timeout().connect(sigc::bind(sigc::mem_fun(this, &MidiRegionView::play_midi_note_off), note),
                        note_length_ms, G_PRIORITY_DEFAULT);
 }
index 952393756594f5518d35e079ffe387db197ba866..ce7b3082c16f1fd21f3af03935e9ce9762e63074 100644 (file)
@@ -303,7 +303,8 @@ class MidiRegionView : public RegionView
   private:
 
        friend class EditNoteDialog;
-       
+        friend class NoteDrag;
+
        /** Play the NoteOn event of the given note immediately
         * and schedule the playback of the corresponding NoteOff event.
         */