David Cottrell wrote: > Every now and then i get a problem that really stumps me. This one is a > definite. > > I have been trying to get some code to work on a range of machines I > have here and have hit a snag. > > The code below crashes into MacBugs at the line indicated on my G4, but > appears to work on my G3 powerbook. Both are running OS9.2.1 > > local fn setUp > dim as double gain > dim as short NewState > dim deviceName$ > dim as integer OSErr > deviceName$ = "" > gInDeviceRefNum = 0 > > OSErr = FN SPBOpenDevice (@deviceName$,1,@gInDeviceRefNum)'<-G4 crash > end fn > > Does anyone know why? > > Has anyone got code to set up a level meter in FB3? I also want to know > how to find what sound input devices are available, and how to set the > input device. Hi David, I thought I sent you this code... In SPBOpenDevice you need to pass the name of an available device in devicename$. You need to pass the variables not their addresses. local fn setUp dim as double gain dim as short NewState dim deviceName$ dim as integer OSErr, perm deviceName$ = "Built In" gInDeviceRefNum = 0 perm = 1 OSErr = FN SPBOpenDevice (deviceName$,perm,gInDeviceRefNum)'<-G4 crash end fn Should work better if Built In is a valid device name on your computer. You can get a list of available devices by calling SPBGet IndexedDevice (Count, deviceName$, DeviceIconHandle) This will return an error when there are no more devices. Remember to kill off DeviceIconHandle if you are not using it. You can get the level meter by calling SPBGetDeviceInfo (gInDeviceRefNum,_"lmet",@mylevel) mylevel needs to be a record of two integers, the level meter state (ON/OFF 1/0) is returned in the first, the level meter value (0 - 255) is returned in the second. Stereo level meters are more complicated. How are you getting on with your translations ?? Best Regards Ian Mann