just an example how to record wav file CD Quality
Posted on 2003-03-30 13:51:23 by Nguga
%include '\lab\vasm\inc\nagoa.inc'




..start:

call GetModuleHandleA, NULL
CONST hInst, dd 0
mov , eax
CONST DIALOG_ID , equ 1000
call DialogBoxParamA, ,DIALOG_ID,0,Dialog1Proc, 0
call ExitProcess,

rotin Dialog1Proc,hdlg1,dlg1msg,wparam,lparam

cmp dword ,WM_INITDIALOG
je wminitdialog
cmp dword ,WM_COMMAND
je near wmcommand
cmp dword ,WM_CLOSE
je near wmclose
return FALSE

wminitdialog:

; --set the icon

CONST ICON_SMALL , equ 0
CONST hIcon , dd 0
call LoadIconA,,"DRUM_ICON"
call SendMessageA,,WM_SETICON,ICON_SMALL,eax
mov ,eax

; --set the menu
call LoadMenuA,,"recordmenu" ;menu in RC file
call SetMenu,,eax
return TRUE


wmcommand:
; --what are the cliked buttons ?
cmp dword ,0 ; record
je near RECORD
cmp dword , 1 ; stop and save record.wav
je near STOP_SAVE
cmp dword , 2 ; play record.wav
jne .out2
invoke playthread
.out2
cmp dword ,100 ; about menu id
jne near .out3
call ShellAboutA,,"WAVE RECORDER","made by Pedro Granja Carvalho,assembler NASM using NAGOA",
.out3
return

;-------------
RECORD:

call mciSendStringA,"open new type waveaudio alias capture",0,0,0
CONST .audioQ, db "set capture time format ms bitspersample 16 samplespersec 44100 channels 2" ,0
call mciSendStringA,.audioQ, NULL , 0, 0
call mciSendStringA,"record capture overwrite",0,0,0
return

STOP_SAVE:
call mciSendStringA,"stop capture",0,0,0
call mciSendStringA,"save capture record.wav",0,0,0
call mciSendStringA,"close capture",0, 0, 0
return

;-----------
playthread:
CONST hThread, dd 0
call CreateThread,0,0,ThreadPLAYProc,0,0,"PlayThread"
mov ,eax
ret
;-----------
;-----------
ThreadPLAYProc:
;- code to do in the thread
call sndPlaySoundA,"record.wav",SND_FILENAME
;-
call GetExitCodeThread,,0
call ExitThread,0
xor eax,eax
ret
;------------

wmclose:
call ExitProcess,0
endrotin
;; ====================================================
Posted on 2003-03-30 13:52:07 by Nguga