2013-01-16 13:37:48 -05:00
|
|
|
/*
|
2019-08-02 17:26:43 -04:00
|
|
|
* Copyright (C) 2010-2018 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
* Copyright (C) 2011-2015 David Robillard <d@drobilla.net>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
2013-01-16 13:37:48 -05:00
|
|
|
|
2015-01-07 20:12:14 -05:00
|
|
|
#ifndef __gtk2_ardour_step_editor_h__
|
|
|
|
#define __gtk2_ardour_step_editor_h__
|
2010-08-15 12:39:51 -04:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include <gdk/gdk.h>
|
|
|
|
#include <sigc++/trackable.h>
|
|
|
|
|
|
|
|
#include "pbd/signals.h"
|
2017-09-24 12:57:27 -04:00
|
|
|
|
2017-09-24 12:03:54 -04:00
|
|
|
#include "temporal/beats.h"
|
2010-08-15 12:39:51 -04:00
|
|
|
|
|
|
|
namespace ARDOUR {
|
2015-01-07 20:12:14 -05:00
|
|
|
class MidiTrack;
|
|
|
|
class MidiRegion;
|
2010-08-15 12:39:51 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
class MidiRegionView;
|
|
|
|
class MidiTimeAxisView;
|
|
|
|
class PublicEditor;
|
|
|
|
class StepEntry;
|
|
|
|
|
2018-12-22 16:48:16 -05:00
|
|
|
/** A StepEditor is an object which understands how to interact with the
|
|
|
|
* MidiTrack and MidiTimeAxisView APIs to make the changes required during step
|
|
|
|
* editing. However, it defers all GUI matters to the StepEntry class, which
|
|
|
|
* presents an interface to the user, and then calls StepEditor methods to make
|
|
|
|
* changes.
|
|
|
|
*
|
|
|
|
* The StepEntry is a singleton, used over and over each time the user wants to
|
|
|
|
* step edit; the StepEditor is owned by a MidiTimeAxisView and re-used for any
|
|
|
|
* step editing in the MidiTrack for which the MidiTimeAxisView is a view.
|
|
|
|
*/
|
|
|
|
|
2010-08-15 12:39:51 -04:00
|
|
|
class StepEditor : public PBD::ScopedConnectionList, public sigc::trackable
|
|
|
|
{
|
2015-01-07 20:12:14 -05:00
|
|
|
public:
|
2023-02-16 18:33:28 -05:00
|
|
|
StepEditor (PublicEditor&, std::shared_ptr<ARDOUR::MidiTrack>, MidiTimeAxisView&);
|
2015-01-07 20:12:14 -05:00
|
|
|
virtual ~StepEditor ();
|
2010-08-15 12:39:51 -04:00
|
|
|
|
2018-12-22 16:48:16 -05:00
|
|
|
void step_entry_done ();
|
|
|
|
|
2010-08-15 12:39:51 -04:00
|
|
|
void check_step_edit ();
|
2017-09-24 12:03:54 -04:00
|
|
|
void step_edit_rest (Temporal::Beats beats);
|
2015-01-07 20:12:14 -05:00
|
|
|
void step_edit_beat_sync ();
|
|
|
|
void step_edit_bar_sync ();
|
|
|
|
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_note (uint8_t channel, uint8_t pitch, uint8_t velocity,
|
2017-09-24 12:03:54 -04:00
|
|
|
Temporal::Beats beat_duration);
|
|
|
|
void step_edit_sustain (Temporal::Beats beats);
|
2015-01-07 20:12:14 -05:00
|
|
|
bool step_edit_within_triplet () const;
|
|
|
|
void step_edit_toggle_triplet ();
|
|
|
|
bool step_edit_within_chord () const;
|
|
|
|
void step_edit_toggle_chord ();
|
|
|
|
void reset_step_edit_beat_pos ();
|
|
|
|
void resync_step_edit_to_edit_point ();
|
2017-09-24 12:03:54 -04:00
|
|
|
void move_step_edit_beat_pos (Temporal::Beats beats);
|
|
|
|
void set_step_edit_cursor_width (Temporal::Beats beats);
|
2015-01-07 20:12:14 -05:00
|
|
|
|
2019-04-08 15:37:02 -04:00
|
|
|
std::string name () const;
|
2010-08-15 12:39:51 -04:00
|
|
|
|
|
|
|
void start_step_editing ();
|
|
|
|
void stop_step_editing ();
|
|
|
|
|
2015-01-07 20:12:14 -05:00
|
|
|
private:
|
2020-10-02 23:26:17 -04:00
|
|
|
Temporal::timepos_t step_edit_insert_position;
|
2019-04-08 15:37:02 -04:00
|
|
|
Temporal::Beats step_edit_beat_pos;
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<ARDOUR::MidiRegion> step_edit_region;
|
2019-04-08 15:37:02 -04:00
|
|
|
MidiRegionView* step_edit_region_view;
|
2015-01-07 20:12:14 -05:00
|
|
|
uint8_t _step_edit_triplet_countdown;
|
|
|
|
bool _step_edit_within_chord;
|
2017-09-24 12:57:27 -04:00
|
|
|
Temporal::Beats _step_edit_chord_duration;
|
2019-04-08 15:37:02 -04:00
|
|
|
PBD::ScopedConnection step_edit_region_connection;
|
2015-01-07 20:12:14 -05:00
|
|
|
PublicEditor& _editor;
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<ARDOUR::MidiTrack> _track;
|
2015-01-07 20:12:14 -05:00
|
|
|
MidiTimeAxisView& _mtv;
|
2019-04-08 15:37:02 -04:00
|
|
|
int8_t last_added_pitch;
|
|
|
|
Temporal::Beats last_added_end;
|
2015-01-07 20:12:14 -05:00
|
|
|
|
2018-12-22 16:48:16 -05:00
|
|
|
sigc::connection delete_connection;
|
|
|
|
sigc::connection hide_connection;
|
|
|
|
|
2023-02-16 18:33:28 -05:00
|
|
|
void region_removed (std::weak_ptr<ARDOUR::Region>);
|
2015-01-07 20:12:14 -05:00
|
|
|
void playlist_changed ();
|
2018-12-22 14:45:28 -05:00
|
|
|
bool step_entry_hidden (GdkEventAny*);
|
2015-01-07 20:12:14 -05:00
|
|
|
void resync_step_edit_position ();
|
|
|
|
void prepare_step_edit_region ();
|
2010-08-15 12:39:51 -04:00
|
|
|
};
|
|
|
|
|
2015-01-07 20:12:14 -05:00
|
|
|
#endif /* __gtk2_ardour_step_editor_h__ */
|