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

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

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

Go to the source code of this file.

Data Structures

struct  kore_audio_buffer

Macros

#define KORE_AUDIO_MAX_CHANNELS   8

Typedefs

typedef struct kore_audio_buffer kore_audio_buffer

Functions

KORE_FUNC void kore_audio_init (void)
 Initializes the Audio2-API.
KORE_FUNC void kore_audio_set_callback (void(*kore_audio_callback)(kore_audio_buffer *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.
KORE_FUNC uint32_t kore_audio_samples_per_second (void)
 The current sample-rate of the system.
KORE_FUNC void kore_audio_set_sample_rate_callback (void(*kore_audio_sample_rate_callback)(void *userdata), void *userdata)
 Sets a callback that's called when the system's sample-rate changes.
KORE_FUNC void kore_audio_update (void)
 kore_audio_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.
KORE_FUNC void kore_audio_shutdown (void)
 Shuts down the Audio2-API.
void kore_audio_internal_init (void)
bool kore_audio_internal_callback (kore_audio_buffer *buffer, int samples)
void kore_audio_internal_sample_rate_callback (void)

Detailed Description

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

Function Documentation

◆ kore_audio_set_callback()

KORE_FUNC void kore_audio_set_callback ( void(* kore_audio_callback )(kore_audio_buffer *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
kore_audio_callbackThe callback to set
userdataThe user data provided to the callback

◆ kore_audio_set_sample_rate_callback()

KORE_FUNC void kore_audio_set_sample_rate_callback ( void(* kore_audio_sample_rate_callback )(void *userdata),
void * userdata )

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

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