mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-09 08:14:58 +01:00
Fix whitespace (noop).
This commit is contained in:
parent
e705e93376
commit
69069e0381
3 changed files with 285 additions and 286 deletions
|
|
@ -676,15 +676,15 @@ RouteUI::rec_enable_press(GdkEventButton* ev)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_midi_track()) {
|
if (is_midi_track()) {
|
||||||
|
|
||||||
/* rec-enable button exits from step editing */
|
/* rec-enable button exits from step editing */
|
||||||
|
|
||||||
if (midi_track()->step_editing()) {
|
if (midi_track()->step_editing()) {
|
||||||
midi_track()->set_step_editing (false);
|
midi_track()->set_step_editing (false);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_track() && rec_enable_button) {
|
if (is_track() && rec_enable_button) {
|
||||||
|
|
||||||
|
|
@ -856,79 +856,79 @@ RouteUI::monitor_release (GdkEventButton* ev, MonitorChoice monitor_choice)
|
||||||
void
|
void
|
||||||
RouteUI::build_record_menu ()
|
RouteUI::build_record_menu ()
|
||||||
{
|
{
|
||||||
if (record_menu) {
|
if (record_menu) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* no rec-button context menu for non-MIDI tracks
|
/* no rec-button context menu for non-MIDI tracks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (is_midi_track()) {
|
if (is_midi_track()) {
|
||||||
record_menu = new Menu;
|
record_menu = new Menu;
|
||||||
record_menu->set_name ("ArdourContextMenu");
|
record_menu->set_name ("ArdourContextMenu");
|
||||||
|
|
||||||
using namespace Menu_Helpers;
|
using namespace Menu_Helpers;
|
||||||
MenuList& items = record_menu->items();
|
MenuList& items = record_menu->items();
|
||||||
|
|
||||||
items.push_back (CheckMenuElem (_("Step Entry"), sigc::mem_fun (*this, &RouteUI::toggle_step_edit)));
|
items.push_back (CheckMenuElem (_("Step Entry"), sigc::mem_fun (*this, &RouteUI::toggle_step_edit)));
|
||||||
step_edit_item = dynamic_cast<Gtk::CheckMenuItem*> (&items.back());
|
step_edit_item = dynamic_cast<Gtk::CheckMenuItem*> (&items.back());
|
||||||
|
|
||||||
if (_route->record_enabled()) {
|
if (_route->record_enabled()) {
|
||||||
step_edit_item->set_sensitive (false);
|
step_edit_item->set_sensitive (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
step_edit_item->set_active (midi_track()->step_editing());
|
step_edit_item->set_active (midi_track()->step_editing());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
RouteUI::toggle_step_edit ()
|
RouteUI::toggle_step_edit ()
|
||||||
{
|
{
|
||||||
if (!is_midi_track() || _route->record_enabled()) {
|
if (!is_midi_track() || _route->record_enabled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
midi_track()->set_step_editing (step_edit_item->get_active());
|
midi_track()->set_step_editing (step_edit_item->get_active());
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
RouteUI::step_edit_changed (bool yn)
|
RouteUI::step_edit_changed (bool yn)
|
||||||
{
|
{
|
||||||
if (yn) {
|
if (yn) {
|
||||||
if (rec_enable_button) {
|
if (rec_enable_button) {
|
||||||
rec_enable_button->set_active_state (Gtkmm2ext::ExplicitActive);
|
rec_enable_button->set_active_state (Gtkmm2ext::ExplicitActive);
|
||||||
}
|
}
|
||||||
|
|
||||||
start_step_editing ();
|
start_step_editing ();
|
||||||
|
|
||||||
if (step_edit_item) {
|
if (step_edit_item) {
|
||||||
step_edit_item->set_active (true);
|
step_edit_item->set_active (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (rec_enable_button) {
|
if (rec_enable_button) {
|
||||||
rec_enable_button->unset_active_state ();
|
rec_enable_button->unset_active_state ();
|
||||||
}
|
}
|
||||||
|
|
||||||
stop_step_editing ();
|
stop_step_editing ();
|
||||||
|
|
||||||
if (step_edit_item) {
|
if (step_edit_item) {
|
||||||
step_edit_item->set_active (false);
|
step_edit_item->set_active (false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
RouteUI::rec_enable_release (GdkEventButton* ev)
|
RouteUI::rec_enable_release (GdkEventButton* ev)
|
||||||
{
|
{
|
||||||
if (Keyboard::is_context_menu_event (ev)) {
|
if (Keyboard::is_context_menu_event (ev)) {
|
||||||
build_record_menu ();
|
build_record_menu ();
|
||||||
if (record_menu) {
|
if (record_menu) {
|
||||||
record_menu->popup (1, ev->time);
|
record_menu->popup (1, ev->time);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,56 +33,56 @@ using namespace Gtk;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
StepEditor::StepEditor (PublicEditor& e, boost::shared_ptr<MidiTrack> t, MidiTimeAxisView& mtv)
|
StepEditor::StepEditor (PublicEditor& e, boost::shared_ptr<MidiTrack> t, MidiTimeAxisView& mtv)
|
||||||
: _editor (e)
|
: _editor (e)
|
||||||
, _track (t)
|
, _track (t)
|
||||||
, step_editor (0)
|
, step_editor (0)
|
||||||
, _mtv (mtv)
|
, _mtv (mtv)
|
||||||
{
|
{
|
||||||
step_edit_insert_position = 0;
|
step_edit_insert_position = 0;
|
||||||
_step_edit_triplet_countdown = 0;
|
_step_edit_triplet_countdown = 0;
|
||||||
_step_edit_within_chord = 0;
|
_step_edit_within_chord = 0;
|
||||||
_step_edit_chord_duration = Evoral::Beats();
|
_step_edit_chord_duration = Evoral::Beats();
|
||||||
step_edit_region_view = 0;
|
step_edit_region_view = 0;
|
||||||
|
|
||||||
_track->PlaylistChanged.connect (*this, invalidator (*this),
|
_track->PlaylistChanged.connect (*this, invalidator (*this),
|
||||||
boost::bind (&StepEditor::playlist_changed, this),
|
boost::bind (&StepEditor::playlist_changed, this),
|
||||||
gui_context());
|
gui_context());
|
||||||
playlist_changed ();
|
playlist_changed ();
|
||||||
}
|
}
|
||||||
|
|
||||||
StepEditor::~StepEditor()
|
StepEditor::~StepEditor()
|
||||||
{
|
{
|
||||||
delete step_editor;
|
delete step_editor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
StepEditor::start_step_editing ()
|
StepEditor::start_step_editing ()
|
||||||
{
|
{
|
||||||
_step_edit_triplet_countdown = 0;
|
_step_edit_triplet_countdown = 0;
|
||||||
_step_edit_within_chord = 0;
|
_step_edit_within_chord = 0;
|
||||||
_step_edit_chord_duration = Evoral::Beats();
|
_step_edit_chord_duration = Evoral::Beats();
|
||||||
step_edit_region.reset ();
|
step_edit_region.reset ();
|
||||||
step_edit_region_view = 0;
|
step_edit_region_view = 0;
|
||||||
last_added_pitch = -1;
|
last_added_pitch = -1;
|
||||||
last_added_end = Evoral::Beats();
|
last_added_end = Evoral::Beats();
|
||||||
|
|
||||||
resync_step_edit_position ();
|
resync_step_edit_position ();
|
||||||
prepare_step_edit_region ();
|
prepare_step_edit_region ();
|
||||||
reset_step_edit_beat_pos ();
|
reset_step_edit_beat_pos ();
|
||||||
|
|
||||||
assert (step_edit_region);
|
assert (step_edit_region);
|
||||||
assert (step_edit_region_view);
|
assert (step_edit_region_view);
|
||||||
|
|
||||||
if (step_editor == 0) {
|
if (step_editor == 0) {
|
||||||
step_editor = new StepEntry (*this);
|
step_editor = new StepEntry (*this);
|
||||||
step_editor->signal_delete_event().connect (sigc::mem_fun (*this, &StepEditor::step_editor_hidden));
|
step_editor->signal_delete_event().connect (sigc::mem_fun (*this, &StepEditor::step_editor_hidden));
|
||||||
step_editor->signal_hide().connect (sigc::mem_fun (*this, &StepEditor::step_editor_hide));
|
step_editor->signal_hide().connect (sigc::mem_fun (*this, &StepEditor::step_editor_hide));
|
||||||
}
|
}
|
||||||
|
|
||||||
step_edit_region_view->show_step_edit_cursor (step_edit_beat_pos);
|
step_edit_region_view->show_step_edit_cursor (step_edit_beat_pos);
|
||||||
step_edit_region_view->set_step_edit_cursor_width (step_editor->note_length());
|
step_edit_region_view->set_step_edit_cursor_width (step_editor->note_length());
|
||||||
|
|
||||||
step_editor->present ();
|
step_editor->present ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -94,20 +94,20 @@ StepEditor::resync_step_edit_position ()
|
||||||
void
|
void
|
||||||
StepEditor::resync_step_edit_to_edit_point ()
|
StepEditor::resync_step_edit_to_edit_point ()
|
||||||
{
|
{
|
||||||
resync_step_edit_position ();
|
resync_step_edit_position ();
|
||||||
if (step_edit_region) {
|
if (step_edit_region) {
|
||||||
reset_step_edit_beat_pos ();
|
reset_step_edit_beat_pos ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
StepEditor::prepare_step_edit_region ()
|
StepEditor::prepare_step_edit_region ()
|
||||||
{
|
{
|
||||||
boost::shared_ptr<Region> r = _track->playlist()->top_region_at (step_edit_insert_position);
|
boost::shared_ptr<Region> r = _track->playlist()->top_region_at (step_edit_insert_position);
|
||||||
|
|
||||||
if (r) {
|
if (r) {
|
||||||
step_edit_region = boost::dynamic_pointer_cast<MidiRegion>(r);
|
step_edit_region = boost::dynamic_pointer_cast<MidiRegion>(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (step_edit_region) {
|
if (step_edit_region) {
|
||||||
RegionView* rv = _mtv.midi_view()->find_view (step_edit_region);
|
RegionView* rv = _mtv.midi_view()->find_view (step_edit_region);
|
||||||
|
|
@ -118,59 +118,59 @@ StepEditor::prepare_step_edit_region ()
|
||||||
const Meter& m = _mtv.session()->tempo_map().meter_at (step_edit_insert_position);
|
const Meter& m = _mtv.session()->tempo_map().meter_at (step_edit_insert_position);
|
||||||
const Tempo& t = _mtv.session()->tempo_map().tempo_at (step_edit_insert_position);
|
const Tempo& t = _mtv.session()->tempo_map().tempo_at (step_edit_insert_position);
|
||||||
|
|
||||||
step_edit_region = _mtv.add_region (step_edit_insert_position, floor (m.frames_per_bar (t, _mtv.session()->frame_rate())), true);
|
step_edit_region = _mtv.add_region (step_edit_insert_position, floor (m.frames_per_bar (t, _mtv.session()->frame_rate())), true);
|
||||||
|
|
||||||
RegionView* rv = _mtv.midi_view()->find_view (step_edit_region);
|
RegionView* rv = _mtv.midi_view()->find_view (step_edit_region);
|
||||||
step_edit_region_view = dynamic_cast<MidiRegionView*>(rv);
|
step_edit_region_view = dynamic_cast<MidiRegionView*>(rv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
StepEditor::reset_step_edit_beat_pos ()
|
StepEditor::reset_step_edit_beat_pos ()
|
||||||
{
|
{
|
||||||
assert (step_edit_region);
|
assert (step_edit_region);
|
||||||
assert (step_edit_region_view);
|
assert (step_edit_region_view);
|
||||||
|
|
||||||
framecnt_t frames_from_start = _editor.get_preferred_edit_position() - step_edit_region->position();
|
framecnt_t frames_from_start = _editor.get_preferred_edit_position() - step_edit_region->position();
|
||||||
|
|
||||||
if (frames_from_start < 0) {
|
if (frames_from_start < 0) {
|
||||||
/* this can happen with snap enabled, and the edit point == Playhead. we snap the
|
/* this can happen with snap enabled, and the edit point == Playhead. we snap the
|
||||||
position of the new region, and it can end up after the edit point.
|
position of the new region, and it can end up after the edit point.
|
||||||
*/
|
*/
|
||||||
frames_from_start = 0;
|
frames_from_start = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
step_edit_beat_pos = step_edit_region_view->region_frames_to_region_beats (frames_from_start);
|
step_edit_beat_pos = step_edit_region_view->region_frames_to_region_beats (frames_from_start);
|
||||||
step_edit_region_view->move_step_edit_cursor (step_edit_beat_pos);
|
step_edit_region_view->move_step_edit_cursor (step_edit_beat_pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
StepEditor::step_editor_hidden (GdkEventAny*)
|
StepEditor::step_editor_hidden (GdkEventAny*)
|
||||||
{
|
{
|
||||||
step_editor_hide ();
|
step_editor_hide ();
|
||||||
return true; // XXX remember position ?!
|
return true; // XXX remember position ?!
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
StepEditor::step_editor_hide ()
|
StepEditor::step_editor_hide ()
|
||||||
{
|
{
|
||||||
/* everything else will follow the change in the model */
|
/* everything else will follow the change in the model */
|
||||||
_track->set_step_editing (false);
|
_track->set_step_editing (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
StepEditor::stop_step_editing ()
|
StepEditor::stop_step_editing ()
|
||||||
{
|
{
|
||||||
if (step_editor) {
|
if (step_editor) {
|
||||||
step_editor->hide ();
|
step_editor->hide ();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (step_edit_region_view) {
|
if (step_edit_region_view) {
|
||||||
step_edit_region_view->hide_step_edit_cursor();
|
step_edit_region_view->hide_step_edit_cursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
step_edit_region.reset ();
|
step_edit_region.reset ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -206,162 +206,162 @@ StepEditor::check_step_edit ()
|
||||||
int
|
int
|
||||||
StepEditor::step_add_bank_change (uint8_t /*channel*/, uint8_t /*bank*/)
|
StepEditor::step_add_bank_change (uint8_t /*channel*/, uint8_t /*bank*/)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
StepEditor::step_add_program_change (uint8_t /*channel*/, uint8_t /*program*/)
|
StepEditor::step_add_program_change (uint8_t /*channel*/, uint8_t /*program*/)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
StepEditor::step_edit_sustain (Evoral::Beats beats)
|
StepEditor::step_edit_sustain (Evoral::Beats beats)
|
||||||
{
|
{
|
||||||
if (step_edit_region_view) {
|
if (step_edit_region_view) {
|
||||||
step_edit_region_view->step_sustain (beats);
|
step_edit_region_view->step_sustain (beats);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
StepEditor::move_step_edit_beat_pos (Evoral::Beats beats)
|
StepEditor::move_step_edit_beat_pos (Evoral::Beats beats)
|
||||||
{
|
{
|
||||||
if (beats > 0.0) {
|
if (beats > 0.0) {
|
||||||
step_edit_beat_pos = min (step_edit_beat_pos + beats,
|
step_edit_beat_pos = min (step_edit_beat_pos + beats,
|
||||||
step_edit_region_view->region_frames_to_region_beats (step_edit_region->length()));
|
step_edit_region_view->region_frames_to_region_beats (step_edit_region->length()));
|
||||||
} else if (beats < 0.0) {
|
} else if (beats < 0.0) {
|
||||||
if (-beats < step_edit_beat_pos) {
|
if (-beats < step_edit_beat_pos) {
|
||||||
step_edit_beat_pos += beats; // its negative, remember
|
step_edit_beat_pos += beats; // its negative, remember
|
||||||
} else {
|
} else {
|
||||||
step_edit_beat_pos = Evoral::Beats();
|
step_edit_beat_pos = Evoral::Beats();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
step_edit_region_view->move_step_edit_cursor (step_edit_beat_pos);
|
step_edit_region_view->move_step_edit_cursor (step_edit_beat_pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
StepEditor::step_add_note (uint8_t channel, uint8_t pitch, uint8_t velocity, Evoral::Beats beat_duration)
|
StepEditor::step_add_note (uint8_t channel, uint8_t pitch, uint8_t velocity, Evoral::Beats beat_duration)
|
||||||
{
|
{
|
||||||
/* do these things in case undo removed the step edit region
|
/* do these things in case undo removed the step edit region
|
||||||
*/
|
*/
|
||||||
if (!step_edit_region) {
|
if (!step_edit_region) {
|
||||||
resync_step_edit_position ();
|
resync_step_edit_position ();
|
||||||
prepare_step_edit_region ();
|
prepare_step_edit_region ();
|
||||||
reset_step_edit_beat_pos ();
|
reset_step_edit_beat_pos ();
|
||||||
step_edit_region_view->show_step_edit_cursor (step_edit_beat_pos);
|
step_edit_region_view->show_step_edit_cursor (step_edit_beat_pos);
|
||||||
step_edit_region_view->set_step_edit_cursor_width (step_editor->note_length());
|
step_edit_region_view->set_step_edit_cursor_width (step_editor->note_length());
|
||||||
}
|
}
|
||||||
|
|
||||||
assert (step_edit_region);
|
assert (step_edit_region);
|
||||||
assert (step_edit_region_view);
|
assert (step_edit_region_view);
|
||||||
|
|
||||||
if (beat_duration == 0.0 && step_editor) {
|
if (beat_duration == 0.0 && step_editor) {
|
||||||
beat_duration = step_editor->note_length();
|
beat_duration = step_editor->note_length();
|
||||||
} else if (beat_duration == 0.0) {
|
} else if (beat_duration == 0.0) {
|
||||||
bool success;
|
bool success;
|
||||||
beat_duration = _editor.get_grid_type_as_beats (success, step_edit_insert_position);
|
beat_duration = _editor.get_grid_type_as_beats (success, step_edit_insert_position);
|
||||||
|
|
||||||
if (!success) {
|
if (!success) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MidiStreamView* msv = _mtv.midi_view();
|
MidiStreamView* msv = _mtv.midi_view();
|
||||||
|
|
||||||
/* make sure its visible on the vertical axis */
|
/* make sure its visible on the vertical axis */
|
||||||
|
|
||||||
if (pitch < msv->lowest_note() || pitch > msv->highest_note()) {
|
if (pitch < msv->lowest_note() || pitch > msv->highest_note()) {
|
||||||
msv->update_note_range (pitch);
|
msv->update_note_range (pitch);
|
||||||
msv->set_note_range (MidiStreamView::ContentsRange);
|
msv->set_note_range (MidiStreamView::ContentsRange);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* make sure its visible on the horizontal axis */
|
/* make sure its visible on the horizontal axis */
|
||||||
|
|
||||||
framepos_t fpos = step_edit_region_view->region_beats_to_absolute_frames (step_edit_beat_pos + beat_duration);
|
framepos_t fpos = step_edit_region_view->region_beats_to_absolute_frames (step_edit_beat_pos + beat_duration);
|
||||||
|
|
||||||
if (fpos >= (_editor.leftmost_sample() + _editor.current_page_samples())) {
|
if (fpos >= (_editor.leftmost_sample() + _editor.current_page_samples())) {
|
||||||
_editor.reset_x_origin (fpos - (_editor.current_page_samples()/4));
|
_editor.reset_x_origin (fpos - (_editor.current_page_samples()/4));
|
||||||
}
|
}
|
||||||
|
|
||||||
Evoral::Beats at = step_edit_beat_pos;
|
Evoral::Beats at = step_edit_beat_pos;
|
||||||
Evoral::Beats len = beat_duration;
|
Evoral::Beats len = beat_duration;
|
||||||
|
|
||||||
if ((last_added_pitch >= 0) && (pitch == last_added_pitch) && (last_added_end == step_edit_beat_pos)) {
|
if ((last_added_pitch >= 0) && (pitch == last_added_pitch) && (last_added_end == step_edit_beat_pos)) {
|
||||||
|
|
||||||
/* avoid any apparent note overlap - move the start of this note
|
/* avoid any apparent note overlap - move the start of this note
|
||||||
up by 1 tick from where the last note ended
|
up by 1 tick from where the last note ended
|
||||||
*/
|
*/
|
||||||
|
|
||||||
at += Evoral::Beats::ticks(1);
|
at += Evoral::Beats::ticks(1);
|
||||||
len -= Evoral::Beats::ticks(1);
|
len -= Evoral::Beats::ticks(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
step_edit_region_view->step_add_note (channel, pitch, velocity, at, len);
|
step_edit_region_view->step_add_note (channel, pitch, velocity, at, len);
|
||||||
|
|
||||||
last_added_pitch = pitch;
|
last_added_pitch = pitch;
|
||||||
last_added_end = at+len;
|
last_added_end = at+len;
|
||||||
|
|
||||||
if (_step_edit_triplet_countdown > 0) {
|
if (_step_edit_triplet_countdown > 0) {
|
||||||
_step_edit_triplet_countdown--;
|
_step_edit_triplet_countdown--;
|
||||||
|
|
||||||
if (_step_edit_triplet_countdown == 0) {
|
if (_step_edit_triplet_countdown == 0) {
|
||||||
_step_edit_triplet_countdown = 3;
|
_step_edit_triplet_countdown = 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_step_edit_within_chord) {
|
if (!_step_edit_within_chord) {
|
||||||
step_edit_beat_pos += beat_duration;
|
step_edit_beat_pos += beat_duration;
|
||||||
step_edit_region_view->move_step_edit_cursor (step_edit_beat_pos);
|
step_edit_region_view->move_step_edit_cursor (step_edit_beat_pos);
|
||||||
} else {
|
} else {
|
||||||
step_edit_beat_pos += Evoral::Beats::ticks(1); // tiny, but no longer overlapping
|
step_edit_beat_pos += Evoral::Beats::ticks(1); // tiny, but no longer overlapping
|
||||||
_step_edit_chord_duration = max (_step_edit_chord_duration, beat_duration);
|
_step_edit_chord_duration = max (_step_edit_chord_duration, beat_duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
StepEditor::set_step_edit_cursor_width (Evoral::Beats beats)
|
StepEditor::set_step_edit_cursor_width (Evoral::Beats beats)
|
||||||
{
|
{
|
||||||
if (step_edit_region_view) {
|
if (step_edit_region_view) {
|
||||||
step_edit_region_view->set_step_edit_cursor_width (beats);
|
step_edit_region_view->set_step_edit_cursor_width (beats);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
StepEditor::step_edit_within_triplet() const
|
StepEditor::step_edit_within_triplet() const
|
||||||
{
|
{
|
||||||
return _step_edit_triplet_countdown > 0;
|
return _step_edit_triplet_countdown > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
StepEditor::step_edit_within_chord() const
|
StepEditor::step_edit_within_chord() const
|
||||||
{
|
{
|
||||||
return _step_edit_within_chord;
|
return _step_edit_within_chord;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
StepEditor::step_edit_toggle_triplet ()
|
StepEditor::step_edit_toggle_triplet ()
|
||||||
{
|
{
|
||||||
if (_step_edit_triplet_countdown == 0) {
|
if (_step_edit_triplet_countdown == 0) {
|
||||||
_step_edit_within_chord = false;
|
_step_edit_within_chord = false;
|
||||||
_step_edit_triplet_countdown = 3;
|
_step_edit_triplet_countdown = 3;
|
||||||
} else {
|
} else {
|
||||||
_step_edit_triplet_countdown = 0;
|
_step_edit_triplet_countdown = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
StepEditor::step_edit_toggle_chord ()
|
StepEditor::step_edit_toggle_chord ()
|
||||||
{
|
{
|
||||||
if (_step_edit_within_chord) {
|
if (_step_edit_within_chord) {
|
||||||
_step_edit_within_chord = false;
|
_step_edit_within_chord = false;
|
||||||
step_edit_beat_pos += _step_edit_chord_duration;
|
step_edit_beat_pos += _step_edit_chord_duration;
|
||||||
step_edit_region_view->move_step_edit_cursor (step_edit_beat_pos);
|
step_edit_region_view->move_step_edit_cursor (step_edit_beat_pos);
|
||||||
} else {
|
} else {
|
||||||
_step_edit_triplet_countdown = 0;
|
_step_edit_triplet_countdown = 0;
|
||||||
_step_edit_within_chord = true;
|
_step_edit_within_chord = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -369,68 +369,68 @@ StepEditor::step_edit_rest (Evoral::Beats beats)
|
||||||
{
|
{
|
||||||
bool success;
|
bool success;
|
||||||
|
|
||||||
if (beats == 0.0) {
|
if (beats == 0.0) {
|
||||||
beats = _editor.get_grid_type_as_beats (success, step_edit_insert_position);
|
beats = _editor.get_grid_type_as_beats (success, step_edit_insert_position);
|
||||||
} else {
|
} else {
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
step_edit_beat_pos += beats;
|
step_edit_beat_pos += beats;
|
||||||
step_edit_region_view->move_step_edit_cursor (step_edit_beat_pos);
|
step_edit_region_view->move_step_edit_cursor (step_edit_beat_pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
StepEditor::step_edit_beat_sync ()
|
StepEditor::step_edit_beat_sync ()
|
||||||
{
|
{
|
||||||
step_edit_beat_pos = step_edit_beat_pos.round_up_to_beat();
|
step_edit_beat_pos = step_edit_beat_pos.round_up_to_beat();
|
||||||
step_edit_region_view->move_step_edit_cursor (step_edit_beat_pos);
|
step_edit_region_view->move_step_edit_cursor (step_edit_beat_pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
StepEditor::step_edit_bar_sync ()
|
StepEditor::step_edit_bar_sync ()
|
||||||
{
|
{
|
||||||
Session* _session = _mtv.session ();
|
Session* _session = _mtv.session ();
|
||||||
|
|
||||||
if (!_session || !step_edit_region_view || !step_edit_region) {
|
if (!_session || !step_edit_region_view || !step_edit_region) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
framepos_t fpos = step_edit_region_view->region_beats_to_absolute_frames (step_edit_beat_pos);
|
framepos_t fpos = step_edit_region_view->region_beats_to_absolute_frames (step_edit_beat_pos);
|
||||||
fpos = _session->tempo_map().round_to_bar (fpos, RoundUpAlways);
|
fpos = _session->tempo_map().round_to_bar (fpos, RoundUpAlways);
|
||||||
step_edit_beat_pos = step_edit_region_view->region_frames_to_region_beats (fpos - step_edit_region->position()).round_up_to_beat();
|
step_edit_beat_pos = step_edit_region_view->region_frames_to_region_beats (fpos - step_edit_region->position()).round_up_to_beat();
|
||||||
step_edit_region_view->move_step_edit_cursor (step_edit_beat_pos);
|
step_edit_region_view->move_step_edit_cursor (step_edit_beat_pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
StepEditor::playlist_changed ()
|
StepEditor::playlist_changed ()
|
||||||
{
|
{
|
||||||
step_edit_region_connection.disconnect ();
|
step_edit_region_connection.disconnect ();
|
||||||
_track->playlist()->RegionRemoved.connect (step_edit_region_connection, invalidator (*this),
|
_track->playlist()->RegionRemoved.connect (step_edit_region_connection, invalidator (*this),
|
||||||
boost::bind (&StepEditor::region_removed, this, _1),
|
boost::bind (&StepEditor::region_removed, this, _1),
|
||||||
gui_context());
|
gui_context());
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
StepEditor::region_removed (boost::weak_ptr<Region> wr)
|
StepEditor::region_removed (boost::weak_ptr<Region> wr)
|
||||||
{
|
{
|
||||||
boost::shared_ptr<Region> r (wr.lock());
|
boost::shared_ptr<Region> r (wr.lock());
|
||||||
|
|
||||||
if (!r) {
|
if (!r) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (step_edit_region == r) {
|
if (step_edit_region == r) {
|
||||||
step_edit_region.reset();
|
step_edit_region.reset();
|
||||||
step_edit_region_view = 0;
|
step_edit_region_view = 0;
|
||||||
// force a recompute of the insert position
|
// force a recompute of the insert position
|
||||||
step_edit_beat_pos = Evoral::Beats(-1);
|
step_edit_beat_pos = Evoral::Beats(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string
|
string
|
||||||
StepEditor::name() const
|
StepEditor::name() const
|
||||||
{
|
{
|
||||||
return _track->name();
|
return _track->name();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,11 +14,10 @@
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __pbd__step_editor_h__
|
#ifndef __gtk2_ardour_step_editor_h__
|
||||||
#define __pbd__step_editor_h__
|
#define __gtk2_ardour_step_editor_h__
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
|
@ -29,8 +28,8 @@
|
||||||
#include "evoral/types.hpp"
|
#include "evoral/types.hpp"
|
||||||
|
|
||||||
namespace ARDOUR {
|
namespace ARDOUR {
|
||||||
class MidiTrack;
|
class MidiTrack;
|
||||||
class MidiRegion;
|
class MidiRegion;
|
||||||
}
|
}
|
||||||
|
|
||||||
class MidiRegionView;
|
class MidiRegionView;
|
||||||
|
|
@ -40,55 +39,55 @@ class StepEntry;
|
||||||
|
|
||||||
class StepEditor : public PBD::ScopedConnectionList, public sigc::trackable
|
class StepEditor : public PBD::ScopedConnectionList, public sigc::trackable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
StepEditor (PublicEditor&, boost::shared_ptr<ARDOUR::MidiTrack>, MidiTimeAxisView&);
|
StepEditor (PublicEditor&, boost::shared_ptr<ARDOUR::MidiTrack>, MidiTimeAxisView&);
|
||||||
virtual ~StepEditor ();
|
virtual ~StepEditor ();
|
||||||
|
|
||||||
void check_step_edit ();
|
void check_step_edit ();
|
||||||
void step_edit_rest (Evoral::Beats beats);
|
void step_edit_rest (Evoral::Beats beats);
|
||||||
void step_edit_beat_sync ();
|
void step_edit_beat_sync ();
|
||||||
void step_edit_bar_sync ();
|
void step_edit_bar_sync ();
|
||||||
int step_add_bank_change (uint8_t channel, uint8_t bank);
|
int step_add_bank_change (uint8_t channel, uint8_t bank);
|
||||||
int step_add_program_change (uint8_t channel, uint8_t program);
|
int step_add_program_change (uint8_t channel, uint8_t program);
|
||||||
int step_add_note (uint8_t channel, uint8_t pitch, uint8_t velocity,
|
int step_add_note (uint8_t channel, uint8_t pitch, uint8_t velocity,
|
||||||
Evoral::Beats beat_duration);
|
Evoral::Beats beat_duration);
|
||||||
void step_edit_sustain (Evoral::Beats beats);
|
void step_edit_sustain (Evoral::Beats beats);
|
||||||
bool step_edit_within_triplet () const;
|
bool step_edit_within_triplet () const;
|
||||||
void step_edit_toggle_triplet ();
|
void step_edit_toggle_triplet ();
|
||||||
bool step_edit_within_chord () const;
|
bool step_edit_within_chord () const;
|
||||||
void step_edit_toggle_chord ();
|
void step_edit_toggle_chord ();
|
||||||
void reset_step_edit_beat_pos ();
|
void reset_step_edit_beat_pos ();
|
||||||
void resync_step_edit_to_edit_point ();
|
void resync_step_edit_to_edit_point ();
|
||||||
void move_step_edit_beat_pos (Evoral::Beats beats);
|
void move_step_edit_beat_pos (Evoral::Beats beats);
|
||||||
void set_step_edit_cursor_width (Evoral::Beats beats);
|
void set_step_edit_cursor_width (Evoral::Beats beats);
|
||||||
|
|
||||||
std::string name() const;
|
std::string name() const;
|
||||||
|
|
||||||
void start_step_editing ();
|
void start_step_editing ();
|
||||||
void stop_step_editing ();
|
void stop_step_editing ();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ARDOUR::framepos_t step_edit_insert_position;
|
ARDOUR::framepos_t step_edit_insert_position;
|
||||||
Evoral::Beats step_edit_beat_pos;
|
Evoral::Beats step_edit_beat_pos;
|
||||||
boost::shared_ptr<ARDOUR::MidiRegion> step_edit_region;
|
boost::shared_ptr<ARDOUR::MidiRegion> step_edit_region;
|
||||||
MidiRegionView* step_edit_region_view;
|
MidiRegionView* step_edit_region_view;
|
||||||
uint8_t _step_edit_triplet_countdown;
|
uint8_t _step_edit_triplet_countdown;
|
||||||
bool _step_edit_within_chord;
|
bool _step_edit_within_chord;
|
||||||
Evoral::Beats _step_edit_chord_duration;
|
Evoral::Beats _step_edit_chord_duration;
|
||||||
PBD::ScopedConnection step_edit_region_connection;
|
PBD::ScopedConnection step_edit_region_connection;
|
||||||
PublicEditor& _editor;
|
PublicEditor& _editor;
|
||||||
boost::shared_ptr<ARDOUR::MidiTrack> _track;
|
boost::shared_ptr<ARDOUR::MidiTrack> _track;
|
||||||
StepEntry* step_editor;
|
StepEntry* step_editor;
|
||||||
MidiTimeAxisView& _mtv;
|
MidiTimeAxisView& _mtv;
|
||||||
int8_t last_added_pitch;
|
int8_t last_added_pitch;
|
||||||
Evoral::Beats last_added_end;
|
Evoral::Beats last_added_end;
|
||||||
|
|
||||||
void region_removed (boost::weak_ptr<ARDOUR::Region>);
|
void region_removed (boost::weak_ptr<ARDOUR::Region>);
|
||||||
void playlist_changed ();
|
void playlist_changed ();
|
||||||
bool step_editor_hidden (GdkEventAny*);
|
bool step_editor_hidden (GdkEventAny*);
|
||||||
void step_editor_hide ();
|
void step_editor_hide ();
|
||||||
void resync_step_edit_position ();
|
void resync_step_edit_position ();
|
||||||
void prepare_step_edit_region ();
|
void prepare_step_edit_region ();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __pbd__step_editor_h__ */
|
#endif /* __gtk2_ardour_step_editor_h__ */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue