mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 14:54:56 +01:00
lots of changes to try to get the Mackie Control display be more useful and usable
This commit is contained in:
parent
4677d047a5
commit
0cb1c7b58c
6 changed files with 177 additions and 91 deletions
|
|
@ -461,11 +461,17 @@ MackieControlProtocol::periodic ()
|
||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
struct timeval now;
|
ARDOUR::microseconds_t now_usecs = ARDOUR::get_microseconds ();
|
||||||
uint64_t now_usecs;
|
|
||||||
gettimeofday (&now, 0);
|
|
||||||
|
|
||||||
now_usecs = (now.tv_sec * 1000000) + now.tv_usec;
|
static int cnt = 0;
|
||||||
|
|
||||||
|
cnt++;
|
||||||
|
if ((cnt != 1) && (cnt % 25 == 0)) {
|
||||||
|
if (_master_surface) {
|
||||||
|
cerr << string_compose ("Cnt now %1 ", cnt) << endl;
|
||||||
|
_master_surface->display_message_for (string_compose ("Cnt now %1\n12Hey Paul", cnt), 1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
Glib::Threads::Mutex::Lock lm (surfaces_lock);
|
Glib::Threads::Mutex::Lock lm (surfaces_lock);
|
||||||
|
|
@ -496,11 +502,13 @@ MackieControlProtocol::redisplay ()
|
||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ARDOUR::microseconds_t now = ARDOUR::get_microseconds ();
|
||||||
|
|
||||||
{
|
{
|
||||||
Glib::Threads::Mutex::Lock lm (surfaces_lock);
|
Glib::Threads::Mutex::Lock lm (surfaces_lock);
|
||||||
|
|
||||||
for (Surfaces::iterator s = surfaces.begin(); s != surfaces.end(); ++s) {
|
for (Surfaces::iterator s = surfaces.begin(); s != surfaces.end(); ++s) {
|
||||||
(*s)->redisplay ();
|
(*s)->redisplay (now);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -88,8 +88,9 @@ ostream & operator << (ostream & os, const MidiByteArray & mba)
|
||||||
|
|
||||||
MidiByteArray & operator << (MidiByteArray & mba, const std::string & st)
|
MidiByteArray & operator << (MidiByteArray & mba, const std::string & st)
|
||||||
{
|
{
|
||||||
for (string::const_iterator it = st.begin(); it != st.end(); ++it) {
|
/* note that this assumes that "st" is ASCII encoded
|
||||||
mba << *it;
|
*/
|
||||||
}
|
|
||||||
|
mba.insert (mba.end(), st.begin(), st.end());
|
||||||
return mba;
|
return mba;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -61,8 +61,6 @@ using namespace PBD;
|
||||||
using namespace ArdourSurface;
|
using namespace ArdourSurface;
|
||||||
using namespace Mackie;
|
using namespace Mackie;
|
||||||
|
|
||||||
uint64_t Strip::_global_block_redisplay_until = 0;
|
|
||||||
|
|
||||||
#ifndef timeradd /// only avail with __USE_BSD
|
#ifndef timeradd /// only avail with __USE_BSD
|
||||||
#define timeradd(a,b,result) \
|
#define timeradd(a,b,result) \
|
||||||
do { \
|
do { \
|
||||||
|
|
@ -94,7 +92,8 @@ Strip::Strip (Surface& s, const std::string& name, int index, const map<Button::
|
||||||
, _controls_locked (false)
|
, _controls_locked (false)
|
||||||
, _transport_is_rolling (false)
|
, _transport_is_rolling (false)
|
||||||
, _metering_active (true)
|
, _metering_active (true)
|
||||||
, _block_redisplay_until (0)
|
, _block_vpot_mode_redisplay_until (0)
|
||||||
|
, _block_screen_redisplay_until (0)
|
||||||
, _pan_mode (PanAzimuthAutomation)
|
, _pan_mode (PanAzimuthAutomation)
|
||||||
, _last_gain_position_written (-1.0)
|
, _last_gain_position_written (-1.0)
|
||||||
, _last_pan_azi_position_written (-1.0)
|
, _last_pan_azi_position_written (-1.0)
|
||||||
|
|
@ -345,7 +344,6 @@ Strip::notify_gain_changed (bool force_update)
|
||||||
queue_parameter_display (GainAutomation, gain_coefficient);
|
queue_parameter_display (GainAutomation, gain_coefficient);
|
||||||
}
|
}
|
||||||
|
|
||||||
block_display_for (2000);
|
|
||||||
_last_gain_position_written = normalized_position;
|
_last_gain_position_written = normalized_position;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -502,7 +500,7 @@ Strip::select_event (Button&, ButtonState bs)
|
||||||
if (ms & MackieControlProtocol::MODIFIER_CMDALT) {
|
if (ms & MackieControlProtocol::MODIFIER_CMDALT) {
|
||||||
_controls_locked = !_controls_locked;
|
_controls_locked = !_controls_locked;
|
||||||
_surface->write (display (1,_controls_locked ? "Locked" : "Unlock"));
|
_surface->write (display (1,_controls_locked ? "Locked" : "Unlock"));
|
||||||
block_display_for (1000);
|
block_vpot_mode_display_for (1000);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -571,7 +569,6 @@ Strip::fader_touch_event (Button&, ButtonState bs)
|
||||||
|
|
||||||
if (ac) {
|
if (ac) {
|
||||||
queue_parameter_display ((AutomationType) ac->parameter().type(), ac->internal_to_interface (ac->get_value()));
|
queue_parameter_display ((AutomationType) ac->parameter().type(), ac->internal_to_interface (ac->get_value()));
|
||||||
block_display_for (2000);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -666,6 +663,8 @@ Strip::queue_parameter_display (AutomationType type, float val)
|
||||||
void
|
void
|
||||||
Strip::do_parameter_display (AutomationType type, float val)
|
Strip::do_parameter_display (AutomationType type, float val)
|
||||||
{
|
{
|
||||||
|
bool screen_hold = false;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case GainAutomation:
|
case GainAutomation:
|
||||||
if (val == 0.0) {
|
if (val == 0.0) {
|
||||||
|
|
@ -675,6 +674,7 @@ Strip::do_parameter_display (AutomationType type, float val)
|
||||||
float dB = accurate_coefficient_to_dB (val);
|
float dB = accurate_coefficient_to_dB (val);
|
||||||
snprintf (buf, sizeof (buf), "%6.1f", dB);
|
snprintf (buf, sizeof (buf), "%6.1f", dB);
|
||||||
_surface->write (display (1, buf));
|
_surface->write (display (1, buf));
|
||||||
|
screen_hold = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -684,6 +684,7 @@ Strip::do_parameter_display (AutomationType type, float val)
|
||||||
if (p && _route->panner()) {
|
if (p && _route->panner()) {
|
||||||
string str =_route->panner()->value_as_string (p->pan_azimuth_control);
|
string str =_route->panner()->value_as_string (p->pan_azimuth_control);
|
||||||
_surface->write (display (1, str));
|
_surface->write (display (1, str));
|
||||||
|
screen_hold = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -693,6 +694,7 @@ Strip::do_parameter_display (AutomationType type, float val)
|
||||||
char buf[16];
|
char buf[16];
|
||||||
snprintf (buf, sizeof (buf), "%5ld%%", lrintf ((val * 200.0)-100));
|
snprintf (buf, sizeof (buf), "%5ld%%", lrintf ((val * 200.0)-100));
|
||||||
_surface->write (display (1, buf));
|
_surface->write (display (1, buf));
|
||||||
|
screen_hold = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -708,6 +710,10 @@ Strip::do_parameter_display (AutomationType type, float val)
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (screen_hold) {
|
||||||
|
block_vpot_mode_display_for (1000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -756,30 +762,50 @@ Strip::handle_pot (Pot& pot, float delta)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Strip::periodic (uint64_t usecs)
|
Strip::periodic (ARDOUR::microseconds_t now)
|
||||||
{
|
{
|
||||||
|
bool reshow_vpot_mode = false;
|
||||||
|
|
||||||
if (!_route) {
|
if (!_route) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (_global_block_redisplay_until >= usecs) {
|
|
||||||
|
if (_block_screen_redisplay_until >= now) {
|
||||||
|
|
||||||
|
/* no drawing here, for now */
|
||||||
return;
|
return;
|
||||||
} else {
|
|
||||||
/* reset since timer has expired */
|
} else if (_block_screen_redisplay_until) {
|
||||||
_global_block_redisplay_until = 0;
|
|
||||||
|
/* timeout reached, reset */
|
||||||
|
|
||||||
|
_block_screen_redisplay_until = 0;
|
||||||
|
reshow_vpot_mode = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_block_redisplay_until >= usecs) {
|
if (_block_vpot_mode_redisplay_until >= now) {
|
||||||
return;
|
return;
|
||||||
} else if (_block_redisplay_until) {
|
} else if (_block_vpot_mode_redisplay_until) {
|
||||||
|
|
||||||
|
/* timeout reached, reset */
|
||||||
|
|
||||||
|
_block_vpot_mode_redisplay_until = 0;
|
||||||
|
reshow_vpot_mode = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reshow_vpot_mode) {
|
||||||
return_to_vpot_mode_display ();
|
return_to_vpot_mode_display ();
|
||||||
} else {
|
} else {
|
||||||
|
/* no point doing this if we just switched back to vpot mode
|
||||||
|
display */
|
||||||
update_automation ();
|
update_automation ();
|
||||||
update_meter ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
update_meter ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Strip::redisplay ()
|
Strip::redisplay (ARDOUR::microseconds_t now)
|
||||||
{
|
{
|
||||||
RedisplayRequest req;
|
RedisplayRequest req;
|
||||||
bool have_request = false;
|
bool have_request = false;
|
||||||
|
|
@ -789,6 +815,10 @@ Strip::redisplay ()
|
||||||
have_request = true;
|
have_request = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_block_screen_redisplay_until >= now) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (have_request) {
|
if (have_request) {
|
||||||
do_parameter_display (req.type, req.val);
|
do_parameter_display (req.type, req.val);
|
||||||
}
|
}
|
||||||
|
|
@ -1004,35 +1034,15 @@ Strip::flip_mode_changed (bool notify)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Strip::block_display_for (uint32_t msecs)
|
Strip::block_screen_display_for (uint32_t msecs)
|
||||||
{
|
{
|
||||||
struct timeval now;
|
_block_screen_redisplay_until = ARDOUR::get_microseconds() + (msecs * 1000);
|
||||||
struct timeval delta;
|
|
||||||
struct timeval when;
|
|
||||||
gettimeofday (&now, 0);
|
|
||||||
|
|
||||||
delta.tv_sec = msecs/1000;
|
|
||||||
delta.tv_usec = (msecs - ((msecs/1000) * 1000)) * 1000;
|
|
||||||
|
|
||||||
timeradd (&now, &delta, &when);
|
|
||||||
|
|
||||||
_block_redisplay_until = (when.tv_sec * 1000000) + when.tv_usec;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Strip::block_all_strip_redisplay_for (uint32_t msecs)
|
Strip::block_vpot_mode_display_for (uint32_t msecs)
|
||||||
{
|
{
|
||||||
struct timeval now;
|
_block_vpot_mode_redisplay_until = ARDOUR::get_microseconds() + (msecs * 1000);
|
||||||
struct timeval delta;
|
|
||||||
struct timeval when;
|
|
||||||
gettimeofday (&now, 0);
|
|
||||||
|
|
||||||
delta.tv_sec = msecs/1000;
|
|
||||||
delta.tv_usec = (msecs - ((msecs/1000) * 1000)) * 1000;
|
|
||||||
|
|
||||||
timeradd (&now, &delta, &when);
|
|
||||||
|
|
||||||
_global_block_redisplay_until = (when.tv_sec * 1000000) + when.tv_usec;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -1047,8 +1057,6 @@ Strip::return_to_vpot_mode_display ()
|
||||||
} else {
|
} else {
|
||||||
_surface->write (blank_display (1));
|
_surface->write (blank_display (1));
|
||||||
}
|
}
|
||||||
|
|
||||||
_block_redisplay_until = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct RouteCompareByName {
|
struct RouteCompareByName {
|
||||||
|
|
@ -1137,7 +1145,7 @@ Strip::next_pot_mode ()
|
||||||
/* do not change vpot mode while in flipped mode */
|
/* do not change vpot mode while in flipped mode */
|
||||||
DEBUG_TRACE (DEBUG::MackieControl, "not stepping pot mode - in flip mode\n");
|
DEBUG_TRACE (DEBUG::MackieControl, "not stepping pot mode - in flip mode\n");
|
||||||
_surface->write (display (1, "Flip"));
|
_surface->write (display (1, "Flip"));
|
||||||
block_display_for (1000);
|
block_vpot_mode_display_for (1000);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -67,8 +67,8 @@ public:
|
||||||
void handle_fader_touch (Fader&, bool touch_on);
|
void handle_fader_touch (Fader&, bool touch_on);
|
||||||
void handle_pot (Pot&, float delta);
|
void handle_pot (Pot&, float delta);
|
||||||
|
|
||||||
void periodic (uint64_t now_usecs);
|
void periodic (ARDOUR::microseconds_t now_usecs);
|
||||||
void redisplay ();
|
void redisplay (ARDOUR::microseconds_t now_usecs);
|
||||||
|
|
||||||
MidiByteArray display (uint32_t line_number, const std::string&);
|
MidiByteArray display (uint32_t line_number, const std::string&);
|
||||||
MidiByteArray blank_display (uint32_t line_number);
|
MidiByteArray blank_display (uint32_t line_number);
|
||||||
|
|
@ -86,7 +86,8 @@ public:
|
||||||
|
|
||||||
void notify_metering_state_changed();
|
void notify_metering_state_changed();
|
||||||
|
|
||||||
static void block_all_strip_redisplay_for (uint32_t msecs);
|
void block_screen_display_for (uint32_t msecs);
|
||||||
|
void block_vpot_mode_display_for (uint32_t msecs);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Button* _solo;
|
Button* _solo;
|
||||||
|
|
@ -103,7 +104,8 @@ private:
|
||||||
bool _controls_locked;
|
bool _controls_locked;
|
||||||
bool _transport_is_rolling;
|
bool _transport_is_rolling;
|
||||||
bool _metering_active;
|
bool _metering_active;
|
||||||
uint64_t _block_redisplay_until;
|
uint64_t _block_vpot_mode_redisplay_until;
|
||||||
|
uint64_t _block_screen_redisplay_until;
|
||||||
boost::shared_ptr<ARDOUR::Route> _route;
|
boost::shared_ptr<ARDOUR::Route> _route;
|
||||||
PBD::ScopedConnectionList route_connections;
|
PBD::ScopedConnectionList route_connections;
|
||||||
|
|
||||||
|
|
@ -130,7 +132,6 @@ private:
|
||||||
|
|
||||||
std::string vpot_mode_string () const;
|
std::string vpot_mode_string () const;
|
||||||
|
|
||||||
void block_display_for (uint32_t msecs);
|
|
||||||
void return_to_vpot_mode_display ();
|
void return_to_vpot_mode_display ();
|
||||||
|
|
||||||
struct RedisplayRequest {
|
struct RedisplayRequest {
|
||||||
|
|
@ -162,8 +163,6 @@ private:
|
||||||
void reset_saved_values ();
|
void reset_saved_values ();
|
||||||
|
|
||||||
std::map<Evoral::Parameter,Control*> control_by_parameter;
|
std::map<Evoral::Parameter,Control*> control_by_parameter;
|
||||||
|
|
||||||
static uint64_t _global_block_redisplay_until;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,8 @@
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
|
#include <glibmm/convert.h>
|
||||||
|
|
||||||
#include "midi++/port.h"
|
#include "midi++/port.h"
|
||||||
|
|
||||||
#include "ardour/audioengine.h"
|
#include "ardour/audioengine.h"
|
||||||
|
|
@ -845,10 +847,10 @@ Surface::periodic (uint64_t now_usecs)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Surface::redisplay ()
|
Surface::redisplay (ARDOUR::microseconds_t now)
|
||||||
{
|
{
|
||||||
for (Strips::iterator s = strips.begin(); s != strips.end(); ++s) {
|
for (Strips::iterator s = strips.begin(); s != strips.end(); ++s) {
|
||||||
(*s)->redisplay ();
|
(*s)->redisplay (now);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1088,13 +1090,11 @@ Surface::reset ()
|
||||||
{
|
{
|
||||||
if (_port) {
|
if (_port) {
|
||||||
/* reset msg for Mackie Control */
|
/* reset msg for Mackie Control */
|
||||||
MidiByteArray msg (8, MIDI::sysex, 0x00, 0x00, 0x66, 0x14, 0x08, 0x00, MIDI::eox);
|
MidiByteArray msg;
|
||||||
_port->write (msg);
|
msg << sysex_hdr();
|
||||||
msg[4] = 0x15; /* reset Mackie XT */
|
msg << 0x08;
|
||||||
_port->write (msg);
|
msg << 0x00;
|
||||||
msg[4] = 0x10; /* reset Logic Control */
|
msg << MIDI::eox;
|
||||||
_port->write (msg);
|
|
||||||
msg[4] = 0x11; /* reset Logic Control XT */
|
|
||||||
_port->write (msg);
|
_port->write (msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1104,13 +1104,11 @@ Surface::toggle_backlight ()
|
||||||
{
|
{
|
||||||
if (_port) {
|
if (_port) {
|
||||||
int onoff = random() %2;
|
int onoff = random() %2;
|
||||||
MidiByteArray msg (8, MIDI::sysex, 0x00, 0x00, 0x66, 0x14, 0x0a, onoff, MIDI::eox);
|
MidiByteArray msg;
|
||||||
_port->write (msg);
|
msg << sysex_hdr ();
|
||||||
msg[4] = 0x15; /* reset Mackie XT */
|
msg << 0xa;
|
||||||
_port->write (msg);
|
msg << (onoff ? 0x1 : 0x0);
|
||||||
msg[4] = 0x10; /* reset Logic Control */
|
msg << MIDI::eox;
|
||||||
_port->write (msg);
|
|
||||||
msg[4] = 0x11; /* reset Logic Control XT */
|
|
||||||
_port->write (msg);
|
_port->write (msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1119,13 +1117,11 @@ void
|
||||||
Surface::recalibrate_faders ()
|
Surface::recalibrate_faders ()
|
||||||
{
|
{
|
||||||
if (_port) {
|
if (_port) {
|
||||||
MidiByteArray msg (8, MIDI::sysex, 0x00, 0x00, 0x66, 0x14, 0x09, 0x00, MIDI::eox);
|
MidiByteArray msg;
|
||||||
_port->write (msg);
|
msg << sysex_hdr ();
|
||||||
msg[4] = 0x15; /* reset Mackie XT */
|
msg << 0x09;
|
||||||
_port->write (msg);
|
msg << 0x00;
|
||||||
msg[4] = 0x10; /* reset Logic Control */
|
msg << MIDI::eox;
|
||||||
_port->write (msg);
|
|
||||||
msg[4] = 0x11; /* reset Logic Control XT */
|
|
||||||
_port->write (msg);
|
_port->write (msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1138,19 +1134,17 @@ Surface::set_touch_sensitivity (int sensitivity)
|
||||||
/* sensitivity already clamped by caller */
|
/* sensitivity already clamped by caller */
|
||||||
|
|
||||||
if (_port) {
|
if (_port) {
|
||||||
MidiByteArray msg (9, MIDI::sysex, 0x00, 0x00, 0x66, 0x14, 0x0e, 0xff, sensitivity, MIDI::eox);
|
MidiByteArray msg;
|
||||||
|
|
||||||
|
msg << sysex_hdr ();
|
||||||
|
msg << 0x0e;
|
||||||
|
msg << 0xff; /* overwritten for each fader below */
|
||||||
|
msg << (sensitivity & 0x7f);
|
||||||
|
msg << MIDI::eox;
|
||||||
|
|
||||||
for (int fader = 0; fader < 9; ++fader) {
|
for (int fader = 0; fader < 9; ++fader) {
|
||||||
msg[6] = fader;
|
msg[6] = fader;
|
||||||
|
|
||||||
_port->write (msg);
|
_port->write (msg);
|
||||||
msg[4] = 0x15; /* reset Mackie XT */
|
|
||||||
_port->write (msg);
|
|
||||||
msg[4] = 0x10; /* reset Logic Control */
|
|
||||||
_port->write (msg);
|
|
||||||
msg[4] = 0x11; /* reset Logic Control XT */
|
|
||||||
|
|
||||||
g_usleep (1000); /* milliseconds */
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1177,3 +1171,75 @@ Surface::connected ()
|
||||||
turn_it_on ();
|
turn_it_on ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MidiByteArray
|
||||||
|
Surface::display_line (string const& msg, int line_num)
|
||||||
|
{
|
||||||
|
MidiByteArray midi_msg;
|
||||||
|
midi_msg << sysex_hdr ();
|
||||||
|
midi_msg << 0x12;
|
||||||
|
midi_msg << (line_num ? 0x38 : 0x0); /* offsets into char array
|
||||||
|
* on device that
|
||||||
|
* correspond to line
|
||||||
|
* starts
|
||||||
|
*/
|
||||||
|
if (msg.empty()) {
|
||||||
|
|
||||||
|
midi_msg.insert (midi_msg.end(), 55, ' ');
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
/* ascii data to display. @param msg is UTF-8 which is not legal. */
|
||||||
|
string ascii = Glib::convert_with_fallback (msg, "UTF-8", "ISO-8859-1", "_");
|
||||||
|
string::size_type len = ascii.length();
|
||||||
|
|
||||||
|
if (len > 55) {
|
||||||
|
midi_msg << ascii.substr (0, 55);
|
||||||
|
} else {
|
||||||
|
midi_msg << ascii;
|
||||||
|
|
||||||
|
for (string::size_type i = len; i < 55; ++i) {
|
||||||
|
midi_msg << ' ';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
midi_msg << MIDI::eox;
|
||||||
|
|
||||||
|
return midi_msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** display @param msg on the 55x2 screen for @param msecs milliseconds
|
||||||
|
*
|
||||||
|
* @param msg is assumed to be UTF-8 encoded, and will be converted
|
||||||
|
* to ASCII with an underscore as fallback character before being
|
||||||
|
* sent to the device.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
Surface::display_message_for (string const& msg, uint64_t msecs)
|
||||||
|
{
|
||||||
|
string::size_type newline;
|
||||||
|
|
||||||
|
if ((newline = msg.find ('\n')) == string::npos) {
|
||||||
|
|
||||||
|
_port->write (display_line (msg, 0));
|
||||||
|
_port->write (display_line (string(), 1));
|
||||||
|
|
||||||
|
} else if (newline == 0) {
|
||||||
|
|
||||||
|
_port->write (display_line (string(), 0));
|
||||||
|
_port->write (display_line (msg.substr (1), 1));
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
string first_line = msg.substr (0, newline-1);
|
||||||
|
string second_line = msg.substr (newline+1);
|
||||||
|
|
||||||
|
_port->write (display_line (first_line, 0));
|
||||||
|
_port->write (display_line (second_line.substr (0, second_line.find_first_of ('\n')), 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Strips::const_iterator s = strips.begin(); s != strips.end(); ++s) {
|
||||||
|
(*s)->block_screen_display_for (msecs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -89,8 +89,8 @@ public:
|
||||||
|
|
||||||
const MidiByteArray& sysex_hdr() const;
|
const MidiByteArray& sysex_hdr() const;
|
||||||
|
|
||||||
void periodic (uint64_t now_usecs);
|
void periodic (ARDOUR::microseconds_t now_usecs);
|
||||||
void redisplay ();
|
void redisplay (ARDOUR::microseconds_t now_usecs);
|
||||||
void hui_heartbeat ();
|
void hui_heartbeat ();
|
||||||
|
|
||||||
void handle_midi_pitchbend_message (MIDI::Parser&, MIDI::pitchbend_t, uint32_t channel_id);
|
void handle_midi_pitchbend_message (MIDI::Parser&, MIDI::pitchbend_t, uint32_t channel_id);
|
||||||
|
|
@ -163,6 +163,8 @@ public:
|
||||||
void notify_metering_state_changed();
|
void notify_metering_state_changed();
|
||||||
void turn_it_on ();
|
void turn_it_on ();
|
||||||
|
|
||||||
|
void display_message_for (std::string const& msg, uint64_t msecs);
|
||||||
|
|
||||||
XMLNode& get_state ();
|
XMLNode& get_state ();
|
||||||
int set_state (const XMLNode&, int version);
|
int set_state (const XMLNode&, int version);
|
||||||
|
|
||||||
|
|
@ -198,6 +200,8 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
int connection_state;
|
int connection_state;
|
||||||
|
|
||||||
|
MidiByteArray display_line (std::string const& msg, int line_num);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue