Presents the user with a list of available ACM codec output formats to choose from (or suggests one).
DWORD BASS_Encode_GetACMFormat(
DWORD handle,
void *form,
DWORD formlen,
char *title,
DWORD flags
);
| handle | The channel handle... a HSTREAM, HMUSIC, or HRECORD. | ||||||||||
| form | Format buffer. | ||||||||||
| formlen | Size of the format buffer. If this is 0, then a suggested format buffer length is returned. | ||||||||||
| title | Window title for the selector... NULL = "Choose the output format". | ||||||||||
| flags | A combination of these flags.
|
| BASS_ERROR_HANDLE | handle is not valid. |
| BASS_ERROR_NOTAVAIL | There are no codecs available that will accept the channel's format. |
| BASS_ERROR_ACM_CANCEL | The user pressed the "cancel" button. |
| BASS_ERROR_UNKNOWN | Some other mystery problem! |
The form buffer contents are actually a WAVEFORMATEX structure, and if writing the encoder output to a WAVE file, would be the format chunk ("fmt ") of the file.
DWORD formlen=BASS_Encode_GetACMFormat(0, NULL, 0, (char*)NULL, 0); // get suggested format buffer size
void *form=malloc(formlen); // allocate the format buffer
if (BASS_Encode_GetACMFormat(channel, form, formlen, (char*)NULL, 0)) // let the user choose a codec
BASS_Encode_StartACMFile(channel, form, 0, "acm.wav"); // begin encoding using the codec
free(form); // free the format buffer
Without letting the user choose, setup an MP3 encoder on a channel.
DWORD formlen=BASS_Encode_GetACMFormat(0, NULL, 0, (char*)NULL, 0); // get suggested format buffer size
void *form=malloc(formlen); // allocate the format buffer
if (BASS_Encode_GetACMFormat(channel, form, formlen, (char*)NULL,
MAKELONG(BASS_ACM_SUGGEST|BASS_ACM_RATE|BASS_ACM_CHANS, WAVE_FORMAT_MPEGLAYER3)) // get the format details
BASS_Encode_StartACMFile(channel, form, BASS_ENCODE_NOHEAD, "acm.mp3"); // begin encoding without a WAVE header
free(form); // free the format buffer