class MicroMIDI::Instructions::Sticky

Commands that deal with sticky default properties.

For example, setting a default MIDI channel that persists for the messages to follow it:

“`ruby channel 5 note “C4” note “C3” “`

Public Class Methods

new(state) click to toggle source

@param [State] state

# File lib/micromidi/instructions/sticky.rb, line 18
def initialize(state)
  @state = state
end

Public Instance Methods

ch(*args)
Alias for: channel
channel(*args) click to toggle source

Gets/sets the sticky channel for the current block @param [*Fixnum] args args is an optional parameter to set the channel: [Fixnum, nil] @return [Fixnum]

# File lib/micromidi/instructions/sticky.rb, line 25
def channel(*args)
  @state.channel = args.first unless args.empty?
  @state.channel
end
Also aliased as: ch
node(*args)
Alias for: sysex_node
octave(*args) click to toggle source

Gets/sets the octave for the current block @param [*Fixnum] args args is an optional parameter to set the octave: [Fixnum, nil] @return [Fixnum]

# File lib/micromidi/instructions/sticky.rb, line 33
def octave(*args)
  @state.octave = args.first unless args.empty?
  @state.octave
end
ss()
Alias for: super_sticky
super_sticky() click to toggle source

Toggles super_sticky mode, a mode where any explicit values used to create MIDI messages automatically become sticky. Normally the explicit value would only be used for the current message.

For example, while in super sticky mode

“`ruby note “C4”, :channel => 5 note “C3” “`

will have the same results as

“`ruby channel 5 note “C4” note “C3” “`

@return [Boolean]

# File lib/micromidi/instructions/sticky.rb, line 78
def super_sticky
  @state.toggle_super_sticky
end
Also aliased as: ss
sysex_node(*args) click to toggle source

Gets/sets the sysex node for the current block @param [*Object] args @return [MIDIMessage::SystemExclusive::Node]

# File lib/micromidi/instructions/sticky.rb, line 41
def sysex_node(*args)
  args = args.dup
  options = args.last.kind_of?(Hash) ? args.last : {}
  @state.sysex_node = MIDIMessage::SystemExclusive::Node.new(args.first, options) unless args.empty?
  @state.sysex_node
end
Also aliased as: node
v(*args)
Alias for: velocity
velocity(*args) click to toggle source

Gets/sets the sticky velocity for the current block @param [*Fixnum] args args is an optional parameter to set the velocity: [Fixnum, nil] @return [Fixnum]

# File lib/micromidi/instructions/sticky.rb, line 52
def velocity(*args)
  @state.velocity = args.first unless args.empty?
  @state.velocity
end
Also aliased as: v