AudioStream
EditAn 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.newAudioStream | Create a new AudioStream. |
Methods
| AudioStream:getCapacity | Get the size of the AudioStream ring buffer. |
| AudioStream:getChannelCount | Get the number of channels in the AudioStream. |
| AudioStream:getChannelLayout | Get the channel layout of the AudioStream. |
| AudioStream:getFormat | Get the sample format of the AudioStream. |
| AudioStream:getReadCapacity | Get the number of frames available for reading. |
| AudioStream:getSampleRate | Get the sample rate of the AudioStream. |
| AudioStream:getWriteCapacity | Get the number of frames available for writing. |
| AudioStream:read | Read data from the AudioStream. |
| AudioStream:write | Write data to the AudioStream. |
| Object:release | Immediately release the Lua reference to an object. |
| Object:type | Get the type name of the object. |