Encoding audio data
To encode audio data using libfishsound:
More...
To encode audio data using libfishsound:
- create a FishSound* object with mode FISH_SOUND_ENCODE, and with a FishSoundInfo structure filled in with the required encoding parameters. fish_sound_new() will return a new FishSound* object initialised for encoding.
- provide a FishSoundEncoded callback for libfishsound to call when it has a block of encoded audio
- feed raw PCM audio data to libfishsound via fish_sound_encode_*(). libfishsound will encode the audio for you, calling the FishSoundEncoded callback you provided earlier each time it has a block of encoded audio ready.
- when finished, call fish_sound_delete().
This procedure is illustrated in src/examples/fishsound-encode.c. Note that this example additionally:
- uses libsndfile to read input from a PCM audio file (WAV, AIFF, etc.)
- uses liboggz to encapsulate the encoded FLAC, Speex or Vorbis data in an Ogg stream.
Hence this example code demonstrates all that is needed to encode Ogg FLAC, Speex and Ogg Vorbis files: