BASS WMA

BASS_WMA_EncodeGetRates


Retrieves the WMA encoding bitrates available for a specified sample format.

DWORD *BASS_WMA_EncodeGetRates(
    DWORD freq,
    DWORD chans,
    DWORD flags
);

Parameters

freqThe sample rate, or a BASS channel handle if the BASS_WMA_ENCODE_SOURCE flag is specified.
chansThe number of channels.
flagsA combination of these flags.
BASS_WMA_ENCODE_SOURCEUse the sample format of the BASS channel with the handle in freq. The chans parameter is ignored.
BASS_WMA_ENCODE_STANDARDGet available bitrates for standard WMA encoding. If neither this or the BASS_WMA_ENCODE_PRO flag is specified, then the bitrates available for either codec are returned.
BASS_WMA_ENCODE_PROGet available bitrates for WMA Pro encoding.
BASS_WMA_ENCODE_24BITGet available bitrates for 24-bit encoding, else 16-bit encoding rates.
BASS_WMA_ENCODE_RATES_VBRGet available VBR (Variable BitRate) quality settings, else CBR (Constant BitRate) rates.

Return value

If successful, a pointer to an array of the available bitrates is returned (terminated by a 0), else NULL is returned. Use BASS_ErrorGetCode to get the error code.

Error codes

BASS_ERROR_WMAThe Windows Media modules (v9 or above) are not installed.
BASS_ERROR_NOTAVAILNo codec could be found to support the specified sample format.
BASS_ERROR_UNKNOWNSome other mystery problem!

Remarks

When requesting VBR rates, the rates returned are quality settings. For example, 10 = 10% quality, 25 = 25% quality, etc... 100% quality is lossless.

The WMA codec expects 16-bit or 24-bit sample data depending on the BASS_WMA_ENCODE_24BIT flag, but BASSWMA will accept 8-bit, 16-bit or floating-point data, and convert it to the appropriate format. Of course, it makes little sense to encode 8-bit or 16-bit data in 24-bit.

The WMA codec currently supports the following sample rates: 8000, 11025, 16000, 22050, 32000, 44100, 48000, 88200, 96000. And the following number of channels: 1, 2, 6, 8. But not all combinations of these are supported. To encode other sample formats, the data will first have to be resampled to a supported format.

WMA Pro gives better quality than the standard WMA codec. Support for multi-channel (more than stereo) and 24-bit encoding is also only available with WMA Pro.

Example

List the CBR bitrates available at 44100hz 16-bit stereo.
DWORD *rates=BASS_WMA_EncodeGetRates(44100, 2, 0); // get a pointer to the available bitrates
if (rates)
    while (*rates) {
        printf("%d\n", *rates); // display the rate
        rates++; // move on to the next rate
    }

See also

BASS_WMA_EncodeOpen, BASS_WMA_EncodeOpenFile, BASS_WMA_EncodeOpenNetwork, BASS_WMA_EncodeOpenPublish