MCP: zoom button toggles led
[ardour.git] / libs / surfaces / mackie / bcf_surface.cc
1 #include <cmath>
2
3 #include "bcf_surface.h"
4 #include "controls.h"
5 #include "mackie_midi_builder.h"
6 #include "surface_port.h"
7 #include "jog.h"
8 #include "pot.h"
9
10 using namespace Mackie;
11
12 void 
13 BcfSurface::display_bank_start (SurfacePort & port, MackieMidiBuilder & builder, uint32_t current_bank)
14 {
15         if  (current_bank == 0) {
16                 // send Ar. to 2-char display on the master
17                 port.write (builder.two_char_display ("Ar", ".."));
18         } else {
19                 // write the current first remote_id to the 2-char display
20                 port.write (builder.two_char_display (current_bank));
21         }
22 }
23
24 void 
25 BcfSurface::zero_all (SurfacePort & port, MackieMidiBuilder & builder)
26 {
27         // clear 2-char display
28         port.write (builder.two_char_display ("LC"));
29
30         // and the led ring for the master strip
31         blank_jog_ring (port, builder);
32 }
33
34 void 
35 BcfSurface::blank_jog_ring (SurfacePort & port, MackieMidiBuilder & builder)
36 {
37         Control & control = *controls_by_name["jog"];
38         port.write (builder.build_led_ring (dynamic_cast<Pot &> (control), off));
39 }
40
41 float 
42 BcfSurface::scaled_delta (const ControlState & state, float current_speed)
43 {
44         return state.sign *  (std::pow (float(state.ticks + 1), 2) + current_speed) / 100.0;
45 }
46