summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2012-06-02 14:51:53 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2012-06-02 14:51:53 +0000
commit6d46299df3430166f630b615cd6fde36dad7788e (patch)
tree67f696c3335e432cdfd756b86e68fe63a671dd56 /libs
parent1cb5aed0ce24605d16684e3d49167c81b8c83587 (diff)
MCP: another patch from rodrigo:
* setting a (arbitraty) limit to zoom out to prevent segfaults because out of memory condition; * setting initial update of master fader, and read, play and stop leds on the Mackie; * changed the timecode display char selection for update algorithm as chars are sent one by one and not all right most; * implemented method of showing timecode at the mackie to better deal with the differences between Ardour's foramts and Mackie's, i.e, use spaces in place of the zeros that had no meaning; * preventing timecode display updates when the surface isn't yet active. git-svn-id: svn://localhost/ardour2/branches/3.0@12541 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/surfaces/mackie/mackie_control_protocol.cc13
-rw-r--r--libs/surfaces/mackie/surface.cc33
2 files changed, 29 insertions, 17 deletions
diff --git a/libs/surfaces/mackie/mackie_control_protocol.cc b/libs/surfaces/mackie/mackie_control_protocol.cc
index 8dd2eb32a3..b13314fdc4 100644
--- a/libs/surfaces/mackie/mackie_control_protocol.cc
+++ b/libs/surfaces/mackie/mackie_control_protocol.cc
@@ -473,7 +473,7 @@ MackieControlProtocol::update_global_led (int id, LedState ls)
{
boost::shared_ptr<Surface> surface = surfaces.front();
- if (!surface->type() == mcu) {
+ if (surface->type() != mcu) {
return;
}
@@ -734,7 +734,8 @@ MackieControlProtocol::format_bbt_timecode (framepos_t now_frame)
os << setw(3) << setfill('0') << bbt_time.bars;
os << setw(2) << setfill('0') << bbt_time.beats;
- os << setw(2) << setfill('0') << bbt_time.ticks / 1000;
+ os << ' ';
+ os << setw(1) << setfill('0') << bbt_time.ticks / 1000;
os << setw(3) << setfill('0') << bbt_time.ticks % 1000;
return os.str();
@@ -750,10 +751,12 @@ MackieControlProtocol::format_timecode_timecode (framepos_t now_frame)
// digits: 888/88/88/888
// Timecode mode: Hours/Minutes/Seconds/Frames
ostringstream os;
- os << setw(3) << setfill('0') << timecode.hours;
+ os << ' ';
+ os << setw(2) << setfill('0') << timecode.hours;
os << setw(2) << setfill('0') << timecode.minutes;
os << setw(2) << setfill('0') << timecode.seconds;
- os << setw(3) << setfill('0') << timecode.frames;
+ os << ' ';
+ os << setw(2) << setfill('0') << timecode.frames;
return os.str();
}
@@ -767,7 +770,7 @@ MackieControlProtocol::update_timecode_display()
boost::shared_ptr<Surface> surface = surfaces.front();
- if (surface->type() != mcu || !_device_info.has_timecode_display()) {
+ if (surface->type() != mcu || !_device_info.has_timecode_display() || !surface->active ()) {
return;
}
diff --git a/libs/surfaces/mackie/surface.cc b/libs/surfaces/mackie/surface.cc
index 6fb94cba93..a63f4757e7 100644
--- a/libs/surfaces/mackie/surface.cc
+++ b/libs/surfaces/mackie/surface.cc
@@ -515,6 +515,15 @@ Surface::turn_it_on ()
(*s)->notify_all ();
}
update_view_mode_display ();
+ if (_mcp.device_info ().has_master_fader ()) {
+ master_gain_changed ();
+ }
+
+ if (_mcp.device_info ().has_global_controls ()) {
+ _mcp.update_global_button (Button::Read, _mcp.metering_active ());
+ _mcp.update_global_button (Button::Stop, _mcp.get_session ().transport_stopped ());
+ _mcp.update_global_button (Button::Play, (_mcp.get_session ().transport_speed () == 1.0f));
+ }
}
}
@@ -578,7 +587,7 @@ Surface::zero_all ()
}
if (_mcp.device_info().has_two_character_display()) {
- show_two_char_display (string (2, ' '), string (2, '.'));
+ show_two_char_display (string (2, '0'), string (2, ' '));
}
if (_mcp.device_info().has_master_fader ()) {
@@ -717,18 +726,18 @@ Surface::display_timecode (const std::string & timecode, const std::string & las
while (local_timecode.length() < 10) {
local_timecode += " ";
}
-
- // find the suffix of local_timecode that differs from last_timecode
- std::pair<string::const_iterator,string::iterator> pp = mismatch (last_timecode.begin(), last_timecode.end(), local_timecode.begin());
- int position = 0x40;
-
- // translate characters. These are sent in reverse order of display
- // hence the reverse iterators
- string::reverse_iterator rend = reverse_iterator<string::iterator> (pp.second);
- for (string::reverse_iterator it = local_timecode.rbegin(); it != rend; ++it) {
- MidiByteArray retval (2, 0xb0, position++);
- retval << translate_seven_segment (*it);
+ // translate characters.
+ // Only the characters that actually changed are sent.
+ int position = 0x3f;
+ int i;
+ for (i = local_timecode.length () - 1; i >= 0; i--) {
+ position++;
+ if (local_timecode[i] == last_timecode[i]) {
+ continue;
+ }
+ MidiByteArray retval (2, 0xb0, position);
+ retval << translate_seven_segment (local_timecode[i]);
_port->write (retval);
}
}