Microsoft DirectX 8.1 (C++)

IDirectSoundBuffer8::SetFrequency

The SetFrequency method sets the frequency at which the audio samples are played.

Syntax

HRESULT SetFrequency(
  DWORD dwFrequency 
);

Parameters

dwFrequency

New frequency, in hertz (Hz), at which to play the audio samples. The value must be in the range DSBFREQUENCY_MIN to DSBFREQUENCY_MAX. These values are currently defined in Dsound.h as 100 and 100,000 respectively.

If the value is DSBFREQUENCY_ORIGINAL, the frequency is reset to the default value in the buffer format. This format is specified in the IDirectSound8::CreateSoundBuffer method.

Return Values

If the method succeeds, the return value is DS_OK.

If the method fails, the return value may be one of the following error values:

Return code
DSERR_CONTROLUNAVAIL
DSERR_GENERIC
DSERR_INVALIDPARAM
DSERR_PRIOLEVELNEEDED

Remarks

Increasing or decreasing the frequency changes the perceived pitch of the audio data. This method does not affect the format of the buffer.

This method is not valid for the primary buffer.

Requirements

  Header: Declared in dsound.h.

See Also