X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fsurfaces%2Fmackie%2Fstrip.cc;h=9447b4121cf870f7acbe4b1bd1cf87071a56a1f4;hb=05a8107ff689284c22b2a89498ade31493c06cfc;hp=ef4447d900906d6a92f34957de7e1523a35b2014;hpb=35c170937de6150ae09154f96e4920d30e83f6ce;p=ardour.git diff --git a/libs/surfaces/mackie/strip.cc b/libs/surfaces/mackie/strip.cc index ef4447d900..9447b4121c 100644 --- a/libs/surfaces/mackie/strip.cc +++ b/libs/surfaces/mackie/strip.cc @@ -23,6 +23,8 @@ #include +#include + #include "midi++/port.h" #include "pbd/compose.h" @@ -53,10 +55,24 @@ #include "jog.h" #include "meter.h" -using namespace Mackie; using namespace std; using namespace ARDOUR; using namespace PBD; +using namespace ArdourSurface; +using namespace Mackie; + +#ifndef timeradd /// only avail with __USE_BSD +#define timeradd(a,b,result) \ + do { \ + (result)->tv_sec = (a)->tv_sec + (b)->tv_sec; \ + (result)->tv_usec = (a)->tv_usec + (b)->tv_usec; \ + if ((result)->tv_usec >= 1000000) \ + { \ + ++(result)->tv_sec; \ + (result)->tv_usec -= 1000000; \ + } \ + } while (0) +#endif #define ui_context() MackieControlProtocol::instance() /* a UICallback-derived object that specifies the event loop for signal handling */ @@ -338,7 +354,7 @@ Strip::notify_property_changed (const PropertyChange& what_changed) } else { line1 = PBD::short_version (fullname, 6); } - + _surface->write (display (0, line1)); } } @@ -616,7 +632,7 @@ Strip::do_parameter_display (AutomationType type, float val) case PanWidthAutomation: if (_route) { char buf[16]; - snprintf (buf, sizeof (buf), "%5ld%%", lrintf (val * 100.0)); + snprintf (buf, sizeof (buf), "%5ld%%", lrintf ((val * 200.0)-100)); _surface->write (display (1, buf)); } break; @@ -626,13 +642,22 @@ Strip::do_parameter_display (AutomationType type, float val) } } +void +Strip::handle_fader_touch (Fader& fader, bool touch_on) +{ + if (touch_on) { + fader.start_touch (_surface->mcp().transport_frame()); + } else { + fader.stop_touch (_surface->mcp().transport_frame(), false); + } +} + void Strip::handle_fader (Fader& fader, float position) { DEBUG_TRACE (DEBUG::MackieControl, string_compose ("fader to %1\n", position)); fader.set_value (position); - fader.start_touch (_surface->mcp().transport_frame()); queue_display_reset (2000); // must echo bytes back to slider now, because @@ -694,7 +719,7 @@ void Strip::update_meter () { if (_meter && _transport_is_rolling && _metering_active) { - float dB = const_cast (_route->peak_meter()).peak_power (0); + float dB = const_cast (_route->peak_meter()).meter_level (0, MeterMCP); _meter->send_update (*_surface, dB); } } @@ -733,10 +758,16 @@ Strip::display (uint32_t line_number, const std::string& line) // offset (0 to 0x37 first line, 0x38 to 0x6f for second line) retval << (_index * 7 + (line_number * 0x38)); - // ascii data to display - retval << line; + // ascii data to display. @param line is UTF-8 + string ascii = Glib::convert_with_fallback (line, "UTF-8", "ISO-8859-1", "_"); + string::size_type len = ascii.length(); + if (len > 6) { + ascii = ascii.substr (0, 6); + len = 6; + } + retval << ascii; // pad with " " out to 6 chars - for (int i = line.length(); i < 6; ++i) { + for (int i = len; i < 6; ++i) { retval << ' '; }