; Listing generated by Microsoft (R) Optimizing Compiler Version 15.00.21022.08 

	TITLE	c:\Develop\DScaler423a\DScaler\avi_audio.cpp
	.686P
	.XMM
	include listing.inc
	.model	flat

INCLUDELIB OLDNAMES

PUBLIC	?bytesToTicks@@YA_JPAUAVI_FILE@@PAUtWAVEFORMATEX@@K@Z ; bytesToTicks
PUBLIC	?ticksToBytes@@YAKPAUAVI_FILE@@PAUtWAVEFORMATEX@@_J@Z ; ticksToBytes
PUBLIC	?bytesToSamples@@YAKPAUAVI_FILE@@PAUtWAVEFORMATEX@@K@Z ; bytesToSamples
PUBLIC	??_C@_1EM@EPFCBIAC@?$AAT?$AAh?$AAe?$AA?5?$AAr?$AAe?$AAc?$AAo?$AAr?$AAd?$AAi?$AAn?$AAg?$AA?5?$AAf?$AAo?$AAr?$AAm?$AAa?$AAt?$AA?5?$AAi?$AAs?$AA?5?$AAn?$AAo?$AAt?$AA?5?$AAs?$AAu?$AAp?$AAp@ ; `string'
PUBLIC	??_C@_1EM@HIDHLDPC@?$AAT?$AAh?$AAe?$AA?5?$AAw?$AAa?$AAv?$AAe?$AAI?$AAn?$AA?5?$AAd?$AAe?$AAv?$AAi?$AAc?$AAe?$AA?5?$AAc?$AAo?$AAu?$AAl?$AAd?$AA?5?$AAn?$AAo?$AAt?$AA?5?$AAb?$AAe?$AA?5?$AAo@ ; `string'
PUBLIC	??_C@_1BM@CKLAAKNF@?$AAO?$AAu?$AAt?$AA?5?$AAo?$AAf?$AA?5?$AAm?$AAe?$AAm?$AAo?$AAr?$AAy?$AA?$AA@ ; `string'
PUBLIC	??_C@_1DG@JEPPDNAK@?$AAw?$AAa?$AAv?$AAe?$AAI?$AAn?$AAP?$AAr?$AAe?$AAp?$AAa?$AAr?$AAe?$AAH?$AAe?$AAa?$AAd?$AAe?$AAr?$AA?5?$AAf?$AAa?$AAi?$AAl?$AAe?$AAd?$AA?$AA@ ; `string'
PUBLIC	??_C@_1CO@OHGIMNG@?$AAw?$AAa?$AAv?$AAe?$AAI?$AAn?$AAA?$AAd?$AAd?$AAB?$AAu?$AAf?$AAf?$AAe?$AAr?$AA?5?$AAf?$AAa?$AAi?$AAl?$AAe?$AAd?$AA?$AA@ ; `string'
EXTRN	__imp__waveInOpen@24:PROC
EXTRN	__imp__waveInPrepareHeader@12:PROC
EXTRN	__imp__waveInAddBuffer@12:PROC
EXTRN	__imp__waveInClose@4:PROC
EXTRN	__imp__waveInUnprepareHeader@12:PROC
EXTRN	__imp__waveInReset@4:PROC
EXTRN	__imp__waveInStart@4:PROC
;	COMDAT ??_C@_1CO@OHGIMNG@?$AAw?$AAa?$AAv?$AAe?$AAI?$AAn?$AAA?$AAd?$AAd?$AAB?$AAu?$AAf?$AAf?$AAe?$AAr?$AA?5?$AAf?$AAa?$AAi?$AAl?$AAe?$AAd?$AA?$AA@
CONST	SEGMENT
??_C@_1CO@OHGIMNG@?$AAw?$AAa?$AAv?$AAe?$AAI?$AAn?$AAA?$AAd?$AAd?$AAB?$AAu?$AAf?$AAf?$AAe?$AAr?$AA?5?$AAf?$AAa?$AAi?$AAl?$AAe?$AAd?$AA?$AA@ DB 'w'
	DB	00H, 'a', 00H, 'v', 00H, 'e', 00H, 'I', 00H, 'n', 00H, 'A', 00H
	DB	'd', 00H, 'd', 00H, 'B', 00H, 'u', 00H, 'f', 00H, 'f', 00H, 'e'
	DB	00H, 'r', 00H, ' ', 00H, 'f', 00H, 'a', 00H, 'i', 00H, 'l', 00H
	DB	'e', 00H, 'd', 00H, 00H, 00H			; `string'
CONST	ENDS
;	COMDAT ??_C@_1DG@JEPPDNAK@?$AAw?$AAa?$AAv?$AAe?$AAI?$AAn?$AAP?$AAr?$AAe?$AAp?$AAa?$AAr?$AAe?$AAH?$AAe?$AAa?$AAd?$AAe?$AAr?$AA?5?$AAf?$AAa?$AAi?$AAl?$AAe?$AAd?$AA?$AA@
CONST	SEGMENT
??_C@_1DG@JEPPDNAK@?$AAw?$AAa?$AAv?$AAe?$AAI?$AAn?$AAP?$AAr?$AAe?$AAp?$AAa?$AAr?$AAe?$AAH?$AAe?$AAa?$AAd?$AAe?$AAr?$AA?5?$AAf?$AAa?$AAi?$AAl?$AAe?$AAd?$AA?$AA@ DB 'w'
	DB	00H, 'a', 00H, 'v', 00H, 'e', 00H, 'I', 00H, 'n', 00H, 'P', 00H
	DB	'r', 00H, 'e', 00H, 'p', 00H, 'a', 00H, 'r', 00H, 'e', 00H, 'H'
	DB	00H, 'e', 00H, 'a', 00H, 'd', 00H, 'e', 00H, 'r', 00H, ' ', 00H
	DB	'f', 00H, 'a', 00H, 'i', 00H, 'l', 00H, 'e', 00H, 'd', 00H, 00H
	DB	00H						; `string'
CONST	ENDS
;	COMDAT ??_C@_1BM@CKLAAKNF@?$AAO?$AAu?$AAt?$AA?5?$AAo?$AAf?$AA?5?$AAm?$AAe?$AAm?$AAo?$AAr?$AAy?$AA?$AA@
CONST	SEGMENT
??_C@_1BM@CKLAAKNF@?$AAO?$AAu?$AAt?$AA?5?$AAo?$AAf?$AA?5?$AAm?$AAe?$AAm?$AAo?$AAr?$AAy?$AA?$AA@ DB 'O'
	DB	00H, 'u', 00H, 't', 00H, ' ', 00H, 'o', 00H, 'f', 00H, ' ', 00H
	DB	'm', 00H, 'e', 00H, 'm', 00H, 'o', 00H, 'r', 00H, 'y', 00H, 00H
	DB	00H						; `string'
CONST	ENDS
;	COMDAT ??_C@_1EM@HIDHLDPC@?$AAT?$AAh?$AAe?$AA?5?$AAw?$AAa?$AAv?$AAe?$AAI?$AAn?$AA?5?$AAd?$AAe?$AAv?$AAi?$AAc?$AAe?$AA?5?$AAc?$AAo?$AAu?$AAl?$AAd?$AA?5?$AAn?$AAo?$AAt?$AA?5?$AAb?$AAe?$AA?5?$AAo@
CONST	SEGMENT
??_C@_1EM@HIDHLDPC@?$AAT?$AAh?$AAe?$AA?5?$AAw?$AAa?$AAv?$AAe?$AAI?$AAn?$AA?5?$AAd?$AAe?$AAv?$AAi?$AAc?$AAe?$AA?5?$AAc?$AAo?$AAu?$AAl?$AAd?$AA?5?$AAn?$AAo?$AAt?$AA?5?$AAb?$AAe?$AA?5?$AAo@ DB 'T'
	DB	00H, 'h', 00H, 'e', 00H, ' ', 00H, 'w', 00H, 'a', 00H, 'v', 00H
	DB	'e', 00H, 'I', 00H, 'n', 00H, ' ', 00H, 'd', 00H, 'e', 00H, 'v'
	DB	00H, 'i', 00H, 'c', 00H, 'e', 00H, ' ', 00H, 'c', 00H, 'o', 00H
	DB	'u', 00H, 'l', 00H, 'd', 00H, ' ', 00H, 'n', 00H, 'o', 00H, 't'
	DB	00H, ' ', 00H, 'b', 00H, 'e', 00H, ' ', 00H, 'o', 00H, 'p', 00H
	DB	'e', 00H, 'n', 00H, 'e', 00H, 'd', 00H, 00H, 00H ; `string'
CONST	ENDS
;	COMDAT ??_C@_1EM@EPFCBIAC@?$AAT?$AAh?$AAe?$AA?5?$AAr?$AAe?$AAc?$AAo?$AAr?$AAd?$AAi?$AAn?$AAg?$AA?5?$AAf?$AAo?$AAr?$AAm?$AAa?$AAt?$AA?5?$AAi?$AAs?$AA?5?$AAn?$AAo?$AAt?$AA?5?$AAs?$AAu?$AAp?$AAp@
CONST	SEGMENT
??_C@_1EM@EPFCBIAC@?$AAT?$AAh?$AAe?$AA?5?$AAr?$AAe?$AAc?$AAo?$AAr?$AAd?$AAi?$AAn?$AAg?$AA?5?$AAf?$AAo?$AAr?$AAm?$AAa?$AAt?$AA?5?$AAi?$AAs?$AA?5?$AAn?$AAo?$AAt?$AA?5?$AAs?$AAu?$AAp?$AAp@ DB 'T'
	DB	00H, 'h', 00H, 'e', 00H, ' ', 00H, 'r', 00H, 'e', 00H, 'c', 00H
	DB	'o', 00H, 'r', 00H, 'd', 00H, 'i', 00H, 'n', 00H, 'g', 00H, ' '
	DB	00H, 'f', 00H, 'o', 00H, 'r', 00H, 'm', 00H, 'a', 00H, 't', 00H
	DB	' ', 00H, 'i', 00H, 's', 00H, ' ', 00H, 'n', 00H, 'o', 00H, 't'
	DB	00H, ' ', 00H, 's', 00H, 'u', 00H, 'p', 00H, 'p', 00H, 'o', 00H
	DB	'r', 00H, 't', 00H, 'e', 00H, 'd', 00H, 00H, 00H ; `string'
PUBLIC	?aviAudioStartRecording@@YAXPAUAVI_FILE@@@Z	; aviAudioStartRecording
; Function compile flags: /Odtp
; File c:\develop\dscaler423a\dscaler\avi_audio.cpp
;	COMDAT ?aviAudioStartRecording@@YAXPAUAVI_FILE@@@Z
_TEXT	SEGMENT
_file$ = 8						; size = 4
?aviAudioStartRecording@@YAXPAUAVI_FILE@@@Z PROC	; aviAudioStartRecording, COMDAT

; 340  : {

  00000	55		 push	 ebp
  00001	8b ec		 mov	 ebp, esp

; 341  :     if (file && file->audio.hWaveIn != INVALID_HANDLE_VALUE)

  00003	83 7d 08 00	 cmp	 DWORD PTR _file$[ebp], 0
  00007	74 29		 je	 SHORT $LN2@aviAudioSt
  00009	8b 45 08	 mov	 eax, DWORD PTR _file$[ebp]
  0000c	83 b8 78 03 00
	00 ff		 cmp	 DWORD PTR [eax+888], -1
  00013	74 1d		 je	 SHORT $LN2@aviAudioSt

; 342  :     {
; 343  :         file->audio.recording = TRUE;

  00015	8b 4d 08	 mov	 ecx, DWORD PTR _file$[ebp]
  00018	c7 81 7c 03 00
	00 01 00 00 00	 mov	 DWORD PTR [ecx+892], 1

; 344  : 
; 345  :         /* Start grabbing audio */
; 346  :         waveInStart(file->audio.hWaveIn);

  00022	8b 55 08	 mov	 edx, DWORD PTR _file$[ebp]
  00025	8b 82 78 03 00
	00		 mov	 eax, DWORD PTR [edx+888]
  0002b	50		 push	 eax
  0002c	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__waveInStart@4
$LN2@aviAudioSt:

; 347  :     }
; 348  : }

  00032	5d		 pop	 ebp
  00033	c3		 ret	 0
?aviAudioStartRecording@@YAXPAUAVI_FILE@@@Z ENDP	; aviAudioStartRecording
_TEXT	ENDS
PUBLIC	?aviAudioEnd@@YAXPAUAVI_FILE@@@Z		; aviAudioEnd
; Function compile flags: /Odtp
;	COMDAT ?aviAudioEnd@@YAXPAUAVI_FILE@@@Z
_TEXT	SEGMENT
_i$ = -4						; size = 4
_file$ = 8						; size = 4
?aviAudioEnd@@YAXPAUAVI_FILE@@@Z PROC			; aviAudioEnd, COMDAT

; 296  : {

  00000	55		 push	 ebp
  00001	8b ec		 mov	 ebp, esp
  00003	51		 push	 ecx

; 297  :     int i;
; 298  : 
; 299  :     if (file)

  00004	83 7d 08 00	 cmp	 DWORD PTR _file$[ebp], 0
  00008	0f 84 be 00 00
	00		 je	 $LN8@aviAudioEn

; 300  :     {
; 301  :         if (file->audio.hWaveIn != INVALID_HANDLE_VALUE)

  0000e	8b 45 08	 mov	 eax, DWORD PTR _file$[ebp]
  00011	83 b8 78 03 00
	00 ff		 cmp	 DWORD PTR [eax+888], -1
  00018	0f 84 ae 00 00
	00		 je	 $LN8@aviAudioEn

; 302  :         {
; 303  :             file->audio.recording = FALSE;

  0001e	8b 4d 08	 mov	 ecx, DWORD PTR _file$[ebp]
  00021	c7 81 7c 03 00
	00 00 00 00 00	 mov	 DWORD PTR [ecx+892], 0

; 304  : 
; 305  :             /* Stop recording */
; 306  :             waveInReset(file->audio.hWaveIn);

  0002b	8b 55 08	 mov	 edx, DWORD PTR _file$[ebp]
  0002e	8b 82 78 03 00
	00		 mov	 eax, DWORD PTR [edx+888]
  00034	50		 push	 eax
  00035	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__waveInReset@4

; 307  : 
; 308  :             /* Deallocate the buffers and unprepare the headers */
; 309  :             for (i = 0; i < MAX_WAVE_BUFFER; i++)

  0003b	c7 45 fc 00 00
	00 00		 mov	 DWORD PTR _i$[ebp], 0
  00042	eb 09		 jmp	 SHORT $LN5@aviAudioEn
$LN4@aviAudioEn:
  00044	8b 4d fc	 mov	 ecx, DWORD PTR _i$[ebp]
  00047	83 c1 01	 add	 ecx, 1
  0004a	89 4d fc	 mov	 DWORD PTR _i$[ebp], ecx
$LN5@aviAudioEn:
  0004d	83 7d fc 04	 cmp	 DWORD PTR _i$[ebp], 4
  00051	7d 5c		 jge	 SHORT $LN3@aviAudioEn

; 310  :             {
; 311  :                 if (file->audio.buffer[i])

  00053	8b 55 fc	 mov	 edx, DWORD PTR _i$[ebp]
  00056	8b 45 08	 mov	 eax, DWORD PTR _file$[ebp]
  00059	83 bc 90 18 04
	00 00 00	 cmp	 DWORD PTR [eax+edx*4+1048], 0
  00061	74 4a		 je	 SHORT $LN2@aviAudioEn

; 312  :                 {
; 313  :                     if (waveInUnprepareHeader(file->audio.hWaveIn,
; 314  :                                               &file->audio.whdr[i],
; 315  :                                               sizeof(WAVEHDR)) != MMSYSERR_NOERROR)

  00063	6a 20		 push	 32			; 00000020H
  00065	8b 4d fc	 mov	 ecx, DWORD PTR _i$[ebp]
  00068	c1 e1 05	 shl	 ecx, 5
  0006b	8b 55 08	 mov	 edx, DWORD PTR _file$[ebp]
  0006e	8d 84 0a 98 03
	00 00		 lea	 eax, DWORD PTR [edx+ecx+920]
  00075	50		 push	 eax
  00076	8b 4d 08	 mov	 ecx, DWORD PTR _file$[ebp]
  00079	8b 91 78 03 00
	00		 mov	 edx, DWORD PTR [ecx+888]
  0007f	52		 push	 edx
  00080	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__waveInUnprepareHeader@12

; 316  :                     {
; 317  :                         #ifdef AVI_DEBUG
; 318  :                         cprintf(_T("waveInUnprepareHeader error\n"));
; 319  :                         #endif
; 320  :                     }
; 321  : 
; 322  :                     free(file->audio.buffer[i]);

  00086	8b 45 fc	 mov	 eax, DWORD PTR _i$[ebp]
  00089	8b 4d 08	 mov	 ecx, DWORD PTR _file$[ebp]
  0008c	8b 94 81 18 04
	00 00		 mov	 edx, DWORD PTR [ecx+eax*4+1048]
  00093	52		 push	 edx
  00094	e8 00 00 00 00	 call	 _free
  00099	83 c4 04	 add	 esp, 4

; 323  :                     file->audio.buffer[i] = NULL;

  0009c	8b 45 fc	 mov	 eax, DWORD PTR _i$[ebp]
  0009f	8b 4d 08	 mov	 ecx, DWORD PTR _file$[ebp]
  000a2	c7 84 81 18 04
	00 00 00 00 00
	00		 mov	 DWORD PTR [ecx+eax*4+1048], 0
$LN2@aviAudioEn:

; 324  :                 }
; 325  :             }

  000ad	eb 95		 jmp	 SHORT $LN4@aviAudioEn
$LN3@aviAudioEn:

; 326  : 
; 327  :             waveInClose(file->audio.hWaveIn);

  000af	8b 55 08	 mov	 edx, DWORD PTR _file$[ebp]
  000b2	8b 82 78 03 00
	00		 mov	 eax, DWORD PTR [edx+888]
  000b8	50		 push	 eax
  000b9	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__waveInClose@4

; 328  :             file->audio.hWaveIn = (HWAVEIN)INVALID_HANDLE_VALUE;

  000bf	8b 4d 08	 mov	 ecx, DWORD PTR _file$[ebp]
  000c2	c7 81 78 03 00
	00 ff ff ff ff	 mov	 DWORD PTR [ecx+888], -1
$LN8@aviAudioEn:

; 329  :         }
; 330  :     }
; 331  : }

  000cc	8b e5		 mov	 esp, ebp
  000ce	5d		 pop	 ebp
  000cf	c3		 ret	 0
?aviAudioEnd@@YAXPAUAVI_FILE@@@Z ENDP			; aviAudioEnd
_TEXT	ENDS
PUBLIC	_aviAudioDefineStream
; Function compile flags: /Odtp
;	COMDAT _aviAudioDefineStream
_TEXT	SEGMENT
_wfx$ = -4						; size = 4
_file$ = 8						; size = 4
_deviceID$ = 12						; size = 4
_wfxIn$ = 16						; size = 4
_wfxOut$ = 20						; size = 4
_aviAudioDefineStream PROC				; COMDAT

; 169  : {

  00000	55		 push	 ebp
  00001	8b ec		 mov	 ebp, esp
  00003	51		 push	 ecx

; 170  :     WAVEFORMATEX *wfx;
; 171  : 
; 172  :     if (!file || !wfxIn || !wfxOut)

  00004	83 7d 08 00	 cmp	 DWORD PTR _file$[ebp], 0
  00008	74 0c		 je	 SHORT $LN1@aviAudioDe
  0000a	83 7d 10 00	 cmp	 DWORD PTR _wfxIn$[ebp], 0
  0000e	74 06		 je	 SHORT $LN1@aviAudioDe
  00010	83 7d 14 00	 cmp	 DWORD PTR _wfxOut$[ebp], 0
  00014	75 05		 jne	 SHORT $LN2@aviAudioDe
$LN1@aviAudioDe:

; 173  :        return;

  00016	e9 e4 00 00 00	 jmp	 $LN3@aviAudioDe
$LN2@aviAudioDe:

; 174  : 
; 175  :     /*wfx = &file->audio.wfxIn;
; 176  : 
; 177  :     memset(wfx, 0, sizeof(WAVEFORMATEX));
; 178  :     wfx->wFormatTag      = WAVE_FORMAT_PCM;
; 179  :     wfx->nChannels       = 2;
; 180  :     wfx->nSamplesPerSec  = 44100;
; 181  :     wfx->wBitsPerSample  = 16;
; 182  :     wfx->nBlockAlign     = (wfx->nChannels * wfx->wBitsPerSample) / 8;
; 183  :     wfx->nAvgBytesPerSec = wfx->nSamplesPerSec * wfx->nBlockAlign;
; 184  : 
; 185  :     memcpy(&file->audio.wfxOut, &file->audio.wfxIn, sizeof(WAVEFORMATEX));*/
; 186  : 
; 187  :     file->audio.deviceID = deviceID;

  0001b	8b 45 08	 mov	 eax, DWORD PTR _file$[ebp]
  0001e	8b 4d 0c	 mov	 ecx, DWORD PTR _deviceID$[ebp]
  00021	89 88 80 03 00
	00		 mov	 DWORD PTR [eax+896], ecx

; 188  : 
; 189  :     memcpy(&file->audio.wfxIn, wfxIn, sizeof(WAVEFORMATEX));

  00027	6a 12		 push	 18			; 00000012H
  00029	8b 55 10	 mov	 edx, DWORD PTR _wfxIn$[ebp]
  0002c	52		 push	 edx
  0002d	8b 45 08	 mov	 eax, DWORD PTR _file$[ebp]
  00030	05 50 03 00 00	 add	 eax, 848		; 00000350H
  00035	50		 push	 eax
  00036	e8 00 00 00 00	 call	 _memcpy
  0003b	83 c4 0c	 add	 esp, 12			; 0000000cH

; 190  :     memcpy(&file->audio.wfxOut, wfxOut, sizeof(WAVEFORMATEX));

  0003e	6a 12		 push	 18			; 00000012H
  00040	8b 4d 14	 mov	 ecx, DWORD PTR _wfxOut$[ebp]
  00043	51		 push	 ecx
  00044	8b 55 08	 mov	 edx, DWORD PTR _file$[ebp]
  00047	81 c2 62 03 00
	00		 add	 edx, 866		; 00000362H
  0004d	52		 push	 edx
  0004e	e8 00 00 00 00	 call	 _memcpy
  00053	83 c4 0c	 add	 esp, 12			; 0000000cH

; 191  : 
; 192  :     /* Recalculate the block align and bytes per sec variables in both the
; 193  :        input and output formats to make sure they're using the correct
; 194  :        values */
; 195  :     wfx = &file->audio.wfxIn;

  00056	8b 45 08	 mov	 eax, DWORD PTR _file$[ebp]
  00059	05 50 03 00 00	 add	 eax, 848		; 00000350H
  0005e	89 45 fc	 mov	 DWORD PTR _wfx$[ebp], eax

; 196  : 
; 197  :     wfx->nBlockAlign     = (wfx->nChannels * wfx->wBitsPerSample) / 8;

  00061	8b 4d fc	 mov	 ecx, DWORD PTR _wfx$[ebp]
  00064	0f b7 41 02	 movzx	 eax, WORD PTR [ecx+2]
  00068	8b 55 fc	 mov	 edx, DWORD PTR _wfx$[ebp]
  0006b	0f b7 4a 0e	 movzx	 ecx, WORD PTR [edx+14]
  0006f	0f af c1	 imul	 eax, ecx
  00072	99		 cdq
  00073	83 e2 07	 and	 edx, 7
  00076	03 c2		 add	 eax, edx
  00078	c1 f8 03	 sar	 eax, 3
  0007b	8b 55 fc	 mov	 edx, DWORD PTR _wfx$[ebp]
  0007e	66 89 42 0c	 mov	 WORD PTR [edx+12], ax

; 198  :     wfx->nAvgBytesPerSec = wfx->nSamplesPerSec * wfx->nBlockAlign;

  00082	8b 45 fc	 mov	 eax, DWORD PTR _wfx$[ebp]
  00085	0f b7 48 0c	 movzx	 ecx, WORD PTR [eax+12]
  00089	8b 55 fc	 mov	 edx, DWORD PTR _wfx$[ebp]
  0008c	0f af 4a 04	 imul	 ecx, DWORD PTR [edx+4]
  00090	8b 45 fc	 mov	 eax, DWORD PTR _wfx$[ebp]
  00093	89 48 08	 mov	 DWORD PTR [eax+8], ecx

; 199  : 
; 200  :     wfx = &file->audio.wfxOut;

  00096	8b 4d 08	 mov	 ecx, DWORD PTR _file$[ebp]
  00099	81 c1 62 03 00
	00		 add	 ecx, 866		; 00000362H
  0009f	89 4d fc	 mov	 DWORD PTR _wfx$[ebp], ecx

; 201  : 
; 202  :     wfx->nBlockAlign     = (wfx->nChannels * wfx->wBitsPerSample) / 8;

  000a2	8b 55 fc	 mov	 edx, DWORD PTR _wfx$[ebp]
  000a5	0f b7 42 02	 movzx	 eax, WORD PTR [edx+2]
  000a9	8b 4d fc	 mov	 ecx, DWORD PTR _wfx$[ebp]
  000ac	0f b7 51 0e	 movzx	 edx, WORD PTR [ecx+14]
  000b0	0f af c2	 imul	 eax, edx
  000b3	99		 cdq
  000b4	83 e2 07	 and	 edx, 7
  000b7	03 c2		 add	 eax, edx
  000b9	c1 f8 03	 sar	 eax, 3
  000bc	8b 4d fc	 mov	 ecx, DWORD PTR _wfx$[ebp]
  000bf	66 89 41 0c	 mov	 WORD PTR [ecx+12], ax

; 203  :     wfx->nAvgBytesPerSec = wfx->nSamplesPerSec * wfx->nBlockAlign;

  000c3	8b 55 fc	 mov	 edx, DWORD PTR _wfx$[ebp]
  000c6	0f b7 42 0c	 movzx	 eax, WORD PTR [edx+12]
  000ca	8b 4d fc	 mov	 ecx, DWORD PTR _wfx$[ebp]
  000cd	0f af 41 04	 imul	 eax, DWORD PTR [ecx+4]
  000d1	8b 55 fc	 mov	 edx, DWORD PTR _wfx$[ebp]
  000d4	89 42 08	 mov	 DWORD PTR [edx+8], eax

; 204  : 
; 205  :     file->audio.cc.data  = mmioFOURCC('0', '1', 'w', 'b');

  000d7	8b 45 08	 mov	 eax, DWORD PTR _file$[ebp]
  000da	c7 80 48 03 00
	00 30 31 77 62	 mov	 DWORD PTR [eax+840], 1651978544 ; 62773130H

; 206  :     file->audio.cc.index = mmioFOURCC('i', 'x', '0', '1');

  000e4	8b 4d 08	 mov	 ecx, DWORD PTR _file$[ebp]
  000e7	c7 81 4c 03 00
	00 69 78 30 31	 mov	 DWORD PTR [ecx+844], 825260137 ; 31307869H

; 207  : 
; 208  :     file->flags |= AVI_FLAG_AUDIO;

  000f1	8b 55 08	 mov	 edx, DWORD PTR _file$[ebp]
  000f4	0f b6 02	 movzx	 eax, BYTE PTR [edx]
  000f7	83 c8 02	 or	 eax, 2
  000fa	8b 4d 08	 mov	 ecx, DWORD PTR _file$[ebp]
  000fd	88 01		 mov	 BYTE PTR [ecx], al
$LN3@aviAudioDe:

; 209  : }

  000ff	8b e5		 mov	 esp, ebp
  00101	5d		 pop	 ebp
  00102	c3		 ret	 0
_aviAudioDefineStream ENDP
; Function compile flags: /Odtp
_TEXT	ENDS
;	COMDAT ?bytesToSamples@@YAKPAUAVI_FILE@@PAUtWAVEFORMATEX@@K@Z
_TEXT	SEGMENT
tv70 = -4						; size = 4
_file$ = 8						; size = 4
_wfx$ = 12						; size = 4
_bytes$ = 16						; size = 4
?bytesToSamples@@YAKPAUAVI_FILE@@PAUtWAVEFORMATEX@@K@Z PROC ; bytesToSamples, COMDAT

; 55   : {

  00000	55		 push	 ebp
  00001	8b ec		 mov	 ebp, esp
  00003	51		 push	 ecx

; 56   :     return wfx->nBlockAlign > 0 ? bytes / wfx->nBlockAlign : bytes;

  00004	8b 45 0c	 mov	 eax, DWORD PTR _wfx$[ebp]
  00007	0f b7 48 0c	 movzx	 ecx, WORD PTR [eax+12]
  0000b	85 c9		 test	 ecx, ecx
  0000d	7e 13		 jle	 SHORT $LN3@bytesToSam
  0000f	8b 55 0c	 mov	 edx, DWORD PTR _wfx$[ebp]
  00012	0f b7 4a 0c	 movzx	 ecx, WORD PTR [edx+12]
  00016	8b 45 10	 mov	 eax, DWORD PTR _bytes$[ebp]
  00019	33 d2		 xor	 edx, edx
  0001b	f7 f1		 div	 ecx
  0001d	89 45 fc	 mov	 DWORD PTR tv70[ebp], eax
  00020	eb 06		 jmp	 SHORT $LN4@bytesToSam
$LN3@bytesToSam:
  00022	8b 55 10	 mov	 edx, DWORD PTR _bytes$[ebp]
  00025	89 55 fc	 mov	 DWORD PTR tv70[ebp], edx
$LN4@bytesToSam:
  00028	8b 45 fc	 mov	 eax, DWORD PTR tv70[ebp]

; 57   : }

  0002b	8b e5		 mov	 esp, ebp
  0002d	5d		 pop	 ebp
  0002e	c3		 ret	 0
?bytesToSamples@@YAKPAUAVI_FILE@@PAUtWAVEFORMATEX@@K@Z ENDP ; bytesToSamples
; Function compile flags: /Odtp
_TEXT	ENDS
;	COMDAT ?ticksToBytes@@YAKPAUAVI_FILE@@PAUtWAVEFORMATEX@@_J@Z
_TEXT	SEGMENT
tv95 = -28						; size = 8
tv93 = -20						; size = 4
tv90 = -14						; size = 2
tv88 = -12						; size = 4
tv84 = -8						; size = 8
_file$ = 8						; size = 4
_wfx$ = 12						; size = 4
_ticks$ = 16						; size = 8
?ticksToBytes@@YAKPAUAVI_FILE@@PAUtWAVEFORMATEX@@_J@Z PROC ; ticksToBytes, COMDAT

; 39   : {

  00000	55		 push	 ebp
  00001	8b ec		 mov	 ebp, esp
  00003	83 ec 1c	 sub	 esp, 28			; 0000001cH

; 40   :     return (DWORD)(((double)ticks / (double)file->timer.freq) *
; 41   :                    ((double)wfx->nSamplesPerSec * (double)wfx->nBlockAlign));

  00006	df 6d 10	 fild	 QWORD PTR _ticks$[ebp]
  00009	8b 45 08	 mov	 eax, DWORD PTR _file$[ebp]
  0000c	df a8 58 02 00
	00		 fild	 QWORD PTR [eax+600]
  00012	de f9		 fdivp	 ST(1), ST(0)
  00014	8b 4d 0c	 mov	 ecx, DWORD PTR _wfx$[ebp]
  00017	8b 51 04	 mov	 edx, DWORD PTR [ecx+4]
  0001a	89 55 f8	 mov	 DWORD PTR tv84[ebp], edx
  0001d	c7 45 fc 00 00
	00 00		 mov	 DWORD PTR tv84[ebp+4], 0
  00024	df 6d f8	 fild	 QWORD PTR tv84[ebp]
  00027	8b 45 0c	 mov	 eax, DWORD PTR _wfx$[ebp]
  0002a	0f b7 48 0c	 movzx	 ecx, WORD PTR [eax+12]
  0002e	89 4d f4	 mov	 DWORD PTR tv88[ebp], ecx
  00031	db 45 f4	 fild	 DWORD PTR tv88[ebp]
  00034	de c9		 fmulp	 ST(1), ST(0)
  00036	de c9		 fmulp	 ST(1), ST(0)
  00038	d9 7d f2	 fnstcw	 WORD PTR tv90[ebp]
  0003b	0f b7 45 f2	 movzx	 eax, WORD PTR tv90[ebp]
  0003f	0d 00 0c 00 00	 or	 eax, 3072		; 00000c00H
  00044	89 45 ec	 mov	 DWORD PTR tv93[ebp], eax
  00047	d9 6d ec	 fldcw	 WORD PTR tv93[ebp]
  0004a	df 7d e4	 fistp	 QWORD PTR tv95[ebp]
  0004d	d9 6d f2	 fldcw	 WORD PTR tv90[ebp]
  00050	8b 45 e4	 mov	 eax, DWORD PTR tv95[ebp]

; 42   : }

  00053	8b e5		 mov	 esp, ebp
  00055	5d		 pop	 ebp
  00056	c3		 ret	 0
?ticksToBytes@@YAKPAUAVI_FILE@@PAUtWAVEFORMATEX@@_J@Z ENDP ; ticksToBytes
_TEXT	ENDS
EXTRN	__ftol2:PROC
; Function compile flags: /Odtp
;	COMDAT ?bytesToTicks@@YA_JPAUAVI_FILE@@PAUtWAVEFORMATEX@@K@Z
_TEXT	SEGMENT
tv85 = -16						; size = 8
tv79 = -8						; size = 8
_file$ = 8						; size = 4
_wfx$ = 12						; size = 4
_bytes$ = 16						; size = 4
?bytesToTicks@@YA_JPAUAVI_FILE@@PAUtWAVEFORMATEX@@K@Z PROC ; bytesToTicks, COMDAT

; 23   : {

  00000	55		 push	 ebp
  00001	8b ec		 mov	 ebp, esp
  00003	83 ec 10	 sub	 esp, 16			; 00000010H

; 24   :     return (aviTime_t)(((double)bytes /
; 25   :                        (double)(wfx->nSamplesPerSec * wfx->nBlockAlign)) *
; 26   :                        (double)file->timer.freq);

  00006	8b 45 10	 mov	 eax, DWORD PTR _bytes$[ebp]
  00009	89 45 f8	 mov	 DWORD PTR tv79[ebp], eax
  0000c	c7 45 fc 00 00
	00 00		 mov	 DWORD PTR tv79[ebp+4], 0
  00013	df 6d f8	 fild	 QWORD PTR tv79[ebp]
  00016	8b 4d 0c	 mov	 ecx, DWORD PTR _wfx$[ebp]
  00019	0f b7 51 0c	 movzx	 edx, WORD PTR [ecx+12]
  0001d	8b 45 0c	 mov	 eax, DWORD PTR _wfx$[ebp]
  00020	0f af 50 04	 imul	 edx, DWORD PTR [eax+4]
  00024	89 55 f0	 mov	 DWORD PTR tv85[ebp], edx
  00027	c7 45 f4 00 00
	00 00		 mov	 DWORD PTR tv85[ebp+4], 0
  0002e	df 6d f0	 fild	 QWORD PTR tv85[ebp]
  00031	de f9		 fdivp	 ST(1), ST(0)
  00033	8b 4d 08	 mov	 ecx, DWORD PTR _file$[ebp]
  00036	df a9 58 02 00
	00		 fild	 QWORD PTR [ecx+600]
  0003c	de c9		 fmulp	 ST(1), ST(0)
  0003e	e8 00 00 00 00	 call	 __ftol2

; 27   : }

  00043	8b e5		 mov	 esp, ebp
  00045	5d		 pop	 ebp
  00046	c3		 ret	 0
?bytesToTicks@@YA_JPAUAVI_FILE@@PAUtWAVEFORMATEX@@K@Z ENDP ; bytesToTicks
PUBLIC	?waveInCallback@@YGXPAUHWAVEIN__@@IKKK@Z	; waveInCallback
; Function compile flags: /Odtp
;	COMDAT ?waveInCallback@@YGXPAUHWAVEIN__@@IKKK@Z
_TEXT	SEGMENT
_save$ = -44						; size = 4
_startOffset$ = -40					; size = 4
_size$ = -36						; size = 4
_file$ = -32						; size = 4
_samples$ = -28						; size = 4
_time$ = -24						; size = 16
_whdr$ = -4						; size = 4
_hWaveIn$ = 8						; size = 4
_uMsg$ = 12						; size = 4
_dwInstance$ = 16					; size = 4
_dwParam1$ = 20						; size = 4
_dwParam2$ = 24						; size = 4
?waveInCallback@@YGXPAUHWAVEIN__@@IKKK@Z PROC		; waveInCallback, COMDAT

; 66   : {

  00000	55		 push	 ebp
  00001	8b ec		 mov	 ebp, esp
  00003	83 ec 2c	 sub	 esp, 44			; 0000002cH

; 67   :     WAVEHDR  *whdr;
; 68   :     AVI_FILE *file;
; 69   :     BOOL     save;
; 70   :     DWORD    startOffset;
; 71   :     DWORD    size;
; 72   :     DWORD    samples;
; 73   : 
; 74   :     struct
; 75   :     {
; 76   :         aviTime_t start, current;
; 77   :     } time;
; 78   : 
; 79   :     if (uMsg==WIM_DATA)

  00006	81 7d 0c c0 03
	00 00		 cmp	 DWORD PTR _uMsg$[ebp], 960 ; 000003c0H
  0000d	0f 85 28 02 00
	00		 jne	 $LN11@waveInCall

; 80   :     {
; 81   :         whdr = (WAVEHDR *)dwParam1;

  00013	8b 45 14	 mov	 eax, DWORD PTR _dwParam1$[ebp]
  00016	89 45 fc	 mov	 DWORD PTR _whdr$[ebp], eax

; 82   :         file = (AVI_FILE *)dwInstance;

  00019	8b 4d 10	 mov	 ecx, DWORD PTR _dwInstance$[ebp]
  0001c	89 4d e0	 mov	 DWORD PTR _file$[ebp], ecx

; 83   : 
; 84   :         /* Stop here if no more data is supposed to be written */
; 85   :         if (file->hold)

  0001f	8b 55 e0	 mov	 edx, DWORD PTR _file$[ebp]
  00022	83 7a 04 00	 cmp	 DWORD PTR [edx+4], 0
  00026	74 05		 je	 SHORT $LN9@waveInCall

; 86   :            return;

  00028	e9 0e 02 00 00	 jmp	 $LN11@waveInCall
$LN9@waveInCall:

; 87   : 
; 88   :         if (whdr->dwBytesRecorded > 0)

  0002d	8b 45 fc	 mov	 eax, DWORD PTR _whdr$[ebp]
  00030	83 78 08 00	 cmp	 DWORD PTR [eax+8], 0
  00034	0f 86 cb 01 00
	00		 jbe	 $LN8@waveInCall

; 89   :         {
; 90   :             save         = FALSE;

  0003a	c7 45 d4 00 00
	00 00		 mov	 DWORD PTR _save$[ebp], 0

; 91   :             startOffset  = 0;

  00041	c7 45 d8 00 00
	00 00		 mov	 DWORD PTR _startOffset$[ebp], 0

; 92   :             time.current = aviGetTimer();

  00048	e8 00 00 00 00	 call	 _aviGetTimer
  0004d	89 45 f0	 mov	 DWORD PTR _time$[ebp+8], eax
  00050	89 55 f4	 mov	 DWORD PTR _time$[ebp+12], edx

; 93   : 
; 94   :             aviLockTimer(file);

  00053	8b 4d e0	 mov	 ecx, DWORD PTR _file$[ebp]
  00056	51		 push	 ecx
  00057	e8 00 00 00 00	 call	 ?aviLockTimer@@YAXPAUAVI_FILE@@@Z ; aviLockTimer
  0005c	83 c4 04	 add	 esp, 4

; 95   : 
; 96   :             if (aviTimerStarted(file))

  0005f	8b 55 e0	 mov	 edx, DWORD PTR _file$[ebp]
  00062	52		 push	 edx
  00063	e8 00 00 00 00	 call	 ?aviTimerStarted@@YAHPAUAVI_FILE@@@Z ; aviTimerStarted
  00068	83 c4 04	 add	 esp, 4
  0006b	85 c0		 test	 eax, eax
  0006d	0f 84 a5 00 00
	00		 je	 $LN7@waveInCall

; 97   :             {
; 98   :                 time.start = aviTimerGetStart(file);

  00073	8b 45 e0	 mov	 eax, DWORD PTR _file$[ebp]
  00076	50		 push	 eax
  00077	e8 00 00 00 00	 call	 ?aviTimerGetStart@@YA_JPAUAVI_FILE@@@Z ; aviTimerGetStart
  0007c	83 c4 04	 add	 esp, 4
  0007f	89 45 e8	 mov	 DWORD PTR _time$[ebp], eax
  00082	89 55 ec	 mov	 DWORD PTR _time$[ebp+4], edx

; 99   :                 if (time.current > time.start)

  00085	8b 4d f4	 mov	 ecx, DWORD PTR _time$[ebp+12]
  00088	3b 4d ec	 cmp	 ecx, DWORD PTR _time$[ebp+4]
  0008b	0f 8c 87 00 00
	00		 jl	 $LN7@waveInCall
  00091	7f 08		 jg	 SHORT $LN13@waveInCall
  00093	8b 55 f0	 mov	 edx, DWORD PTR _time$[ebp+8]
  00096	3b 55 e8	 cmp	 edx, DWORD PTR _time$[ebp]
  00099	76 7d		 jbe	 SHORT $LN7@waveInCall
$LN13@waveInCall:

; 100  :                 {
; 101  :                     save = TRUE;

  0009b	c7 45 d4 01 00
	00 00		 mov	 DWORD PTR _save$[ebp], 1

; 102  : 
; 103  :                     /* Make sure the starting time doesn't go below zero if the
; 104  :                        total time of this data is subtracted from it */
; 105  :                     time.start -= bytesToTicks(file, &file->audio.wfxIn,
; 106  :                                                whdr->dwBytesRecorded);

  000a2	8b 45 fc	 mov	 eax, DWORD PTR _whdr$[ebp]
  000a5	8b 48 08	 mov	 ecx, DWORD PTR [eax+8]
  000a8	51		 push	 ecx
  000a9	8b 55 e0	 mov	 edx, DWORD PTR _file$[ebp]
  000ac	81 c2 50 03 00
	00		 add	 edx, 848		; 00000350H
  000b2	52		 push	 edx
  000b3	8b 45 e0	 mov	 eax, DWORD PTR _file$[ebp]
  000b6	50		 push	 eax
  000b7	e8 00 00 00 00	 call	 ?bytesToTicks@@YA_JPAUAVI_FILE@@PAUtWAVEFORMATEX@@K@Z ; bytesToTicks
  000bc	83 c4 0c	 add	 esp, 12			; 0000000cH
  000bf	8b 4d e8	 mov	 ecx, DWORD PTR _time$[ebp]
  000c2	2b c8		 sub	 ecx, eax
  000c4	8b 45 ec	 mov	 eax, DWORD PTR _time$[ebp+4]
  000c7	1b c2		 sbb	 eax, edx
  000c9	89 4d e8	 mov	 DWORD PTR _time$[ebp], ecx
  000cc	89 45 ec	 mov	 DWORD PTR _time$[ebp+4], eax

; 107  :                     if (time.start < 0)

  000cf	83 7d ec 00	 cmp	 DWORD PTR _time$[ebp+4], 0
  000d3	7f 43		 jg	 SHORT $LN7@waveInCall
  000d5	7c 06		 jl	 SHORT $LN14@waveInCall
  000d7	83 7d e8 00	 cmp	 DWORD PTR _time$[ebp], 0
  000db	73 3b		 jae	 SHORT $LN7@waveInCall
$LN14@waveInCall:

; 108  :                     {
; 109  :                         /* Adjust the starting offset so that data before the
; 110  :                            starting time is not saved */
; 111  :                         startOffset = ticksToBytes(file, &file->audio.wfxIn,
; 112  :                                                    -time.start);

  000dd	8b 4d e8	 mov	 ecx, DWORD PTR _time$[ebp]
  000e0	f7 d9		 neg	 ecx
  000e2	8b 55 ec	 mov	 edx, DWORD PTR _time$[ebp+4]
  000e5	83 d2 00	 adc	 edx, 0
  000e8	f7 da		 neg	 edx
  000ea	52		 push	 edx
  000eb	51		 push	 ecx
  000ec	8b 45 e0	 mov	 eax, DWORD PTR _file$[ebp]
  000ef	05 50 03 00 00	 add	 eax, 848		; 00000350H
  000f4	50		 push	 eax
  000f5	8b 4d e0	 mov	 ecx, DWORD PTR _file$[ebp]
  000f8	51		 push	 ecx
  000f9	e8 00 00 00 00	 call	 ?ticksToBytes@@YAKPAUAVI_FILE@@PAUtWAVEFORMATEX@@_J@Z ; ticksToBytes
  000fe	83 c4 10	 add	 esp, 16			; 00000010H
  00101	89 45 d8	 mov	 DWORD PTR _startOffset$[ebp], eax

; 113  : 
; 114  :                         /* If the number of bytes that would be saved ends up
; 115  :                            being zero, then don't save anything */
; 116  :                         if ((long)whdr->dwBytesRecorded - (long)startOffset <= 0)

  00104	8b 55 fc	 mov	 edx, DWORD PTR _whdr$[ebp]
  00107	8b 42 08	 mov	 eax, DWORD PTR [edx+8]
  0010a	2b 45 d8	 sub	 eax, DWORD PTR _startOffset$[ebp]
  0010d	85 c0		 test	 eax, eax
  0010f	7f 07		 jg	 SHORT $LN7@waveInCall

; 117  :                            save = FALSE;

  00111	c7 45 d4 00 00
	00 00		 mov	 DWORD PTR _save$[ebp], 0
$LN7@waveInCall:

; 118  :                     }
; 119  :                 }
; 120  :             }
; 121  : 
; 122  :             if (save)

  00118	83 7d d4 00	 cmp	 DWORD PTR _save$[ebp], 0
  0011c	74 3f		 je	 SHORT $LN3@waveInCall

; 123  :                file->timer.elapsed += bytesToTicks(file, &file->audio.wfxIn,
; 124  :                                                    whdr->dwBytesRecorded -
; 125  :                                                    startOffset);

  0011e	8b 4d fc	 mov	 ecx, DWORD PTR _whdr$[ebp]
  00121	8b 51 08	 mov	 edx, DWORD PTR [ecx+8]
  00124	2b 55 d8	 sub	 edx, DWORD PTR _startOffset$[ebp]
  00127	52		 push	 edx
  00128	8b 45 e0	 mov	 eax, DWORD PTR _file$[ebp]
  0012b	05 50 03 00 00	 add	 eax, 848		; 00000350H
  00130	50		 push	 eax
  00131	8b 4d e0	 mov	 ecx, DWORD PTR _file$[ebp]
  00134	51		 push	 ecx
  00135	e8 00 00 00 00	 call	 ?bytesToTicks@@YA_JPAUAVI_FILE@@PAUtWAVEFORMATEX@@K@Z ; bytesToTicks
  0013a	83 c4 0c	 add	 esp, 12			; 0000000cH
  0013d	8b 4d e0	 mov	 ecx, DWORD PTR _file$[ebp]
  00140	03 81 70 02 00
	00		 add	 eax, DWORD PTR [ecx+624]
  00146	8b 89 74 02 00
	00		 mov	 ecx, DWORD PTR [ecx+628]
  0014c	13 ca		 adc	 ecx, edx
  0014e	8b 55 e0	 mov	 edx, DWORD PTR _file$[ebp]
  00151	89 82 70 02 00
	00		 mov	 DWORD PTR [edx+624], eax
  00157	89 8a 74 02 00
	00		 mov	 DWORD PTR [edx+628], ecx
$LN3@waveInCall:

; 126  : 
; 127  :             aviUnlockTimer(file);

  0015d	8b 45 e0	 mov	 eax, DWORD PTR _file$[ebp]
  00160	50		 push	 eax
  00161	e8 00 00 00 00	 call	 ?aviUnlockTimer@@YAXPAUAVI_FILE@@@Z ; aviUnlockTimer
  00166	83 c4 04	 add	 esp, 4

; 128  : 
; 129  :             if (save)

  00169	83 7d d4 00	 cmp	 DWORD PTR _save$[ebp], 0
  0016d	0f 84 92 00 00
	00		 je	 $LN8@waveInCall

; 130  :             {
; 131  :                 size    = whdr->dwBytesRecorded - startOffset;

  00173	8b 4d fc	 mov	 ecx, DWORD PTR _whdr$[ebp]
  00176	8b 51 08	 mov	 edx, DWORD PTR [ecx+8]
  00179	2b 55 d8	 sub	 edx, DWORD PTR _startOffset$[ebp]
  0017c	89 55 dc	 mov	 DWORD PTR _size$[ebp], edx

; 132  :                 samples = bytesToSamples(file, &file->audio.wfxIn, size);

  0017f	8b 45 dc	 mov	 eax, DWORD PTR _size$[ebp]
  00182	50		 push	 eax
  00183	8b 4d e0	 mov	 ecx, DWORD PTR _file$[ebp]
  00186	81 c1 50 03 00
	00		 add	 ecx, 848		; 00000350H
  0018c	51		 push	 ecx
  0018d	8b 55 e0	 mov	 edx, DWORD PTR _file$[ebp]
  00190	52		 push	 edx
  00191	e8 00 00 00 00	 call	 ?bytesToSamples@@YAKPAUAVI_FILE@@PAUtWAVEFORMATEX@@K@Z ; bytesToSamples
  00196	83 c4 0c	 add	 esp, 12			; 0000000cH
  00199	89 45 e4	 mov	 DWORD PTR _samples$[ebp], eax

; 133  : 
; 134  :                 aviLockAudio(file);

  0019c	8b 45 e0	 mov	 eax, DWORD PTR _file$[ebp]
  0019f	50		 push	 eax
  001a0	e8 00 00 00 00	 call	 ?aviLockAudio@@YAXPAUAVI_FILE@@@Z ; aviLockAudio
  001a5	83 c4 04	 add	 esp, 4

; 135  : 
; 136  :                 /* Update the maximum and average chunk sizes for this
; 137  :                    stream */
; 138  :                 aviAddStreamValue(&file->audio.values, size);

  001a8	8b 4d dc	 mov	 ecx, DWORD PTR _size$[ebp]
  001ab	51		 push	 ecx
  001ac	8b 55 e0	 mov	 edx, DWORD PTR _file$[ebp]
  001af	81 c2 88 03 00
	00		 add	 edx, 904		; 00000388H
  001b5	52		 push	 edx
  001b6	e8 00 00 00 00	 call	 ?aviAddStreamValue@@YAXPAUSTREAM_VALUES@@K@Z ; aviAddStreamValue
  001bb	83 c4 08	 add	 esp, 8

; 139  : 
; 140  :                 file->audio.streamLength += samples;

  001be	8b 45 e0	 mov	 eax, DWORD PTR _file$[ebp]
  001c1	8b 88 84 03 00
	00		 mov	 ecx, DWORD PTR [eax+900]
  001c7	03 4d e4	 add	 ecx, DWORD PTR _samples$[ebp]
  001ca	8b 55 e0	 mov	 edx, DWORD PTR _file$[ebp]
  001cd	89 8a 84 03 00
	00		 mov	 DWORD PTR [edx+900], ecx

; 141  : 
; 142  :                 aviSaveAudio(file, whdr->lpData + startOffset, size,
; 143  :                              samples, &file->audio.values);

  001d3	8b 45 e0	 mov	 eax, DWORD PTR _file$[ebp]
  001d6	05 88 03 00 00	 add	 eax, 904		; 00000388H
  001db	50		 push	 eax
  001dc	8b 4d e4	 mov	 ecx, DWORD PTR _samples$[ebp]
  001df	51		 push	 ecx
  001e0	8b 55 dc	 mov	 edx, DWORD PTR _size$[ebp]
  001e3	52		 push	 edx
  001e4	8b 45 fc	 mov	 eax, DWORD PTR _whdr$[ebp]
  001e7	8b 08		 mov	 ecx, DWORD PTR [eax]
  001e9	03 4d d8	 add	 ecx, DWORD PTR _startOffset$[ebp]
  001ec	51		 push	 ecx
  001ed	8b 55 e0	 mov	 edx, DWORD PTR _file$[ebp]
  001f0	52		 push	 edx
  001f1	e8 00 00 00 00	 call	 ?aviSaveAudio@@YAHPAUAVI_FILE@@PAXKKPAUSTREAM_VALUES@@@Z ; aviSaveAudio
  001f6	83 c4 14	 add	 esp, 20			; 00000014H

; 144  : 
; 145  :                 aviUnlockAudio(file);

  001f9	8b 45 e0	 mov	 eax, DWORD PTR _file$[ebp]
  001fc	50		 push	 eax
  001fd	e8 00 00 00 00	 call	 ?aviUnlockAudio@@YAXPAUAVI_FILE@@@Z ; aviUnlockAudio
  00202	83 c4 04	 add	 esp, 4
$LN8@waveInCall:

; 146  :             }
; 147  :         }
; 148  : 
; 149  :         if (file->audio.recording)

  00205	8b 4d e0	 mov	 ecx, DWORD PTR _file$[ebp]
  00208	83 b9 7c 03 00
	00 00		 cmp	 DWORD PTR [ecx+892], 0
  0020f	74 2a		 je	 SHORT $LN11@waveInCall

; 150  :         {
; 151  :             /* Give this buffer back to the waveIn device */
; 152  :             whdr->dwFlags = 0;

  00211	8b 55 fc	 mov	 edx, DWORD PTR _whdr$[ebp]
  00214	c7 42 10 00 00
	00 00		 mov	 DWORD PTR [edx+16], 0

; 153  : 
; 154  :             waveInPrepareHeader(hWaveIn, whdr, sizeof(WAVEHDR));

  0021b	6a 20		 push	 32			; 00000020H
  0021d	8b 45 fc	 mov	 eax, DWORD PTR _whdr$[ebp]
  00220	50		 push	 eax
  00221	8b 4d 08	 mov	 ecx, DWORD PTR _hWaveIn$[ebp]
  00224	51		 push	 ecx
  00225	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__waveInPrepareHeader@12

; 155  :             waveInAddBuffer(hWaveIn, whdr, sizeof(WAVEHDR));

  0022b	6a 20		 push	 32			; 00000020H
  0022d	8b 55 fc	 mov	 edx, DWORD PTR _whdr$[ebp]
  00230	52		 push	 edx
  00231	8b 45 08	 mov	 eax, DWORD PTR _hWaveIn$[ebp]
  00234	50		 push	 eax
  00235	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__waveInAddBuffer@12
$LN11@waveInCall:

; 156  :         }
; 157  :     }
; 158  : }

  0023b	8b e5		 mov	 esp, ebp
  0023d	5d		 pop	 ebp
  0023e	c2 14 00	 ret	 20			; 00000014H
?waveInCallback@@YGXPAUHWAVEIN__@@IKKK@Z ENDP		; waveInCallback
PUBLIC	?aviAudioBegin@@YAHPAUAVI_FILE@@@Z		; aviAudioBegin
; Function compile flags: /Odtp
;	COMDAT ?aviAudioBegin@@YAHPAUAVI_FILE@@@Z
_TEXT	SEGMENT
_result$ = -16						; size = 4
_bufferLength$ = -12					; size = 4
_whdr$ = -8						; size = 4
_i$ = -4						; size = 4
_file$ = 8						; size = 4
?aviAudioBegin@@YAHPAUAVI_FILE@@@Z PROC			; aviAudioBegin, COMDAT

; 218  : {

  00000	55		 push	 ebp
  00001	8b ec		 mov	 ebp, esp
  00003	83 ec 10	 sub	 esp, 16			; 00000010H

; 219  :     MMRESULT result;
; 220  :     WAVEHDR  *whdr;
; 221  :     int      i;
; 222  :     DWORD    bufferLength;
; 223  : 
; 224  :     if (!file)

  00006	83 7d 08 00	 cmp	 DWORD PTR _file$[ebp], 0
  0000a	75 07		 jne	 SHORT $LN14@aviAudioBe

; 225  :        return FALSE;

  0000c	33 c0		 xor	 eax, eax
  0000e	e9 cd 01 00 00	 jmp	 $LN15@aviAudioBe
$LN14@aviAudioBe:

; 226  : 
; 227  :     if (file->audio.hWaveIn != INVALID_HANDLE_VALUE)

  00013	8b 45 08	 mov	 eax, DWORD PTR _file$[ebp]
  00016	83 b8 78 03 00
	00 ff		 cmp	 DWORD PTR [eax+888], -1
  0001d	74 0a		 je	 SHORT $LN13@aviAudioBe

; 228  :        return TRUE;

  0001f	b8 01 00 00 00	 mov	 eax, 1
  00024	e9 b7 01 00 00	 jmp	 $LN15@aviAudioBe
$LN13@aviAudioBe:

; 229  : 
; 230  :     result = waveInOpen(&file->audio.hWaveIn, file->audio.deviceID,
; 231  :                         &file->audio.wfxIn, (DWORD_PTR)waveInCallback,
; 232  :                         (DWORD_PTR)file, CALLBACK_FUNCTION);

  00029	68 00 00 03 00	 push	 196608			; 00030000H
  0002e	8b 4d 08	 mov	 ecx, DWORD PTR _file$[ebp]
  00031	51		 push	 ecx
  00032	68 00 00 00 00	 push	 OFFSET ?waveInCallback@@YGXPAUHWAVEIN__@@IKKK@Z ; waveInCallback
  00037	8b 55 08	 mov	 edx, DWORD PTR _file$[ebp]
  0003a	81 c2 50 03 00
	00		 add	 edx, 848		; 00000350H
  00040	52		 push	 edx
  00041	8b 45 08	 mov	 eax, DWORD PTR _file$[ebp]
  00044	8b 88 80 03 00
	00		 mov	 ecx, DWORD PTR [eax+896]
  0004a	51		 push	 ecx
  0004b	8b 55 08	 mov	 edx, DWORD PTR _file$[ebp]
  0004e	81 c2 78 03 00
	00		 add	 edx, 888		; 00000378H
  00054	52		 push	 edx
  00055	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__waveInOpen@24
  0005b	89 45 f0	 mov	 DWORD PTR _result$[ebp], eax

; 233  : 
; 234  :     if (result != MMSYSERR_NOERROR)

  0005e	83 7d f0 00	 cmp	 DWORD PTR _result$[ebp], 0
  00062	74 42		 je	 SHORT $LN12@aviAudioBe

; 235  :     {
; 236  :         file->audio.hWaveIn = (HWAVEIN)INVALID_HANDLE_VALUE;

  00064	8b 45 08	 mov	 eax, DWORD PTR _file$[ebp]
  00067	c7 80 78 03 00
	00 ff ff ff ff	 mov	 DWORD PTR [eax+888], -1

; 237  : 
; 238  :         if (result==WAVERR_BADFORMAT)

  00071	83 7d f0 20	 cmp	 DWORD PTR _result$[ebp], 32 ; 00000020H
  00075	75 15		 jne	 SHORT $LN11@aviAudioBe

; 239  :            aviSetError(file, AVI_ERROR_AUDIO_OPEN,
; 240  :                              _T("The recording format is not supported"));

  00077	68 00 00 00 00	 push	 OFFSET ??_C@_1EM@EPFCBIAC@?$AAT?$AAh?$AAe?$AA?5?$AAr?$AAe?$AAc?$AAo?$AAr?$AAd?$AAi?$AAn?$AAg?$AA?5?$AAf?$AAo?$AAr?$AAm?$AAa?$AAt?$AA?5?$AAi?$AAs?$AA?5?$AAn?$AAo?$AAt?$AA?5?$AAs?$AAu?$AAp?$AAp@
  0007c	6a 06		 push	 6
  0007e	8b 4d 08	 mov	 ecx, DWORD PTR _file$[ebp]
  00081	51		 push	 ecx
  00082	e8 00 00 00 00	 call	 ?aviSetError@@YAXPAUAVI_FILE@@W4aviError_t@@PA_W@Z ; aviSetError
  00087	83 c4 0c	 add	 esp, 12			; 0000000cH

; 241  :            else

  0008a	eb 13		 jmp	 SHORT $LN10@aviAudioBe
$LN11@aviAudioBe:

; 242  :            aviSetError(file, AVI_ERROR_AUDIO_OPEN,
; 243  :                              _T("The waveIn device could not be opened"));

  0008c	68 00 00 00 00	 push	 OFFSET ??_C@_1EM@HIDHLDPC@?$AAT?$AAh?$AAe?$AA?5?$AAw?$AAa?$AAv?$AAe?$AAI?$AAn?$AA?5?$AAd?$AAe?$AAv?$AAi?$AAc?$AAe?$AA?5?$AAc?$AAo?$AAu?$AAl?$AAd?$AA?5?$AAn?$AAo?$AAt?$AA?5?$AAb?$AAe?$AA?5?$AAo@
  00091	6a 06		 push	 6
  00093	8b 55 08	 mov	 edx, DWORD PTR _file$[ebp]
  00096	52		 push	 edx
  00097	e8 00 00 00 00	 call	 ?aviSetError@@YAXPAUAVI_FILE@@W4aviError_t@@PA_W@Z ; aviSetError
  0009c	83 c4 0c	 add	 esp, 12			; 0000000cH
$LN10@aviAudioBe:

; 244  : 
; 245  :         return FALSE;

  0009f	33 c0		 xor	 eax, eax
  000a1	e9 3a 01 00 00	 jmp	 $LN15@aviAudioBe
$LN12@aviAudioBe:

; 246  :     }
; 247  : 
; 248  :     bufferLength = file->audio.wfxIn.nAvgBytesPerSec;

  000a6	8b 45 08	 mov	 eax, DWORD PTR _file$[ebp]
  000a9	8b 88 58 03 00
	00		 mov	 ecx, DWORD PTR [eax+856]
  000af	89 4d f4	 mov	 DWORD PTR _bufferLength$[ebp], ecx

; 249  : 
; 250  :     /* Reset the pointers of the buffers */
; 251  :     for (i = 0; i < MAX_WAVE_BUFFER; i++)

  000b2	c7 45 fc 00 00
	00 00		 mov	 DWORD PTR _i$[ebp], 0
  000b9	eb 09		 jmp	 SHORT $LN9@aviAudioBe
$LN8@aviAudioBe:
  000bb	8b 55 fc	 mov	 edx, DWORD PTR _i$[ebp]
  000be	83 c2 01	 add	 edx, 1
  000c1	89 55 fc	 mov	 DWORD PTR _i$[ebp], edx
$LN9@aviAudioBe:
  000c4	83 7d fc 04	 cmp	 DWORD PTR _i$[ebp], 4
  000c8	7d 13		 jge	 SHORT $LN7@aviAudioBe

; 252  :         file->audio.buffer[i] = NULL;

  000ca	8b 45 fc	 mov	 eax, DWORD PTR _i$[ebp]
  000cd	8b 4d 08	 mov	 ecx, DWORD PTR _file$[ebp]
  000d0	c7 84 81 18 04
	00 00 00 00 00
	00		 mov	 DWORD PTR [ecx+eax*4+1048], 0
  000db	eb de		 jmp	 SHORT $LN8@aviAudioBe
$LN7@aviAudioBe:

; 253  : 
; 254  :     /* Allocate the buffers and set up the wave headers */
; 255  :     for (i = 0; i < MAX_WAVE_BUFFER; i++)

  000dd	c7 45 fc 00 00
	00 00		 mov	 DWORD PTR _i$[ebp], 0
  000e4	eb 09		 jmp	 SHORT $LN6@aviAudioBe
$LN5@aviAudioBe:
  000e6	8b 55 fc	 mov	 edx, DWORD PTR _i$[ebp]
  000e9	83 c2 01	 add	 edx, 1
  000ec	89 55 fc	 mov	 DWORD PTR _i$[ebp], edx
$LN6@aviAudioBe:
  000ef	83 7d fc 04	 cmp	 DWORD PTR _i$[ebp], 4
  000f3	0f 8d e2 00 00
	00		 jge	 $LN4@aviAudioBe

; 256  :     {
; 257  :         /* Allocate enough space for one second of audio */
; 258  :         file->audio.buffer[i] = malloc(bufferLength);

  000f9	8b 45 f4	 mov	 eax, DWORD PTR _bufferLength$[ebp]
  000fc	50		 push	 eax
  000fd	e8 00 00 00 00	 call	 _malloc
  00102	83 c4 04	 add	 esp, 4
  00105	8b 4d fc	 mov	 ecx, DWORD PTR _i$[ebp]
  00108	8b 55 08	 mov	 edx, DWORD PTR _file$[ebp]
  0010b	89 84 8a 18 04
	00 00		 mov	 DWORD PTR [edx+ecx*4+1048], eax

; 259  :         if (!file->audio.buffer[i])

  00112	8b 45 fc	 mov	 eax, DWORD PTR _i$[ebp]
  00115	8b 4d 08	 mov	 ecx, DWORD PTR _file$[ebp]
  00118	83 bc 81 18 04
	00 00 00	 cmp	 DWORD PTR [ecx+eax*4+1048], 0
  00120	75 1a		 jne	 SHORT $LN3@aviAudioBe

; 260  :         {
; 261  :             aviSetError(file, AVI_ERROR_AUDIO_OPEN, _T("Out of memory"));

  00122	68 00 00 00 00	 push	 OFFSET ??_C@_1BM@CKLAAKNF@?$AAO?$AAu?$AAt?$AA?5?$AAo?$AAf?$AA?5?$AAm?$AAe?$AAm?$AAo?$AAr?$AAy?$AA?$AA@
  00127	6a 06		 push	 6
  00129	8b 55 08	 mov	 edx, DWORD PTR _file$[ebp]
  0012c	52		 push	 edx
  0012d	e8 00 00 00 00	 call	 ?aviSetError@@YAXPAUAVI_FILE@@W4aviError_t@@PA_W@Z ; aviSetError
  00132	83 c4 0c	 add	 esp, 12			; 0000000cH

; 262  :             return FALSE;

  00135	33 c0		 xor	 eax, eax
  00137	e9 a4 00 00 00	 jmp	 $LN15@aviAudioBe
$LN3@aviAudioBe:

; 263  :         }
; 264  : 
; 265  :         whdr = &file->audio.whdr[i];

  0013c	8b 45 fc	 mov	 eax, DWORD PTR _i$[ebp]
  0013f	c1 e0 05	 shl	 eax, 5
  00142	8b 4d 08	 mov	 ecx, DWORD PTR _file$[ebp]
  00145	8d 94 01 98 03
	00 00		 lea	 edx, DWORD PTR [ecx+eax+920]
  0014c	89 55 f8	 mov	 DWORD PTR _whdr$[ebp], edx

; 266  : 
; 267  :         whdr->lpData         = (LPSTR)file->audio.buffer[i];

  0014f	8b 45 f8	 mov	 eax, DWORD PTR _whdr$[ebp]
  00152	8b 4d fc	 mov	 ecx, DWORD PTR _i$[ebp]
  00155	8b 55 08	 mov	 edx, DWORD PTR _file$[ebp]
  00158	8b 8c 8a 18 04
	00 00		 mov	 ecx, DWORD PTR [edx+ecx*4+1048]
  0015f	89 08		 mov	 DWORD PTR [eax], ecx

; 268  :         whdr->dwBufferLength = bufferLength;

  00161	8b 55 f8	 mov	 edx, DWORD PTR _whdr$[ebp]
  00164	8b 45 f4	 mov	 eax, DWORD PTR _bufferLength$[ebp]
  00167	89 42 04	 mov	 DWORD PTR [edx+4], eax

; 269  :         whdr->dwFlags        = 0;

  0016a	8b 4d f8	 mov	 ecx, DWORD PTR _whdr$[ebp]
  0016d	c7 41 10 00 00
	00 00		 mov	 DWORD PTR [ecx+16], 0

; 270  : 
; 271  :         if (waveInPrepareHeader(file->audio.hWaveIn, whdr,
; 272  :                                 sizeof(WAVEHDR)) != MMSYSERR_NOERROR)

  00174	6a 20		 push	 32			; 00000020H
  00176	8b 55 f8	 mov	 edx, DWORD PTR _whdr$[ebp]
  00179	52		 push	 edx
  0017a	8b 45 08	 mov	 eax, DWORD PTR _file$[ebp]
  0017d	8b 88 78 03 00
	00		 mov	 ecx, DWORD PTR [eax+888]
  00183	51		 push	 ecx
  00184	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__waveInPrepareHeader@12
  0018a	85 c0		 test	 eax, eax
  0018c	74 17		 je	 SHORT $LN2@aviAudioBe

; 273  :         {
; 274  :             aviSetError(file, AVI_ERROR_AUDIO_OPEN,
; 275  :                               _T("waveInPrepareHeader failed"));

  0018e	68 00 00 00 00	 push	 OFFSET ??_C@_1DG@JEPPDNAK@?$AAw?$AAa?$AAv?$AAe?$AAI?$AAn?$AAP?$AAr?$AAe?$AAp?$AAa?$AAr?$AAe?$AAH?$AAe?$AAa?$AAd?$AAe?$AAr?$AA?5?$AAf?$AAa?$AAi?$AAl?$AAe?$AAd?$AA?$AA@
  00193	6a 06		 push	 6
  00195	8b 55 08	 mov	 edx, DWORD PTR _file$[ebp]
  00198	52		 push	 edx
  00199	e8 00 00 00 00	 call	 ?aviSetError@@YAXPAUAVI_FILE@@W4aviError_t@@PA_W@Z ; aviSetError
  0019e	83 c4 0c	 add	 esp, 12			; 0000000cH

; 276  :             return FALSE;

  001a1	33 c0		 xor	 eax, eax
  001a3	eb 3b		 jmp	 SHORT $LN15@aviAudioBe
$LN2@aviAudioBe:

; 277  :         }
; 278  : 
; 279  :         /* Send this buffer to the waveIn device */
; 280  :         if (waveInAddBuffer(file->audio.hWaveIn, whdr,
; 281  :                             sizeof(WAVEHDR)) != MMSYSERR_NOERROR)

  001a5	6a 20		 push	 32			; 00000020H
  001a7	8b 45 f8	 mov	 eax, DWORD PTR _whdr$[ebp]
  001aa	50		 push	 eax
  001ab	8b 4d 08	 mov	 ecx, DWORD PTR _file$[ebp]
  001ae	8b 91 78 03 00
	00		 mov	 edx, DWORD PTR [ecx+888]
  001b4	52		 push	 edx
  001b5	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__waveInAddBuffer@12
  001bb	85 c0		 test	 eax, eax
  001bd	74 17		 je	 SHORT $LN1@aviAudioBe

; 282  :         {
; 283  :             aviSetError(file, AVI_ERROR_AUDIO_OPEN, _T("waveInAddBuffer failed"));

  001bf	68 00 00 00 00	 push	 OFFSET ??_C@_1CO@OHGIMNG@?$AAw?$AAa?$AAv?$AAe?$AAI?$AAn?$AAA?$AAd?$AAd?$AAB?$AAu?$AAf?$AAf?$AAe?$AAr?$AA?5?$AAf?$AAa?$AAi?$AAl?$AAe?$AAd?$AA?$AA@
  001c4	6a 06		 push	 6
  001c6	8b 45 08	 mov	 eax, DWORD PTR _file$[ebp]
  001c9	50		 push	 eax
  001ca	e8 00 00 00 00	 call	 ?aviSetError@@YAXPAUAVI_FILE@@W4aviError_t@@PA_W@Z ; aviSetError
  001cf	83 c4 0c	 add	 esp, 12			; 0000000cH

; 284  :             return FALSE;

  001d2	33 c0		 xor	 eax, eax
  001d4	eb 0a		 jmp	 SHORT $LN15@aviAudioBe
$LN1@aviAudioBe:

; 285  :         }
; 286  :     }

  001d6	e9 0b ff ff ff	 jmp	 $LN5@aviAudioBe
$LN4@aviAudioBe:

; 287  : 
; 288  :     return TRUE;

  001db	b8 01 00 00 00	 mov	 eax, 1
$LN15@aviAudioBe:

; 289  : }

  001e0	8b e5		 mov	 esp, ebp
  001e2	5d		 pop	 ebp
  001e3	c3		 ret	 0
?aviAudioBegin@@YAHPAUAVI_FILE@@@Z ENDP			; aviAudioBegin
END
