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

Audio2 is a low-level audio-API that allows you to directly provide a stream of audio-samples. More...

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

Go to the source code of this file.

Data Structures

struct  kinc_a2_buffer

Macros

#define KINC_A2_MAX_CHANNELS   8

Typedefs

typedef struct kinc_a2_buffer kinc_a2_buffer_t

Functions

KINC_FUNC void kinc_a2_init (void)
 Initializes the Audio2-API.
KINC_FUNC void kinc_a2_set_callback (void(*kinc_a2_audio_callback)(kinc_a2_buffer_t *buffer, uint32_t samples, void *userdata), void *userdata)
 Sets the callback that's used to provide audio-samples. This is the primary method of operation for Audio2. The callback is expected to write the requested number of samples into the ring-buffer. The callback is typically called from the system's audio-thread to minimize audio-latency.
KINC_FUNC uint32_t kinc_a2_samples_per_second (void)
 The current sample-rate of the system.
KINC_FUNC void kinc_a2_set_sample_rate_callback (void(*kinc_a2_sample_rate_callback)(void *userdata), void *userdata)
 Sets a callback that's called when the system's sample-rate changes.
KINC_FUNC void kinc_a2_update (void)
 kinc_a2_update should be called every frame. It is required by some systems to pump their audio-loops but on most systems it is a no-op.
KINC_FUNC void kinc_a2_shutdown (void)
 Shuts down the Audio2-API.
void kinc_a2_internal_init (void)
bool kinc_a2_internal_callback (kinc_a2_buffer_t *buffer, int samples)
void kinc_a2_internal_sample_rate_callback (void)

Detailed Description

Audio2 is a low-level audio-API that allows you to directly provide a stream of audio-samples.

Function Documentation

◆ kinc_a2_set_callback()

KINC_FUNC void kinc_a2_set_callback ( void(* kinc_a2_audio_callback )(kinc_a2_buffer_t *buffer, uint32_t samples, void *userdata),
void * userdata )

Sets the callback that's used to provide audio-samples. This is the primary method of operation for Audio2. The callback is expected to write the requested number of samples into the ring-buffer. The callback is typically called from the system's audio-thread to minimize audio-latency.

Parameters
kinc_a2_audio_callbackThe callback to set
userdataThe user data provided to the callback

◆ kinc_a2_set_sample_rate_callback()

KINC_FUNC void kinc_a2_set_sample_rate_callback ( void(* kinc_a2_sample_rate_callback )(void *userdata),
void * userdata )

Sets a callback that's called when the system's sample-rate changes.

Parameters
kinc_a2_sample_rate_callbackThe callback to set
userdataThe user data provided to the callback
Returns