BASS_Encode_StartCAFile
Sets up an encoder on a channel, using a CoreAudio codec and sending the output to a file.
HENCODE BASS_Encode_StartCAFile(
DWORD handle,
DWORD ftype,
DWORD atype,
DWORD flags,
DWORD bitrate,
char *file
);
Parameters
handle | The channel handle... a HSTREAM, HMUSIC, or HRECORD.
|
ftype | File format identifier.
|
atype | Audio data format identifier.
|
flags | A combination of these flags.
BASS_ENCODE_FP_8BIT, BASS_ENCODE_FP_16BIT, BASS_ENCODE_FP_24BIT, BASS_ENCODE_FP_32BIT | Convert floating-point sample data to 8/16/24/32 bit integer before encoding. These flags are ignored if the channel is not floating-point and the BASS_CONFIG_FLOATDSP option is not enabled.
| BASS_ENCODE_MONO | Convert to mono before encoding.
| BASS_ENCODE_QUEUE | Queue data to feed the encoder asynchronously. This prevents the data source (DSP system or BASS_Encode_Write call) getting blocked by the encoder, but if data is queud more quickly than the encoder can process it, that could result in lost data.
| BASS_ENCODE_PAUSE | Start the encoder in a paused state.
| BASS_ENCODE_AUTOFREE | Automatically free the encoder when the source channel is freed. If queuing is enabled, any remaining queued data will be sent to the encoder before it is freed.
| BASS_UNICODE | file is a Unicode (UTF-16) filename.
|
|
bitrate | The bitrate in bits per second... 0 = the codec's default bitrate.
|
file | The filename to write.
|
Return value
The encoder handle is returned if the encoder is successfully started, else 0 is returned. Use
BASS_ErrorGetCode to get the error code.
Error codes
BASS_ERROR_HANDLE | handle is not valid.
|
BASS_ERROR_FILEFORM | ftype is not valid.
|
BASS_ERROR_CODEC | atype is not valid or supported with ftype.
|
BASS_ERROR_NOTAVAIL | bitrate is not supported by the codec.
|
BASS_ERROR_FORMAT | The channel's sample format is not supported by the codec.
|
BASS_ERROR_CREATE | The file could not be created.
|
BASS_ERROR_UNKNOWN | Some other mystery problem!
|
Remarks
This function is identical to
BASS_Encode_StartCA, except that it writes the encoded data to a file instead of a callback function.
Platform-specific
This function is only available on OSX and iOS.
Example
Start encoding a channel to an ALAC file (output.m4a).
BASS_Encode_StartCAFile(channel, 'm4af', 'alac', 0, 0, "output.m4a");
BASS_ChannelPlay(channel, 0); // start the channel playing & encoding
Start encoding a channel to a 128 kb/s AAC MP4 file (output.mp4).
BASS_Encode_StartCAFile(channel, 'mp4f', 'aac ', 0, 128000, "output.mp4");
BASS_ChannelPlay(channel, 0); // start the channel playing & encoding
See also
BASS_Encode_GetACMFormat,
BASS_Encode_IsActive,
BASS_Encode_SetPaused,
BASS_Encode_Start,
BASS_Encode_StartCA,
BASS_Encode_Stop,
BASS_Encode_Write,
BASS_CONFIG_ENCODE_PRIORITY