//
// Bindings for the dr_mp3 + dr_flac wrapper compiled in source/build.sh.
//
// Each decode_* call hands back a heap-allocated s16 PCM buffer; the caller
// owns it and must release it with `decoder_free()`. The buffer is
// interleaved (L,R,L,R,…) for stereo, or mono for 1ch.
//

#scope_module

#if OS == .LINUX  decoders :: #library,no_dll "linux/decoders";
#if OS == .MACOS  decoders :: #library,no_dll "macos/decoders";

#scope_export

decode_mp3 :: (
    data:                   *void,
    data_size:              u64,
    out_channels:           *u32,
    out_sample_rate:        *u32,
    out_total_pcm_frames:   *u64,
) -> *s16 #foreign decoders "player_decode_mp3";

decode_flac :: (
    data:                   *void,
    data_size:              u64,
    out_channels:           *u32,
    out_sample_rate:        *u32,
    out_total_pcm_frames:   *u64,
) -> *s16 #foreign decoders "player_decode_flac";

decoder_free :: (p: *void) #foreign decoders "player_decoder_free";
