2020-10-26 17:55:00 -04:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2020 Robin Gareus <robin@gareus.org>
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __gtk_ardour_recorder_ui_h__
|
|
|
|
#define __gtk_ardour_recorder_ui_h__
|
|
|
|
|
2020-12-06 16:05:09 -05:00
|
|
|
#include <boost/shared_ptr.hpp>
|
|
|
|
#include <list>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include <gtkmm/alignment.h>
|
2020-10-26 17:55:00 -04:00
|
|
|
#include <gtkmm/box.h>
|
2020-12-06 16:05:09 -05:00
|
|
|
#include <gtkmm/scrolledwindow.h>
|
|
|
|
#include <gtkmm/sizegroup.h>
|
|
|
|
#include <gtkmm/table.h>
|
|
|
|
|
|
|
|
#include "pbd/natsort.h"
|
2020-10-26 17:55:00 -04:00
|
|
|
|
|
|
|
#include "ardour/session_handle.h"
|
2020-12-06 16:05:09 -05:00
|
|
|
#include "ardour/circular_buffer.h"
|
|
|
|
#include "ardour/types.h"
|
|
|
|
|
2020-10-26 17:55:00 -04:00
|
|
|
#include "gtkmm2ext/bindings.h"
|
2020-12-06 16:05:09 -05:00
|
|
|
#include "gtkmm2ext/cairo_widget.h"
|
|
|
|
|
|
|
|
#include "widgets/ardour_button.h"
|
|
|
|
#include "widgets/ardour_spacer.h"
|
|
|
|
#include "widgets/frame.h"
|
|
|
|
#include "widgets/pane.h"
|
2020-10-26 17:55:00 -04:00
|
|
|
#include "widgets/tabbable.h"
|
|
|
|
|
2020-12-06 16:05:09 -05:00
|
|
|
#include "input_port_monitor.h"
|
2021-02-15 18:08:02 -05:00
|
|
|
#include "rec_info_box.h"
|
2021-06-18 16:26:22 -04:00
|
|
|
#include "shuttle_control.h"
|
2021-02-15 18:08:02 -05:00
|
|
|
#include "transport_control_ui.h"
|
2020-12-06 16:05:09 -05:00
|
|
|
|
2021-02-23 07:10:05 -05:00
|
|
|
namespace ARDOUR {
|
|
|
|
class SoloMuteRelease;
|
|
|
|
}
|
|
|
|
|
2020-12-06 16:05:09 -05:00
|
|
|
class TrackRecordAxis;
|
|
|
|
class RecorderGroupTabs;
|
|
|
|
|
2020-10-26 17:55:00 -04:00
|
|
|
class RecorderUI : public ArdourWidgets::Tabbable, public ARDOUR::SessionHandlePtr, public PBD::ScopedConnectionList
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
RecorderUI ();
|
|
|
|
~RecorderUI ();
|
|
|
|
|
|
|
|
void set_session (ARDOUR::Session*);
|
|
|
|
void cleanup ();
|
|
|
|
|
2022-04-06 23:56:45 -04:00
|
|
|
XMLNode& get_state () const;
|
2020-10-26 17:55:00 -04:00
|
|
|
int set_state (const XMLNode&, int /* version */);
|
|
|
|
|
|
|
|
Gtk::Window* use_own_window (bool and_fill_it);
|
|
|
|
|
2020-12-06 16:05:09 -05:00
|
|
|
void spill_port (std::string const&);
|
|
|
|
void add_track (std::string const&);
|
|
|
|
|
2020-10-26 17:55:00 -04:00
|
|
|
private:
|
|
|
|
void load_bindings ();
|
|
|
|
void register_actions ();
|
|
|
|
void update_title ();
|
|
|
|
void session_going_away ();
|
|
|
|
void parameter_changed (std::string const&);
|
2020-12-06 16:05:09 -05:00
|
|
|
void presentation_info_changed (PBD::PropertyChange const&);
|
|
|
|
void gui_extents_changed ();
|
2021-05-07 16:45:28 -04:00
|
|
|
void regions_changed (boost::shared_ptr<ARDOUR::RegionList>, PBD::PropertyChange const&);
|
2020-12-06 16:05:09 -05:00
|
|
|
|
|
|
|
void start_updating ();
|
|
|
|
void stop_updating ();
|
|
|
|
bool update_meters ();
|
|
|
|
void add_or_remove_io (ARDOUR::DataType, std::vector<std::string>, bool);
|
|
|
|
void update_io_widget_labels ();
|
|
|
|
|
|
|
|
void initial_track_display ();
|
|
|
|
void add_routes (ARDOUR::RouteList&);
|
|
|
|
void remove_route (TrackRecordAxis*);
|
2021-02-15 18:27:29 -05:00
|
|
|
void tra_name_edit (TrackRecordAxis*, bool);
|
2020-12-06 16:05:09 -05:00
|
|
|
void update_rec_table_layout ();
|
|
|
|
void update_spacer_width (Gtk::Allocation&, TrackRecordAxis*);
|
2021-02-15 18:08:02 -05:00
|
|
|
void tabbed_changed (bool);
|
2020-12-06 16:05:09 -05:00
|
|
|
|
|
|
|
void set_connections (std::string const&);
|
|
|
|
void port_connected_or_disconnected (std::string, std::string);
|
|
|
|
void port_pretty_name_changed (std::string);
|
|
|
|
|
|
|
|
void meter_area_size_allocate (Gtk::Allocation&);
|
|
|
|
void meter_area_size_request (GtkRequisition*);
|
|
|
|
void meter_area_layout ();
|
|
|
|
|
2021-03-28 14:36:37 -04:00
|
|
|
bool scroller_button_event (GdkEventButton*);
|
2020-12-06 16:05:09 -05:00
|
|
|
|
|
|
|
void arm_all ();
|
|
|
|
void arm_none ();
|
|
|
|
void peak_reset ();
|
|
|
|
|
|
|
|
void update_sensitivity ();
|
|
|
|
void update_recordstate ();
|
2021-02-23 07:10:05 -05:00
|
|
|
void update_monitorstate (std::string, bool);
|
2020-12-06 16:05:09 -05:00
|
|
|
void new_track_for_port (ARDOUR::DataType, std::string const&);
|
|
|
|
|
|
|
|
static int calc_columns (int child_width, int parent_width);
|
|
|
|
|
|
|
|
Gtkmm2ext::Bindings* bindings;
|
|
|
|
Gtk::VBox _content;
|
|
|
|
Gtk::HBox _toolbar;
|
|
|
|
Gtk::Table _button_table;
|
|
|
|
ArdourWidgets::VPane _pane;
|
|
|
|
Gtk::ScrolledWindow _rec_scroller;
|
|
|
|
Gtk::VBox _rec_container;
|
|
|
|
Gtk::HBox _rec_groups;
|
|
|
|
Gtk::VBox _rec_area;
|
|
|
|
Gtk::ScrolledWindow _meter_scroller;
|
|
|
|
Gtk::VBox _meter_area;
|
|
|
|
Gtk::Table _meter_table;
|
|
|
|
Gtk::EventBox _scroller_base;
|
|
|
|
|
|
|
|
ArdourWidgets::ArdourHSpacer _toolbar_sep;
|
|
|
|
Gtk::Label _recs_label;
|
|
|
|
ArdourWidgets::ArdourButton _btn_rec_all;
|
|
|
|
ArdourWidgets::ArdourButton _btn_rec_none;
|
|
|
|
ArdourWidgets::ArdourButton _btn_rec_forget;
|
|
|
|
ArdourWidgets::ArdourButton _btn_peak_reset;
|
|
|
|
ArdourWidgets::ArdourButton _monitor_in_button;
|
|
|
|
ArdourWidgets::ArdourButton _monitor_disk_button;
|
2021-06-04 12:53:06 -04:00
|
|
|
ArdourWidgets::ArdourButton _btn_new_plist;
|
|
|
|
ArdourWidgets::ArdourButton _btn_new_plist_rec;
|
2020-12-06 16:05:09 -05:00
|
|
|
ArdourWidgets::ArdourButton _auto_input_button;
|
2021-02-15 18:08:02 -05:00
|
|
|
DurationInfoBox _duration_info_box;
|
|
|
|
XrunInfoBox _xrun_info_box;
|
|
|
|
RemainInfoBox _remain_info_box;
|
|
|
|
TransportControlUI _transport_ctrl;
|
2020-12-06 16:05:09 -05:00
|
|
|
Glib::RefPtr<Gtk::SizeGroup> _toolbar_button_height;
|
|
|
|
Glib::RefPtr<Gtk::SizeGroup> _toolbar_recarm_width;
|
|
|
|
Glib::RefPtr<Gtk::SizeGroup> _toolbar_monitoring_width;
|
|
|
|
|
|
|
|
int _meter_box_width;
|
|
|
|
int _meter_area_cols;
|
|
|
|
bool _vertical;
|
2020-10-26 17:55:00 -04:00
|
|
|
|
2020-12-06 16:05:09 -05:00
|
|
|
std::set<std::string> _spill_port_names;
|
2020-10-26 17:55:00 -04:00
|
|
|
|
2020-12-06 16:05:09 -05:00
|
|
|
sigc::connection _fast_screen_update_connection;
|
|
|
|
sigc::connection _ruler_width_update_connection;
|
|
|
|
PBD::ScopedConnectionList _engine_connections;
|
2021-02-23 07:10:05 -05:00
|
|
|
PBD::ScopedConnection _monitor_connection;
|
2020-12-06 16:05:09 -05:00
|
|
|
|
|
|
|
class RecRuler : public CairoWidget , public ARDOUR::SessionHandlePtr
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
RecRuler ();
|
|
|
|
|
|
|
|
void playhead_position_changed (ARDOUR::samplepos_t);
|
|
|
|
void set_gui_extents (samplepos_t, samplepos_t);
|
|
|
|
void set_right_edge (int);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void render (Cairo::RefPtr<Cairo::Context> const&, cairo_rectangle_t*);
|
|
|
|
void on_size_request (Gtk::Requisition*);
|
|
|
|
bool on_button_press_event (GdkEventButton*);
|
|
|
|
|
|
|
|
private:
|
|
|
|
Glib::RefPtr<Pango::Layout> _layout;
|
|
|
|
int _time_width;
|
|
|
|
int _time_height;
|
|
|
|
int _width;
|
|
|
|
ARDOUR::samplecnt_t _left;
|
|
|
|
ARDOUR::samplecnt_t _right;
|
|
|
|
};
|
|
|
|
|
|
|
|
class InputPort : public Gtk::EventBox
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
InputPort (std::string const&, ARDOUR::DataType, RecorderUI*, bool vertical = false);
|
|
|
|
~InputPort ();
|
|
|
|
|
|
|
|
void set_frame_label (std::string const&);
|
|
|
|
void set_connections (ARDOUR::WeakRouteList);
|
|
|
|
void setup_name ();
|
|
|
|
bool spill (bool);
|
|
|
|
bool spilled () const;
|
2021-02-23 07:10:05 -05:00
|
|
|
void allow_monitoring (bool);
|
|
|
|
void update_monitorstate (bool);
|
2020-12-06 16:05:09 -05:00
|
|
|
void update_rec_stat ();
|
|
|
|
|
|
|
|
ARDOUR::DataType data_type () const;
|
|
|
|
std::string const& name () const;
|
|
|
|
|
|
|
|
void update (float, float); // FastMeter
|
|
|
|
void update (float const*); // EventMeter
|
|
|
|
void update (ARDOUR::CircularSampleBuffer&); // InputScope
|
|
|
|
void update (ARDOUR::CircularEventBuffer&); // EventMonitor
|
|
|
|
void clear ();
|
|
|
|
|
|
|
|
bool operator< (InputPort const& o) const {
|
|
|
|
if (_dt == o._dt) {
|
|
|
|
return PBD::naturally_less (_port_name.c_str (), o._port_name.c_str ());
|
|
|
|
}
|
|
|
|
return _dt < (uint32_t) o._dt;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
void rename_port ();
|
2021-02-23 07:10:05 -05:00
|
|
|
bool monitor_press (GdkEventButton*);
|
|
|
|
bool monitor_release (GdkEventButton*);
|
2020-12-06 16:05:09 -05:00
|
|
|
|
|
|
|
ARDOUR::DataType _dt;
|
|
|
|
InputPortMonitor _monitor;
|
|
|
|
Gtk::Alignment _alignment;
|
|
|
|
ArdourWidgets::Frame _frame;
|
|
|
|
ArdourWidgets::ArdourButton _spill_button;
|
2021-02-23 07:10:05 -05:00
|
|
|
ArdourWidgets::ArdourButton _monitor_button;
|
2020-12-06 16:05:09 -05:00
|
|
|
ArdourWidgets::ArdourButton _name_button;
|
|
|
|
Gtk::Label _name_label;
|
|
|
|
ArdourWidgets::ArdourButton _add_button;
|
|
|
|
std::string _port_name;
|
|
|
|
ARDOUR::WeakRouteList _connected_routes;
|
2021-02-23 07:10:05 -05:00
|
|
|
ARDOUR::SoloMuteRelease* _solo_release;
|
2020-12-06 16:05:09 -05:00
|
|
|
|
|
|
|
static bool _size_groups_initialized;
|
|
|
|
static Glib::RefPtr<Gtk::SizeGroup> _name_size_group;
|
2021-02-23 07:10:05 -05:00
|
|
|
static Glib::RefPtr<Gtk::SizeGroup> _ctrl_size_group;
|
2020-12-06 16:05:09 -05:00
|
|
|
static Glib::RefPtr<Gtk::SizeGroup> _monitor_size_group;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct InputPortPtrSort {
|
|
|
|
bool operator() (boost::shared_ptr<InputPort> const& a, boost::shared_ptr<InputPort> const& b) const {
|
|
|
|
return *a < *b;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-02-25 09:55:10 -05:00
|
|
|
typedef std::map<std::string, boost::shared_ptr<InputPort> > InputPortMap;
|
|
|
|
typedef std::set<boost::shared_ptr<InputPort>, InputPortPtrSort> InputPortSet;
|
2020-12-06 16:05:09 -05:00
|
|
|
|
|
|
|
RecRuler _ruler;
|
|
|
|
Gtk::EventBox _space;
|
|
|
|
Gtk::HBox _ruler_box;
|
|
|
|
ArdourWidgets::ArdourHSpacer _ruler_sep;
|
|
|
|
RecorderGroupTabs* _rec_group_tabs;
|
|
|
|
|
|
|
|
InputPortMap _input_ports;
|
|
|
|
std::list<TrackRecordAxis*> _recorders;
|
|
|
|
std::list<TrackRecordAxis*> _visible_recorders;
|
|
|
|
|
|
|
|
public:
|
|
|
|
/* only for RecorderGroupTab */
|
|
|
|
std::list<TrackRecordAxis*> visible_recorders () const;
|
2020-10-26 17:55:00 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __gtk_ardour_recorder_ui_h__ */
|