carb::audio::AudioImageDesc

Defined in carb/audio/IAudioUtils.h

struct AudioImageDesc

A descriptor for IAudioData::drawWaveform().

Public Members

AudioImageFlags flags

Flags that alter the drawing style.

const SoundData *sound

The sound to render into the waveform.

size_t length

The length of sound to render as an image.

This may be 0 to render the entire sound.

int64_t offset

The offset into the sound to start visualizing.

The region visualized will start at offset and end at offset

  • length. If the region extends beyond the end of the sound, it will be internally clamped to the end of the sound. If this value is negative, then this is treated as an offset relative to the end of the file, rather than the start. This may be 0 to render the entire sound.

UnitType lengthType

The unit type of length and offset.

Note that using UnitType::eBytes with a variable bitrate format will not provide very accurate results.

size_t channel

This specifies which audio channel from sound will be rendered.

This is ignored when fAudioImageMultiChannel is set on flags.

void *image

The buffer that holds the image data.

The image format is RGBA8888. This must be height * pitch bytes long. This may not be nullptr.

size_t width

The width of the image in pixels.

size_t pitch

The width of the image buffer in bytes.

This can be set to 0 to use 4 * width as the pitch. This may be used for applications such as writing a subimage or an image that needs some specific alignment.

size_t height

The height of the image in pixels.

Float4 background

The background color to write to the image in normalized RGBA color.

The alpha channel in this color is not used to blend this color with the existing data in image; use fAudioImageNoClear if you want to render on top of an existing image. This value is ignored when fAudioImageNoClear is set on flags.

Float4 colors[kMaxChannels]

The colors to use for the image in normalized RGBA colors.

If fAudioImageMultiChannel, each element in this array maps to each channel in the output audio data; otherwise, element 0 is used as the color for the single channel.