IWMEncAudioSource.Duration

Windows Media Encoder SDK banner art

The Duration property retrieves the duration of the audio source.

Syntax

Long = IWMEncAudioSource.Duration

Parameters

This property takes no parameters.

Property Value

A Long that indicates the duration of the audio source, in milliseconds.

Remarks

Retrieve the Duration property after you have configured your encoding session and a call to WMEncoder.PrepareToEncode has succeeded.

This property is read-only.

Example Code

' Create a WMEncoder object.
  Dim Encoder As WMEncoder
  Set Encoder = New WMEncoder

' Create a source group.
  Dim SrcGrpColl As IWMEncSourceGroupCollection
  Dim SrcGrp As IWMEncSourceGroup
  Set SrcGrpColl = Encoder.SourceGroupCollection
  Set SrcGrp = SrcGrpColl.Add("SG_1")

' Create an IWMEncAudioSource object, add an audio source to
' the source group, and specify an input file.
  Dim SrcAud As IWMEncAudioSource
  Set SrcAud = SrcGrp.AddSource(WMENC_AUDIO)
  SrcAud.SetInput "C:\Audiosource.wav" ' REPLACE THIS.

' Finish configuring the encoding session with a profile and
' the path and file name for the output.

' Prepare to start encoding.
  Encoder.PrepareToEncode True

' Retrieve the duration of the audio input, in seconds.
  Dim lAudDuration As Long
  lAudDuration = SrcAud.Duration / 1000

Requirements

Reference: Windows Media Encoder

Library: wmenc.exe

See Also