Class: MusaLCEServer::Bitwig::Handler Private
- Defined in:
- lib/bitwig/handler.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
OSC message handler for Bitwig Studio.
Handles communication with the MusaLCE for Bitwig controller extension, processing incoming OSC messages for controller and channel registration, and sending transport commands.
Instance Method Summary collapse
-
#continue ⇒ void
private
Sends continue command to Bitwig.
-
#goto(position) ⇒ void
private
Moves playhead to specified position.
-
#initialize(osc_server, osc_client, controllers, sequencer, logger:) ⇒ Handler
constructor
private
Creates a new Bitwig handler.
-
#panic! ⇒ void
private
Sends panic to all tracks.
-
#play ⇒ void
private
Sends play command to Bitwig.
-
#record ⇒ void
private
Sends record command to Bitwig.
-
#stop ⇒ void
private
Sends stop command to Bitwig.
-
#sync ⇒ void
private
Requests synchronization of controllers and channels from Bitwig.
Constructor Details
#initialize(osc_server, osc_client, controllers, sequencer, logger:) ⇒ Handler
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Creates a new Bitwig handler.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/bitwig/handler.rb', line 20 def initialize(osc_server, osc_client, controllers, sequencer, logger:) super() @server = osc_server @client = osc_client @controllers = controllers @sequencer = sequencer @logger = logger @server.add_method '/hello' do || @logger.info "Received /hello #{.to_a}!" version sync end @server.add_method '/musalce4bitwig/controllers' do || @logger.info("Received /musalce4bitwig/controllers #{.to_a}") @controllers.register_controllers(.to_a) end @server.add_method '/musalce4bitwig/controller' do || @logger.info("Received /musalce4bitwig/controller #{.to_a}") a = .to_a @controllers.register_controller(name: a[0], port_name: a[1], is_clock: a[2] == 1) end @server.add_method '/musalce4bitwig/controller/update' do || @logger.info("Received /musalce4bitwig/controller/update #{.to_a}") a = .to_a @controllers.update_controller(old_name: a[0], new_name: a[1], port_name: a[2], is_clock: a[3] == 1) end @server.add_method '/musalce4bitwig/channels' do || @logger.info("Received /musalce4bitwig/channels #{.to_a}") a = .to_a @controllers.register_channels(controller_name: a[0], channels: a[1..]) end end |
Instance Method Details
#continue ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Sends continue command to Bitwig.
84 85 86 87 |
# File 'lib/bitwig/handler.rb', line 84 def continue @logger.info 'Asking continue' send_osc '/musalce4bitwig/continue' end |
#goto(position) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Moves playhead to specified position.
93 94 95 96 |
# File 'lib/bitwig/handler.rb', line 93 def goto(position) @logger.info "Asking goto #{position}" send_osc '/musalce4bitwig/goto', OSC::OSCDouble64.new(((position - 1) * @sequencer.).to_f) end |
#panic! ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Sends panic to all tracks.
107 108 109 |
# File 'lib/bitwig/handler.rb', line 107 def panic! @controllers.tracks.each(:panic!) end |
#play ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Sends play command to Bitwig.
70 71 72 73 |
# File 'lib/bitwig/handler.rb', line 70 def play @logger.info 'Asking play' send_osc '/musalce4bitwig/play' end |
#record ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Sends record command to Bitwig.
100 101 102 103 |
# File 'lib/bitwig/handler.rb', line 100 def record @logger.info 'Asking record' send_osc '/musalce4bitwig/record' end |
#stop ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Sends stop command to Bitwig.
77 78 79 80 |
# File 'lib/bitwig/handler.rb', line 77 def stop @logger.info 'Asking stop' send_osc '/musalce4bitwig/stop' end |
#sync ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Requests synchronization of controllers and channels from Bitwig.
63 64 65 66 |
# File 'lib/bitwig/handler.rb', line 63 def sync @logger.info 'Asking sync' send_osc '/musalce4bitwig/sync' end |