Richard Goodman wrote: > > Two questions: > > Question #1: The two functions below are from Hommel's Sound Tutor for > FB^2. There has been some discussion on this forum regarding the fact that > they cause the program to crash if used on current Macs. I would like to > incorporate them into Sebastian, if possible. I need my program to know > when a melody has finished playing. Have any of the audio mavens on this > list gotten these functions to work, or derived alternate functions that > accomplish the same thing? > > '--------------------------------------------------------------------- > 'FBSndChannelStatus(chanP&,theLength%,@theStatusP&) > '--------------------------------------------------------------------- > 'Current version of FB doesn't support this function, so we > > 'need to add it. REQUIRES SYSTEM 7.0+! > 'Pascal prototype from Inside Macintosh Vol VI: > ' FUNCTION SndChannelStatus(chan:ChannelPtr;theLength:integer;VAR > theStatus:scStatus):OSErr > ' > 'Calling syntax: > ' DIM theStatus.24 > ' osErr=FN FBSndChannelStatus(chan&,theLength%,theStatus) > ' > 'If you use this routine, or one of the routines that calls it > '(SndChannelBusy or SndChannelPaused), be sure to check that your > 'program is running on a Mac with System 7 or higher. > '--------------------------------------------------------------------- > > REM: The function below doesn't work with FB^2 or FB^3 with System 8.6 > > 'LOCAL FN FBSndChannelStatus(chanP&,theLength%,@theStatusP&) > ` subq.l #2,SP ;clear room on stack for osErr% > ` move.l ^chanP&,-(SP) ;put chan ptr on stack > ` move.w ^theLength%,-(SP) ;put theLength% on stack > ` move.l ^theStatusP&,-(SP) ;put theStatus ptr on stack > ` dc.w $203C,$0010,$0008,$A800 ;make the call > ` move.w (SP)+,D0 ;pull osErr off stack and place > in D0 > ` ext.l D0 ;extend D0 to long > END FN > Richard, It is not clear if you are currently working with FBII, but in FB^3 you can replace FBSndChannelStatus with the Toolbox function SndChannelStatus which is now implemented. -- Cheers, Alain ------------------------------------------------------ Program different E = FB^3 FutureBASIC^3 in Europe: http://euro.futurebasic.com/ ------------------------------------------------------