basic note-tupling functionality implemented
This commit is contained in:
parent
7f779bb934
commit
c3d14b1169
|
@ -470,6 +470,10 @@ This mode provides many different operations on both regions and control points,
|
|||
@notes|Notes/nudge-earlier-fine| <@SECONDARY@>Left|Nudge Notes Earlier (fine)
|
||||
@notes|Notes/edit-channels| c|Edit Note Channels
|
||||
@notes|Notes/edit-velocities| v|Edit Note Velocities
|
||||
@notes|Notes/split-notes-grid| <@PRIMARY@>e|Split Notes By Grid
|
||||
@notes|Notes/join-notes| <@PRIMARY@>j|Join Notes
|
||||
@notes|Notes/split-notes-more| <@PRIMARY@>Up|Split Notes More Finely
|
||||
@notes|Notes/split-notes-less| <@PRIMARY@>Down|Split Notes Less Finely
|
||||
|
||||
@notes|Notes/transpose-up-octave| <@SECONDARY@>Up|Transpose up (1 octave)
|
||||
@notes|Notes/transpose-down-octave| <@SECONDARY@>Down|Transpose down (1 octave)
|
||||
|
|
|
@ -4787,19 +4787,101 @@ MidiRegionView::end_note_splitting ()
|
|||
void
|
||||
MidiRegionView::split_notes_grid ()
|
||||
{
|
||||
if (_selection.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* XXX need to adjust pos to be global */
|
||||
bool success;
|
||||
std::shared_ptr<NoteType> base ((*_selection.begin())->note());
|
||||
|
||||
split_base_note.set_channel (base->channel());
|
||||
split_base_note.set_length (base->length());
|
||||
split_base_note.set_time (base->time());
|
||||
split_base_note.set_note (base->note());
|
||||
split_base_note.set_velocity (base->velocity());
|
||||
split_base_note.set_off_velocity (base->off_velocity());
|
||||
|
||||
Temporal::Beats grid = trackview.editor().get_grid_type_as_beats (success, timepos_t (split_base_note.time()));
|
||||
|
||||
if (!success) {
|
||||
/* No grid => use quarters */
|
||||
grid = Beats (1, 0);
|
||||
}
|
||||
|
||||
split_tuple = split_base_note.length().to_ticks() / grid.to_ticks();
|
||||
|
||||
start_note_diff_command (_("split notes"));
|
||||
for (auto & s : _selection) {
|
||||
note_diff_remove_note (s);
|
||||
}
|
||||
add_split_notes ();
|
||||
apply_note_diff (false);
|
||||
}
|
||||
|
||||
void
|
||||
MidiRegionView::split_notes_more ()
|
||||
{
|
||||
if (_selection.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
split_tuple++;
|
||||
|
||||
char buf[64];
|
||||
snprintf (buf, sizeof (buf), "Split %s into %d", split_base_note.length().str().c_str(), split_tuple);
|
||||
show_verbose_cursor (buf, 0, 0);
|
||||
|
||||
start_note_diff_command (_("split notes more"));
|
||||
for (auto & s : _selection) {
|
||||
note_diff_remove_note (s);
|
||||
}
|
||||
add_split_notes ();
|
||||
apply_note_diff (false);
|
||||
}
|
||||
|
||||
void
|
||||
MidiRegionView::split_notes_less ()
|
||||
{
|
||||
if (_selection.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (split_tuple <= 2) {
|
||||
return;
|
||||
}
|
||||
|
||||
split_tuple--;
|
||||
|
||||
char buf[64];
|
||||
snprintf (buf, sizeof (buf), "Split %s into %d", split_base_note.length().str().c_str(), split_tuple);
|
||||
show_verbose_cursor (buf, 0, 0);
|
||||
|
||||
start_note_diff_command (_("split notes less"));
|
||||
for (auto & s : _selection) {
|
||||
note_diff_remove_note (s);
|
||||
}
|
||||
add_split_notes ();
|
||||
apply_note_diff (false);
|
||||
}
|
||||
|
||||
void
|
||||
MidiRegionView::join_notes ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
MidiRegionView::add_split_notes ()
|
||||
{
|
||||
Beats b (split_base_note.length());
|
||||
|
||||
b = b / split_tuple;
|
||||
|
||||
Beats pos (split_base_note.time());
|
||||
|
||||
for (uint32_t n = 0; n < split_tuple; ++n) {
|
||||
std::shared_ptr<NoteType> new_note (new NoteType (split_base_note.channel(), pos, b, split_base_note.note(), split_base_note.velocity()));
|
||||
note_diff_add_note (new_note, true, true);
|
||||
pos += b;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -593,6 +593,7 @@ public:
|
|||
|
||||
uint32_t split_tuple;
|
||||
bool note_splitting;
|
||||
NoteType split_base_note;
|
||||
|
||||
void start_note_splitting ();
|
||||
void end_note_splitting ();
|
||||
|
@ -601,6 +602,8 @@ public:
|
|||
void split_notes_more ();
|
||||
void split_notes_less ();
|
||||
void join_notes ();
|
||||
|
||||
void add_split_notes ();
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue