class InputStream

Overview

An input MIDI stream.

Defined in:

port_midi/input_stream.cr

Constructors

Instance Method Summary

Instance methods inherited from class PMStream

close close, host_error? : Bool host_error?, stream : LibPortMIDI::Stream stream, synchronize synchronize

Constructor methods inherited from class PMStream

new(stream : LibPortMIDI::Stream) new

Constructor Detail

def self.open(input_device_num : Int32, input_driver_info : Pointer(Void) | Nil = nil, buffer_size : Int32 = 1024, time_proc : Pointer(Void) -> LibPortMIDI::PmTimestamp | Nil = nil, time_info : Pointer(Void) | Nil = nil) : InputStream #

Opens and returns a new InputStream. This convenience method provides default for most of its arguments.


[View source]

Instance Method Detail

def has_data? : Bool #

Returns true if polling indicates that data is ready to read.


[View source]
def read(buffer : Pointer(LibPortMIDI::Event), length : Int32) : Int32 #

Reads up to length LibPortMIDI::Event structs into buffer. Raises an exception on error.


[View source]
def read(buffer : Array(LibPortMIDI::Event)) : Int32 #

Reads LibPortMIDI::Event structs into buffer, up to the length of the buffer. Raises an exception on error.


[View source]
def set_channel_mask(bitmask : UInt32) #

Sets the channel maks for this input stream. Raises an exception on error.


[View source]
def set_filter(filters_bitmask : UInt32) #

Sets the filter bitmask for this input stream. Raises an exception on error.


[View source]
def wait_for_data(sleep_secs = 0.001) #

Polls for data, waiting sleep_secs between polls. sleep_secs may be sub-second.


[View source]