AudioBuffer

An AudioBuffer is a multi-channel buffer, with defined length, to act as storage of audio samples of type T. It is passed around by DSP algorithms. Data is store deinterleaved.

Destructor

~this
~this()
Undocumented in source.

Postblit

this(this)
this(this)
Undocumented in source.

Members

Functions

alignment
int alignment()

Return alignment of the sample storage.

assumeIsolated
void assumeIsolated()
Undocumented in source. Be warned that the author may not have intended to support it.
channels
int channels()

Return number of channels in this buffer.

chunkBy
auto chunkBy(int maxFrames)

Return an input range that returns several subbuffers that covers the parent buffer, each with length not larger than maxFrames.

copyFrom
void copyFrom(const(AudioBuffer) source)

Copy samples from source to dest. Number of frames and channels must match.

fillWithValue
void fillWithValue(T value)

Fill the buffer with a single value. Warning: the buffer must be in fp32 format.

fillWithZeroes
void fillWithZeroes()

Fill the buffer with zeroes.

frames
int frames()

Return number of frames in this buffer.

getChannel
T[] getChannel(int channel)
const(T)[] getChannel(int channel)
immutable(T)[] getChannel(int channel)

Get slice of a given channel.

getChannelPointer
T* getChannelPointer(int channel)

Get pointer of a given channel.

getChannelPointer
const(T)* getChannelPointer(int channel)

Get const pointer of a given channel.

getChannelPointer
immutable(T)* getChannelPointer(int channel)

Get immutable pointer of a given channel.

getChannelsPointers
T** getChannelsPointers()

Get channel pointers.

getChannelsPointers
const(T*)* getChannelsPointers()

Get const channel pointers.

getChannelsPointers
immutable(T*)* getChannelsPointers()

Get immutable channel pointers.

hasOwnership
bool hasOwnership()
initWithData
void initWithData(int channels, int frames, T** inData)

Dispose the previous content, if any. Allocate a new AudioBuffer with given frames and channels. This step can reuse an existing owned allocation.

isIsolated
bool isIsolated()
isSilent
bool isSilent()
opDollar
int opDollar()
Undocumented in source. Be warned that the author may not have intended to support it.
opDollar
int opDollar()
Undocumented in source. Be warned that the author may not have intended to support it.
opIndex
inout(T)[] opIndex(int channel)

Get slice of a given channel.

opIndex
AudioBuffer opIndex()
const(AudioBuffer) opIndex()

Create an AudioBuffer that is a ref to the same data.

opIndex
inout(T) opIndex(int channel, int frame)

Index a single sample.

opIndex
AudioBuffer opIndex(int[2] chan)
const(AudioBuffer) opIndex(int[2] chan)

Slice with a sub-range of channels.

opIndex
AudioBuffer opIndex(int[2] chan, int[2] framesBounds)
const(AudioBuffer) opIndex(int[2] chan, int[2] framesBounds)

Slice across channels and temporally. Take a sub-range of channels, and a sub-range of frames.

opSlice
int[2] opSlice(int start, int end)

Select only a slice of channels from AudioBuffer.

recomputeZeroFlag
void recomputeZeroFlag()

Recompute the status of the zero flag. Otherwise, asking for a mutable pointer into the zero data will clear this flag. This is useful if you've written in a buffer and want to optimize downstream.

resize
void resize(int channels, int frames, int alignment)

Change the size (channels and frames of the underlying store. Data is left uninitialized. Typically you would reuse an AudioBuffer if you want to reuse the allocation. When the same size is requested, the same allocation is reused (unless alignment is changed).

sliceChannels
AudioBuffer sliceChannels(int channelStart, int channelEnd)

Select only a slice of channels from AudioBuffer.

sliceChannels
const(AudioBuffer) sliceChannels(int channelStart, int channelEnd)
Undocumented in source. Be warned that the author may not have intended to support it.
sliceFrames
AudioBuffer sliceFrames(int frameStart, int frameEnd)
const(AudioBuffer) sliceFrames(int frameStart, int frameEnd)

Create a AudioBuffer derivated from another buffer.

Meta