Previous Book Contents Book Index Next

Inside Macintosh: Sound /
Chapter 2 - Sound Manager / Sound Manager Reference
Sound Manager Routines / Performing Unsigned Fixed-Point Arithmetic


Legacy Documentclose button

Important: Inside Macintosh: Sound is deprecated as of Mac OS X v10.5. For new audio development in Mac OS X, use Core Audio. See the Audio page in the ADC Reference Library.

UnsignedFixMulDiv

You can use the UnsignedFixMulDiv function to perform multiplications and divisions on unsigned fixed-point numbers. You'll typically use it to calculate sample rates.

FUNCTION UnsignedFixMulDiv (value: UnsignedFixed; 
                              multiplier: UnsignedFixed; 
                              divisor: UnsignedFixed): 
                              UnsignedFixed;
value
The value to be multiplied and divided.
multiplier
The multiplier to be applied to the value in the value parameter.
divisor
The divisor to be applied to the value in the value parameter.
DESCRIPTION
The UnsignedFixMulDiv function returns the fixed-point number that is the value of the value parameter, multiplied by the value in the multiplier parameter and divided by the value in the divisor parameter. Note that UnsignedFixMulDiv performs both operations before returning. If you want to perform only a multiplication or only a division, pass the value $00010000 for whichever parameter you want to ignore. For example, to determine the sample rate that is twice that of the 22 kHz rate, you can use UnsignedFixMulDiv as follows:

myNewRate := UnsignedFixMulDiv(rate22kHz, $00020000, $00010000);
Similarly, to determine the sample rate that is half that of the 44 kHz rate, you can use UnsignedFixMulDiv as follows:

myNewRate := UnsignedFixMulDiv(rate44kHz, $00010000, $00020000);
SPECIAL CONSIDERATIONS
The UnsignedFixMulDiv function is available only in versions 3.0 and later of the Sound Manager.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
2 JUL 1996