summaryrefslogtreecommitdiff
path: root/gtk2_ardour/midi_time_axis.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2010-08-02 21:52:21 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2010-08-02 21:52:21 +0000
commite0edca5a2abd65d869348e4bddb9d07ecc156450 (patch)
tree3ebb98c670729ee017b4245c4e003f2d013df773 /gtk2_ardour/midi_time_axis.cc
parent8b0354f91003582c4eafc4f2e1ef7ab2daba22e7 (diff)
first, incomplete pass at step entry dialog, along with various SVG and PNG files for notes and dynamics notation
git-svn-id: svn://localhost/ardour2/branches/3.0@7529 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/midi_time_axis.cc')
-rw-r--r--gtk2_ardour/midi_time_axis.cc67
1 files changed, 40 insertions, 27 deletions
diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc
index b1d886a04b..89a138f8b9 100644
--- a/gtk2_ardour/midi_time_axis.cc
+++ b/gtk2_ardour/midi_time_axis.cc
@@ -81,6 +81,7 @@
#include "rgb_macros.h"
#include "selection.h"
#include "simplerect.h"
+#include "step_entry.h"
#include "utils.h"
#include "ardour/midi_track.h"
@@ -918,6 +919,11 @@ MidiTimeAxisView::start_step_editing ()
}
midi_track()->set_step_editing (true);
+
+ StepEntry* se = new StepEntry (*this);
+
+ se->set_position (WIN_POS_MOUSE);
+ se->present ();
}
void
@@ -951,37 +957,44 @@ MidiTimeAxisView::check_step_edit ()
incoming.read_contents (size, buf);
if ((buf[0] & 0xf0) == MIDI_CMD_NOTE_ON) {
+ step_add_note (buf[0] & 0xf, buf[1], buf[2], 0.0);
+ }
+ }
+}
- if (step_edit_region == 0) {
-
- step_edit_region = add_region (step_edit_insert_position);
- RegionView* rv = view()->find_view (step_edit_region);
- step_edit_region_view = dynamic_cast<MidiRegionView*>(rv);
- }
-
- if (step_edit_region && step_edit_region_view) {
+int
+MidiTimeAxisView::step_add_note (uint8_t channel, uint8_t pitch, uint8_t velocity, Evoral::MusicalTime beat_duration)
+{
+ if (step_edit_region == 0) {
+
+ step_edit_region = add_region (step_edit_insert_position);
+ RegionView* rv = view()->find_view (step_edit_region);
+ step_edit_region_view = dynamic_cast<MidiRegionView*>(rv);
+ }
+
+ if (step_edit_region && step_edit_region_view) {
+ if (step_edit_beat_pos < 0.0) {
+ framecnt_t frames_from_start = _editor.get_preferred_edit_position() - step_edit_region->position();
+ if (frames_from_start < 0) {
+ return 1;
+ }
+ step_edit_beat_pos = step_edit_region_view->frames_to_beats (frames_from_start);
+ }
+
+ if (beat_duration == 0.0) {
+ bool success;
+ beat_duration = _editor.get_grid_type_as_beats (success, step_edit_insert_position);
- if (step_edit_beat_pos < 0.0) {
- framecnt_t frames_from_start = _editor.get_preferred_edit_position() - step_edit_region->position();
- if (frames_from_start < 0) {
- continue;
- }
- step_edit_beat_pos = step_edit_region_view->frames_to_beats (frames_from_start);
- }
-
- bool success;
- Evoral::MusicalTime beats = _editor.get_grid_type_as_beats (success, step_edit_insert_position);
-
- if (!success) {
- continue;
- }
+ if (!success) {
+ return -1;
+ }
+ }
- step_edit_region_view->step_add_note (buf[0] & 0xf, buf[1], buf[2], step_edit_beat_pos, beats);
- step_edit_beat_pos += beats;
- }
- }
+ step_edit_region_view->step_add_note (channel, pitch, velocity, step_edit_beat_pos, beat_duration);
+ step_edit_beat_pos += beat_duration;
+ }
- }
+ return 0;
}
void