Kore
Loading...
Searching...
No Matches
soundstream.h
Go to the documentation of this file.
1#pragma once
2
3#include <kinc/global.h>
4
5#include <stdbool.h>
6#include <stdint.h>
7
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16struct stb_vorbis;
17
18typedef struct kinc_a1_sound_stream {
19 struct stb_vorbis *vorbis;
20 int chans;
21 int rate;
22 bool myLooping;
23 float myVolume;
24 bool rateDecodedHack;
25 bool end;
26 float samples[2];
27 uint8_t *buffer;
28} kinc_a1_sound_stream_t;
29
36KINC_FUNC kinc_a1_sound_stream_t *kinc_a1_sound_stream_create(const char *filename, bool looping);
37
43KINC_FUNC float *kinc_a1_sound_stream_next_frame(kinc_a1_sound_stream_t *stream);
44
50KINC_FUNC int kinc_a1_sound_stream_channels(kinc_a1_sound_stream_t *stream);
51
57KINC_FUNC int kinc_a1_sound_stream_sample_rate(kinc_a1_sound_stream_t *stream);
58
64KINC_FUNC bool kinc_a1_sound_stream_looping(kinc_a1_sound_stream_t *stream);
65
71KINC_FUNC void kinc_a1_sound_stream_set_looping(kinc_a1_sound_stream_t *stream, bool loop);
72
78KINC_FUNC bool kinc_a1_sound_stream_ended(kinc_a1_sound_stream_t *stream);
79
85KINC_FUNC float kinc_a1_sound_stream_length(kinc_a1_sound_stream_t *stream);
86
92KINC_FUNC float kinc_a1_sound_stream_position(kinc_a1_sound_stream_t *stream);
93
98KINC_FUNC void kinc_a1_sound_stream_reset(kinc_a1_sound_stream_t *stream);
99
105KINC_FUNC float kinc_a1_sound_stream_volume(kinc_a1_sound_stream_t *stream);
106
112KINC_FUNC void kinc_a1_sound_stream_set_volume(kinc_a1_sound_stream_t *stream, float value);
113
114#ifdef __cplusplus
115}
116#endif
Provides basic functionality that's used all over the place. There's usually no need to manually incl...
KINC_FUNC kinc_a1_sound_stream_t * kinc_a1_sound_stream_create(const char *filename, bool looping)
Create a sound-stream from a wav file.
Definition soundstream.c.h:16
KINC_FUNC float kinc_a1_sound_stream_length(kinc_a1_sound_stream_t *stream)
Returns the length of the stream.
Definition soundstream.c.h:73
KINC_FUNC bool kinc_a1_sound_stream_looping(kinc_a1_sound_stream_t *stream)
Returns whether the stream loops automatically.
Definition soundstream.c.h:53
KINC_FUNC float * kinc_a1_sound_stream_next_frame(kinc_a1_sound_stream_t *stream)
Gets the next audio-frame in the stream.
Definition soundstream.c.h:92
KINC_FUNC float kinc_a1_sound_stream_position(kinc_a1_sound_stream_t *stream)
Returns the current playing-position of the stream.
Definition soundstream.c.h:79
KINC_FUNC void kinc_a1_sound_stream_set_volume(kinc_a1_sound_stream_t *stream, float value)
Sets the stream's volume-multiplicator.
Definition soundstream.c.h:65
KINC_FUNC void kinc_a1_sound_stream_reset(kinc_a1_sound_stream_t *stream)
Resets the stream to its start-position.
Definition soundstream.c.h:85
KINC_FUNC int kinc_a1_sound_stream_sample_rate(kinc_a1_sound_stream_t *stream)
Gets the sample-rate used by the stream.
Definition soundstream.c.h:49
KINC_FUNC bool kinc_a1_sound_stream_ended(kinc_a1_sound_stream_t *stream)
Returns whether the stream finished playing.
Definition soundstream.c.h:69
KINC_FUNC void kinc_a1_sound_stream_set_looping(kinc_a1_sound_stream_t *stream, bool loop)
Changes whether the stream is looped automatically.
Definition soundstream.c.h:57
KINC_FUNC int kinc_a1_sound_stream_channels(kinc_a1_sound_stream_t *stream)
Gets the number of audio-channels the stream uses.
Definition soundstream.c.h:45
KINC_FUNC float kinc_a1_sound_stream_volume(kinc_a1_sound_stream_t *stream)
Gets the stream's volume-multiplicator.
Definition soundstream.c.h:61
Definition soundstream.h:18