class Sound::Stream

Defined in:

sound.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(channel_count : Int, sample_rate : Int, waveform : Waveform, frequency : Float64) #

[View source]

Instance Method Detail

def on_get_data : Slice(Int16) | Nil #
Description copied from class SF::SoundStream

Request a new chunk of audio samples from the stream source

This function must be overridden by derived classes to provide the audio samples to play. It is called continuously by the streaming loop, in a separate thread. The source can choose to stop the streaming loop at any time, by returning false to the caller. If you return true (i.e. continue streaming) it is important that the returned array of samples is not empty; this would stop the stream due to an internal limitation.

  • data - Chunk of data to fill

Returns: True to continue playback, false to stop


[View source]
def on_seek(time_offset) #

[View source]
def set_frequency(frequency : Float) #

[View source]
def set_waveform(waveform : Waveform) #

[View source]