2 Copyright (C) 2012 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 #ifndef __gtk2_ardour_step_editor_h__
20 #define __gtk2_ardour_step_editor_h__
25 #include <sigc++/trackable.h>
27 #include "pbd/signals.h"
28 #include "evoral/types.hpp"
36 class MidiTimeAxisView;
40 class StepEditor : public PBD::ScopedConnectionList, public sigc::trackable
43 StepEditor (PublicEditor&, boost::shared_ptr<ARDOUR::MidiTrack>, MidiTimeAxisView&);
44 virtual ~StepEditor ();
46 void check_step_edit ();
47 void step_edit_rest (Evoral::Beats beats);
48 void step_edit_beat_sync ();
49 void step_edit_bar_sync ();
50 int step_add_bank_change (uint8_t channel, uint8_t bank);
51 int step_add_program_change (uint8_t channel, uint8_t program);
52 int step_add_note (uint8_t channel, uint8_t pitch, uint8_t velocity,
53 Evoral::Beats beat_duration);
54 void step_edit_sustain (Evoral::Beats beats);
55 bool step_edit_within_triplet () const;
56 void step_edit_toggle_triplet ();
57 bool step_edit_within_chord () const;
58 void step_edit_toggle_chord ();
59 void reset_step_edit_beat_pos ();
60 void resync_step_edit_to_edit_point ();
61 void move_step_edit_beat_pos (Evoral::Beats beats);
62 void set_step_edit_cursor_width (Evoral::Beats beats);
64 std::string name() const;
66 void start_step_editing ();
67 void stop_step_editing ();
70 ARDOUR::framepos_t step_edit_insert_position;
71 Evoral::Beats step_edit_beat_pos;
72 boost::shared_ptr<ARDOUR::MidiRegion> step_edit_region;
73 MidiRegionView* step_edit_region_view;
74 uint8_t _step_edit_triplet_countdown;
75 bool _step_edit_within_chord;
76 Evoral::Beats _step_edit_chord_duration;
77 PBD::ScopedConnection step_edit_region_connection;
78 PublicEditor& _editor;
79 boost::shared_ptr<ARDOUR::MidiTrack> _track;
80 StepEntry* step_editor;
81 MidiTimeAxisView& _mtv;
82 int8_t last_added_pitch;
83 Evoral::Beats last_added_end;
85 void region_removed (boost::weak_ptr<ARDOUR::Region>);
86 void playlist_changed ();
87 bool step_editor_hidden (GdkEventAny*);
88 void step_editor_hide ();
89 void resync_step_edit_position ();
90 void prepare_step_edit_region ();
93 #endif /* __gtk2_ardour_step_editor_h__ */