SetAudioRate

Changes the rate of the audio clock.

Synopsis

Err SetAudioRate (Item Owner, frac16 Rate)

Description

This function changes the rate of the audio clock. The default rate is 240 Hz. The range of the clock rate is 60 to 1000 Hz.

The current audio clock rate can be read with GetAudioRate().

You must own the audio clock before changing the rate or duration. See OwnAudioClock().

Arguments

Owner
Item number of owner ID from OwnAudioClock().
Rate
16.16 fractional rate value in Hz. Must be in the range of 60 Hz to 1000 Hz.

Return Value

The function returns a non-negative value if successful or an error code (a negative value) if an error occurs.

Implementation

SWI implemented in Audio folio V20.

Caveats

High clock rates may degrade system performance.

Examples

// Here is an example of changing the rate to 300 Hz (error checking
// omitted for brevity).
{
    Owner = OwnAudioClock();
    SetAudioRate (Owner, Convert32_F16 (300));
}

Associated Files

audio.h

See Also

OwnAudioClock(), GetAudioRate(), SetAudioDuration(), GetAudioDuration(), SignalAtTime(), SleepUntilTime()