libfishsound  1.0.0
Typedefs | Functions
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. More...
 

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. More...
 
long fish_sound_encode_float (FishSound *fsound, float *pcm[], long frames)
 Encode a block of PCM audio given as non-interleaved floats. More...
 
long fish_sound_encode_float_ilv (FishSound *fsound, float **pcm, long frames)
 Encode a block of audio given as interleaved floats. More...
 

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
fsoundThe FishSound* handle
bufThe encoded data
bytesThe count of bytes encoded
user_dataArbitrary user data
Return values
0to continue
non-zeroto 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
fsoundA FishSound* handle (created with mode FISH_SOUND_ENCODE)
pcmThe audio data to encode
framesA 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
fsoundA FishSound* handle (created with mode FISH_SOUND_ENCODE)
pcmThe audio data to encode
framesA 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
fsoundA FishSound* handle (created with mode FISH_SOUND_ENCODE)
encodedThe callback to call
user_dataArbitrary user data to pass to the callback
Returns
0 on success, -1 on failure