#include <sys/time.h>
+#include <glibmm/convert.h>
+
#include "midi++/port.h"
#include "pbd/compose.h"
#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 */
} else {
line1 = PBD::short_version (fullname, 6);
}
-
+
_surface->write (display (0, line1));
}
}
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;
}
}
+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
Strip::update_meter ()
{
if (_meter && _transport_is_rolling && _metering_active) {
- float dB = const_cast<PeakMeter&> (_route->peak_meter()).peak_power (0);
+ float dB = const_cast<PeakMeter&> (_route->peak_meter()).meter_level (0, MeterMCP);
_meter->send_update (*_surface, dB);
}
}
// 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 << ' ';
}