Class: MusaLCEServer::Bitwig::Track

Inherits:
Object
  • Object
show all
Defined in:
lib/bitwig/tracks.rb

Overview

Represents a track in Bitwig with dynamic MIDI output.

Uses DynamicProxy to allow the output to be reassigned when channel mappings change.

Since:

  • 0.1.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, logger:) ⇒ Track

Creates a new track.

Parameters:

  • name (String)

    the track name

  • logger (Logger)

    the logger

Since:

  • 0.1.0



69
70
71
72
73
74
# File 'lib/bitwig/tracks.rb', line 69

def initialize(name, logger:)
  @name = name
  @logger = logger

  @output = Musa::Extension::DynamicProxy::DynamicProxy.new
end

Instance Attribute Details

#nameObject (readonly)

Since:

  • 0.1.0



78
79
80
# File 'lib/bitwig/tracks.rb', line 78

def name
  @name
end

Instance Method Details

#_channel=(new_channel) ⇒ 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.

Sets the channel for this track.

Parameters:

  • new_channel (Channel)

    the channel to assign

Since:

  • 0.1.0



91
92
93
94
# File 'lib/bitwig/tracks.rb', line 91

def _channel=(new_channel)
  @logger.info "Assigning #{new_channel} to track '#{@name}'"
  @output.receiver = new_channel.output
end

#_forget_channelvoid

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.

Disconnects the current channel from this track.

Since:

  • 0.1.0



83
84
85
# File 'lib/bitwig/tracks.rb', line 83

def _forget_channel
  @output.receiver = nil
end

#outMusa::Extension::DynamicProxy::DynamicProxy

Returns the MIDI output for this track.

Returns:

  • (Musa::Extension::DynamicProxy::DynamicProxy)

    proxy to the MIDI voice

Since:

  • 0.1.0



99
100
101
# File 'lib/bitwig/tracks.rb', line 99

def out
  @output
end