Kore
Loading...
Searching...
No Matches
sound.h
Go to the documentation of this file.
1#pragma once
2
3#include <kinc/global.h>
4
5#include <kinc/audio2/audio.h>
6
7#include <stdint.h>
8
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
17typedef struct kinc_a1_sound {
18 uint8_t channel_count;
19 uint8_t bits_per_sample;
20 uint32_t samples_per_second;
21 int16_t *left;
22 int16_t *right;
23 int size;
24 float sample_rate_pos;
25 float volume;
26 bool in_use;
27} kinc_a1_sound_t;
28
29typedef enum { KINC_A1_AUDIOFORMAT_WAV, KINC_A1_AUDIOFORMAT_OGG } kinc_a1_audioformat_t;
30
36KINC_FUNC kinc_a1_sound_t *kinc_a1_sound_create(const char *filename);
37
43KINC_FUNC kinc_a1_sound_t *kinc_a1_sound_create_from_buffer(uint8_t *audio_data, const uint32_t size, kinc_a1_audioformat_t format);
44
49KINC_FUNC void kinc_a1_sound_destroy(kinc_a1_sound_t *sound);
50
56KINC_FUNC float kinc_a1_sound_volume(kinc_a1_sound_t *sound);
57
63KINC_FUNC void kinc_a1_sound_set_volume(kinc_a1_sound_t *sound, float value);
64
65#ifdef __cplusplus
66}
67#endif
Audio2 is a low-level audio-API that allows you to directly provide a stream of audio-samples.
Provides basic functionality that's used all over the place. There's usually no need to manually incl...
KINC_FUNC void kinc_a1_sound_destroy(kinc_a1_sound_t *sound)
Destroy a sound.
Definition sound.c.h:222
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.
Definition sound.c.h:234
KINC_FUNC float kinc_a1_sound_volume(kinc_a1_sound_t *sound)
Gets the current volume-multiplicator that's used when playing the sound.
Definition sound.c.h:230
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.
Definition sound.c.h:107
KINC_FUNC kinc_a1_sound_t * kinc_a1_sound_create(const char *filename)
Create a sound from a wav or ogg file.
Definition sound.c.h:191
Definition sound.h:17