Kore
Loading...
Searching...
No Matches
sound.h File Reference

Sounds are pre-decoded on load and therefore primarily useful for playing sound-effects. More...

#include <kinc/global.h>
#include <kinc/audio2/audio.h>
#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  kinc_a1_sound

Typedefs

typedef struct kinc_a1_sound kinc_a1_sound_t

Enumerations

enum  kinc_a1_audioformat_t { KINC_A1_AUDIOFORMAT_WAV , KINC_A1_AUDIOFORMAT_OGG }

Functions

KINC_FUNC kinc_a1_sound_t * kinc_a1_sound_create (const char *filename)
 Create a sound from a wav or ogg file.
KINC_FUNC kinc_a1_sound_t * kinc_a1_sound_create_from_buffer (uint8_t *audio_data, const uint32_t size, kinc_a1_audioformat_t format)
 Create a sound from a buffer.
KINC_FUNC void kinc_a1_sound_destroy (kinc_a1_sound_t *sound)
 Destroy a sound.
KINC_FUNC float kinc_a1_sound_volume (kinc_a1_sound_t *sound)
 Gets the current volume-multiplicator that's used when playing the sound.
KINC_FUNC void kinc_a1_sound_set_volume (kinc_a1_sound_t *sound, float value)
 Sets the volume-multiplicator that's used when playing the sound.

Detailed Description

Sounds are pre-decoded on load and therefore primarily useful for playing sound-effects.

Function Documentation

◆ kinc_a1_sound_create()

KINC_FUNC kinc_a1_sound_t * kinc_a1_sound_create ( const char * filename)

Create a sound from a wav or ogg file.

Parameters
filenamePath to a wav or ogg file
Returns
The newly created sound

◆ kinc_a1_sound_create_from_buffer()

KINC_FUNC kinc_a1_sound_t * kinc_a1_sound_create_from_buffer ( uint8_t * audio_data,
const uint32_t size,
kinc_a1_audioformat_t format )

Create a sound from a buffer.

Parameters
filenamePath to a wav file
Returns
The newly created sound

◆ kinc_a1_sound_destroy()

KINC_FUNC void kinc_a1_sound_destroy ( kinc_a1_sound_t * sound)

Destroy a sound.

Parameters
soundThe sound to destroy.

◆ kinc_a1_sound_set_volume()

KINC_FUNC void kinc_a1_sound_set_volume ( kinc_a1_sound_t * sound,
float value )

Sets the volume-multiplicator that's used when playing the sound.

Parameters
soundThe sound to modify
valueThe volume-multiplicator to set

◆ kinc_a1_sound_volume()

KINC_FUNC float kinc_a1_sound_volume ( kinc_a1_sound_t * sound)

Gets the current volume-multiplicator that's used when playing the sound.

Parameters
soundThe sound to query
Returns
The volume-multiplicator