// This file is part of the 64k demo project. // Experimental MP3 sample decoding (non-STRIP_ALL only). // Entire API unavailable when STRIP_ALL is defined (compile error on use). #pragma once #include #include #if !defined(STRIP_ALL) // Opaque MP3 decoder. Create with mp3_open(), destroy with mp3_close(). // Output format: mono f32 PCM at 32 kHz (matches synth sample rate). // |data| passed to mp3_open() must remain valid for the decoder's lifetime // (embedded asset byte arrays satisfy this automatically). struct Mp3Decoder; // Open an in-memory MP3 blob for range decoding. // Returns nullptr on error. Mp3Decoder* mp3_open(const uint8_t* data, size_t size); // Seek to |start_frame| and decode up to |num_frames| f32 mono samples into // |out|. Returns the number of frames actually decoded (may be < num_frames at // end of stream). int mp3_decode_range(Mp3Decoder* dec, int start_frame, int num_frames, float* out); // Release the decoder. void mp3_close(Mp3Decoder* dec); #endif // !STRIP_ALL