Kore 3
Loading...
Searching...
No Matches
sound.h
Go to the documentation of this file.
1#ifndef KORE_MIXER_SOUND_HEADER
2#define KORE_MIXER_SOUND_HEADER
3
4#include <kore3/global.h>
5
6#include <kore3/audio/audio.h>
7
8#include <stdint.h>
9
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
18typedef struct kore_mixer_sound {
19 uint8_t channel_count;
20 uint8_t bits_per_sample;
21 uint32_t samples_per_second;
22 int16_t *left;
23 int16_t *right;
24 int size;
25 float sample_rate_pos;
26 float volume;
27 bool in_use;
29
30typedef enum { KORE_MIXER_AUDIOFORMAT_WAV, KORE_MIXER_AUDIOFORMAT_OGG } kore_mixer_audioformat;
31
37KORE_FUNC kore_mixer_sound *kore_mixer_sound_create_from_file(const char *filename);
38
46KORE_FUNC kore_mixer_sound *kore_mixer_sound_create_from_file_buffer(uint8_t *audio_data, uint32_t size, kore_mixer_audioformat format);
47
56KORE_FUNC kore_mixer_sound *kore_mixer_sound_create_from_samples(int16_t *samples, uint32_t samples_count, uint32_t samples_per_second, bool stereo);
57
63
70
76KORE_FUNC void kore_mixer_sound_set_volume(kore_mixer_sound *sound, float value);
77
78#ifdef __cplusplus
79}
80#endif
81
82#endif
This 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...
KORE_FUNC kore_mixer_sound * kore_mixer_sound_create_from_file_buffer(uint8_t *audio_data, uint32_t size, kore_mixer_audioformat format)
Create a sound from the contents of a wav or ogg file.
KORE_FUNC void kore_mixer_sound_destroy(kore_mixer_sound *sound)
Destroy a sound.
KORE_FUNC kore_mixer_sound * kore_mixer_sound_create_from_file(const char *filename)
Create a sound from a wav or ogg file.
KORE_FUNC float kore_mixer_sound_volume(kore_mixer_sound *sound)
Gets the current volume-multiplicator that's used when playing the sound.
KORE_FUNC kore_mixer_sound * kore_mixer_sound_create_from_samples(int16_t *samples, uint32_t samples_count, uint32_t samples_per_second, bool stereo)
Create a sound from an array of samples.
KORE_FUNC void kore_mixer_sound_set_volume(kore_mixer_sound *sound, float value)
Sets the volume-multiplicator that's used when playing the sound.
Definition sound.h:18