FormatAudioGetByIndex Method (IMFormat)
type of the format
index of the format
properties of current audio format (bitrate, number of channels, value of samples per second and number of tracks)
full name of format (for example, "44100 Hz, 6 Ch, 16-bit")
Gets the audio format by its index.
Syntax
Sub FormatAudioGetByIndex( _
   ByVal _eFormatType As eMFormatType, _
   ByVal _nIndex As Integer, _
   ByRef _pAudProps As M_AUD_PROPS, _
   ByRef _pbsName As String _
) 
void FormatAudioGetByIndex( 
   eMFormatType _eFormatType,
   int _nIndex,
   out M_AUD_PROPS _pAudProps,
   out string _pbsName
)
procedure FormatAudioGetByIndex( 
    _eFormatType: eMFormatType;
    _nIndex: Integer;
   Out  _pAudProps: M_AUD_PROPS;
   Out  _pbsName: String
); 
void FormatAudioGetByIndex( 
   eMFormatType _eFormatType,
   int _nIndex,
   [PARAMFLAG::Out] M_AUD_PROPS _pAudProps,
   [PARAMFLAG::Out] BSTR* _pbsName
) 

Parameters

_eFormatType
type of the format
_nIndex
index of the format
_pAudProps
properties of current audio format (bitrate, number of channels, value of samples per second and number of tracks)
_pbsName
full name of format (for example, "44100 Hz, 6 Ch, 16-bit")
Example

Here is example of how to set standard format to the playlist:

Dim myPlaylist As New MPlaylistClass()
Dim audProps As New M_AUD_PROPS()
Dim strFormat As String
Dim nCount As Integer
myPlaylist.FormatAudioGetCount(nCount)
myPlaylist.FormatAudioGetByIndex(eMFormatType.eMFT_Convert, nCount - 1, audProps, strFormat)
myPlaylist.FormatAudioSet(eMFormatType.eMFT_Convert, audProps)
MPlaylistClass myPlaylist = new MPlaylistClass();
M_AUD_PROPS audProps = new M_AUD_PROPS();
string strFormat;
int nCount;
myPlaylist.FormatAudioGetCount(out nCount);
myPlaylist.FormatAudioGetByIndex(eMFormatType.eMFT_Convert, nCount - 1, out audProps, out strFormat);
myPlaylist.FormatAudioSet(eMFormatType.eMFT_Convert, ref audProps);
var
myPlaylist: MPlaylist;
myFormat: IMFormat;
nCount: integer;
audProps: M_AUD_PROPS;
strFormat: string;
begin
myPlaylist:= CreateComObject(CLASS_MPlaylist) as MPlaylist;
myFormat := myPlaylist as IMFormat;
myFormat.FormatAudioGetCount(nCount);
myFormat.FormatAudioGetByIndex(eMFT_Convert, nCount-2, audProps, strFormat);
myFormat.FormatAudioSet(eMFT_Convert, audProps);
end;
See Also

Reference

IMFormat Interface
IMFormat Members