Share via


IWMEncAudienceObj.SetAudioConfig

Windows Media Encoder SDK banner art

The SetAudioConfig method specifies the audio format settings for the current audience.

Syntax

IWMEncAudienceObj.SetAudioConfig(iRenderSiteIndex, nChannels, nSamplesPerSec, lBitrate, wBitsPerSample)

Parameters

iRenderSiteIndex

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

nChannels

[in]  Integer containing the number of channels; for example, 2 for stereo or 1 for mono.

nSamplesPerSec

[in]  Long containing the sampling rate, specified in samples per second (Hz).

lBitrate

[in]  Long containing the bit rate, specified in bits per second (bps).

wBitsPerSample

[in]  Integer containing the bits per sample.

Return Values

This method does not return a value.

Remarks

Use SetAudioConfig to select an audio format for the current audience by specifying its configuration settings. You must specify the settings of an audio format that is supported by the audio codec used by the current audience.

You can also use WMEncProfile2.EnumAudioFormat to enumerate the supported audio formats and their settings, and then use the AudioFormat property to specify the index of the audio format to use.

Example Code

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

' Set the profile's content type to audio and video.
  Pro.ContentType = 17

' Set the VBR mode for both audio and video to CBR.
  Pro.VBRMode(WMENC_AUDIO, 0) = WMENC_PVM_NONE
  Pro.VBRMode(WMENC_VIDEO, 0) = WMENC_PVM_NONE

' Add a new audience with a bit rate of 100 Kbps. By default, the WMA and
' WMV codecs are used. The audio format defaults to the one closest to the
' specified bit rate (10 Kbps, 16 kHz, mono CBR).
  Dim Audnc As IWMEncAudienceObj
  Set Audnc = Pro.AddAudience(100000)

' Change the audio configuration to 8 Kbps, 8 kHz, mono CBR.
  Audnc.SetAudioConfig 0, 1, 8000, 8000, 16

Requirements

Reference: Windows Media Encoder

Library: wmenc.exe

See Also