2014-07-19 18:32:45 +03:00
|
|
|
/*
|
|
|
|
|
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"
|
2014-07-20 18:02:36 +03:00
|
|
|
#include "ardour/track.h"
|
2014-07-19 18:32:45 +03:00
|
|
|
#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;
|
|
|
|
|
|
|
|
|
|
CompactMeterStrip::CompactMeterStrip (Session* sess, boost::shared_ptr<ARDOUR::Route> rt)
|
|
|
|
|
: EventBox()
|
|
|
|
|
, WavesUI ("compact_meter_strip.xml", *this)
|
|
|
|
|
, _route(rt)
|
2014-07-20 18:02:36 +03:00
|
|
|
, _level_meter_home (get_box ("level_meter_home"))
|
|
|
|
|
, _level_meter (sess)
|
|
|
|
|
, _record_indicator (get_event_box ("record_indicator"))
|
2014-07-29 12:09:11 +03:00
|
|
|
, _serial_number (0)
|
2014-08-06 10:19:04 +03:00
|
|
|
, _meter_width (xml_property (*xml_tree ()->root (), "meterwidth", 1))
|
|
|
|
|
, _thin_meter_width (xml_property (*xml_tree ()->root (), "thinmeterwidth", 1))
|
2014-07-19 18:32:45 +03:00
|
|
|
{
|
2014-07-28 20:10:12 +03:00
|
|
|
set_attributes (*this, *xml_tree ()->root (), XMLNodeMap ());
|
2014-07-20 18:02:36 +03:00
|
|
|
|
|
|
|
|
_level_meter.set_meter (_route->shared_peak_meter().get());
|
|
|
|
|
_level_meter.clear_meters();
|
|
|
|
|
_level_meter.set_type (_route->meter_type());
|
2014-08-12 00:50:47 +03:00
|
|
|
_level_meter.setup_meters (_meter_width, _thin_meter_width);
|
2014-07-20 18:02:36 +03:00
|
|
|
_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());
|
2014-07-19 18:32:45 +03:00
|
|
|
|
|
|
|
|
meter_configuration_changed (_route->shared_peak_meter()->input_streams ());
|
|
|
|
|
|
2014-07-20 18:02:36 +03:00
|
|
|
_route->DropReferences.connect (_route_connections,
|
|
|
|
|
invalidator (*this),
|
|
|
|
|
boost::bind (&CompactMeterStrip::self_delete,
|
|
|
|
|
this),
|
|
|
|
|
gui_context());
|
|
|
|
|
boost::shared_ptr<Track> t = boost::dynamic_pointer_cast<Track> (_route);
|
|
|
|
|
if (t) {
|
|
|
|
|
t->RecordEnableChanged.connect (_route_connections,
|
|
|
|
|
invalidator (*this),
|
|
|
|
|
boost::bind (&CompactMeterStrip::update_rec_display,
|
|
|
|
|
this), gui_context());
|
2014-07-29 17:21:43 +03:00
|
|
|
_route->PropertyChanged.connect(_route_connections,
|
|
|
|
|
invalidator (*this),
|
|
|
|
|
boost::bind (&CompactMeterStrip::route_property_changed, this, _1),
|
|
|
|
|
gui_context());
|
2014-07-29 12:58:22 +03:00
|
|
|
|
|
|
|
|
update_rec_display ();
|
2014-07-20 18:02:36 +03:00
|
|
|
}
|
2014-07-19 18:32:45 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CompactMeterStrip::~CompactMeterStrip ()
|
|
|
|
|
{
|
|
|
|
|
CatchDeletion (this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
CompactMeterStrip::self_delete ()
|
|
|
|
|
{
|
|
|
|
|
delete this;
|
|
|
|
|
}
|
|
|
|
|
|
2014-07-29 17:21:43 +03:00
|
|
|
void
|
|
|
|
|
CompactMeterStrip::route_property_changed(const PropertyChange& what_changed)
|
|
|
|
|
{
|
|
|
|
|
if (what_changed.contains (ARDOUR::Properties::name)) {
|
|
|
|
|
update_tooltip();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-07-29 12:58:22 +03:00
|
|
|
void
|
|
|
|
|
CompactMeterStrip::update_tooltip ()
|
|
|
|
|
{
|
|
|
|
|
string record_status = _route->record_enabled() ? "Record Enabled" : "Record Disabled";
|
|
|
|
|
stringstream ss;
|
|
|
|
|
ss<<_serial_number;
|
|
|
|
|
this->set_tooltip_text ("Track " + ss.str() + "\n" + _route->name () + "\n" + record_status);
|
|
|
|
|
}
|
|
|
|
|
|
2014-07-19 18:32:45 +03:00
|
|
|
void
|
|
|
|
|
CompactMeterStrip::update_rec_display ()
|
|
|
|
|
{
|
2014-07-20 18:02:36 +03:00
|
|
|
_record_indicator.set_state ((_route && _route->record_enabled ()) ? Gtk::STATE_ACTIVE : Gtk::STATE_NORMAL);
|
2014-07-29 12:58:22 +03:00
|
|
|
update_tooltip ();
|
2014-07-19 18:32:45 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
CompactMeterStrip::fast_update ()
|
|
|
|
|
{
|
2014-07-20 18:02:36 +03:00
|
|
|
_level_meter.update_meters();
|
2014-07-19 18:32:45 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
CompactMeterStrip::meter_configuration_changed (ChanCount c)
|
|
|
|
|
{
|
2014-08-12 00:50:47 +03:00
|
|
|
_level_meter.setup_meters (_meter_width, _thin_meter_width);
|
2014-07-19 18:32:45 +03:00
|
|
|
}
|
|
|
|
|
|