MCP: metering changes from rodrigo, makes metering work correctly on the MC Pro (also checked on the nucleus)
git-svn-id: svn://localhost/ardour2/branches/3.0@12489 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
cd58caa93b
commit
28e3bc3ac7
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2001-2007 Paul Davis
|
||||
Copyright (C) 2001-2012 Paul Davis
|
||||
|
||||
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
|
||||
|
@ -180,14 +180,10 @@ fixup_bundle_environment (int, char* [])
|
|||
export_search_path (dir_path, "ARDOUR_DATA_PATH", "/../Resources");
|
||||
export_search_path (dir_path, "ARDOUR_CONFIG_PATH", "/../Resources");
|
||||
export_search_path (dir_path, "ARDOUR_INSTANT_XML_PATH", "/../Resources");
|
||||
|
||||
export_search_path (dir_path, "LADSPA_PATH", "/../Plugins");
|
||||
export_search_path (dir_path, "VAMP_PATH", "/../lib");
|
||||
export_search_path (dir_path, "SUIL_MODULE_DIR", "/../lib");
|
||||
|
||||
path = dir_path;
|
||||
path += "/../lib/clearlooks";
|
||||
setenv ("GTK_PATH", path.c_str(), 1);
|
||||
export_search_path (dir_path, "GTK_PATH", "/../lib/clearlooks");
|
||||
|
||||
/* unset GTK_RC_FILES so that we only load the RC files that we define
|
||||
*/
|
||||
|
@ -195,12 +191,7 @@ fixup_bundle_environment (int, char* [])
|
|||
unsetenv ("GTK_RC_FILES");
|
||||
|
||||
if (!ARDOUR::translations_are_disabled ()) {
|
||||
|
||||
path = dir_path;
|
||||
path += "/../Resources/locale";
|
||||
|
||||
localedir = strdup (path.c_str());
|
||||
setenv ("GTK_LOCALEDIR", localedir, 1);
|
||||
expoirt_search_path (dir_path, "GTK_LOCALEDIR", "/../Resources/locale");
|
||||
}
|
||||
|
||||
/* write a pango.rc file and tell pango to use it. we'd love
|
||||
|
@ -246,18 +237,8 @@ fixup_bundle_environment (int, char* [])
|
|||
setenv ("CHARSETALIASDIR", path.c_str(), 1);
|
||||
|
||||
// font config
|
||||
|
||||
path = dir_path;
|
||||
path += "/../Resources/fonts.conf";
|
||||
|
||||
setenv ("FONTCONFIG_FILE", path.c_str(), 1);
|
||||
|
||||
// GDK Pixbuf loader module file
|
||||
|
||||
path = dir_path;
|
||||
path += "/../Resources/gdk-pixbuf.loaders";
|
||||
|
||||
setenv ("GDK_PIXBUF_MODULE_FILE", path.c_str(), 1);
|
||||
export_search_path (dir_path, "FONTCONFIG_FILE", "/../Resources/fonts.conf");
|
||||
export_search_path (dir_path, "GDK_PIXBUF_MODULE_FILE", "/../Resources/gdk-pixbuf.loaders");
|
||||
|
||||
if (getenv ("ARDOUR_WITH_JACK")) {
|
||||
// JACK driver dir
|
||||
|
|
|
@ -880,7 +880,11 @@ MackieControlProtocol::notify_transport_state_changed()
|
|||
update_global_button (Button::Stop, !session->transport_rolling());
|
||||
update_global_button (Button::Rewind, session->transport_speed() < 0.0);
|
||||
update_global_button (Button::Ffwd, session->transport_speed() > 1.0);
|
||||
|
||||
|
||||
for (Surfaces::iterator s = surfaces.begin(); s != surfaces.end(); ++s) {
|
||||
(*s)->notify_transport_state_changed ();
|
||||
}
|
||||
|
||||
_transport_previously_rolling = session->transport_rolling();
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "pbd/compose.h"
|
||||
#include "ardour/debug.h"
|
||||
|
||||
#include "mackie_control_protocol.h"
|
||||
#include "meter.h"
|
||||
#include "surface.h"
|
||||
#include "surface_port.h"
|
||||
|
@ -40,6 +41,57 @@ Meter::factory (Surface& surface, int id, const char* name, Group& group)
|
|||
return m;
|
||||
}
|
||||
|
||||
void
|
||||
Meter::update_transport_rolling(Surface& surface)
|
||||
{
|
||||
bool transport_is_rolling = (surface.mcp().get_transport_speed () != 0.0f);
|
||||
|
||||
if (_transport_is_rolling == transport_is_rolling) {
|
||||
return;
|
||||
}
|
||||
if (transport_is_rolling) {
|
||||
MidiByteArray enable_msg;
|
||||
|
||||
// sysex header
|
||||
enable_msg << surface.sysex_hdr();
|
||||
|
||||
// code for Channel Meter Enable Message
|
||||
enable_msg << 0x20;
|
||||
|
||||
// Channel identification
|
||||
enable_msg << id();
|
||||
|
||||
// Enabling level meter on LCD, peak hold display on horizontal meter and signal LED
|
||||
enable_msg << 0x07;
|
||||
|
||||
// sysex trailer
|
||||
enable_msg << MIDI::eox;
|
||||
|
||||
surface.write (enable_msg);
|
||||
|
||||
} else {
|
||||
MidiByteArray disable_msg;
|
||||
|
||||
// sysex header
|
||||
disable_msg << surface.sysex_hdr();
|
||||
|
||||
// code for Channel Meter Enable Message
|
||||
disable_msg << 0x20;
|
||||
|
||||
// Channel identification
|
||||
disable_msg << id();
|
||||
|
||||
// Disabling level meter on LCD, peak hold display on horizontal meter and signal LED
|
||||
disable_msg << 0x00;
|
||||
|
||||
// sysex trailer
|
||||
disable_msg << MIDI::eox;
|
||||
|
||||
surface.write (disable_msg);
|
||||
}
|
||||
_transport_is_rolling = transport_is_rolling;
|
||||
}
|
||||
|
||||
void
|
||||
Meter::send_update (Surface& surface, float dB)
|
||||
{
|
||||
|
@ -47,6 +99,10 @@ Meter::send_update (Surface& surface, float dB)
|
|||
|
||||
// DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Meter ID %1 dB %2\n", id(), dB));
|
||||
|
||||
if (!_transport_is_rolling) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (dB < -70.0f) {
|
||||
def = 0.0f;
|
||||
} else if (dB < -60.0f) {
|
||||
|
@ -89,10 +145,7 @@ Meter::send_update (Surface& surface, float dB)
|
|||
|
||||
int segment = lrintf ((def/115.0) * 13.0);
|
||||
|
||||
if (last_segment_value_sent != segment) {
|
||||
last_segment_value_sent = segment;
|
||||
surface.write (MidiByteArray (2, 0xD0, (id()<<4) | segment));
|
||||
}
|
||||
surface.write (MidiByteArray (2, 0xd0, (id()<<4) | segment));
|
||||
}
|
||||
|
||||
MidiByteArray
|
||||
|
|
|
@ -32,7 +32,6 @@ class Meter : public Control
|
|||
public:
|
||||
Meter (int id, std::string name, Group & group)
|
||||
: Control (id, name, group)
|
||||
, last_segment_value_sent (-1)
|
||||
, overload_on (false) {}
|
||||
|
||||
void send_update (Surface&, float dB);
|
||||
|
@ -40,11 +39,12 @@ public:
|
|||
MidiByteArray zero();
|
||||
|
||||
static Control* factory (Surface&, int id, const char*, Group&);
|
||||
|
||||
int last_segment_value_sent;
|
||||
|
||||
void update_transport_rolling(Surface& surface);
|
||||
|
||||
private:
|
||||
bool overload_on;
|
||||
bool _transport_is_rolling;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -1066,3 +1066,11 @@ Strip::reset_saved_values ()
|
|||
_last_gain_position_written = -1.0;
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
Strip::notify_transport_state_changed()
|
||||
{
|
||||
if (_meter) {
|
||||
_meter->update_transport_rolling (*_surface);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -83,6 +83,8 @@ public:
|
|||
bool locked() const { return _controls_locked; }
|
||||
|
||||
void gui_selection_changed (const ARDOUR::StrongRouteNotificationList&);
|
||||
|
||||
void notify_transport_state_changed();
|
||||
|
||||
private:
|
||||
Button* _solo;
|
||||
|
|
|
@ -845,3 +845,11 @@ Surface::route_is_locked_to_strip (boost::shared_ptr<Route> r) const
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
Surface::notify_transport_state_changed()
|
||||
{
|
||||
for (Strips::const_iterator s = strips.begin(); s != strips.end(); ++s) {
|
||||
(*s)->notify_transport_state_changed ();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -145,6 +145,8 @@ public:
|
|||
|
||||
void next_jog_mode ();
|
||||
void set_jog_mode (Mackie::JogWheel::Mode);
|
||||
|
||||
void notify_transport_state_changed();
|
||||
|
||||
protected:
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user