FB II Compiler

PG PRO

Debugging

Memory

System

Mathematics

Resources

Disk I/O

Windows

Controls

Menus

Mouse

Keyboard

Text

Fonts

Drawing

Sound

Clipboard

Printing

Communication

ASM

Made with FB

SOUND

Understand FixDiv in sound functions


The "Div" function in C returns both the quotient and the remainder of a division function, placing the results in a structure; so I suspect "FixDiv" does the same thing in a fixed-point format. Integer division in FB is represented by a "\" (or the "/", depending on your default; \ will be the "other one") and you can get the remainder with MOD.The "$" denotes hexadecimal; in FB, it'd be "&H".
So... I'd start with this and see where it leads you; (not knowing what results you want, I'm guessing on variable types, etc...)

mySndCmdQ& = myRate& \ &H00020000
mySndCmdR% = myRate& MOD &H00020000

Bill


Well, FixDiv is a toolbox division call that operates on 32-bit values (long, Fixed, or Fract). It returns a quotient whose format depends on that of the input parameters (see IM). You don't say what oldrate is defined as in the C code (I'm guessing a Fixed, which I believe is a way of representing a floating point number within a long by using the upper word as the integer portion and the lower word as the decimal portion). It does appear to be supported by FB, so a translation of the line in question would be:

newrate& = FN FIXDIV(oldrate&,&H00080000)

As for "freqcmd", I have no idea.

Chris Young