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
This commit is contained in:
Paul Davis 2012-06-02 14:51:53 +00:00
parent 1cb5aed0ce
commit 6d46299df3
3 changed files with 36 additions and 17 deletions

View File

@ -1369,6 +1369,13 @@ Editor::temporal_zoom (gdouble fpu)
}
nfpu = fpu;
// Imposing an arbitrary limit to zoom out as too much zoom out produces
// segfaults for lack of memory. If somebody decides this is not high enough I
// believe it can be raisen to higher values but some limit must be in place.
if (nfpu > 8e+08) {
nfpu = 8e+08;
}
new_page_size = (framepos_t) floor (_canvas_width * nfpu);
half_page_size = new_page_size / 2;

View File

@ -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;
}

View File

@ -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);
}
}