equal
deleted
inserted
replaced
246 frequency, channels: LongInt; |
246 frequency, channels: LongInt; |
247 begin |
247 begin |
248 AddFileLog('BeginPreRecording'); |
248 AddFileLog('BeginPreRecording'); |
249 |
249 |
250 numFrames:= 0; |
250 numFrames:= 0; |
251 startTime:= SDL_GetTicks(); |
251 thumbnailSaved:= false; |
252 |
|
253 RecPrefix:= FormatDateTime('YYYY-MM-DD_HH-mm-ss', Now()); |
252 RecPrefix:= FormatDateTime('YYYY-MM-DD_HH-mm-ss', Now()); |
254 |
|
255 thumbnailSaved:= false; |
|
256 |
253 |
257 Mix_QuerySpec(@frequency, @format, @channels); |
254 Mix_QuerySpec(@frequency, @format, @channels); |
258 AddFileLog('sound: frequency = ' + IntToStr(frequency) + ', format = ' + IntToStr(format) + ', channels = ' + IntToStr(channels)); |
255 AddFileLog('sound: frequency = ' + IntToStr(frequency) + ', format = ' + IntToStr(format) + ', channels = ' + IntToStr(channels)); |
259 if format <> $8010 then |
256 if format <> $8010 then |
260 begin |
257 begin |
282 begin |
279 begin |
283 AddFileLog('Error: Could not write to ' + filename); |
280 AddFileLog('Error: Could not write to ' + filename); |
284 exit; |
281 exit; |
285 end; |
282 end; |
286 |
283 |
|
284 // save audio parameters in sound file |
287 BlockWrite(audioFile, frequency, 4); |
285 BlockWrite(audioFile, frequency, 4); |
288 BlockWrite(audioFile, channels, 4); |
286 BlockWrite(audioFile, channels, 4); |
289 {$IOCHECKS ON} |
287 {$IOCHECKS ON} |
290 |
288 |
291 // register callback for actual audio recording |
289 // register callback for actual audio recording |
292 Mix_SetPostMix(@RecordPostMix, nil); |
290 Mix_SetPostMix(@RecordPostMix, nil); |
293 |
291 |
|
292 startTime:= SDL_GetTicks(); |
294 flagPrerecording:= true; |
293 flagPrerecording:= true; |
295 end; |
294 end; |
296 |
295 |
297 procedure StopPreRecording; |
296 procedure StopPreRecording; |
298 begin |
297 begin |
303 SDL_LockAudio(); |
302 SDL_LockAudio(); |
304 Close(audioFile); |
303 Close(audioFile); |
305 Close(cameraFile); |
304 Close(cameraFile); |
306 Mix_SetPostMix(nil, nil); |
305 Mix_SetPostMix(nil, nil); |
307 SDL_UnlockAudio(); |
306 SDL_UnlockAudio(); |
|
307 |
|
308 if not thumbnailSaved then |
|
309 SaveThumbnail(); |
308 end; |
310 end; |
309 |
311 |
310 procedure SaveCameraPosition; |
312 procedure SaveCameraPosition; |
311 var curTime: LongInt; |
313 var curTime: LongInt; |
312 frame: TFrame; |
314 frame: TFrame; |