Unknown
From BASSenc
BASS_Encode_StartLimit
Sets up an encoder on a channel, and limits the amount of sample data that is fed to it.
HENCODE BASS_Encode_StartLimit(
DWORD handle,
char *cmdline,
DWORD flags,
ENCODEPROC *proc,
void *user,
DWORD limit
);
Parameters
| handle | The channel handle... a HSTREAM, HMUSIC, or HRECORD. | ||||||||||||||||||||||
| cmdline | The encoder command-line, including the executable filename and any options. Or the output filename if the BASS_ENCODE_PCM flag is used. | ||||||||||||||||||||||
| flags | A combination of these flags.
| ||||||||||||||||||||||
| proc | Optional callback function to receive the encoded data... NULL = no callback. To have the encoded data received by a callback function, the encoder needs to be told to output to STDOUT. | ||||||||||||||||||||||
| user | User instance data to pass to the callback function. | ||||||||||||||||||||||
| limit | The number of bytes of sample data to encode... 0 = unlimited. If one of the BASS_ENCODE_FP flags is used, the limit is applied after the effect of that. |
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_FILEOPEN | The encoder could not be started. Check that the executable exists. |
| BASS_ERROR_CREATE | The PCM file could not be created. |
| BASS_ERROR_UNKNOWN | Some other mystery problem! |
Remarks
This function is identical to BASS_Encode_Start, with the additional ability to limit the amount of sample data that is fed to the encoder. This can be useful in situations where the encoder needs to know in advance how much data it will be receiving. For example, when using a callback function with a file format that stores the length in the header, as the header cannot then be updated at the end of encoding. The length is communicated to the encoder via the WAVE header, so it requires that the BASS_ENCODE_NOHEAD flag is not used.Once the limit is hit, the encoder will "die". BASS_Encode_SetNotify can be used to be notified of that occurrence.
Example
Start encoding a channel to an MP3 file (output.mp3) using LAME with the standard preset settings, limiting it to 1000000 bytes of sample data.BASS_Encode_StartLimit(channel, "lame --alt-preset standard - output.mp3", 0, NULL, 0, 1000000); BASS_ChannelPlay(channel, 0); // start the channel playing & encoding
See also
BASS_Encode_AddChunk, BASS_Encode_CastInit, BASS_Encode_IsActive, BASS_Encode_SetNotify, BASS_Encode_SetPaused, BASS_Encode_Start, BASS_Encode_Stop, BASS_Encode_Write, ENCODEPROC callback, BASS_CONFIG_ENCODE_PRIORITY