[Summary] Progressing TRACKS Meter Bridge (invented name = compact meter bridge)

This commit is contained in:
VKamyshniy 2014-07-19 18:32:45 +03:00
parent 5c39b2e283
commit a5caa2778b
14 changed files with 446 additions and 14 deletions

View file

@ -0,0 +1,188 @@
/*
Copyright (C) 2014 Waves Audio Ltd.
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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifdef WAF_BUILD
#include "gtk2ardour-config.h"
#endif
#include <map>
#include <sigc++/bind.h>
#include <gtkmm/accelmap.h>
#include <glibmm/threads.h>
#include <gtkmm2ext/gtk_ui.h>
#include <gtkmm2ext/utils.h>
#include <gtkmm2ext/window_title.h>
#include "ardour/debug.h"
#include "ardour/midi_track.h"
#include "ardour/route_group.h"
#include "ardour/session.h"
#include "ardour/audio_track.h"
#include "ardour/midi_track.h"
#include "compact_meter_bridge.h"
#include "keyboard.h"
#include "monitor_section.h"
#include "public_editor.h"
#include "ardour_ui.h"
#include "utils.h"
#include "route_sorter.h"
#include "actions.h"
#include "gui_thread.h"
#include "global_signals.h"
#include "meter_patterns.h"
#include "i18n.h"
using namespace ARDOUR;
using namespace PBD;
using namespace Gtk;
using namespace Glib;
using namespace Gtkmm2ext;
using namespace std;
using namespace ArdourMeter;
using PBD::atoi;
struct SignalOrderRouteSorter {
bool operator() (boost::shared_ptr<Route> a, boost::shared_ptr<Route> b) {
if (a->is_master() || a->is_monitor()) {
/* "a" is a special route (master, monitor, etc), and comes
* last in the mixer ordering
*/
return false;
} else if (b->is_master() || b->is_monitor()) {
/* everything comes before b */
return true;
}
return a->order_key () < b->order_key ();
}
};
CompactMeterbridge::CompactMeterbridge ()
: Gtk::EventBox()
, WavesUI ("compact_meter_bridge.xml", *this)
, _compact_meter_strips_home (get_box ("compact_meter_strips_home"))
{
set_attributes (*this, *xml_tree ()->root (), XMLNodeMap ());
signal_configure_event().connect (sigc::mem_fun (*ARDOUR_UI::instance(), &ARDOUR_UI::configure_handler));
CompactMeterStrip::CatchDeletion.connect (*this, invalidator (*this), boost::bind (&CompactMeterbridge::remove_strip, this, _1), gui_context());
}
CompactMeterbridge::~CompactMeterbridge ()
{
}
void
CompactMeterbridge::set_session (Session* s)
{
SessionHandlePtr::set_session (s);
if (!_session) {
return;
}
SignalOrderRouteSorter sorter;
boost::shared_ptr<RouteList> routes = _session->get_routes();
RouteList copy(*routes);
copy.sort(sorter);
add_strips(copy);
_session->RouteAdded.connect (_session_connections, invalidator (*this), boost::bind (&CompactMeterbridge::add_strips, this, _1), gui_context());
start_updating ();
}
void
CompactMeterbridge::session_going_away ()
{
ENSURE_GUI_THREAD (*this, &CompactMeterbridge::session_going_away);
for (list<CompactMeterStrip*>::iterator i = _strips.begin(); i != _strips.end(); ++i) {
delete *i;
}
_strips.clear ();
stop_updating ();
SessionHandlePtr::session_going_away ();
_session = 0;
}
gint
CompactMeterbridge::start_updating ()
{
fast_screen_update_connection = ARDOUR_UI::instance()->SuperRapidScreenUpdate.connect (sigc::mem_fun(*this, &CompactMeterbridge::fast_update_strips));
return 0;
}
gint
CompactMeterbridge::stop_updating ()
{
fast_screen_update_connection.disconnect();
return 0;
}
void
CompactMeterbridge::fast_update_strips ()
{
if (!is_mapped () || !_session) {
return;
}
for (list<CompactMeterStrip*>::iterator i = _strips.begin(); i != _strips.end(); ++i) {
(*i)->fast_update ();
}
}
void
CompactMeterbridge::add_strips (RouteList& routes)
{
for (RouteList::iterator x = routes.begin(); x != routes.end(); ++x) {
boost::shared_ptr<Route> route = (*x);
if (route->is_auditioner() || route->is_monitor() || route->is_master()) {
continue;
}
CompactMeterStrip* strip = new CompactMeterStrip (_session, route);
_strips.push_back (strip);
strip->show();
_compact_meter_strips_home.pack_start (*strip, false, false);
}
}
void
CompactMeterbridge::remove_strip (CompactMeterStrip* strip)
{
if (_session && _session->deletion_in_progress()) {
return;
}
for (list<CompactMeterStrip*>::iterator i = _strips.begin(); i != _strips.end(); ++i) {
if ( (*i) == strip) {
_strips.erase (i);
break;
}
}
}

View file

@ -0,0 +1,70 @@
/*
Copyright (C) 2014 Waves Audio Ltd.
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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __ardour_compact_meter_bridge_h__
#define __ardour_compact_meter_bridge_h__
#include <glibmm/thread.h>
#include <gtkmm/box.h>
#include <gtkmm/scrolledwindow.h>
#include <gtkmm/label.h>
#include <gtkmm/window.h>
#include "ardour/ardour.h"
#include "ardour/types.h"
#include "ardour/session_handle.h"
#include "pbd/stateful.h"
#include "pbd/signals.h"
#include "gtkmm2ext/visibility_tracker.h"
#include "waves_ui.h"
#include "compact_meter_strip.h"
class CompactMeterbridge :
public Gtk::EventBox,
public WavesUI,
public PBD::ScopedConnectionList,
public ARDOUR::SessionHandlePtr
{
public:
CompactMeterbridge ();
~CompactMeterbridge();
void set_session (ARDOUR::Session *);
private:
Gtk::Box& _compact_meter_strips_home;
gint start_updating ();
gint stop_updating ();
sigc::connection fast_screen_update_connection;
void fast_update_strips ();
void add_strips (ARDOUR::RouteList&);
void remove_strip (CompactMeterStrip *);
void session_going_away ();
std::list<CompactMeterStrip*> _strips;
};
#endif //__ardour_compact_meter_bridge_h__

View file

@ -0,0 +1,88 @@
/*
Copyright (C) 2014 Waves Audio Ltd.
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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "ardour/meter.h"
#include "ardour_ui.h"
#include "gui_thread.h"
#include "meter_patterns.h"
#include "compact_meter_strip.h"
#include "dbg_msg.h"
using namespace ARDOUR;
using namespace PBD;
using namespace Gtk;
using namespace Gtkmm2ext;
using namespace std;
using namespace ArdourMeter;
PBD::Signal1<void,CompactMeterStrip*> CompactMeterStrip::CatchDeletion;
int CompactMeterStrip::__meter_width = 4;
CompactMeterStrip::CompactMeterStrip (Session* sess, boost::shared_ptr<ARDOUR::Route> rt)
: EventBox()
, WavesUI ("compact_meter_strip.xml", *this)
, _route(rt)
, level_meter_home (get_box ("level_meter_home"))
, level_meter (sess)
{
set_attributes (*this, *xml_tree ()->root (), XMLNodeMap ());
level_meter.set_meter (_route->shared_peak_meter().get());
level_meter.clear_meters();
level_meter.set_type (_route->meter_type());
level_meter.setup_meters (__meter_width, __meter_width);
level_meter_home.add (level_meter);
_route->shared_peak_meter()->ConfigurationChanged.connect (
route_connections, invalidator (*this), boost::bind (&CompactMeterStrip::meter_configuration_changed, this, _1), gui_context()
);
meter_configuration_changed (_route->shared_peak_meter()->input_streams ());
_route->DropReferences.connect (route_connections, invalidator (*this), boost::bind (&CompactMeterStrip::self_delete, this), gui_context());
}
CompactMeterStrip::~CompactMeterStrip ()
{
CatchDeletion (this);
}
void
CompactMeterStrip::self_delete ()
{
delete this;
}
void
CompactMeterStrip::update_rec_display ()
{
}
void
CompactMeterStrip::fast_update ()
{
level_meter.update_meters();
}
void
CompactMeterStrip::meter_configuration_changed (ChanCount c)
{
level_meter.setup_meters (__meter_width, __meter_width);
}

View file

@ -0,0 +1,54 @@
/*
Copyright (C) 2014 Waves Audio Ltd.
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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __tracks_compact_meter_strip__
#define __tracks_compact_meter_strip__
#include "waves_ui.h"
#include "level_meter.h"
namespace ARDOUR {
class Route;
class Session;
}
class CompactMeterStrip :public Gtk::EventBox, public WavesUI
{
public:
CompactMeterStrip (ARDOUR::Session*, boost::shared_ptr<ARDOUR::Route>);
~CompactMeterStrip ();
void fast_update ();
boost::shared_ptr<ARDOUR::Route> route() { return _route; }
static PBD::Signal1<void,CompactMeterStrip*> CatchDeletion;
protected:
boost::shared_ptr<ARDOUR::Route> _route;
void self_delete ();
private:
Gtk::Box& level_meter_home;
LevelMeterHBox level_meter;
PBD::ScopedConnectionList route_connections;
static int __meter_width;
void meter_configuration_changed (ARDOUR::ChanCount);
void update_rec_display ();
};
#endif /* __tracks_compact_meter_strip__ */

View file

@ -251,7 +251,8 @@ Editor::Editor ()
, global_hpacker (get_h_box ("global_hpacker"))
, global_vpacker (get_v_box ("global_vpacker"))
, inspector_home (get_container ("inspector_home"))
, master_bus_ui_home (get_container ("master_bus_ui_home"))
, _master_bus_ui_home (get_container ("master_bus_ui_home"))
, _compact_meter_bridge_home (get_container ("compact_meter_bridge_home"))
, vpacker (get_v_box ("vpacker"))
, _tool_marker_button (get_waves_button ("tool_marker_button"))
, _tool_zoom_button (get_waves_button ("tool_zoom_button"))
@ -308,6 +309,7 @@ Editor::Editor ()
/* we are a singleton */
PublicEditor::_instance = this;
_compact_meter_bridge_home.add (_compact_meter_bridge);
_have_idled = false;
@ -1301,6 +1303,7 @@ Editor::set_session (Session *t)
_snapshots->set_session (_session);
_routes->set_session (_session);
_locations->set_session (_session);
_compact_meter_bridge.set_session (_session);
if (rhythm_ferret) {
rhythm_ferret->set_session (_session);

View file

@ -56,6 +56,7 @@
#include "enums.h"
#include "editor_items.h"
#include "region_selection.h"
#include "compact_meter_bridge.h"
namespace Gtkmm2ext {
class TearOff;
@ -689,9 +690,10 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
Gtk::HBox& global_hpacker;
Gtk::VBox& global_vpacker;
Gtk::Container& inspector_home;
Gtk::Container& master_bus_ui_home;
Gtk::VBox& vpacker;
Gtk::Container& _master_bus_ui_home;
Gtk::Container& _compact_meter_bridge_home;
MasterBusUI* _master_bus_ui;
Gtk::VBox& vpacker;
Gdk::Cursor* current_canvas_cursor;
Gdk::Cursor* which_grabber_cursor ();
@ -1905,6 +1907,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
/* editor-mixer strip */
MixerStrip *current_mixer_strip;
CompactMeterbridge _compact_meter_bridge;
bool show_editor_mixer_when_tracks_arrive;
void cms_new (boost::shared_ptr<ARDOUR::Route>);
void current_mixer_strip_hidden ();

View file

@ -179,7 +179,7 @@ Editor::create_editor_mixer ()
current_mixer_strip->Hiding.connect (sigc::mem_fun(*this, &Editor::current_mixer_strip_hidden));
current_mixer_strip->set_embedded (true);
_master_bus_ui = new MasterBusUI (*this, _session);
master_bus_ui_home.add (*_master_bus_ui);
_master_bus_ui_home.add (*_master_bus_ui);
}
void

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View file

@ -625,7 +625,6 @@ Meterbridge::remove_strip (MeterStrip* strip)
return;
}
list<MeterBridgeStrip>::iterator i;
for (list<MeterBridgeStrip>::iterator i = strips.begin(); i != strips.end(); ++i) {
if ( (*i).s == strip) {
strips.erase (i);

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<CompactMeterbridge bgnormal="#353535">
<HBox>
<VBox>
<icon source="meter_bridge_level_scale.png"/>
</VBox>
<VBox>
<Hbox height="13"/>
<Hbox id="compact_meter_strips_home" spacing="2"/>
</VBox>
</HBox>
</CompactMeterbridge>

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<CompactMeterStrip>
<VBox>
<Hbox id="level_meter_home" height="51"/>
</VBox>
</CompactMeterStrip>

View file

@ -189,10 +189,11 @@
</EventBox>
<HBox>
<EventBox id="master_bus_ui_home"/>
<EventBox bgnormal="#D9E99F"
width="100"
box.fill="true"
box.expand="true"/>
<EventBox id="compact_meter_bridge_home"
bgnormal="#383838"
box.expand="true"
box.fill="true">
</EventBox>
</HBox>
<HBox id="global_hpacker"
box.pack="end"

View file

@ -15,11 +15,15 @@
bordercolor="#C9C9C9"
borderwidth="1 1 0 0"/>
<HBox>
<VBox id="level_meter_home"
x="1"
y="36"
width="17"
height="187"/>
<VBox>
<HBox height ="10"/>
<VBox id="level_meter_home"
x="1"
y="36"
width="17"
height="187"/>
<HBox height ="13"/>
</VBox>
<icon source="mixer_strip_meter_marks.png"/>
<Fader id="gain_slider" bgnormal="#303030" bgactive="#545454"
adjustment="gain_adjustment"

View file

@ -155,6 +155,8 @@ gtk2_ardour_sources = [
'master_bus_ui.cc',
'meterbridge.cc',
'meter_strip.cc',
'compact_meter_strip.cc',
'compact_meter_bridge.cc',
'meter_patterns.cc',
'monitor_section.cc',
'mono_panner.cc',