Share via


WMEncProfile2.EnumAudioFormat

Windows Media Encoder SDK banner art

The EnumAudioFormat method retrieves information about a specific audio format.

Syntax

Long = WMEncProfile2.EnumAudioFormat(lCodecIndex, lFormatIndex, varName, varSamplingRate, varNChannels, varBitsPerSample)

Parameters

lCodecIndex

[in]  Long containing the audio codec index.

lFormatIndex

[in]  Long containing the audio format index.

varName

[out]  Returns a Variant specifying the audio format name.

varSamplingRate

[out]  Returns a Variant containing the sampling rate, specified in samples per second (Hz).

varNChannels

[out]  Returns a Variant containing the number of channels; for example, 2 for stereo or 1 for mono.

varBitsPerSample

[out]  Returns a Variant containing the bits per sample.

Return Values

This method returns a Long indicating the bit rate of the current audio format, a Variant containing the audio codec name, a Variant containing the sampling rate, a Variant containing the number of channels, and a Variant containing the bits per sample.

Remarks

Use the IWMEncAudienceObj.AudioCodec property to retrieve the index of the audio codec that is used by the current profile. Use the AudioCodecCount property to retrieve the total number of audio codecs available in the current profile.

Use the IWMEncAudienceObj.AudioFormat property to retrieve the index of the audio format that is used by the current audience. Use the AudioFormatCount property to retrieve the total number of audio formats that a specific audio codec supports.

Example Code

' Create a WMEncProfile2 object.
  Dim Pro As WMEncProfile2
  Set Pro = New WMEncProfile2

' Load a custom profile. REPLACE THE FILE NAME.
  Pro.LoadFromFile "C:\Profiles\CustomProfile.prx"

' Create an IWMEncAudienceObj object, selecting the first audience (0)
' in the profile.
  Dim Audnc As IWMEncAudienceObj
  Set Audnc = Pro.Audience(0)

' Retrieve the index of the audio codec that is used by the current
' audience.
  Dim lAudCodec As Long
  lAudCodec = Audnc.AudioCodec(0)

' Retrieve the index of the audio format that is used by the current
' audio codec.
  Dim lAudFormat As Long
  lAudFormat = Audnc.AudioFormat(0)

' Use the audio format index to retrieve information such as its name.
  Dim lAudVal1 As Long, vAudFormatName As Variant
  Dim vChannels As Variant, vSRate As Variant, vBitSample As Variant
  lAudVal1 = Pro.EnumAudioFormat(lAudCodec, lAudFormat, _
    vAudFormatName, vSRate, vChannels, vBitSample)

Requirements

Reference: Windows Media Encoder

Library: wmenc.exe

See Also