diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2015-10-07 18:15:25 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2015-10-08 12:51:18 -0400 |
commit | 4677d047a537a4d459055bb4b0395f2dd821ca32 (patch) | |
tree | d43185e911510b2d71495ba3dd3d9e6da491d501 | |
parent | 0f978a90f48b1544b179416998d3ac11b1c61002 (diff) |
more mackie strip redisplay renames, and add a global block to redisplays\n
-rw-r--r-- | libs/surfaces/mackie/strip.cc | 48 | ||||
-rw-r--r-- | libs/surfaces/mackie/strip.h | 8 |
2 files changed, 42 insertions, 14 deletions
diff --git a/libs/surfaces/mackie/strip.cc b/libs/surfaces/mackie/strip.cc index 616947b71f..fdd1bf7b1a 100644 --- a/libs/surfaces/mackie/strip.cc +++ b/libs/surfaces/mackie/strip.cc @@ -61,6 +61,8 @@ using namespace PBD; using namespace ArdourSurface; using namespace Mackie; +uint64_t Strip::_global_block_redisplay_until = 0; + #ifndef timeradd /// only avail with __USE_BSD #define timeradd(a,b,result) \ do { \ @@ -92,7 +94,7 @@ Strip::Strip (Surface& s, const std::string& name, int index, const map<Button:: , _controls_locked (false) , _transport_is_rolling (false) , _metering_active (true) - , _reset_display_at (0) + , _block_redisplay_until (0) , _pan_mode (PanAzimuthAutomation) , _last_gain_position_written (-1.0) , _last_pan_azi_position_written (-1.0) @@ -343,7 +345,7 @@ Strip::notify_gain_changed (bool force_update) queue_parameter_display (GainAutomation, gain_coefficient); } - queue_display_reset (2000); + block_display_for (2000); _last_gain_position_written = normalized_position; } } @@ -437,7 +439,7 @@ Strip::notify_panner_azi_changed (bool force_update) queue_parameter_display (PanAzimuthAutomation, pos); } - queue_display_reset (2000); + queue_parameter_display (PanAzimuthAutomation, pos); _last_pan_azi_position_written = pos; } } @@ -482,7 +484,7 @@ Strip::notify_panner_width_changed (bool force_update) queue_parameter_display (PanWidthAutomation, pos); } - queue_display_reset (2000); + queue_parameter_display (PanWidthAutomation, pos); _last_pan_azi_position_written = pos; } } @@ -500,7 +502,7 @@ Strip::select_event (Button&, ButtonState bs) if (ms & MackieControlProtocol::MODIFIER_CMDALT) { _controls_locked = !_controls_locked; _surface->write (display (1,_controls_locked ? "Locked" : "Unlock")); - queue_display_reset (1000); + block_display_for (1000); return; } @@ -569,7 +571,7 @@ Strip::fader_touch_event (Button&, ButtonState bs) if (ac) { queue_parameter_display ((AutomationType) ac->parameter().type(), ac->internal_to_interface (ac->get_value())); - queue_display_reset (2000); + block_display_for (2000); } } @@ -759,10 +761,16 @@ Strip::periodic (uint64_t usecs) if (!_route) { return; } + if (_global_block_redisplay_until >= usecs) { + return; + } else { + /* reset since timer has expired */ + _global_block_redisplay_until = 0; + } - if (_reset_display_at >= usecs) { + if (_block_redisplay_until >= usecs) { return; - } else if (_reset_display_at) { + } else if (_block_redisplay_until) { return_to_vpot_mode_display (); } else { update_automation (); @@ -996,7 +1004,23 @@ Strip::flip_mode_changed (bool notify) } void -Strip::queue_display_reset (uint32_t msecs) +Strip::block_display_for (uint32_t msecs) +{ + struct timeval now; + 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 +Strip::block_all_strip_redisplay_for (uint32_t msecs) { struct timeval now; struct timeval delta; @@ -1008,7 +1032,7 @@ Strip::queue_display_reset (uint32_t msecs) timeradd (&now, &delta, &when); - _reset_display_at = (when.tv_sec * 1000000) + when.tv_usec; + _global_block_redisplay_until = (when.tv_sec * 1000000) + when.tv_usec; } void @@ -1024,7 +1048,7 @@ Strip::return_to_vpot_mode_display () _surface->write (blank_display (1)); } - _reset_display_at = 0; + _block_redisplay_until = 0; } struct RouteCompareByName { @@ -1113,7 +1137,7 @@ Strip::next_pot_mode () /* do not change vpot mode while in flipped mode */ DEBUG_TRACE (DEBUG::MackieControl, "not stepping pot mode - in flip mode\n"); _surface->write (display (1, "Flip")); - queue_display_reset (1000); + block_display_for (1000); return; } diff --git a/libs/surfaces/mackie/strip.h b/libs/surfaces/mackie/strip.h index 87c96b3687..61bab7c352 100644 --- a/libs/surfaces/mackie/strip.h +++ b/libs/surfaces/mackie/strip.h @@ -86,6 +86,8 @@ public: void notify_metering_state_changed(); + static void block_all_strip_redisplay_for (uint32_t msecs); + private: Button* _solo; Button* _recenable; @@ -101,7 +103,7 @@ private: bool _controls_locked; bool _transport_is_rolling; bool _metering_active; - uint64_t _reset_display_at; + uint64_t _block_redisplay_until; boost::shared_ptr<ARDOUR::Route> _route; PBD::ScopedConnectionList route_connections; @@ -128,7 +130,7 @@ private: std::string vpot_mode_string () const; - void queue_display_reset (uint32_t msecs); + void block_display_for (uint32_t msecs); void return_to_vpot_mode_display (); struct RedisplayRequest { @@ -160,6 +162,8 @@ private: void reset_saved_values (); std::map<Evoral::Parameter,Control*> control_by_parameter; + + static uint64_t _global_block_redisplay_until; }; } |