Impulse Response

Typedefs

typedef struct _IPLImpulseResponse_t *IPLImpulseResponse

An impulse response.

Impulse responses are represented in Ambisonics to allow for directional variation of propagated sound.

Impulse response data is stored as a 2D array of size #channels * #samples, in row-major order.

Functions

IPLerror iplImpulseResponseCreate(IPLContext context, IPLImpulseResponseSettings *settings, IPLImpulseResponse *impulseResponse)

Creates an impulse response.

Parameters:
  • context – The context used to initialize Steam Audio.

  • settings – The settings to use when creating the impulse response.

  • impulseResponse – [out] The created impulse response.

Returns:

Status code indicating whether or not the operation succeeded.

IPLImpulseResponse iplImpulseResponseRetain(IPLImpulseResponse impulseResponse)

Retains an additional reference to an impulse response.

Parameters:

impulseResponse – The impulse response to retain a reference to.

Returns:

The additional reference to the impulse response.

void iplImpulseResponseRelease(IPLImpulseResponse *impulseResponse)

Releases a reference to an impulse response.

Parameters:

impulseResponse – The impulse response to release a reference to.

IPLint32 iplImpulseResponseGetNumChannels(IPLImpulseResponse impulseResponse)

Returns the number of channels in the impulse response.

Parameters:

impulseResponse – The impulse response.

Returns:

The number of channels in the impulse response.

IPLint32 iplImpulseResponseGetNumSamples(IPLImpulseResponse impulseResponse)

Returns the number of samples in the impulse response.

Parameters:

impulseResponse – The impulse response.

Returns:

The number of samples in the impulse response.

IPLfloat32 *iplImpulseResponseGetData(IPLImpulseResponse impulseResponse)

Returns a pointer to the data stored in the impulse response.

Parameters:

impulseResponse – The impulse response.

Returns:

Pointer to #channels * #samples IPLfloat32 values stored in the impulse response, in row-major order.

IPLfloat32 *iplImpulseResponseGetChannel(IPLImpulseResponse impulseResponse, int channelIndex)

Returns a pointer to the data stored in the impulse response for the given channel.

Parameters:
  • impulseResponse – The impulse response.

  • channelIndex – Index of the channel.

Returns:

Pointer to #samples IPLfloat32 values stored in the impulse response for the given channel, in row-major order.

void iplImpulseResponseReset(IPLImpulseResponse impulseResponse)

Resets all values stored in an impulse response to zero.

Parameters:

impulseResponse – The impulse response.

void iplImpulseResponseCopy(IPLImpulseResponse src, IPLImpulseResponse dst)

Copies data from one impulse response into another.

If the source and destination impulse responses have different numbers of channels, only the smaller of the two numbers of channels will be copied.

If the source and destination impulse responses have different numbers of samples, only the smaller of the two numbers of samples will be copied.

Parameters:
  • src – The source impulse response.

  • dst – The destination impulse response.

void iplImpulseResponseSwap(IPLImpulseResponse ir1, IPLImpulseResponse ir2)

Swaps the data contained in one impulse response with the data contained in another impulse response.

The two impulse responses may contain different numbers of channels or samples.

Parameters:
  • a – The first impulse response.

  • b – The second impulse response.

void iplImpulseResponseAdd(IPLImpulseResponse in1, IPLImpulseResponse in2, IPLImpulseResponse out)

Adds the values stored in two impulse responses, and stores the result in a third impulse response.

If the impulse responses have different numbers of channels, only the smallest of the three numbers of channels will be added.

If the impulse responses have different numbers of samples, only the smallest of the three numbers of samples will be added.

This function can be used for in-place addition, i.e. out may be equal to in1 or in2.

Parameters:
  • in1 – The first input impulse response.

  • in2 – The second input impulse response.

  • out – The output impulse response.

void iplImpulseResponseScale(IPLImpulseResponse in, IPLfloat32 scalar, IPLImpulseResponse out)

Scales the values stored in an impulse response by a scalar, and stores the result in a second impulse response.

If the impulse responses have different numbers of channels, only the smallest of the two numbers of channels will be scaled.

If the impulse responses have different numbers of samples, only the smallest of the two numbers of samples will be scaled.

This function can be used for in-place scaling, i.e. out may be equal to in.

Parameters:
  • in – The input impulse response.

  • scalar – The scalar value.

  • out – The output impulse response.

void iplImpulseResponseScaleAccum(IPLImpulseResponse in, IPLfloat32 scalar, IPLImpulseResponse out)

Scales the values stored in an impulse response by a scalar, and adds the result to a second impulse response.

If the impulse responses have different numbers of channels, only the smallest of the two numbers of channels will be added.

If the impulse responses have different numbers of samples, only the smallest of the two numbers of samples will be added.

This function can be used for in-place operation, i.e. out may be equal to in.

Parameters:
  • in – The input impulse response.

  • scalar – The scalar value.

  • out – The output impulse response.

Structures

struct IPLImpulseResponseSettings

Settings used to create an impulse response.

Public Members

IPLfloat32 duration

Total duration (in seconds) of the impulse response.

This determines the number of samples in each channel.

IPLint32 order

The Ambisonic order.

This determines the number of channels.

IPLint32 samplingRate

The sampling rate.

This, together with the duration, determines the number of samples in each channel.