class AlsaRawMIDI::Output
Output
device class
Public Class Methods
all()
click to toggle source
All outputs @return [Array<Output>]
# File lib/alsa-rawmidi/output.rb, line 90 def self.all Device.all_by_type[:output] end
first()
click to toggle source
The first available output @return [Output]
# File lib/alsa-rawmidi/output.rb, line 78 def self.first Device.first(:output) end
last()
click to toggle source
The last available output @return [Output]
# File lib/alsa-rawmidi/output.rb, line 84 def self.last Device.last(:output) end
Public Instance Methods
close()
click to toggle source
Close this output @return [Boolean]
# File lib/alsa-rawmidi/output.rb, line 10 def close if @enabled API::Device.close(@resource) @enabled = false true else false end end
enable(options = {}) { |self| ... }
click to toggle source
Enable this device; yields @param [Hash] options @param [Proc] block @return [Output]
# File lib/alsa-rawmidi/output.rb, line 59 def enable(options = {}, &block) unless @enabled @resource = API::Output.open(@system_id) @enabled = true end if block_given? begin yield(self) ensure close end end self end
puts(*args)
click to toggle source
Output
the given MIDI message @param [*Integer, *String] args @return [Boolean]
# File lib/alsa-rawmidi/output.rb, line 46 def puts(*args) case args.first when Array then args.each { |arg| puts(*arg) } when Numeric then puts_bytes(*args) when String then puts_bytestr(*args) end end
Also aliased as: write
puts_bytes(*data)
click to toggle source
Output
a MIDI message in numeric byte format @param [*Integer] data @return [Boolean]
# File lib/alsa-rawmidi/output.rb, line 38 def puts_bytes(*data) API::Output.puts(@resource, data) true end
puts_s(data)
click to toggle source
Output
a MIDI message in hex string format @param [String] data @return [Boolean]
# File lib/alsa-rawmidi/output.rb, line 23 def puts_s(data) data = data.dup output = [] until (str = data.slice!(0,2)) == "" output << str.hex end puts_bytes(*output) true end
Also aliased as: puts_bytestr, puts_hex