sigc::mem_fun(mrv, &MidiRegionView::delete_selection)));
items.push_back(MenuElem(_("Edit..."),
sigc::bind(sigc::mem_fun(*this, &Editor::edit_notes), &mrv)));
+ items.push_back(MenuElem(_("Transpose..."),
+ sigc::bind(sigc::mem_fun(*this, &Editor::transpose_regions), rs)));
items.push_back(MenuElem(_("Legatize"),
sigc::bind(sigc::mem_fun(*this, &Editor::legatize_regions), rs, false)));
items.push_back(MenuElem(_("Quantize..."),
void legatize_regions (const RegionSelection& rs, bool shrink_only);
void transform_region ();
void transform_regions (const RegionSelection& rs);
+ void transpose_region ();
+ void transpose_regions (const RegionSelection& rs);
void insert_patch_change (bool from_context);
void fork_region ();
int pitch_shift (RegionSelection&, float cents);
void pitch_shift_region ();
- void transpose_region ();
-
/* editor-mixer strip */
MixerStrip *current_mixer_strip;
#include "ardour/session_playlists.h"
#include "ardour/strip_silence.h"
#include "ardour/transient_detector.h"
+#include "ardour/transpose.h"
#include "canvas/canvas.h"
}
}
+void
+Editor::transpose_region ()
+{
+ if (_session) {
+ transpose_regions(get_regions_from_selection_and_entered ());
+ }
+}
+
+void
+Editor::transpose_regions (const RegionSelection& rs)
+{
+ if (rs.n_midi_regions() == 0) {
+ return;
+ }
+
+ TransposeDialog d;
+ int const r = d.run ();
+
+ if (r == RESPONSE_ACCEPT) {
+ Transpose transpose(d.semitones ());
+ apply_midi_note_edit_op (transpose, rs);
+ }
+}
+
void
Editor::insert_patch_change (bool from_context)
{
pitch_shift (audio_rs, 1.2);
}
-void
-Editor::transpose_region ()
-{
- RegionSelection rs = get_regions_from_selection_and_entered ();
-
- list<MidiRegionView*> midi_region_views;
- for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) {
- MidiRegionView* mrv = dynamic_cast<MidiRegionView*> (*i);
- if (mrv) {
- midi_region_views.push_back (mrv);
- }
- }
-
- TransposeDialog d;
- int const r = d.run ();
- if (r != RESPONSE_ACCEPT) {
- return;
- }
-
- for (list<MidiRegionView*>::iterator i = midi_region_views.begin(); i != midi_region_views.end(); ++i) {
- (*i)->midi_region()->transpose (d.semitones ());
- }
-}
-
void
Editor::set_tempo_from_region ()
{