FSOUND_SetFrequency

##### [API function]

## FSOUND_SetFrequency

Sets a channels frequency or playback rate, in HZ.

signed char F_API FSOUND_SetFrequency(
int channel,
int freq
);

### Parameters

channel | The channel number/handle to change the frequency for. FSOUND_ALL can also be used (see remarks).
freq | The frequency to set. Valid ranges are from 100 to 705600, and -100 to -705600.

### Return Value

On success, TRUE is returned.
On failure, FALSE is returned.

### Remarks

FSOUND_ALL is supported here. Passing this will set ALL channels to specified frequency.
If FSOUND_ALL is used the last channel success flag will be returned. This return value is not useful in most circumstances.
Negative frequencies make the sound play backwards, so FSOUND_SetCurrentPosition would be needed to set the sound to the right position.
---------
NOTE: FSOUND_HW3D limitations in Direct Sound.
Every hardware device has a minimum and maximum frequency. You can determine these by looking at the DirectSound caps and viewing the members dwMaxSecondarySampleRate and dwMaxSecondarySampleRate.
FMOD clamps frequencies to these values when playing back on hardware, so if you are setting the frequency outside of this range, the frequency will stay at either dwMinSecondarySampleRate or dwMaxSecondarySampleRate.
To find out these two values in fmod (maybe whether to decide to drop back to software mixing or not), you can use the following code.
---------
include <dsound.h>
int minhwfreq, maxhwfreq;
if (FSOUND_GetNumHardwareChannels() && FSOUND_GetOutput() == FSOUND_OUTPUT_DSOUND)
{
HRESULT hr;
DSCAPS dscaps;
memset(&dscaps, 0, sizeof(DSCAPS));
dscaps.dwSize = sizeof(DSCAPS);
hr = IDirectSound_GetCaps((LPDIRECTSOUND)FSOUND_GetOutputHandle(), &dscaps);
minhwfreq = dscaps.dwMinSecondarySampleRate;
maxhwfreq = dscaps.dwMaxSecondarySampleRate;
}
___________________
Supported on the following platforms : Win32, WinCE, Linux, Macintosh, XBox, PlayStation 2, GameCube

### See Also

FSOUND_DSP_MixBuffers , FSOUND_GetFrequency , FSOUND_GetOutput , FSOUND_GetOutputHandle , FSOUND_Sample_SetDefaults , FSOUND_Sample_SetDefaultsEx , FSOUND_SetCurrentPosition

This document copyright ©Firelight Technologies, Pty, Ltd, 1999-2002. All rights reserved.
Generated Thu Dec 15 17:31:33 2005 by SourceDoc v0.10, the automated source code documenter.