Creates a mp3 decoder out of two functions: a reader and a seeker. Both must work together for things to work.
A destructor is present on this object, but not explicitly documented in the source.
Closes the decoder, freeing memory associated with it. Remember, this does NOT close any file you referred to in your reader and seeker delegates, it just frees internal memory.
Decodes the next frame of data and stores it in frameSamplesFloat (also accessible through frameSamples as short).
Calls seek(0). This function is provided for compatibility with older versions of the MP3Decoder api and has no other use.
Seeks the decoder to the given sample number, so the next call to decodeNextFrame will move to that part of the file.
Does nothing. Only provided for compatibility with older versions of the MP3Decoder api.
Returns the bitrate of the first frame, in kbps.
Returns the number of channels in the file. Note the channel data is interlaced, meaning the first sample is left channel, second sample right channel, then back and forth (assuming two channels, of course).
Returns the duration of the mp3, in seconds, if available, or float.nan if it is unknown (unknown may happen because it is an unseekable stream without metadata).
Returns the current frame, as prepared by decodeNextFrame, in signed 16 bit (short) format.
Returns the current frame, as prepared by decodeNextFrame, in floating point (float) format.
Returns the sample rate, in hz, of the audio stream. Note that this is per channel, so if this returns 44,100 hz and channels returns 2, you'd have a total of 88,200 samples per second between the two channels.
Returns the number of samples in the current frame, as prepared by decodeNextFrame.
Returns true if the object is in a valid state. May be false if the stream was corrupted or reached end-of-file.
The high-level D api for mp3 decoding. You construct it with a read and seek function, then inspect the members for info about the mp3, then call decodeNextFrame and frameSamplesFloat in a loop to get the data until frameSamplesFloat returns an empty array, indicating you've hit the end of file.