Decode File API

From Winamp Developer Wiki
Revision as of 04:33, 30 November 2010 by Culix (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Interface name: api_decodefile

Related interfaces: ifc_audiostream

Include file: Agave/DecodeFile/api_decodefile.h

Related files: Agave/DecodeFile/ifc_audiostream.h

GUID name: decodeFileGUID

GUID: {9B4188F5-4295-48ab-B50C-F2B0BB56D242}

Use:

api_decodefile allows you to decode audio files to PCM.

Uses by Winamp:

It is used by the CD Burner to decode files to Red Book audio prior to burning.

It is used by the Auto Tagger to decode files prior to feed to the analysis engine.

It is used by the IPC_CONVERTFILE API to decode files prior to feeding the encoder.

How to use:

Open an audio stream (ifc_audiostream) by calling OpenAudioBackground(). The passed AudioParameters struct may be filled with requested values; some formats are able to return multiple PCM data types and this can be used to request a particular format. Winamp will also apply resampling, bit decimation and downmixing, although it is not guaranteed to work in all situations. You need to verify the AudioParameters struct after opening the audio - it may have been opened with different parameters than what you wanted or expected!

The returned ifc_audiostream is then read sequentially. Call ReadAudio() continuously until 0 is returned or an error is reported. The audio stream is closed by calling api_decodefile's CloseAudio() method.