encode.h File Reference

Encode functions and callback prototypes. More...

Go to the source code of this file.

## Typedefs

typedef int(* | FishSoundEncoded) (FishSound *fsound, unsigned char *buf, long bytes, void *user_data)
| Signature of a callback for libfishsound to call when it has encoded data.

## Functions

int | fish_sound_set_encoded_callback (FishSound *fsound, FishSoundEncoded encoded, void *user_data)
| Set the callback for libfishsound to call when it has a block of encoded data ready.
long | fish_sound_encode_float (FishSound *fsound, float *pcm[], long frames)
| Encode a block of PCM audio given as non-interleaved floats.
long | fish_sound_encode_float_ilv (FishSound *fsound, float **pcm, long frames)
| Encode a block of audio given as interleaved floats.

## Detailed Description

Encode functions and callback prototypes.

## Typedef Documentation

## FishSoundEncoded

typedef int(* FishSoundEncoded) (FishSound *fsound, unsigned char *buf, long bytes, void *user_data)

Signature of a callback for libfishsound to call when it has encoded data.

Parameters

  fsound | The FishSound* handle
  buf | The encoded data
  bytes | The count of bytes encoded
  user_data | Arbitrary user data

Return values

  0 | to continue
  non-zero | to stop encoding immediately and return control to the fish_sound_encode() caller

## Function Documentation

## fish_sound_encode_float()

long fish_sound_encode_float | ( | FishSound * | fsound,
|  | float * | pcm[],
|  | long | frames )

Encode a block of PCM audio given as non-interleaved floats.

Parameters

  fsound | A FishSound* handle (created with mode FISH_SOUND_ENCODE)
  pcm | The audio data to encode
  frames | A count of frames to encode

Returns
  The number of frames encoded

Note
  For multichannel audio, the audio data is interpreted according to the current PCM style

## fish_sound_encode_float_ilv()

long fish_sound_encode_float_ilv | ( | FishSound * | fsound,
|  | float ** | pcm,
|  | long | frames )

Encode a block of audio given as interleaved floats.

Parameters

  fsound | A FishSound* handle (created with mode FISH_SOUND_ENCODE)
  pcm | The audio data to encode
  frames | A count of frames to encode

Returns
  The number of frames encoded

Note
  For multichannel audio, the audio data is interpreted according to the current PCM style

## fish_sound_set_encoded_callback()

int fish_sound_set_encoded_callback | ( | FishSound * | fsound,
|  | FishSoundEncoded | encoded,
|  | void * | user_data )

Set the callback for libfishsound to call when it has a block of encoded data ready.

Parameters

  fsound | A FishSound* handle (created with mode FISH_SOUND_ENCODE)
  encoded | The callback to call
  user_data | Arbitrary user data to pass to the callback

Returns
  0 on success, -1 on failure