class RemiAudio::Drivers::PortAudio::PaStream

Defined in:

remiaudio/drivers/port-bindings.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.openDefaultStream(numInput : Int | Nil, numOutput : Int | Nil, sampleFormat : SampleFormat, sampleRate : SampleRate, framesPerBuffer : Int, callback : PaCallback, userData : Pointer(Void) | Nil = nil) : PaStream #

[View source]
def self.openDefaultStream(numInput : Int | Nil, numOutput : Int | Nil, sampleFormat : SampleFormat, sampleRate : SampleRate, framesPerBuffer : Int) : PaStream #

[View source]
def self.openDefaultStream(numInput : Int | Nil, numOutput : Int | Nil, sampleFormat : SampleFormat, sampleRate : SampleRate, framesPerBuffer : Int, userData : Pointer(Void) | Nil, &block : PaCallback) : PaStream #

[View source]
def self.openStream(inputParams : StreamParameters | Nil, outputParams : StreamParameters | Nil, sampleRate : SampleRate, framesPerBuffer : Int, streamFlags : StreamFlags) : PaStream #

[View source]

Class Method Detail

def self.mergeArrays(channelCount : Int, *data : Slice(Float32)) : Slice(Float32) #

A utility function that merges individual channels into interleaved data.


[View source]
def self.mergeArrays(channelCount : Int, *data : Slice(Int32)) : Slice(Int32) #

A utility function that merges individual channels into interleaved data.


[View source]
def self.mergeArrays(channelCount : Int, *data : Slice(Int16)) : Slice(Int16) #

A utility function that merges individual channels into interleaved data.


[View source]
def self.mergeArrays(channelCount : Int, *data : Slice(Int8)) : Slice(Int8) #

A utility function that merges individual channels into interleaved data.


[View source]
def self.mergeArrays(channelCount : Int, *data : Slice(UInt8)) : Slice(UInt8) #

A utility function that merges individual channels into interleaved data.


[View source]
def self.mergeArrays(channelCount : Int, *data : Array(Float32)) : Array(Float32) #

A utility function that merges individual channels into interleaved data.


[View source]
def self.mergeArrays(channelCount : Int, *data : Array(Int32)) : Array(Int32) #

A utility function that merges individual channels into interleaved data.


[View source]
def self.mergeArrays(channelCount : Int, *data : Array(Int16)) : Array(Int16) #

A utility function that merges individual channels into interleaved data.


[View source]
def self.mergeArrays(channelCount : Int, *data : Array(Int8)) : Array(Int8) #

A utility function that merges individual channels into interleaved data.


[View source]
def self.mergeArrays(channelCount : Int, *data : Array(UInt8)) : Array(UInt8) #

A utility function that merges individual channels into interleaved data.


[View source]
def self.separateArray(channelCount : Int, data : Slice(Float32)) : Array(Float32) #

A utility function that separates interleaved data into individual channels.


[View source]
def self.separateArray(channelCount : Int, data : Slice(Int32)) : Array(Int32) #

A utility function that separates interleaved data into individual channels.


[View source]
def self.separateArray(channelCount : Int, data : Slice(Int16)) : Array(Int16) #

A utility function that separates interleaved data into individual channels.


[View source]
def self.separateArray(channelCount : Int, data : Slice(Int8)) : Array(Int8) #

A utility function that separates interleaved data into individual channels.


[View source]
def self.separateArray(channelCount : Int, data : Slice(UInt8)) : Array(UInt8) #

A utility function that separates interleaved data into individual channels.


[View source]
def self.separateArray(channelCount : Int, data : Array(Float32)) : Array(Float32) #

A utility function that separates interleaved data into individual channels.


[View source]
def self.separateArray(channelCount : Int, data : Array(Int32)) : Array(Int32) #

A utility function that separates interleaved data into individual channels.


[View source]
def self.separateArray(channelCount : Int, data : Array(Int16)) : Array(Int16) #

A utility function that separates interleaved data into individual channels.


[View source]
def self.separateArray(channelCount : Int, data : Array(Int8)) : Array(Int8) #

A utility function that separates interleaved data into individual channels.


[View source]
def self.separateArray(channelCount : Int, data : Array(UInt8)) : Array(UInt8) #

A utility function that separates interleaved data into individual channels.


[View source]
def self.withDefaultStream(numInput : Int | Nil, numOutput : Int | Nil, *, sampleFormat : SampleFormat = SampleFormat::Float32, sampleRate : SampleRate = 44100, framesPerBuffer : Int = 1024, &) : Nil #

Opens the default audio stream using the given options and starts it with #start. This then yields the stream. This ensures that the stream is both stopped with #stop and closed with #close before returning.


[View source]
def self.withStream(inputParams : StreamParameters | Nil, outputParams : StreamParameters | Nil, *, sampleRate : SampleRate = 44100, framesPerBuffer : Int = 1024, streamFlags : StreamFlags = StreamFlags::NoFlag, &) : Nil #

Opens an audio stream using the given options and starts it with #start. This then yields the stream. This ensures that the stream is both stopped with #stop and closed with #close before returning.


[View source]

Instance Method Detail

def <<(data : Slice(Float32)) : PaStream #

Writes sample data to an output stream. This function doesn't return until the entire buffer has been consumed - this may involve waiting for the operating system to consume the data. The size of the data must be equal to the frames per buffer multiplied by the number of output channels.

This returns self.


[View source]
def <<(data : Array(Float32)) : PaStream #

Writes sample data to an output stream. This function doesn't return until the entire buffer has been consumed - this may involve waiting for the operating system to consume the data. The size of the data must be equal to the frames per buffer multiplied by the number of output channels.

This returns self.


[View source]
def <<(data : Slice(Int32)) : PaStream #

Writes sample data to an output stream. This function doesn't return until the entire buffer has been consumed - this may involve waiting for the operating system to consume the data. The size of the data must be equal to the frames per buffer multiplied by the number of output channels.

This returns self.


[View source]
def <<(data : Array(Int32)) : PaStream #

Writes sample data to an output stream. This function doesn't return until the entire buffer has been consumed - this may involve waiting for the operating system to consume the data. The size of the data must be equal to the frames per buffer multiplied by the number of output channels.

This returns self.


[View source]
def <<(data : Slice(Int16)) : PaStream #

Writes sample data to an output stream. This function doesn't return until the entire buffer has been consumed - this may involve waiting for the operating system to consume the data. The size of the data must be equal to the frames per buffer multiplied by the number of output channels.

This returns self.


[View source]
def <<(data : Array(Int16)) : PaStream #

Writes sample data to an output stream. This function doesn't return until the entire buffer has been consumed - this may involve waiting for the operating system to consume the data. The size of the data must be equal to the frames per buffer multiplied by the number of output channels.

This returns self.


[View source]
def <<(data : Slice(Int8)) : PaStream #

Writes sample data to an output stream. This function doesn't return until the entire buffer has been consumed - this may involve waiting for the operating system to consume the data. The size of the data must be equal to the frames per buffer multiplied by the number of output channels.

This returns self.


[View source]
def <<(data : Array(Int8)) : PaStream #

Writes sample data to an output stream. This function doesn't return until the entire buffer has been consumed - this may involve waiting for the operating system to consume the data. The size of the data must be equal to the frames per buffer multiplied by the number of output channels.

This returns self.


[View source]
def <<(data : Slice(UInt8)) : PaStream #

Writes sample data to an output stream. This function doesn't return until the entire buffer has been consumed - this may involve waiting for the operating system to consume the data. The size of the data must be equal to the frames per buffer multiplied by the number of output channels.

This returns self.


[View source]
def <<(data : Array(UInt8)) : PaStream #

Writes sample data to an output stream. This function doesn't return until the entire buffer has been consumed - this may involve waiting for the operating system to consume the data. The size of the data must be equal to the frames per buffer multiplied by the number of output channels.

This returns self.


[View source]
def abort : Nil #

Terminates audio processing immediately without waiting for pending buffers to complete.


[View source]
def active? : Bool #

[View source]
def close : Nil #

[View source]
def framesPerBuffer : UInt64 #

[View source]
def info : StreamInfo #

[View source]
def inputChannels : Int32 | Nil #

[View source]
def inputSampleFormat : SampleFormat | Nil #

[View source]
def outputChannels : Int32 | Nil #

[View source]
def outputSampleFormat : SampleFormat | Nil #

[View source]
def read(dest : Slice(Float32)) : Bool #

Attempts to read samples from an input stream into the destination. The method doesn't return until the entire buffer has been filled - this may involve waiting for the operating system to supply the data.

The size of the destination must be less than or equal to the number of frames per buffer multiplied by the channel count.

On success, this returns true. If input data was discarded by PortAudio after the previous call and before this call, this returns false. Otherwise this will raise a PaError if another error occurs.


[View source]
def read(destType : Slice(Float32).class) : Slice(Float32) #

Attempts to read samples from an input stream. The method doesn't return until one entire buffer has been filled - this may involve waiting for the operating system to supply the data. The size of returned data equal to the number of frames per buffer multiplied by the channel count.

On success, this returns the batch of data. Otherwise this will raise a PaError if another error occurs.


[View source]
def read(dest : Array(Float32)) : Bool #

Attempts to read samples from an input stream into the destination. The method doesn't return until the entire buffer has been filled - this may involve waiting for the operating system to supply the data.

The size of the destination must be less than or equal to the number of frames per buffer multiplied by the channel count.

On success, this returns true. If input data was discarded by PortAudio after the previous call and before this call, this returns false. Otherwise this will raise a PaError if another error occurs.


[View source]
def read(destType : Array(Float32).class) : Array(Float32) #

Attempts to read samples from an input stream. The method doesn't return until one entire buffer has been filled - this may involve waiting for the operating system to supply the data. The size of returned data equal to the number of frames per buffer multiplied by the channel count.

On success, this returns the batch of data. Otherwise this will raise a PaError if another error occurs.


[View source]
def read(dest : Slice(Int32)) : Bool #

Attempts to read samples from an input stream into the destination. The method doesn't return until the entire buffer has been filled - this may involve waiting for the operating system to supply the data.

The size of the destination must be less than or equal to the number of frames per buffer multiplied by the channel count.

On success, this returns true. If input data was discarded by PortAudio after the previous call and before this call, this returns false. Otherwise this will raise a PaError if another error occurs.


[View source]
def read(destType : Slice(Int32).class) : Slice(Int32) #

Attempts to read samples from an input stream. The method doesn't return until one entire buffer has been filled - this may involve waiting for the operating system to supply the data. The size of returned data equal to the number of frames per buffer multiplied by the channel count.

On success, this returns the batch of data. Otherwise this will raise a PaError if another error occurs.


[View source]
def read(dest : Array(Int32)) : Bool #

Attempts to read samples from an input stream into the destination. The method doesn't return until the entire buffer has been filled - this may involve waiting for the operating system to supply the data.

The size of the destination must be less than or equal to the number of frames per buffer multiplied by the channel count.

On success, this returns true. If input data was discarded by PortAudio after the previous call and before this call, this returns false. Otherwise this will raise a PaError if another error occurs.


[View source]
def read(destType : Array(Int32).class) : Array(Int32) #

Attempts to read samples from an input stream. The method doesn't return until one entire buffer has been filled - this may involve waiting for the operating system to supply the data. The size of returned data equal to the number of frames per buffer multiplied by the channel count.

On success, this returns the batch of data. Otherwise this will raise a PaError if another error occurs.


[View source]
def read(dest : Slice(Int16)) : Bool #

Attempts to read samples from an input stream into the destination. The method doesn't return until the entire buffer has been filled - this may involve waiting for the operating system to supply the data.

The size of the destination must be less than or equal to the number of frames per buffer multiplied by the channel count.

On success, this returns true. If input data was discarded by PortAudio after the previous call and before this call, this returns false. Otherwise this will raise a PaError if another error occurs.


[View source]
def read(destType : Slice(Int16).class) : Slice(Int16) #

Attempts to read samples from an input stream. The method doesn't return until one entire buffer has been filled - this may involve waiting for the operating system to supply the data. The size of returned data equal to the number of frames per buffer multiplied by the channel count.

On success, this returns the batch of data. Otherwise this will raise a PaError if another error occurs.


[View source]
def read(dest : Array(Int16)) : Bool #

Attempts to read samples from an input stream into the destination. The method doesn't return until the entire buffer has been filled - this may involve waiting for the operating system to supply the data.

The size of the destination must be less than or equal to the number of frames per buffer multiplied by the channel count.

On success, this returns true. If input data was discarded by PortAudio after the previous call and before this call, this returns false. Otherwise this will raise a PaError if another error occurs.


[View source]
def read(destType : Array(Int16).class) : Array(Int16) #

Attempts to read samples from an input stream. The method doesn't return until one entire buffer has been filled - this may involve waiting for the operating system to supply the data. The size of returned data equal to the number of frames per buffer multiplied by the channel count.

On success, this returns the batch of data. Otherwise this will raise a PaError if another error occurs.


[View source]
def read(dest : Slice(Int8)) : Bool #

Attempts to read samples from an input stream into the destination. The method doesn't return until the entire buffer has been filled - this may involve waiting for the operating system to supply the data.

The size of the destination must be less than or equal to the number of frames per buffer multiplied by the channel count.

On success, this returns true. If input data was discarded by PortAudio after the previous call and before this call, this returns false. Otherwise this will raise a PaError if another error occurs.


[View source]
def read(destType : Slice(Int8).class) : Slice(Int8) #

Attempts to read samples from an input stream. The method doesn't return until one entire buffer has been filled - this may involve waiting for the operating system to supply the data. The size of returned data equal to the number of frames per buffer multiplied by the channel count.

On success, this returns the batch of data. Otherwise this will raise a PaError if another error occurs.


[View source]
def read(dest : Array(Int8)) : Bool #

Attempts to read samples from an input stream into the destination. The method doesn't return until the entire buffer has been filled - this may involve waiting for the operating system to supply the data.

The size of the destination must be less than or equal to the number of frames per buffer multiplied by the channel count.

On success, this returns true. If input data was discarded by PortAudio after the previous call and before this call, this returns false. Otherwise this will raise a PaError if another error occurs.


[View source]
def read(destType : Array(Int8).class) : Array(Int8) #

Attempts to read samples from an input stream. The method doesn't return until one entire buffer has been filled - this may involve waiting for the operating system to supply the data. The size of returned data equal to the number of frames per buffer multiplied by the channel count.

On success, this returns the batch of data. Otherwise this will raise a PaError if another error occurs.


[View source]
def read(dest : Slice(UInt8)) : Bool #

Attempts to read samples from an input stream into the destination. The method doesn't return until the entire buffer has been filled - this may involve waiting for the operating system to supply the data.

The size of the destination must be less than or equal to the number of frames per buffer multiplied by the channel count.

On success, this returns true. If input data was discarded by PortAudio after the previous call and before this call, this returns false. Otherwise this will raise a PaError if another error occurs.


[View source]
def read(destType : Slice(UInt8).class) : Slice(UInt8) #

Attempts to read samples from an input stream. The method doesn't return until one entire buffer has been filled - this may involve waiting for the operating system to supply the data. The size of returned data equal to the number of frames per buffer multiplied by the channel count.

On success, this returns the batch of data. Otherwise this will raise a PaError if another error occurs.


[View source]
def read(dest : Array(UInt8)) : Bool #

Attempts to read samples from an input stream into the destination. The method doesn't return until the entire buffer has been filled - this may involve waiting for the operating system to supply the data.

The size of the destination must be less than or equal to the number of frames per buffer multiplied by the channel count.

On success, this returns true. If input data was discarded by PortAudio after the previous call and before this call, this returns false. Otherwise this will raise a PaError if another error occurs.


[View source]
def read(destType : Array(UInt8).class) : Array(UInt8) #

Attempts to read samples from an input stream. The method doesn't return until one entire buffer has been filled - this may involve waiting for the operating system to supply the data. The size of returned data equal to the number of frames per buffer multiplied by the channel count.

On success, this returns the batch of data. Otherwise this will raise a PaError if another error occurs.


[View source]
def readAvailable : Int64 #

[View source]
def start : Nil #

Commences audio processing


[View source]
def stop : Nil #

Terminates audio processing. It will wait until all pending audio buffers have been played before returning.


[View source]
def stopped? : Bool #

[View source]
def time : Float64 #

[View source]
def writeAvailable : Int64 #

[View source]