module AlsaRawMIDI::API::Output
Wrapper for ALSA methods dealing with output
Public Instance Methods
open(id)
click to toggle source
Open the output with the given ID @param [Integer] id @return [Integer]
# File lib/alsa-rawmidi/api.rb, line 291 def open(id) API::Device.open(id) do |pointer| API.snd_rawmidi_open(nil, pointer, id, 0) end end
puts(handle, data)
click to toggle source
Send the given MIDI data to the output with the given handle @param [Integer] handle @param [Array<Integer>] data @return [Boolean]
# File lib/alsa-rawmidi/api.rb, line 278 def puts(handle, data) format = "C" * data.size pointer = FFI::MemoryPointer.new(data.size) bytes = pointer.put_bytes(0, data.pack(format)) API.snd_rawmidi_write(handle, bytes.to_i, data.size) API.snd_rawmidi_drain(handle) true end