carb::audio::createEmptySound

Defined in carb/audio/AudioUtils.h

inline SoundData *carb::audio::createEmptySound(const IAudioData *iface, SampleFormat fmt, size_t frameRate, size_t channels, size_t bufferLength, UnitType unitType = UnitType::eFrames, const char *name = nullptr)

Create an empty SoundData of a specific length.

Parameters
  • iface[in] The IAudioData interface to use.

  • fmt[in] The sample format for the sound.

  • frameRate[in] The frame rate of the sound.

  • channels[in] The number of channels for the sound.

  • bufferLength[in] The length of the sound’s buffer as a measure of unitType.

  • unitType[in] The unit type to use for bufferLength.

  • name[in] The name to give the sound, if desired.

Returns

The created sound with empty buffer with the valid length set to 0. The valid length should be set after the sound’s buffer is filled.

Returns

nullptr if fmt, frameRate or channels are invalid or out of range.

Returns

nullptr if creation failed unexpectedly (such as out of memory).