libfishsound: Decoding audio data

# Decoding audio data

To decode audio data using libfishsound:. More...

To decode audio data using libfishsound:.

- create a FishSound* object with mode FISH_SOUND_DECODE. fish_sound_new() will return a new FishSound* object, initialised for decoding, and the FishSoundInfo structure will be cleared.
- provide a FishSoundDecoded_* callback for libfishsound to call when it has decoded audio.
- (optionally) specify whether you want to receive interleaved or per-channel PCM data, using a fish_sound_set_interleave(). The default is for per-channel (non-interleaved) PCM.
- feed encoded audio data to libfishsound via fish_sound_decode(). libfishsound will decode the audio for you, calling the FishSoundDecoded_* callback you provided earlier each time it has a block of audio ready.
- when finished, call fish_sound_delete().

This procedure is illustrated in src/examples/fishsound-decode.c. Note that this example additionally:

- uses liboggz to demultiplex audio data from an Ogg encapsulated FLAC, Speex or Vorbis stream. The step of feeding encoded data to libfishsound is done within the OggzReadPacket callback.
- uses libsndfile to write the decoded audio to a WAV file.

Hence this example code demonstrates all that is needed to decode Ogg FLAC, Speex or Ogg Vorbis files: