Namespace: Un4seen.Bass.AddOn.Wma
Assembly: Bass.Net (in Bass.Net.dll) Version: 2.4.17.5
Parameters
- freq
- Type: SystemInt32
The sample rate in Hz, or a BASS channel handle if the BASS_WMA_ENCODE_SOURCE flag is specified. - chans
- Type: SystemInt32
The number of channels (1=mono, 2=stereo, etc.). - flags
- Type: Un4seen.Bass.AddOn.WmaBASSWMAEncode
Any combination of these flags (see BASSWMAEncode):BASS_WMA_ENCODE_RATES_VBR Get available VBR (Variable BitRate) quality settings. BASS_WMA_ENCODE_RATES_CBR Get available CBR (Constant BitRate) quality settings. BASS_WMA_ENCODE_STANDARD Get only bitrates available 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_PRO Get only bitrates available for WMA Pro encoding. BASS_WMA_ENCODE_24BIT Get available bitrates for 24-bit encoding, else 16-bit encoding rates. BASS_WMA_ENCODE_SOURCE Use the sample format of the BASS channel with the handle in freq. The chans parameter is ignored.
Return Value
Type: Int32If succesful, an array of the available bitrates is returned (int[], in bits per second), else is returned. Use BASS_ErrorGetCode to get the error code.
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.
ERROR CODE | Description |
---|---|
BASS_ERROR_WMA | The Windows Media modules (v9 or above) are not installed. |
BASS_ERROR_NOTAVAIL | No codec could be found to support the specified sample format. |
BASS_ERROR_UNKNOWN | Some other mystery problem! |
int[] bitrates = BassWma.BASS_WMA_EncodeGetRates(44100, 2, BASSWMAEncode.BASS_WMA_ENCODE_RATES_CBR ); if (bitrates != null) { foreach (int bitrate in bitrates) Console.WriteLine( bitrate ); }