Skip to content
modkitv0.2

audio.h

#include <modkit/audio.h>92 functions · 17 structs · 6 enums · 17 typedefs · 6 macros

Playback, spatial audio, effects, capture, and recording.

Audio uses Modkit world coordinates: right-handed, Y-up, -Z-forward. Handles are generational; stale handles fail with MK_ERROR_INVALID_ARGUMENT. Unless documented otherwise, control functions are called from the app thread.

Functions

mk_audio_analyzer_attach_busfunction

mk_result mk_audio_analyzer_attach_bus(mk_audio_analyzer_t analyzer, mk_audio_bus_t bus, uint32_t order)

Attach bus for the audio analyzer.

ParameterTypeDescription
analyzermk_audio_analyzer_tValue for analyzer.
busmk_audio_bus_tValue for bus.
orderuint32_tValue for order.

Returns MK_SUCCESS or an error result.

mk_audio_analyzer_attach_soundfunction

mk_result mk_audio_analyzer_attach_sound(mk_audio_analyzer_t analyzer, mk_sound_t sound, uint32_t order)

Attach sound for the audio analyzer.

ParameterTypeDescription
analyzermk_audio_analyzer_tValue for analyzer.
soundmk_sound_tValue for sound.
orderuint32_tValue for order.

Returns MK_SUCCESS or an error result.

mk_audio_analyzer_createfunction

mk_result mk_audio_analyzer_create(const mk_audio_analyzer_desc *desc, mk_audio_analyzer_t *out_analyzer)

Create audio analyzer.

ParameterTypeDescription
descconst mk_audio_analyzer_desc *Configuration descriptor.
out_analyzermk_audio_analyzer_t *Receives the analyzer.

Returns MK_SUCCESS or an error result.

mk_audio_analyzer_desc_initfunction

mk_audio_analyzer_desc mk_audio_analyzer_desc_init(void)

Initialize the audio analyzer desc.

Returns The resulting value.

mk_audio_analyzer_destroyfunction

mk_result mk_audio_analyzer_destroy(mk_audio_analyzer_t analyzer)

Destroy the audio analyzer.

ParameterTypeDescription
analyzermk_audio_analyzer_tValue for analyzer.

Returns MK_SUCCESS or an error result.

mk_audio_analyzer_detachfunction

mk_result mk_audio_analyzer_detach(mk_audio_analyzer_t analyzer)

Detach audio analyzer.

ParameterTypeDescription
analyzermk_audio_analyzer_tValue for analyzer.

Returns MK_SUCCESS or an error result.

mk_audio_analyzer_is_validfunction

bool mk_audio_analyzer_is_valid(mk_audio_analyzer_t h)

Test whether the audio analyzer is valid.

ParameterTypeDescription
hmk_audio_analyzer_tValue for h.

Returns True when the condition holds.

mk_audio_analyzer_spectrumfunction

uint32_t mk_audio_analyzer_spectrum(mk_audio_analyzer_t analyzer, float *out_bins, uint32_t bin_count)

Writes linearly grouped magnitudes from DC to Nyquist and returns the number of bins written.

Values are normalized linear amplitudes, not decibels.

ParameterTypeDescription
analyzermk_audio_analyzer_tValue for analyzer.
out_binsfloat *Receives the bins.
bin_countuint32_tNumber of bin entries.

Returns The resulting value.

mk_audio_analyzer_waveformfunction

uint32_t mk_audio_analyzer_waveform(mk_audio_analyzer_t analyzer, float *out_samples, uint32_t sample_count)

Returns the number of samples written, oldest to newest.

ParameterTypeDescription
analyzermk_audio_analyzer_tValue for analyzer.
out_samplesfloat *Receives the samples.
sample_countuint32_tNumber of sample entries.

Returns The resulting value.

mk_audio_blob_freefunction

void mk_audio_blob_free(mk_audio_blob *blob)

Free audio blob.

ParameterTypeDescription
blobmk_audio_blob *Value for blob.

mk_audio_bus_createfunction

mk_result mk_audio_bus_create(const char *name, mk_audio_bus_t *out_bus)

Create audio bus.

ParameterTypeDescription
nameconst char *Stable name.
out_busmk_audio_bus_t *Receives the bus.

Returns MK_SUCCESS or an error result.

mk_audio_bus_destroyfunction

mk_result mk_audio_bus_destroy(mk_audio_bus_t bus)

Destroy the audio bus.

ParameterTypeDescription
busmk_audio_bus_tValue for bus.

Returns MK_SUCCESS or an error result.

mk_audio_bus_fadefunction

mk_result mk_audio_bus_fade(mk_audio_bus_t bus, float to, double seconds)

Perform the audio bus fade operation.

ParameterTypeDescription
busmk_audio_bus_tValue for bus.
tofloatValue for to.
secondsdoubleValue for seconds.

Returns MK_SUCCESS or an error result.

mk_audio_bus_get_volumefunction

float mk_audio_bus_get_volume(mk_audio_bus_t bus)

Get volume from the audio bus.

ParameterTypeDescription
busmk_audio_bus_tValue for bus.

Returns The resulting value.

mk_audio_bus_is_validfunction

bool mk_audio_bus_is_valid(mk_audio_bus_t h)

Test whether the audio bus is valid.

ParameterTypeDescription
hmk_audio_bus_tValue for h.

Returns True when the condition holds.

mk_audio_bus_masterfunction

mk_audio_bus_t mk_audio_bus_master(void)

Perform the audio bus master operation.

Returns The resulting handle or value.

mk_audio_bus_pausefunction

mk_result mk_audio_bus_pause(mk_audio_bus_t bus)

Pause the audio bus.

ParameterTypeDescription
busmk_audio_bus_tValue for bus.

Returns MK_SUCCESS or an error result.

mk_audio_bus_resumefunction

mk_result mk_audio_bus_resume(mk_audio_bus_t bus)

Resume the audio bus.

ParameterTypeDescription
busmk_audio_bus_tValue for bus.

Returns MK_SUCCESS or an error result.

mk_audio_bus_set_volumefunction

mk_result mk_audio_bus_set_volume(mk_audio_bus_t bus, float volume)

Set volume on the audio bus.

ParameterTypeDescription
busmk_audio_bus_tValue for bus.
volumefloatValue for volume.

Returns MK_SUCCESS or an error result.

mk_audio_capture_availablefunction

uint32_t mk_audio_capture_available(mk_audio_capture_t capture)

Perform the audio capture available operation.

ParameterTypeDescription
capturemk_audio_capture_tValue for capture.

Returns The resulting value.

mk_audio_capture_closefunction

mk_result mk_audio_capture_close(mk_audio_capture_t capture)

Close audio capture.

ParameterTypeDescription
capturemk_audio_capture_tValue for capture.

Returns MK_SUCCESS or an error result.

mk_audio_capture_desc_initfunction

mk_audio_capture_desc mk_audio_capture_desc_init(void)

Initialize the audio capture desc.

Returns The resulting value.

mk_audio_capture_device_countfunction

uint32_t mk_audio_capture_device_count(void)

Perform the audio capture device count operation.

Returns The resulting value.

mk_audio_capture_device_infofunction

mk_result mk_audio_capture_device_info(uint32_t index, mk_audio_device_info *out_info)

Perform the audio capture device info operation.

ParameterTypeDescription
indexuint32_tZero-based index.
out_infomk_audio_device_info *Receives the info.

Returns MK_SUCCESS or an error result.

mk_audio_capture_get_statsfunction

mk_result mk_audio_capture_get_stats(mk_audio_capture_t capture, mk_audio_capture_stats *out_stats)

Get stats from the audio capture.

ParameterTypeDescription
capturemk_audio_capture_tValue for capture.
out_statsmk_audio_capture_stats *Receives the stats.

Returns MK_SUCCESS or an error result.

mk_audio_capture_is_validfunction

bool mk_audio_capture_is_valid(mk_audio_capture_t h)

Test whether the audio capture is valid.

ParameterTypeDescription
hmk_audio_capture_tValue for h.

Returns True when the condition holds.

mk_audio_capture_openfunction

mk_result mk_audio_capture_open(const mk_audio_capture_desc *desc, mk_audio_capture_t *out_capture)

Open audio capture.

ParameterTypeDescription
descconst mk_audio_capture_desc *Configuration descriptor.
out_capturemk_audio_capture_t *Receives the capture.

Returns MK_SUCCESS or an error result.

mk_audio_capture_permissionfunction

mk_audio_permission_state mk_audio_capture_permission(void)

Perform the audio capture permission operation.

Returns The resulting value.

mk_audio_capture_readfunction

uint32_t mk_audio_capture_read(mk_audio_capture_t capture, void *frames, uint32_t frame_capacity)

Read audio capture.

ParameterTypeDescription
capturemk_audio_capture_tValue for capture.
framesvoid *Value for frames.
frame_capacityuint32_tValue for frame capacity.

Returns The resulting value.

mk_audio_capture_request_permissionfunction

mk_result mk_audio_capture_request_permission(void)

Request permission for the audio capture.

Returns MK_SUCCESS or an error result.

mk_audio_capture_set_monitorfunction

mk_result mk_audio_capture_set_monitor(mk_audio_capture_t capture, mk_audio_bus_t bus, float gain)

Set monitor on the audio capture.

ParameterTypeDescription
capturemk_audio_capture_tValue for capture.
busmk_audio_bus_tValue for bus.
gainfloatValue for gain.

Returns MK_SUCCESS or an error result.

mk_audio_capture_startfunction

mk_result mk_audio_capture_start(mk_audio_capture_t capture)

Start the audio capture.

ParameterTypeDescription
capturemk_audio_capture_tValue for capture.

Returns MK_SUCCESS or an error result.

mk_audio_capture_stopfunction

mk_result mk_audio_capture_stop(mk_audio_capture_t capture)

Stop the audio capture.

ParameterTypeDescription
capturemk_audio_capture_tValue for capture.

Returns MK_SUCCESS or an error result.

mk_audio_desc_initfunction

mk_audio_desc mk_audio_desc_init(void)

Initialize the audio desc.

Returns The resulting value.

mk_audio_effect_attach_busfunction

mk_result mk_audio_effect_attach_bus(mk_audio_effect_t effect, mk_audio_bus_t bus, uint32_t order)

Attach bus for the audio effect.

ParameterTypeDescription
effectmk_audio_effect_tValue for effect.
busmk_audio_bus_tValue for bus.
orderuint32_tValue for order.

Returns MK_SUCCESS or an error result.

mk_audio_effect_attach_soundfunction

mk_result mk_audio_effect_attach_sound(mk_audio_effect_t effect, mk_sound_t sound, uint32_t order)

Attach sound for the audio effect.

ParameterTypeDescription
effectmk_audio_effect_tValue for effect.
soundmk_sound_tValue for sound.
orderuint32_tValue for order.

Returns MK_SUCCESS or an error result.

mk_audio_effect_createfunction

mk_result mk_audio_effect_create(const mk_audio_effect_desc *desc, mk_audio_effect_t *out_effect)

Create audio effect.

ParameterTypeDescription
descconst mk_audio_effect_desc *Configuration descriptor.
out_effectmk_audio_effect_t *Receives the effect.

Returns MK_SUCCESS or an error result.

mk_audio_effect_desc_initfunction

mk_audio_effect_desc mk_audio_effect_desc_init(mk_audio_effect_type type)

Initialize the audio effect desc.

ParameterTypeDescription
typemk_audio_effect_typeValue for type.

Returns The resulting value.

mk_audio_effect_destroyfunction

mk_result mk_audio_effect_destroy(mk_audio_effect_t effect)

Destroy the audio effect.

ParameterTypeDescription
effectmk_audio_effect_tValue for effect.

Returns MK_SUCCESS or an error result.

mk_audio_effect_detachfunction

mk_result mk_audio_effect_detach(mk_audio_effect_t effect)

Detach audio effect.

ParameterTypeDescription
effectmk_audio_effect_tValue for effect.

Returns MK_SUCCESS or an error result.

mk_audio_effect_is_validfunction

bool mk_audio_effect_is_valid(mk_audio_effect_t h)

Test whether the audio effect is valid.

ParameterTypeDescription
hmk_audio_effect_tValue for h.

Returns True when the condition holds.

mk_audio_effect_set_bypassfunction

mk_result mk_audio_effect_set_bypass(mk_audio_effect_t effect, bool bypass)

Set bypass on the audio effect.

ParameterTypeDescription
effectmk_audio_effect_tValue for effect.
bypassboolValue for bypass.

Returns MK_SUCCESS or an error result.

mk_audio_effect_updatefunction

mk_result mk_audio_effect_update(mk_audio_effect_t effect, const mk_audio_effect_desc *desc)

Update audio effect.

ParameterTypeDescription
effectmk_audio_effect_tValue for effect.
descconst mk_audio_effect_desc *Configuration descriptor.

Returns MK_SUCCESS or an error result.

mk_audio_get_infofunction

mk_result mk_audio_get_info(mk_audio_info *out_info)

Get info from the audio.

ParameterTypeDescription
out_infomk_audio_info *Receives the info.

Returns MK_SUCCESS or an error result.

mk_audio_get_master_volumefunction

float mk_audio_get_master_volume(void)

Get master volume from the audio.

Returns The resulting value.

mk_audio_initfunction

mk_result mk_audio_init(const mk_audio_desc *desc)

Initialize the audio.

ParameterTypeDescription
descconst mk_audio_desc *Configuration descriptor.

Returns MK_SUCCESS or an error result.

mk_audio_is_initializedfunction

bool mk_audio_is_initialized(void)

Test whether the audio is initialized.

Returns True when the condition holds.

mk_audio_listener_set_transformfunction

mk_result mk_audio_listener_set_transform(uint32_t listener, mk_vec3 position, mk_vec3 forward, mk_vec3 up)

Set transform on the audio listener.

ParameterTypeDescription
listeneruint32_tValue for listener.
positionmk_vec3Value for position.
forwardmk_vec3Value for forward.
upmk_vec3Value for up.

Returns MK_SUCCESS or an error result.

mk_audio_listener_set_velocityfunction

mk_result mk_audio_listener_set_velocity(uint32_t listener, mk_vec3 velocity)

Set velocity on the audio listener.

ParameterTypeDescription
listeneruint32_tValue for listener.
velocitymk_vec3Value for velocity.

Returns MK_SUCCESS or an error result.

mk_audio_pause_allfunction

void mk_audio_pause_all(void)

Pause the all for the audio.

mk_audio_record_file_startfunction

mk_result mk_audio_record_file_start(mk_audio_capture_t capture, const char *wav_path, mk_audio_recording_t *out_recording)

Start the audio record file.

ParameterTypeDescription
capturemk_audio_capture_tValue for capture.
wav_pathconst char *Value for wav path.
out_recordingmk_audio_recording_t *Receives the recording.

Returns MK_SUCCESS or an error result.

mk_audio_record_memory_startfunction

mk_result mk_audio_record_memory_start(mk_audio_capture_t capture, size_t max_bytes, mk_audio_recording_t *out_recording)

Start the audio record memory.

ParameterTypeDescription
capturemk_audio_capture_tValue for capture.
max_bytessize_tMax bytes in bytes.
out_recordingmk_audio_recording_t *Receives the recording.

Returns MK_SUCCESS or an error result.

mk_audio_record_stopfunction

mk_result mk_audio_record_stop(mk_audio_recording_t recording, mk_audio_blob *out_wav)

Stops and destroys a recording handle.

out_wav is required for memory recordings and ignored (but cleared when provided) for file recordings.

ParameterTypeDescription
recordingmk_audio_recording_tValue for recording.
out_wavmk_audio_blob *Receives the wav.

Returns MK_SUCCESS or an error result.

mk_audio_recording_is_validfunction

bool mk_audio_recording_is_valid(mk_audio_recording_t h)

Test whether the audio recording is valid.

ParameterTypeDescription
hmk_audio_recording_tValue for h.

Returns True when the condition holds.

mk_audio_resume_allfunction

void mk_audio_resume_all(void)

Resume the all for the audio.

mk_audio_set_master_volumefunction

mk_result mk_audio_set_master_volume(float volume)

Set master volume on the audio.

ParameterTypeDescription
volumefloatValue for volume.

Returns MK_SUCCESS or an error result.

mk_audio_shutdownfunction

void mk_audio_shutdown(void)

Perform the audio shutdown operation.

mk_audio_spatial_desc_initfunction

mk_audio_spatial_desc mk_audio_spatial_desc_init(void)

Initialize the audio spatial desc.

Returns The resulting value.

mk_audio_stop_allfunction

void mk_audio_stop_all(void)

Stop the all for the audio.

mk_audio_updatefunction

void mk_audio_update(void)

Update audio.

mk_sound_create_streamfunction

mk_result mk_sound_create_stream(const mk_sound_stream_desc *desc, mk_sound_t *out_sound)

Create an application-fed bounded PCM stream.

ParameterTypeDescription
descconst mk_sound_stream_desc *Configuration descriptor.
out_soundmk_sound_t *Receives the sound.

Returns MK_SUCCESS or an error result.

mk_sound_desc_initfunction

mk_sound_desc mk_sound_desc_init(void)

Initialize the sound desc.

Returns The resulting value.

mk_sound_destroyfunction

mk_result mk_sound_destroy(mk_sound_t sound)

Destroy the sound.

ParameterTypeDescription
soundmk_sound_tValue for sound.

Returns MK_SUCCESS or an error result.

mk_sound_get_durationfunction

double mk_sound_get_duration(mk_sound_t sound)

Get duration from the sound.

ParameterTypeDescription
soundmk_sound_tValue for sound.

Returns The resulting value.

mk_sound_get_positionfunction

double mk_sound_get_position(mk_sound_t sound)

Get position from the sound.

ParameterTypeDescription
soundmk_sound_tValue for sound.

Returns The resulting value.

mk_sound_get_statefunction

mk_sound_state mk_sound_get_state(mk_sound_t sound)

Get state from the sound.

ParameterTypeDescription
soundmk_sound_tValue for sound.

Returns The resulting value.

mk_sound_get_volumefunction

float mk_sound_get_volume(mk_sound_t sound)

Get volume from the sound.

ParameterTypeDescription
soundmk_sound_tValue for sound.

Returns The resulting value.

mk_sound_is_at_endfunction

bool mk_sound_is_at_end(mk_sound_t sound)

Test whether the sound is at end.

ParameterTypeDescription
soundmk_sound_tValue for sound.

Returns True when the condition holds.

mk_sound_is_playingfunction

bool mk_sound_is_playing(mk_sound_t sound)

Test whether the sound is playing.

ParameterTypeDescription
soundmk_sound_tValue for sound.

Returns True when the condition holds.

mk_sound_is_validfunction

bool mk_sound_is_valid(mk_sound_t h)

Test whether the sound is valid.

ParameterTypeDescription
hmk_sound_tValue for h.

Returns True when the condition holds.

mk_sound_load_filefunction

mk_result mk_sound_load_file(const char *path, const mk_sound_desc *desc, mk_sound_t *out_sound)

Load file for the sound.

ParameterTypeDescription
pathconst char *Value for path.
descconst mk_sound_desc *Configuration descriptor.
out_soundmk_sound_t *Receives the sound.

Returns MK_SUCCESS or an error result.

mk_sound_load_memoryfunction

mk_result mk_sound_load_memory(const void *data, size_t size, const mk_sound_desc *desc, mk_sound_t *out_sound)

Copies encoded input bytes; the caller may release data after return.

ParameterTypeDescription
dataconst void *Data buffer.
sizesize_tSize in bytes.
descconst mk_sound_desc *Configuration descriptor.
out_soundmk_sound_t *Receives the sound.

Returns MK_SUCCESS or an error result.

mk_sound_pausefunction

mk_result mk_sound_pause(mk_sound_t sound)

Pause the sound.

ParameterTypeDescription
soundmk_sound_tValue for sound.

Returns MK_SUCCESS or an error result.

mk_sound_playfunction

mk_result mk_sound_play(mk_sound_t sound)

Play sound.

ParameterTypeDescription
soundmk_sound_tValue for sound.

Returns MK_SUCCESS or an error result.

mk_sound_resumefunction

mk_result mk_sound_resume(mk_sound_t sound)

Resume the sound.

ParameterTypeDescription
soundmk_sound_tValue for sound.

Returns MK_SUCCESS or an error result.

mk_sound_seekfunction

mk_result mk_sound_seek(mk_sound_t sound, double seconds)

Seek sound.

ParameterTypeDescription
soundmk_sound_tValue for sound.
secondsdoubleValue for seconds.

Returns MK_SUCCESS or an error result.

mk_sound_set_busfunction

mk_result mk_sound_set_bus(mk_sound_t sound, mk_audio_bus_t bus)

Set bus on the sound.

ParameterTypeDescription
soundmk_sound_tValue for sound.
busmk_audio_bus_tValue for bus.

Returns MK_SUCCESS or an error result.

mk_sound_set_loopingfunction

mk_result mk_sound_set_looping(mk_sound_t sound, bool loop)

Set looping on the sound.

ParameterTypeDescription
soundmk_sound_tValue for sound.
loopboolValue for loop.

Returns MK_SUCCESS or an error result.

mk_sound_set_panfunction

mk_result mk_sound_set_pan(mk_sound_t sound, float pan)

Set pan on the sound.

ParameterTypeDescription
soundmk_sound_tValue for sound.
panfloatValue for pan.

Returns MK_SUCCESS or an error result.

mk_sound_set_pitchfunction

mk_result mk_sound_set_pitch(mk_sound_t sound, float pitch)

Set pitch on the sound.

ParameterTypeDescription
soundmk_sound_tValue for sound.
pitchfloatValue for pitch.

Returns MK_SUCCESS or an error result.

mk_sound_set_spatialfunction

mk_result mk_sound_set_spatial(mk_sound_t sound, const mk_audio_spatial_desc *desc)

Set spatial on the sound.

ParameterTypeDescription
soundmk_sound_tValue for sound.
descconst mk_audio_spatial_desc *Configuration descriptor.

Returns MK_SUCCESS or an error result.

mk_sound_set_volumefunction

mk_result mk_sound_set_volume(mk_sound_t sound, float volume)

Set volume on the sound.

ParameterTypeDescription
soundmk_sound_tValue for sound.
volumefloatValue for volume.

Returns MK_SUCCESS or an error result.

mk_sound_stopfunction

mk_result mk_sound_stop(mk_sound_t sound)

Stop the sound.

ParameterTypeDescription
soundmk_sound_tValue for sound.

Returns MK_SUCCESS or an error result.

mk_sound_stream_capacityfunction

uint32_t mk_sound_stream_capacity(mk_sound_t sound)

Perform the sound stream capacity operation.

ParameterTypeDescription
soundmk_sound_tValue for sound.

Returns The resulting value.

mk_sound_stream_consumed_framesfunction

uint64_t mk_sound_stream_consumed_frames(mk_sound_t sound)

Perform the sound stream consumed frames operation.

ParameterTypeDescription
soundmk_sound_tValue for sound.

Returns The resulting value.

mk_sound_stream_desc_initfunction

mk_sound_stream_desc mk_sound_stream_desc_init(void)

Initialize the sound stream desc.

Returns The resulting value.

mk_sound_stream_finishfunction

mk_result mk_sound_stream_finish(mk_sound_t sound)

Mark the stream complete; playback ends after queued PCM is consumed.

ParameterTypeDescription
soundmk_sound_tValue for sound.

Returns MK_SUCCESS or an error result.

mk_sound_stream_flushfunction

mk_result mk_sound_stream_flush(mk_sound_t sound)

Drop queued PCM and reset stream counters/end-of-stream state.

ParameterTypeDescription
soundmk_sound_tValue for sound.

Returns MK_SUCCESS or an error result.

mk_sound_stream_overflowsfunction

uint64_t mk_sound_stream_overflows(mk_sound_t sound)

Perform the sound stream overflows operation.

ParameterTypeDescription
soundmk_sound_tValue for sound.

Returns The resulting value.

mk_sound_stream_queued_framesfunction

uint32_t mk_sound_stream_queued_frames(mk_sound_t sound)

Perform the sound stream queued frames operation.

ParameterTypeDescription
soundmk_sound_tValue for sound.

Returns The resulting value.

mk_sound_stream_underrunsfunction

uint64_t mk_sound_stream_underruns(mk_sound_t sound)

Perform the sound stream underruns operation.

ParameterTypeDescription
soundmk_sound_tValue for sound.

Returns The resulting value.

mk_sound_stream_writefunction

mk_result mk_sound_stream_write(mk_sound_t sound, const void *frames, uint32_t frame_count, uint32_t *out_written)

Write interleaved PCM frames without blocking.

out_written receives the number accepted. MK_ERROR_QUEUE_FULL means the ring could not accept the entire request; a partial write may still have occurred and is reported through out_written.

ParameterTypeDescription
soundmk_sound_tValue for sound.
framesconst void *Value for frames.
frame_countuint32_tNumber of frame entries.
out_writtenuint32_t *Receives the written.

Returns MK_SUCCESS or an error result.

Structs

mk_audio_analyzer_descstruct

A transparent PCM tap.

Attach it anywhere in a sound or bus effect chain, then read a recent mono waveform or FFT spectrum from the app thread.

FieldTypeDescription
fft_sizeuint32_tPower of two from 256..4096; zero defaults to 1024.
smoothingfloatSpectrum smoothing from 0 (none) to <1.

mk_audio_analyzer_tstruct

Data for audio analyzer.

FieldTypeDescription
iduint32_tThe ID.

mk_audio_blobstruct

Data for audio blob.

FieldTypeDescription
datavoid *The data.
sizesize_tThe size.

mk_audio_bus_tstruct

Data for audio bus.

FieldTypeDescription
iduint32_tThe ID.

mk_audio_capture_descstruct

Data for audio capture desc.

FieldTypeDescription
device_indexuint32_tUINT32_MAX selects the default device.
formatmk_audio_sample_formatThe format.
channelsuint32_tZero selects the device default.
sample_rateuint32_tZero selects the device default.
buffer_millisecondsuint32_tZero defaults to 500 ms.

mk_audio_capture_statsstruct

Data for audio capture stats.

FieldTypeDescription
frames_captureduint64_tThe frames captured.
frames_droppeduint64_tThe frames dropped.
frames_availableuint32_tThe frames available.

mk_audio_capture_tstruct

Data for audio capture.

FieldTypeDescription
iduint32_tThe ID.

mk_audio_descstruct

Data for audio desc.

FieldTypeDescription
sample_rateuint32_t0 selects the device-native rate.
channelsuint32_t0 selects the device-native channel count.
listener_countuint32_t1..4; zero defaults to one.
max_soundsuint32_tZero defaults to 256.
max_busesuint32_tZero defaults to 32.
max_effectsuint32_tZero defaults to 64.
max_analyzersuint32_tZero defaults to 16.
max_capturesuint32_tZero defaults to 8.
no_deviceboolOffline/headless engine for tests and tools.

mk_audio_device_infostruct

Data for audio device info.

FieldTypeDescription
indexuint32_tEnumeration-snapshot index used by capture descriptors.
namecharThe name.
is_defaultboolThe is default.

mk_audio_effect_descstruct

Data for audio effect desc.

FieldTypeDescription
typemk_audio_effect_typeThe type.
cutoff_hzfloatLow/high-pass.
orderuint32_tLow/high-pass order, 1..8.
delay_secondsfloatDelay.
decayfloatDelay feedback.
wetfloatThe wet.
dryfloatThe dry.
room_sizefloatReverb.
dampingfloatReverb.
widthfloatReverb.

mk_audio_effect_tstruct

Data for audio effect.

FieldTypeDescription
iduint32_tThe ID.

mk_audio_infostruct

Data for audio info.

FieldTypeDescription
sample_rateuint32_tThe sample rate.
channelsuint32_tThe channels.
listener_countuint32_tThe listener count.
playback_devicecharThe playback device.

mk_audio_recording_tstruct

Data for audio recording.

FieldTypeDescription
iduint32_tThe ID.

mk_audio_spatial_descstruct

Data for audio spatial desc.

FieldTypeDescription
positionmk_vec3The position.
velocitymk_vec3The velocity.
directionmk_vec3The direction.
positioningmk_audio_positioningThe positioning.
attenuationmk_audio_attenuationThe attenuation.
listeneruint32_tThe listener.
min_distancefloatThe min distance.
max_distancefloatThe max distance.
min_gainfloatThe min gain.
max_gainfloatThe max gain.
rollofffloatThe rolloff.
dopplerfloatThe doppler.
cone_inner_radiansfloatThe cone inner radians.
cone_outer_radiansfloatThe cone outer radians.
cone_outer_gainfloatThe cone outer gain.

mk_sound_descstruct

Data for sound desc.

FieldTypeDescription
streamboolThe stream.
loopboolThe loop.
spatialboolThe spatial.
listener_relativeboolThe listener relative.
listeneruint32_tThe listener.
busmk_audio_bus_tThe bus.

mk_sound_stream_descstruct

Descriptor for an application-fed bounded PCM stream.

Frames are interleaved. A zero sample rate selects the audio engine rate, zero channels select the engine channel count, and zero capacity selects a 500 ms ring. Streams are ordinary sounds and can be routed through buses, effects, analyzers, fades, pitch, and volume.

FieldTypeDescription
formatmk_audio_sample_formatThe format.
channelsuint32_tThe channels.
sample_rateuint32_tThe sample rate.
capacity_framesuint32_tThe capacity frames.
busmk_audio_bus_tThe bus.

mk_sound_tstruct

Data for sound.

FieldTypeDescription
iduint32_tThe ID.

Enums

mk_audio_attenuationenum

Values for audio attenuation.

ValueDescription
MK_AUDIO_ATTENUATION_NONESelects none.
MK_AUDIO_ATTENUATION_INVERSESelects inverse.
MK_AUDIO_ATTENUATION_LINEARSelects linear.
MK_AUDIO_ATTENUATION_EXPONENTIALSelects exponential.

mk_audio_effect_typeenum

Values for audio effect type.

ValueDescription
MK_AUDIO_EFFECT_LOWPASSSelects lowpass.
MK_AUDIO_EFFECT_HIGHPASSSelects highpass.
MK_AUDIO_EFFECT_DELAYSelects delay.
MK_AUDIO_EFFECT_REVERBSelects reverb.

mk_audio_permission_stateenum

Values for audio permission state.

ValueDescription
MK_AUDIO_PERMISSION_UNKNOWNSelects unknown.
MK_AUDIO_PERMISSION_PENDINGSelects pending.
MK_AUDIO_PERMISSION_GRANTEDSelects granted.
MK_AUDIO_PERMISSION_DENIEDSelects denied.
MK_AUDIO_PERMISSION_UNAVAILABLESelects unavailable.

mk_audio_positioningenum

Values for audio positioning.

ValueDescription
MK_AUDIO_POSITION_ABSOLUTESelects absolute.
MK_AUDIO_POSITION_LISTENER_RELATIVESelects listener relative.

mk_audio_sample_formatenum

Values for audio sample format.

ValueDescription
MK_AUDIO_FORMAT_F32Selects f32.
MK_AUDIO_FORMAT_S16Selects s16.

mk_sound_stateenum

Values for sound state.

ValueDescription
MK_SOUND_STATE_INVALIDSelects invalid.
MK_SOUND_STATE_READYSelects ready.
MK_SOUND_STATE_PLAYINGSelects playing.
MK_SOUND_STATE_PAUSEDSelects paused.
MK_SOUND_STATE_ENDEDSelects ended.
MK_SOUND_STATE_ERRORSelects error.

Typedefs

mk_audio_analyzer_desctypedef

typedef struct mk_audio_analyzer_desc mk_audio_analyzer_desc

A transparent PCM tap.

Attach it anywhere in a sound or bus effect chain, then read a recent mono waveform or FFT spectrum from the app thread.

mk_audio_attenuationtypedef

typedef enum mk_audio_attenuation mk_audio_attenuation

Values for audio attenuation.

mk_audio_blobtypedef

typedef struct mk_audio_blob mk_audio_blob

Data for audio blob.

mk_audio_capture_desctypedef

typedef struct mk_audio_capture_desc mk_audio_capture_desc

Data for audio capture desc.

mk_audio_capture_statstypedef

typedef struct mk_audio_capture_stats mk_audio_capture_stats

Data for audio capture stats.

mk_audio_desctypedef

typedef struct mk_audio_desc mk_audio_desc

Data for audio desc.

mk_audio_device_infotypedef

typedef struct mk_audio_device_info mk_audio_device_info

Data for audio device info.

mk_audio_effect_desctypedef

typedef struct mk_audio_effect_desc mk_audio_effect_desc

Data for audio effect desc.

mk_audio_effect_typetypedef

typedef enum mk_audio_effect_type mk_audio_effect_type

Values for audio effect type.

mk_audio_infotypedef

typedef struct mk_audio_info mk_audio_info

Data for audio info.

mk_audio_permission_statetypedef

typedef enum mk_audio_permission_state mk_audio_permission_state

Values for audio permission state.

mk_audio_positioningtypedef

typedef enum mk_audio_positioning mk_audio_positioning

Values for audio positioning.

mk_audio_sample_formattypedef

typedef enum mk_audio_sample_format mk_audio_sample_format

Values for audio sample format.

mk_audio_spatial_desctypedef

typedef struct mk_audio_spatial_desc mk_audio_spatial_desc

Data for audio spatial desc.

mk_sound_desctypedef

typedef struct mk_sound_desc mk_sound_desc

Data for sound desc.

mk_sound_statetypedef

typedef enum mk_sound_state mk_sound_state

Values for sound state.

mk_sound_stream_desctypedef

typedef struct mk_sound_stream_desc mk_sound_stream_desc

Descriptor for an application-fed bounded PCM stream.

Frames are interleaved. A zero sample rate selects the audio engine rate, zero channels select the engine channel count, and zero capacity selects a 500 ms ring. Streams are ordinary sounds and can be routed through buses, effects, analyzers, fades, pitch, and volume.

Macros

MK_AUDIO_ANALYZER_INVALIDdefine

MK_AUDIO_ANALYZER_INVALID

Invalid sentinel for audio analyzer.

MK_AUDIO_BUS_INVALIDdefine

MK_AUDIO_BUS_INVALID

Invalid sentinel for audio bus.

MK_AUDIO_CAPTURE_INVALIDdefine

MK_AUDIO_CAPTURE_INVALID

Invalid sentinel for audio capture.

MK_AUDIO_EFFECT_INVALIDdefine

MK_AUDIO_EFFECT_INVALID

Invalid sentinel for audio effect.

MK_AUDIO_RECORDING_INVALIDdefine

MK_AUDIO_RECORDING_INVALID

Invalid sentinel for audio recording.

MK_SOUND_INVALIDdefine

MK_SOUND_INVALID

Invalid sentinel for sound.