Class Sound

Inheritance Relationships

Base Type

Class Documentation

class Sound : public Cacao::Asset

Asset type for audio.

Public Functions

virtual void Realize()

Synchronously convert the audio data into a form suitable for playback.

Throws:
  • BadRealizeStateException – If the sound is already realized

  • BadInitStateException – If the audio system is not initialized

virtual std::shared_future<void> RealizeAsync()

Asynchronously convert the audio data into a form suitable for playback.

Throws:
  • BadRealizeStateException – If the sound is already realized

  • BadInitStateException – If the audio system is not initialized

Returns:

A future that will resolve when realization is complete or fails

virtual void DropRealized()

Destroy the realized representation of the asset.

Throws:
  • BadRealizeStateException – If the sound is not realized

  • BadInitStateException – If the audio system is not initialized

~Sound()

Public Static Functions

static inline std::shared_ptr<Sound> Create(std::vector<char> &&encodedAudio, const std::string &addr)

Create a new sound from encoded audio data.

Parameters:
  • encodedAudio – A buffer of audio, encoded in the format of WAV, MP3, Ogg Vorbis, or Ogg Opus

  • addr – The resource address identifier to associate with the sound