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