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

Sound-Streams are decoded while playing and as such are useful for large audio-files like music or speech. More...

#include <kinc/global.h>
#include <stdbool.h>
#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  kinc_a1_sound_stream

Typedefs

typedef struct kinc_a1_sound_stream kinc_a1_sound_stream_t

Functions

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.
KINC_FUNC float * kinc_a1_sound_stream_next_frame (kinc_a1_sound_stream_t *stream)
 Gets the next audio-frame in the stream.
KINC_FUNC int kinc_a1_sound_stream_channels (kinc_a1_sound_stream_t *stream)
 Gets the number of audio-channels the stream uses.
KINC_FUNC int kinc_a1_sound_stream_sample_rate (kinc_a1_sound_stream_t *stream)
 Gets the sample-rate used by the stream.
KINC_FUNC bool kinc_a1_sound_stream_looping (kinc_a1_sound_stream_t *stream)
 Returns whether the stream loops automatically.
KINC_FUNC void kinc_a1_sound_stream_set_looping (kinc_a1_sound_stream_t *stream, bool loop)
 Changes whether the stream is looped automatically.
KINC_FUNC bool kinc_a1_sound_stream_ended (kinc_a1_sound_stream_t *stream)
 Returns whether the stream finished playing.
KINC_FUNC float kinc_a1_sound_stream_length (kinc_a1_sound_stream_t *stream)
 Returns the length of the stream.
KINC_FUNC float kinc_a1_sound_stream_position (kinc_a1_sound_stream_t *stream)
 Returns the current playing-position of the stream.
KINC_FUNC void kinc_a1_sound_stream_reset (kinc_a1_sound_stream_t *stream)
 Resets the stream to its start-position.
KINC_FUNC float kinc_a1_sound_stream_volume (kinc_a1_sound_stream_t *stream)
 Gets the stream's volume-multiplicator.
KINC_FUNC void kinc_a1_sound_stream_set_volume (kinc_a1_sound_stream_t *stream, float value)
 Sets the stream's volume-multiplicator.

Detailed Description

Sound-Streams are decoded while playing and as such are useful for large audio-files like music or speech.

Function Documentation

◆ kinc_a1_sound_stream_channels()

KINC_FUNC int kinc_a1_sound_stream_channels ( kinc_a1_sound_stream_t * stream)

Gets the number of audio-channels the stream uses.

Parameters
streamThe stream to extract the number of channels from
Returns
The number of audio-channels

◆ kinc_a1_sound_stream_create()

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.

Parameters
filenameA path to a wav file
loopingDefines whether the stream will be looped automatically
Returns
The newly created sound-stream

◆ kinc_a1_sound_stream_ended()

KINC_FUNC bool kinc_a1_sound_stream_ended ( kinc_a1_sound_stream_t * stream)

Returns whether the stream finished playing.

Parameters
streamThe stream to query
Returns
Whether the stream finished playing

◆ kinc_a1_sound_stream_length()

KINC_FUNC float kinc_a1_sound_stream_length ( kinc_a1_sound_stream_t * stream)

Returns the length of the stream.

Parameters
streamThe stream to query
Returns
The length of the stream in seconds

◆ kinc_a1_sound_stream_looping()

KINC_FUNC bool kinc_a1_sound_stream_looping ( kinc_a1_sound_stream_t * stream)

Returns whether the stream loops automatically.

Parameters
streamThe stream to extract the looping-information from
Returns
Whether the stream loops

◆ kinc_a1_sound_stream_next_frame()

KINC_FUNC float * kinc_a1_sound_stream_next_frame ( kinc_a1_sound_stream_t * stream)

Gets the next audio-frame in the stream.

Parameters
streamThe stream to extract the frame from
Returns
The next sample

◆ kinc_a1_sound_stream_position()

KINC_FUNC float kinc_a1_sound_stream_position ( kinc_a1_sound_stream_t * stream)

Returns the current playing-position of the stream.

Parameters
streamThe stream to query
Returns
The current playing-position in seconds

◆ kinc_a1_sound_stream_reset()

KINC_FUNC void kinc_a1_sound_stream_reset ( kinc_a1_sound_stream_t * stream)

Resets the stream to its start-position.

Parameters
streamThe stream to change

◆ kinc_a1_sound_stream_sample_rate()

KINC_FUNC int kinc_a1_sound_stream_sample_rate ( kinc_a1_sound_stream_t * stream)

Gets the sample-rate used by the stream.

Parameters
streamThe stream to extract the sample-rate from
Returns
The sample-rate of the stream

◆ kinc_a1_sound_stream_set_looping()

KINC_FUNC void kinc_a1_sound_stream_set_looping ( kinc_a1_sound_stream_t * stream,
bool loop )

Changes whether the stream is looped automatically.

Parameters
streamThe stream to change
loopThe new loop value to set

◆ kinc_a1_sound_stream_set_volume()

KINC_FUNC void kinc_a1_sound_stream_set_volume ( kinc_a1_sound_stream_t * stream,
float value )

Sets the stream's volume-multiplicator.

Parameters
streamThe stream to change
valueThe volume-multiplicator

◆ kinc_a1_sound_stream_volume()

KINC_FUNC float kinc_a1_sound_stream_volume ( kinc_a1_sound_stream_t * stream)

Gets the stream's volume-multiplicator.

Parameters
streamThe stream to query
Returns
The volume-multiplicator