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

Record sounds


Here try this
' sndRecordToFile

'INCLUDE FILE _aplIncl

'___________________________________________________________________________

' FUNCTION SndRecordToFile(filterProc : ProcPtr; corner : Point;
' quality : OSType; fRefNum : Integer) : OSErr;
' INLINE $203C,$0708,$0014,$A800

'___________________________________________________________________________

CLEAR LOCAL MODE
LOCAL FN fbSndRecordToFile (procPtr&, @fPt&, sndQual&, fRefNum%)
  `  SUBQ.L    #2,sp;clear space for sndErr
  `  MOVE.L    ^procPtr&, - (sp);push proc ptr on stack
  `  MOVE.L    ^fPt&,A0;push point into A0
  `  MOVE.L    (A0), - (sp);put pt in AO onto stack
  `  MOVE.L    ^sndQual&, - (sp);push snd quality type on stack
  `  MOVE.W    ^fRefNum%, - (sp);put fRefNum% on stack
  `  DC.W      $203C,$0708,$0014,$A800;call SndRecordToFile
  `  MOVE.W    (sp) + ,^sndErr%;D0 = sndErr
END FN = sndErr%

'___________________________________________________________________________

CLEAR LOCAL FN srfDialog (fRefNum%)

  DIM pt.4
  sndQual& = _"betr"
  CALL SETPT (pt, 100, 75)

  sndErr% = FN fbSndRecordToFile (0, pt, sndQual&, fRefNum%)

  PRINT "sndErr% = ", sndErr%
  SELECT sndErr%
    CASE 0     : PRINT "noErr - Save Pressed"
    CASE - 51   : PRINT "File Error"
    CASE - 128  : PRINT "userCanceledError - Cancel Pressed"
    CASE - 221  : PRINT "siBadSoundInDevice - Invalid sound input device"
    CASE - 232  : PRINT "siUnknownQuality - Unknown quality"
  END SELECT
END FN

'___________________________________________________________________________

CLEAR LOCAL
  DIM 255 ParamBlock$
  DIM volRefNum%, 63 filename$

LOCAL FN srfGetFileInfo (filename$, volRefNum%)
  _myIOFRefNum = 24
  pbPtr& = @ParamBlock$

  pbPtr&.ioCompletion&   = 0'   NO IOCOMPLETION
  pbPtr&.ioNamePtr&      = @filename$'   FILENAME TO READ
  pbPtr&.ioVRefNum%      = volRefNum%'   VOLUME TO READ
  pbPtr&.ioFDirIndex%    = 0'   DEFAULT DRIVE
'pbPtr&.ioDirID& = 0

  GET FILE INFO ParamBlock$

'PRINT "Name = ", FileName$
  fRefNum% = pbPtr&.myIOFRefNum%
'PRINT "fRefNum%  = ", fRefNum%
END FN = fRefNum%

'___________________________________________________________________________

CLEAR
LOCAL FN srfOpenFile$  (filename$)

  filename$ =  FILES$(_fSave, "Save as --- ", "untitled", volRefNum%)
  actioN=LEN(filename$)

  SELECT action
    CASE 0
      PRINT "Cancel Selected"
    CASE ELSE
'PRINT "Save Selected"
      OPEN "O", 1, filename$,, volRefNum%
'PRINT "File Opened"
      fRefNum% = FN srfGetFileInfo (filename$, volRefNum%)
      FN srfDialog (fRefNum%)
  END SELECT

END FN = filename$
'___________________________________________________________________________

CLEAR LOCAL FN srfCloseFile
  IF LEN (filename$) > 0 THEN CLOSE #1
END FN

'___________________________________________________________________________
'LOCAL FN sndRecordToFile
WINDOW OFF
'WINDOW #1
'CLS : TEXT _monaco,9,0 : DEF TAB 30
FN srfOpenFile$ (filename$)
FN srfCloseFile
'END FN
Peter

Here's what I have in my lib. Been ages since it was used. Believe it comes straight for the FBII Examples, but it appears to be a little different than what you listed
LOCAL FN doPlayASound (resID%)
  resType& = _"snd "
  mySndHdl& = FN GETRESOURCE (resType&,resID%)
  myErr% = FN SNDPLAY (0&,mySndHdl&,_true%)
  IF myErr% = noErr THEN CALL RELEASERESOURCE (mySndHdl&)
END FN                                            'FN doPlayASound

LOCAL FN doPlayASoundRsrc (sndRsrcID%,async%)
  DIM osErr%
  DIM async%
  DIM sndRsrcID%
  osErr% = FN SNDSTARTFILEPLAY (0, 0, sndRsrcID%, 32000, 0, 0, 0, async%)
  IF osErr% = noErr THEN CALL RELEASERESOURCE (sndRsrcID%)
END FN                                            'FN doPlayASoundRsrc

LOCAL MODE
LOCAL FN fbSndRecord (procPtr&,@fPt&,sndQual&,@sndHndl&)
  `  SUBQ.L     #2,sp                   ;clear space for snd err
  `  MOVE.L     ^procPtr&,-(sp)         ;push proc ptr
  `  MOVE.L     ^fPt&,A0                ;push pt into A0
  `  MOVE.L     (A0),-(sp)              ;push pt in A0
  `  MOVE.L     ^sndQual&,-(sp)         ;push snd quality type
  `  MOVE.L     ^sndHndl&,-(sp)         ;push snd Handle
  `  DC.W       $203C,$0804,$0014,$A800 ;call sndRecord
  `  MOVE.W     (sp)+,^sndErr           ;D0 = sndErr
END FN                                            'FN fbSndRecord

LOCAL FN aRecordSoundDialog (T%,L%)
  DIM pt.4
  sndHndl& = 0
  sndQual& = _"good"
  CALL SETPT (pt,T%,L%)
  sndErr = FN fbSndRecord (0,pt,sndQual&,sndHndl&)
  LONG IF sndErr <> _userCanceledErr
    PRINT "Error getting sound: ";sndErr
  END IF
END FN = sndHndl&                                 'FN aRecordSoundDialog
Joe