Share via


IWMEncAudienceObj.AudioFormat

Windows Media Encoder SDK banner art

The AudioFormat property specifies and retrieves the index of the audio format used by the current audience.

Syntax

IWMEncAudienceObj.AudioFormat(iRenderSiteIndex) = Long
Long = IWMEncAudienceObj.AudioFormat(iRenderSiteIndex)

Parameters

iRenderSiteIndex

[in]  Integer containing the audience stream index. Because an audience can only contain one stream of each type, iRenderSiteIndex must be zero.

Property Value

A Long that indicates the index of the audio format.

Remarks

Use the WMEncProfile2.EnumAudioFormat method to retrieve additional information about the audio format, such as its name, bit rate, channels, sampling rate, and bits per sample. Use the SetAudioConfig method to set these values.

This index corresponds to the total number of formats supported by the audio codec, which you can retrieve using the WMEncProfile2.AudioFormatCount property.

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