BASS WMA

BASS_WMA_EncodeOpen


Initializes WMA encoding to a user defined function.

HWMENCODE BASS_WMA_EncodeOpen(
    DWORD freq,
    DWORD chans,
    DWORD flags,
    DWORD bitrate,
    WMENCODEPROC *proc,
    void *user
);

Parameters

freqThe sample rate, or a BASS channel handle if the BASS_WMA_ENCODE_SOURCE flag is specified.
chansThe number of channels. More than stereo requires WMA Pro or PCM.
flagsA combination of these flags.
BASS_SAMPLE_8BITS8-bit sample data. If neither this or the BASS_SAMPLE_FLOAT flags are specified, then 16-bit data is expected.
BASS_SAMPLE_FLOAT32-bit floating-point sample data.
BASS_WMA_ENCODE_SOURCEUse the BASS channel with the handle in freq as the encoder's source. The chans parameter is ignored, as are the BASS_SAMPLE_8BITS and BASS_SAMPLE_FLOAT flags. If the BASSenc add-on is loaded, then the BASS_CONFIG_ENCODE_PRIORITY setting is used to determine where in the channel's DSP chain the encoding is performed, otherwise priority -1000 is used.
BASS_WMA_ENCODE_STANDARDUse standard WMA encoding. If neither this or the BASS_WMA_ENCODE_PRO flag (nor the BASS_WMA_ENCODE_PCM flag) is specified, then either WMA codec could be used, depending on which supports the requested sample format and bitrate.
BASS_WMA_ENCODE_PROUse WMA Pro encoding.
BASS_WMA_ENCODE_PCMWrite uncompressed PCM data in an ASF container. bitrate is ignored except that it should be non-0.
BASS_WMA_ENCODE_24BITEncode in 24-bit, else 16-bit. 24-bit encoding requires WMA Pro or PCM.
BASS_WMA_ENCODE_SCRIPTEnable the specification of tags mid-stream (after encoding has begun).
BASS_WMA_ENCODE_QUEUEQueue data to feed the encoder asynchronously. This prevents BASS_WMA_EncodeWrite getting blocked by the encoder, but the application should control the rate at which data is encoded, as it is possible to queue too much data for the encoder to handle.
bitrateThe encoding bitrate, or VBR quality (100 or less).
procThe user defined function to receive the encoded data.
userUser instance data to pass to the callback function.

Return value

If successful, the new encoder's handle is returned, else FALSE 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 requested sample format and bitrate.
BASS_ERROR_UNKNOWNSome other mystery problem!

Remarks

Encoding to a user defined function allows any storage or delivery method to be used for the encoded WMA data. For example, encoding to memory.

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. Use BASS_WMA_EncodeGetRates to retrieve a list of the encoding bitrates available for a specific sample format.

Use BASS_WMA_EncodeSetTag to set tags, BASS_WMA_EncodeWrite to encode sample data, and BASS_WMA_EncodeClose to finish encoding.

See also

BASS_WMA_EncodeClose, BASS_WMA_EncodeGetRates, BASS_WMA_EncodeOpenFile, BASS_WMA_EncodeOpenNetwork, BASS_WMA_EncodeSetTag, BASS_WMA_EncodeWrite, WMENCODEPROC callback