Hi,
I am using SPBRecordToFile .
CLEAR LOCAL
DIM AS SHORT OsErr
LOCAL FN StartRecording
RECORD #_RecordFileID,0
OsErr = FN
SetupAIFFHeader(gRecFileRefNum,PrefRec.RecMonoOrStereo,gRecSampleRate,gRecSampleSize,_"NONE",0,0)
mySPB.inRefNum = gInDeviceRefNum
mySPB.count = _maxLong
mySPB.milliseconds = 0
mySPB.completionRoutine = PROC "CompletionProc"
mySPB.interruptRoutine = 0
mySPB.userLong = 0
mySPB.unused1 = 0
OsErr = FN SPBRecordToFile(gRecFileRefNum,@mySPB,_True)
END FN
I have defined a completion routine
"CompletionProc"
ENTERPROC FN Completion(inParamPtr AS POINTER)
inParamPtr.ERROR = _noErr
EXITPROC
This is called when I call FN SPBStopRecording (I don't really need to
do anything in the Callback)
CLEAR LOCAL
DIM AS SHORT OsErr
DIM AS UNSIGNED LONG Bytes,Frames
LOCAL FN StopRecording
TRON BREAK
gRecordState = _Monitoring
OsErr = FN SPBStopRecording(gInDeviceRefNum)
Bytes = LOF(_RecordFileID,1)-54
Frames = INT(Bytes /(gRecSampleSize/8*PrefRec.RecMonoOrStereo))
RECORD #_RecordFileID,0
OsErr = FN
SetupAIFFHeader(gRecFileRefNum,PrefRec.RecMonoOrStereo,gRecSampleRate,gRecSampleSize,_"NONE",Bytes,Frames)
END FN
This runs fine, the pause and resume also work. Files are produced that
are playable in SoundMaker and QuickTime Player.
I you have read this far, you are probably wondering why I am worrying
??
If I run this with the debugger on and step through after the tron break
all is well.
If I press Hide in the debugger, I crash - total freeze - No ES - No RB.
Message in MacsBug is :
Illegal Instruction at 0B2C9620 COMPLETION..+0FF24
COMPLETION..
+0FF24 0B2C9620 *DC.W $3FE0 ;
???? | 3FEO
+0FF26 0B2C9622 CMPI.B #$3BFF ,
DO | 0C00 3BFF
+0FF2A 0B2C9626 DC.W $4F42
???? | 4F42
Does anybody know what is causing this, Is it a register problem ??
I have never used EnterProc before so I may have messed that up..
Best Regards
Ian