AudioStream

Edit

An AudioStream is similar to a Sound, but stores a continuous stream of audio. Source objects can be created from AudioStreams.

Audio streams are used for microphone input, by capturing samples from an audio device. See lovr.audio.setDevice and lovr.audio.getStream for more details. They are also useful for generating audio dynamically and playing it with a Source.

Streams store audio data in a fixed-size ring buffer. Data is always written to the end of the stream, and reading data will read from the beginning. Once data is read, it is "consumed", making more space available for writing. Only one thread is allowed to write to the stream at a time, and only one thread is allowed to read.

Constructor

lovr.data.newAudioStreamCreate a new AudioStream.

Methods

AudioStream:getCapacityGet the size of the AudioStream ring buffer.
AudioStream:getChannelCountGet the number of channels in the AudioStream.
AudioStream:getChannelLayoutGet the channel layout of the AudioStream.
AudioStream:getFormatGet the sample format of the AudioStream.
AudioStream:getReadCapacityGet the number of frames available for reading.
AudioStream:getSampleRateGet the sample rate of the AudioStream.
AudioStream:getWriteCapacityGet the number of frames available for writing.
AudioStream:readRead data from the AudioStream.
AudioStream:writeWrite data to the AudioStream.
Object:releaseImmediately release the Lua reference to an object.
Object:typeGet the type name of the object.

See also