RandyGaul / cute_headers

Collection of cross-platform one-file C/C++ libraries with no dependencies, primarily used for games
4.24k stars 264 forks source link

Redesign cute_sound.h high level API #295

Closed RandyGaul closed 1 year ago

RandyGaul commented 2 years ago

Should pretty much look like Cute Framework's API.

struct sound_params_t
{
    bool paused = false;
    bool looped = false;
    float volume = 1.0f;
    float pan = 0.5f;
    float pitch = 1.0f;
    float delay = 0;
};

struct sound_t { uint64_t id = 0; };

CUTE_API sound_t CUTE_CALL sound_play(audio_t* audio_source, sound_params_t params = sound_params_t(), error_t* err = NULL);

CUTE_API bool CUTE_CALL sound_is_active(sound_t sound);
CUTE_API bool CUTE_CALL sound_get_is_paused(sound_t sound);
CUTE_API bool CUTE_CALL sound_get_is_looped(sound_t sound);
CUTE_API float CUTE_CALL sound_get_volume(sound_t sound);
CUTE_API int CUTE_CALL sound_get_sample_index(sound_t sound);
CUTE_API void CUTE_CALL sound_set_is_paused(sound_t sound, bool true_for_paused);
CUTE_API void CUTE_CALL sound_set_is_looped(sound_t sound, bool true_for_looped);
CUTE_API void CUTE_CALL sound_set_volume(sound_t sound, float volume);
CUTE_API void CUTE_CALL sound_set_sample_index(sound_t sound, int sample_index);

// -------------------------------------------------------------------------------------------------

CUTE_API void CUTE_CALL audio_set_pan(float pan);
CUTE_API void CUTE_CALL audio_set_global_volume(float volume);
CUTE_API void CUTE_CALL audio_set_sound_volume(float volume);
CUTE_API void CUTE_CALL audio_set_pause(bool true_for_paused);