Doly C++ SDK v1.00
Loading...
Searching...
No Matches
SoundControl Namespace Reference

Functions

int8_t init ()
 Initialize sound control.
int8_t dispose ()
 Dispose/stop the sound subsystem and release resources.
int8_t play (std::string file_name, uint16_t id)
 Start playing a sound file (non-blocking).
void Abort ()
 Abort the currently playing sound (if any).
SoundState getState ()
 Get current sound playback state.
bool isActive ()
 Check whether the sound subsystem is active (initialized).
int8_t setVolume (uint8_t volume)
 Set playback volume as a percentage.
float getVersion ()
 Get current library version.

Function Documentation

◆ Abort()

void SoundControl::Abort ( )

Abort the currently playing sound (if any).

◆ dispose()

int8_t SoundControl::dispose ( )

Dispose/stop the sound subsystem and release resources.

Returns
Status code:
  • 0 : success
  • 1 : not initialized
Examples
SoundControl/main.cpp, and TtsControl/main.cpp.

◆ getState()

SoundState SoundControl::getState ( )

Get current sound playback state.

Returns
Current SoundState.
Examples
SoundControl/main.cpp.

◆ getVersion()

float SoundControl::getVersion ( )

Get current library version.

Original note: format 0.XYZ (3 digits after major).

Returns
Version as float.
Examples
SoundControl/main.cpp.

◆ init()

int8_t SoundControl::init ( )

Initialize sound control.

Returns
Status code:
  • 0 : success
  • 1 : already running
  • -1 : loading failed
Examples
SoundControl/main.cpp, and TtsControl/main.cpp.

◆ isActive()

bool SoundControl::isActive ( )

Check whether the sound subsystem is active (initialized).

Returns
true if initialized; false otherwise.

◆ play()

int8_t SoundControl::play ( std::string file_name,
uint16_t id )

Start playing a sound file (non-blocking).

Parameters
file_nameFull path of the sound file.
idUser-defined sound identifier forwarded to SoundEvent callbacks.
Returns
Status code:
  • 0 : success
  • -1 : sound control not initialized
  • -2 : file not found
Note
Playback happens asynchronously; use SoundEvent callbacks to track progress.
Examples
SoundControl/main.cpp, and TtsControl/main.cpp.

◆ setVolume()

int8_t SoundControl::setVolume ( uint8_t volume)

Set playback volume as a percentage.

Parameters
volumeVolume percentage (0..100).
Returns
0 on success; negative value on failure.
Examples
SoundControl/main.cpp.