mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-10 08:36:32 +01:00
add step editing sustain support
git-svn-id: svn://localhost/ardour2/branches/3.0@7615 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
3364fda3de
commit
aac46a38fb
5 changed files with 47 additions and 25 deletions
|
|
@ -563,7 +563,7 @@ MidiRegionView::key_press (GdkEventKey* ev)
|
|||
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;
|
||||
|
||||
|
|
@ -1478,7 +1478,7 @@ MidiRegionView::add_note(const boost::shared_ptr<NoteType> note, bool visible)
|
|||
|
||||
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));
|
||||
|
||||
|
|
@ -1501,6 +1501,12 @@ MidiRegionView::step_add_note (uint8_t channel, uint8_t number, uint8_t 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)
|
||||
{
|
||||
|
|
@ -2473,22 +2479,22 @@ MidiRegionView::transpose (bool up, bool fine, bool allow_smush)
|
|||
}
|
||||
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -94,8 +94,8 @@ class MidiRegionView : public RegionView
|
|||
{ 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);
|
||||
|
||||
|
|
@ -276,7 +276,7 @@ class MidiRegionView : public RegionView
|
|||
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -898,8 +898,12 @@ MidiTimeAxisView::start_step_editing ()
|
|||
_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);
|
||||
|
|
@ -962,6 +966,8 @@ MidiTimeAxisView::stop_step_editing ()
|
|||
if (step_edit_region_view) {
|
||||
step_edit_region_view->hide_step_edit_cursor();
|
||||
}
|
||||
|
||||
step_edit_region.reset ();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -1006,6 +1012,14 @@ MidiTimeAxisView::step_add_program_change (uint8_t channel, uint8_t program)
|
|||
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)
|
||||
{
|
||||
|
|
@ -1144,7 +1158,7 @@ MidiTimeAxisView::step_edit_bar_sync ()
|
|||
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);
|
||||
|
|
@ -1172,7 +1186,7 @@ MidiTimeAxisView::add_region (framepos_t pos)
|
|||
|
||||
real_editor->commit_reversible_command();
|
||||
|
||||
return region;
|
||||
return boost::dynamic_pointer_cast<MidiRegion>(region);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ class MidiTimeAxisView : public RouteTimeAxisView
|
|||
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 ();
|
||||
|
|
@ -95,6 +95,7 @@ class MidiTimeAxisView : public RouteTimeAxisView
|
|||
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;
|
||||
|
|
@ -147,7 +148,7 @@ class MidiTimeAxisView : public RouteTimeAxisView
|
|||
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -1030,4 +1030,5 @@ StepEntry::octave_n (int n)
|
|||
void
|
||||
StepEntry::do_sustain ()
|
||||
{
|
||||
_mtv->step_edit_sustain (note_length());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue