bool shorter = Keyboard::modifier_state_contains (ev->state, Keyboard::PrimaryModifier);
bool fine = Keyboard::modifier_state_contains (ev->state, Keyboard::SecondaryModifier);
- change_note_lengths (fine, shorter, start, end);
+ change_note_lengths (fine, shorter, 0.0, start, end);
return true;
void
MidiRegionView::step_add_note (uint8_t channel, uint8_t number, uint8_t velocity,
- Evoral::MusicalTime pos, Evoral::MusicalTime len)
+ Evoral::MusicalTime pos, Evoral::MusicalTime len)
{
boost::shared_ptr<NoteType> new_note (new NoteType (channel, pos, len, number, velocity));
// last_step_edit_note = new_note;
}
+void
+MidiRegionView::step_sustain (Evoral::MusicalTime beats)
+{
+ change_note_lengths (false, false, beats, false, true);
+}
+
void
MidiRegionView::add_pgm_change(PCEvent& program, const string& displaytext)
{
}
void
-MidiRegionView::change_note_lengths (bool fine, bool shorter, bool start, bool end)
+MidiRegionView::change_note_lengths (bool fine, bool shorter, Evoral::MusicalTime delta, bool start, bool end)
{
- Evoral::MusicalTime delta;
-
- if (fine) {
- delta = 1.0/128.0;
- } else {
- /* grab the current grid distance */
- bool success;
- delta = trackview.editor().get_grid_type_as_beats (success, _region->position());
- if (!success) {
- /* XXX cannot get grid type as beats ... should always be possible ... FIX ME */
- cerr << "Grid type not available as beats - TO BE FIXED\n";
- return;
- }
- }
+ if (delta == 0.0) {
+ if (fine) {
+ delta = 1.0/128.0;
+ } else {
+ /* grab the current grid distance */
+ bool success;
+ delta = trackview.editor().get_grid_type_as_beats (success, _region->position());
+ if (!success) {
+ /* XXX cannot get grid type as beats ... should always be possible ... FIX ME */
+ cerr << "Grid type not available as beats - TO BE FIXED\n";
+ return;
+ }
+ }
+ }
if (shorter) {
delta = -delta;
{ return midi_view()->midi_view(); }
void step_add_note (uint8_t channel, uint8_t number, uint8_t velocity,
- Evoral::MusicalTime pos, Evoral::MusicalTime len);
-
+ Evoral::MusicalTime pos, Evoral::MusicalTime len);
+ void step_sustain (Evoral::MusicalTime beats);
void set_height (double);
void apply_note_range(uint8_t lowest, uint8_t highest, bool force=false);
void goto_previous_note ();
void goto_next_note ();
- void change_note_lengths (bool, bool, bool start, bool end);
+ void change_note_lengths (bool, bool, Evoral::MusicalTime beats, bool start, bool end);
void change_velocities (bool up, bool fine, bool allow_smush);
void transpose (bool up, bool fine, bool allow_smush);
void nudge_notes (bool forward);
_step_edit_triplet_countdown = 0;
_step_edit_within_chord = 0;
_step_edit_chord_duration = 0.0;
+
+ boost::shared_ptr<Region> r = playlist()->top_region_at (step_edit_insert_position);
- step_edit_region = playlist()->top_region_at (step_edit_insert_position);
+ if (r) {
+ step_edit_region = boost::dynamic_pointer_cast<MidiRegion>(r);
+ }
if (step_edit_region) {
RegionView* rv = view()->find_view (step_edit_region);
if (step_edit_region_view) {
step_edit_region_view->hide_step_edit_cursor();
}
+
+ step_edit_region.reset ();
}
void
return 0;
}
+void
+MidiTimeAxisView::step_edit_sustain (Evoral::MusicalTime beats)
+{
+ if (step_edit_region_view) {
+ step_edit_region_view->step_sustain (beats);
+ }
+}
+
int
MidiTimeAxisView::step_add_note (uint8_t channel, uint8_t pitch, uint8_t velocity, Evoral::MusicalTime beat_duration)
{
step_edit_region_view->move_step_edit_cursor (step_edit_beat_pos);
}
-boost::shared_ptr<Region>
+boost::shared_ptr<MidiRegion>
MidiTimeAxisView::add_region (framepos_t pos)
{
Editor* real_editor = dynamic_cast<Editor*> (&_editor);
real_editor->commit_reversible_command();
- return region;
+ return boost::dynamic_pointer_cast<MidiRegion>(region);
}
void
void set_height (uint32_t);
void hide ();
- boost::shared_ptr<ARDOUR::Region> add_region (ARDOUR::framepos_t pos);
+ boost::shared_ptr<ARDOUR::MidiRegion> add_region (ARDOUR::framepos_t pos);
void show_all_automation ();
void show_existing_automation ();
int step_add_program_change (uint8_t channel, uint8_t program);
int step_add_note (uint8_t channel, uint8_t pitch, uint8_t velocity,
Evoral::MusicalTime beat_duration);
+ void step_edit_sustain (Evoral::MusicalTime beats);
bool step_edit_within_triplet () const;
void step_edit_toggle_triplet ();
bool step_edit_within_chord () const;
nframes64_t step_edit_insert_position;
Evoral::MusicalTime step_edit_beat_pos;
- boost::shared_ptr<ARDOUR::Region> step_edit_region;
+ boost::shared_ptr<ARDOUR::MidiRegion> step_edit_region;
MidiRegionView* step_edit_region_view;
uint8_t _step_edit_triplet_countdown;
bool _step_edit_within_chord;
void
StepEntry::do_sustain ()
{
+ _mtv->step_edit_sustain (note_length());
}