forked from KolibriOS/kolibrios
sdk: update Makefiles && libsound
git-svn-id: svn://kolibrios.org@5022 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
118
contrib/sdk/sources/sound/src/init.asm
Normal file
118
contrib/sdk/sources/sound/src/init.asm
Normal file
@@ -0,0 +1,118 @@
|
||||
format MS COFF
|
||||
|
||||
include "snd.inc"
|
||||
include "proc32.inc"
|
||||
|
||||
section '.text' align 16 code readable executable
|
||||
|
||||
public _InitSound@4
|
||||
public _CreateBuffer@12
|
||||
public _DestroyBuffer@4
|
||||
|
||||
align 4
|
||||
_InitSound@4: ;p_ver:dword
|
||||
|
||||
push ebx
|
||||
push ecx
|
||||
|
||||
mov eax, 68
|
||||
mov ebx, 16
|
||||
mov ecx, szInfinity
|
||||
int 0x40
|
||||
mov [hSound], eax
|
||||
test eax, eax
|
||||
jz .fail
|
||||
|
||||
mov eax, 68
|
||||
mov ebx, 16
|
||||
mov ecx, szSound
|
||||
int 0x40
|
||||
mov [hrdwSound], eax
|
||||
|
||||
lea eax, [esp+12] ;p_ver
|
||||
xor ebx, ebx
|
||||
|
||||
push 4 ;.out_size
|
||||
push eax ;.output
|
||||
push ebx ;.inp_size
|
||||
push ebx ;.input
|
||||
push SRV_GETVERSION ;.code
|
||||
push [hSound] ;.handle
|
||||
|
||||
mov eax, 68
|
||||
mov ebx, 17
|
||||
mov ecx, esp ;[handle]
|
||||
int 0x40
|
||||
add esp, 24
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret 4
|
||||
.fail:
|
||||
or eax, -1
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret 4
|
||||
|
||||
|
||||
align 4
|
||||
_CreateBuffer@12: ;format:dword,size:dword,p_str:dword
|
||||
|
||||
push ebx
|
||||
push ecx
|
||||
lea eax, [esp+20] ;p_str
|
||||
lea ebx, [esp+12] ;format
|
||||
|
||||
push 4 ;.out_size
|
||||
push eax ;.output
|
||||
push 8 ;.inp_size
|
||||
push ebx ;.input
|
||||
push SND_CREATE_BUFF;.code
|
||||
push [hSound] ;.handle
|
||||
|
||||
mov eax, 68
|
||||
mov ebx, 17
|
||||
mov ecx, esp
|
||||
int 0x40
|
||||
add esp, 24 ;io_cintrol
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret 12
|
||||
|
||||
align 4
|
||||
_DestroyBuffer@4: ;str:dword
|
||||
|
||||
push ebx
|
||||
push ecx
|
||||
|
||||
xor eax, eax
|
||||
lea ebx, [esp+12] ;[stream]
|
||||
|
||||
push eax ;.out_size
|
||||
push eax ;.output
|
||||
push 4 ;.inp_size
|
||||
push ebx ;.input
|
||||
push SND_DESTROY_BUFF;.code
|
||||
push [hSound] ;.handle
|
||||
|
||||
mov eax, 68
|
||||
mov ebx, 17
|
||||
mov ecx, esp ;[handle]
|
||||
int 0x40
|
||||
add esp, 24
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret 4
|
||||
|
||||
|
||||
section '.data' align 16 data readable writable
|
||||
|
||||
public hSound
|
||||
public hrdwSound
|
||||
|
||||
hSound dd ?
|
||||
hrdwSound dd ?
|
||||
|
||||
szInfinity db 'INFINITY',0
|
||||
szSound db 'SOUND',0
|
||||
|
||||
|
268
contrib/sdk/sources/sound/src/proc32.inc
Normal file
268
contrib/sdk/sources/sound/src/proc32.inc
Normal file
@@ -0,0 +1,268 @@
|
||||
|
||||
; Macroinstructions for defining and calling procedures
|
||||
|
||||
macro stdcall proc,[arg] ; directly call STDCALL procedure
|
||||
{ common
|
||||
if ~ arg eq
|
||||
reverse
|
||||
pushd arg
|
||||
common
|
||||
end if
|
||||
call proc }
|
||||
|
||||
macro invoke proc,[arg] ; indirectly call STDCALL procedure
|
||||
{ common
|
||||
if ~ arg eq
|
||||
reverse
|
||||
pushd arg
|
||||
common
|
||||
end if
|
||||
call [proc] }
|
||||
|
||||
macro ccall proc,[arg] ; directly call CDECL procedure
|
||||
{ common
|
||||
size@ccall = 0
|
||||
if ~ arg eq
|
||||
reverse
|
||||
pushd arg
|
||||
size@ccall = size@ccall+4
|
||||
common
|
||||
end if
|
||||
call proc
|
||||
if size@ccall
|
||||
add esp,size@ccall
|
||||
end if }
|
||||
|
||||
macro cinvoke proc,[arg] ; indirectly call CDECL procedure
|
||||
{ common
|
||||
size@ccall = 0
|
||||
if ~ arg eq
|
||||
reverse
|
||||
pushd arg
|
||||
size@ccall = size@ccall+4
|
||||
common
|
||||
end if
|
||||
call [proc]
|
||||
if size@ccall
|
||||
add esp,size@ccall
|
||||
end if }
|
||||
|
||||
macro proc [args] ; define procedure
|
||||
{ common
|
||||
match name params, args>
|
||||
\{ define@proc name,<params \} }
|
||||
|
||||
prologue@proc equ prologuedef
|
||||
|
||||
macro prologuedef procname,flag,parmbytes,localbytes,reglist
|
||||
{ if parmbytes | localbytes
|
||||
push ebp
|
||||
mov ebp,esp
|
||||
if localbytes
|
||||
sub esp,localbytes
|
||||
end if
|
||||
end if
|
||||
irps reg, reglist \{ push reg \} }
|
||||
|
||||
epilogue@proc equ epiloguedef
|
||||
|
||||
macro epiloguedef procname,flag,parmbytes,localbytes,reglist
|
||||
{ irps reg, reglist \{ reverse pop reg \}
|
||||
if parmbytes | localbytes
|
||||
leave
|
||||
end if
|
||||
if flag and 10000b
|
||||
retn
|
||||
else
|
||||
retn parmbytes
|
||||
end if }
|
||||
|
||||
macro define@proc name,statement
|
||||
{ local params,flag,regs,parmbytes,localbytes,current
|
||||
if used name
|
||||
name:
|
||||
match =stdcall args, statement \{ params equ args
|
||||
flag = 11b \}
|
||||
match =stdcall, statement \{ params equ
|
||||
flag = 11b \}
|
||||
match =c args, statement \{ params equ args
|
||||
flag = 10001b \}
|
||||
match =c, statement \{ params equ
|
||||
flag = 10001b \}
|
||||
match =params, params \{ params equ statement
|
||||
flag = 0 \}
|
||||
virtual at ebp+8
|
||||
match =uses reglist=,args, params \{ regs equ reglist
|
||||
params equ args \}
|
||||
match =regs =uses reglist, regs params \{ regs equ reglist
|
||||
params equ \}
|
||||
match =regs, regs \{ regs equ \}
|
||||
match =,args, params \{ defargs@proc args \}
|
||||
match =args@proc args, args@proc params \{ defargs@proc args \}
|
||||
parmbytes = $ - (ebp+8)
|
||||
end virtual
|
||||
name # % = parmbytes/4
|
||||
all@vars equ
|
||||
current = 0
|
||||
match prologue:reglist, prologue@proc:<regs> \{ prologue name,flag,parmbytes,localbytes,reglist \}
|
||||
macro locals
|
||||
\{ virtual at ebp-localbytes+current
|
||||
macro label . \\{ deflocal@proc .,:, \\}
|
||||
struc db [val] \\{ \common deflocal@proc .,db,val \\}
|
||||
struc dw [val] \\{ \common deflocal@proc .,dw,val \\}
|
||||
struc dp [val] \\{ \common deflocal@proc .,dp,val \\}
|
||||
struc dd [val] \\{ \common deflocal@proc .,dd,val \\}
|
||||
struc dt [val] \\{ \common deflocal@proc .,dt,val \\}
|
||||
struc dq [val] \\{ \common deflocal@proc .,dq,val \\}
|
||||
struc rb cnt \\{ deflocal@proc .,rb cnt, \\}
|
||||
struc rw cnt \\{ deflocal@proc .,rw cnt, \\}
|
||||
struc rp cnt \\{ deflocal@proc .,rp cnt, \\}
|
||||
struc rd cnt \\{ deflocal@proc .,rd cnt, \\}
|
||||
struc rt cnt \\{ deflocal@proc .,rt cnt, \\}
|
||||
struc rq cnt \\{ deflocal@proc .,rq cnt, \\} \}
|
||||
macro endl
|
||||
\{ purge label
|
||||
restruc db,dw,dp,dd,dt,dq
|
||||
restruc rb,rw,rp,rd,rt,rq
|
||||
restruc byte,word,dword,pword,tword,qword
|
||||
current = $-(ebp-localbytes)
|
||||
end virtual \}
|
||||
macro ret operand
|
||||
\{ match any, operand \\{ retn operand \\}
|
||||
match , operand \\{ match epilogue:reglist, epilogue@proc:<regs>
|
||||
\\\{ epilogue name,flag,parmbytes,localbytes,reglist \\\} \\} \}
|
||||
macro finish@proc \{ localbytes = (((current-1) shr 2)+1) shl 2
|
||||
end if \} }
|
||||
|
||||
macro defargs@proc [arg]
|
||||
{ common
|
||||
if ~ arg eq
|
||||
forward
|
||||
local ..arg,current@arg
|
||||
match argname:type, arg
|
||||
\{ current@arg equ argname
|
||||
label ..arg type
|
||||
argname equ ..arg
|
||||
if dqword eq type
|
||||
dd ?,?,?,?
|
||||
else if tbyte eq type
|
||||
dd ?,?,?
|
||||
else if qword eq type | pword eq type
|
||||
dd ?,?
|
||||
else
|
||||
dd ?
|
||||
end if \}
|
||||
match =current@arg,current@arg
|
||||
\{ current@arg equ arg
|
||||
arg equ ..arg
|
||||
..arg dd ? \}
|
||||
common
|
||||
args@proc equ current@arg
|
||||
forward
|
||||
restore current@arg
|
||||
common
|
||||
end if }
|
||||
|
||||
macro deflocal@proc name,def,[val]
|
||||
{ common
|
||||
match vars, all@vars \{ all@vars equ all@vars, \}
|
||||
all@vars equ all@vars name
|
||||
forward
|
||||
local ..var,..tmp
|
||||
..var def val
|
||||
match =?, val \{ ..tmp equ \}
|
||||
match any =dup (=?), val \{ ..tmp equ \}
|
||||
match tmp : value, ..tmp : val
|
||||
\{ tmp: end virtual
|
||||
initlocal@proc ..var,def value
|
||||
virtual at tmp\}
|
||||
common
|
||||
match first rest, ..var, \{ name equ first \} }
|
||||
|
||||
macro initlocal@proc name,def
|
||||
{ virtual at name
|
||||
def
|
||||
size@initlocal = $ - name
|
||||
end virtual
|
||||
position@initlocal = 0
|
||||
while size@initlocal > position@initlocal
|
||||
virtual at name
|
||||
def
|
||||
if size@initlocal - position@initlocal < 2
|
||||
current@initlocal = 1
|
||||
load byte@initlocal byte from name+position@initlocal
|
||||
else if size@initlocal - position@initlocal < 4
|
||||
current@initlocal = 2
|
||||
load word@initlocal word from name+position@initlocal
|
||||
else
|
||||
current@initlocal = 4
|
||||
load dword@initlocal dword from name+position@initlocal
|
||||
end if
|
||||
end virtual
|
||||
if current@initlocal = 1
|
||||
mov byte [name+position@initlocal],byte@initlocal
|
||||
else if current@initlocal = 2
|
||||
mov word [name+position@initlocal],word@initlocal
|
||||
else
|
||||
mov dword [name+position@initlocal],dword@initlocal
|
||||
end if
|
||||
position@initlocal = position@initlocal + current@initlocal
|
||||
end while }
|
||||
|
||||
macro endp
|
||||
{ purge ret,locals,endl
|
||||
finish@proc
|
||||
purge finish@proc
|
||||
restore regs@proc
|
||||
match all,args@proc \{ restore all \}
|
||||
restore args@proc
|
||||
match all,all@vars \{ restore all \} }
|
||||
|
||||
macro local [var]
|
||||
{ common
|
||||
locals
|
||||
forward done@local equ
|
||||
match varname[count]:vartype, var
|
||||
\{ match =BYTE, vartype \\{ varname rb count
|
||||
restore done@local \\}
|
||||
match =WORD, vartype \\{ varname rw count
|
||||
restore done@local \\}
|
||||
match =DWORD, vartype \\{ varname rd count
|
||||
restore done@local \\}
|
||||
match =PWORD, vartype \\{ varname rp count
|
||||
restore done@local \\}
|
||||
match =QWORD, vartype \\{ varname rq count
|
||||
restore done@local \\}
|
||||
match =TBYTE, vartype \\{ varname rt count
|
||||
restore done@local \\}
|
||||
match =DQWORD, vartype \\{ label varname dqword
|
||||
rq count+count
|
||||
restore done@local \\}
|
||||
match , done@local \\{ virtual
|
||||
varname vartype
|
||||
end virtual
|
||||
rb count*sizeof.\#vartype
|
||||
restore done@local \\} \}
|
||||
match :varname:vartype, done@local:var
|
||||
\{ match =BYTE, vartype \\{ varname db ?
|
||||
restore done@local \\}
|
||||
match =WORD, vartype \\{ varname dw ?
|
||||
restore done@local \\}
|
||||
match =DWORD, vartype \\{ varname dd ?
|
||||
restore done@local \\}
|
||||
match =PWORD, vartype \\{ varname dp ?
|
||||
restore done@local \\}
|
||||
match =QWORD, vartype \\{ varname dq ?
|
||||
restore done@local \\}
|
||||
match =TBYTE, vartype \\{ varname dt ?
|
||||
restore done@local \\}
|
||||
match =DQWORD, vartype \\{ label varname dqword
|
||||
dq ?,?
|
||||
restore done@local \\}
|
||||
match , done@local \\{ varname vartype
|
||||
restore done@local \\} \}
|
||||
match ,done@local
|
||||
\{ var
|
||||
restore done@local \}
|
||||
common
|
||||
endl }
|
62
contrib/sdk/sources/sound/src/setbuf.asm
Normal file
62
contrib/sdk/sources/sound/src/setbuf.asm
Normal file
@@ -0,0 +1,62 @@
|
||||
format MS COFF
|
||||
|
||||
include "snd.inc"
|
||||
include "proc32.inc"
|
||||
|
||||
section '.text' align 16 code readable executable
|
||||
|
||||
extrn hSound
|
||||
|
||||
public _SetBuffer@16
|
||||
public _PlayBuffer@8
|
||||
|
||||
align 4
|
||||
_SetBuffer@16: ;str:dword, src:dword, offs:dword, size:dword
|
||||
|
||||
push ebx
|
||||
push ecx
|
||||
|
||||
xor eax, eax
|
||||
lea ebx, [esp+12] ;[stream]
|
||||
|
||||
push eax ;.out_size
|
||||
push eax ;.output
|
||||
push 16 ;.inp_size
|
||||
push ebx ;.input
|
||||
push SND_SETBUFF ;.code
|
||||
push dword [hSound] ;.handle
|
||||
|
||||
mov eax, 68
|
||||
mov ebx, 17
|
||||
mov ecx, esp
|
||||
int 0x40
|
||||
add esp, 24
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret 16
|
||||
|
||||
align 4
|
||||
_PlayBuffer@8: ;str:dword,flags:dword
|
||||
|
||||
push ebx
|
||||
push ecx
|
||||
|
||||
xor eax, eax
|
||||
lea ebx, [esp+12] ;[stream]
|
||||
|
||||
push eax ;.out_size
|
||||
push eax ;.output
|
||||
push 8 ;.inp_size
|
||||
push ebx ;.input
|
||||
push SND_PLAY ;.code
|
||||
push dword [hSound] ;.handle
|
||||
|
||||
mov eax, 68
|
||||
mov ebx, 17
|
||||
mov ecx, esp
|
||||
int 0x40
|
||||
add esp, 24
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret 8
|
||||
|
41
contrib/sdk/sources/sound/src/snd.inc
Normal file
41
contrib/sdk/sources/sound/src/snd.inc
Normal file
@@ -0,0 +1,41 @@
|
||||
|
||||
struc CTRL_INFO
|
||||
{ .pci_cmd dd ?
|
||||
.irq dd ?
|
||||
.glob_cntrl dd ?
|
||||
.glob_sta dd ?
|
||||
.codec_io_base dd ?
|
||||
.ctrl_io_base dd ?
|
||||
.codec_mem_base dd ?
|
||||
.ctrl_mem_base dd ?
|
||||
.codec_id dd ?
|
||||
}
|
||||
CTRL_INFO_SIZE equ 9*4
|
||||
|
||||
SRV_GETVERSION equ 0
|
||||
SND_CREATE_BUFF equ 1
|
||||
SND_DESTROY_BUFF equ 2
|
||||
SND_SETFORMAT equ 3
|
||||
SND_GETFORMAT equ 4
|
||||
SND_RESET equ 5
|
||||
SND_SETPOS equ 6
|
||||
SND_GETPOS equ 7
|
||||
SND_SETBUFF equ 8
|
||||
SND_OUT equ 9
|
||||
SND_PLAY equ 10
|
||||
SND_STOP equ 11
|
||||
SND_SETVOLUME equ 12
|
||||
SND_GETVOLUME equ 13
|
||||
SND_SETPAN equ 14
|
||||
SND_GETPAN equ 15
|
||||
SND_GETBUFFSIZE equ 16
|
||||
SND_GETFREESPACE equ 17
|
||||
SND_SETTIMEBASE equ 18
|
||||
SND_GETTIMESTAMP equ 19
|
||||
|
||||
DEV_SET_BUFF equ 4
|
||||
DEV_NOTIFY equ 5
|
||||
DEV_SET_MASTERVOL equ 6
|
||||
DEV_GET_MASTERVOL equ 7
|
||||
DEV_GET_INFO equ 8
|
||||
|
35
contrib/sdk/sources/sound/src/sndgetfmt.asm
Normal file
35
contrib/sdk/sources/sound/src/sndgetfmt.asm
Normal file
@@ -0,0 +1,35 @@
|
||||
format MS COFF
|
||||
|
||||
include "snd.inc"
|
||||
include "proc32.inc"
|
||||
|
||||
section '.text' align 16 code readable executable
|
||||
|
||||
extrn hSound
|
||||
|
||||
public _GetFormat@8
|
||||
|
||||
align 4
|
||||
_GetFormat@8: ;str:dword, p_fmt:dword
|
||||
push ebx
|
||||
push ecx
|
||||
|
||||
lea eax, [esp+16] ;p_fmt
|
||||
lea ebx, [esp+12] ;[stream]
|
||||
|
||||
push 4 ;.out_size
|
||||
push eax ;.output
|
||||
push 4 ;.inp_size
|
||||
push ebx ;.input
|
||||
push SND_GETFORMAT ;.code
|
||||
push dword [hSound] ;.handle
|
||||
|
||||
mov eax, 68
|
||||
mov ebx, 17
|
||||
mov ecx, esp
|
||||
int 0x40
|
||||
add esp, 24
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret 8
|
||||
|
74
contrib/sdk/sources/sound/src/sndgetmvol.asm
Normal file
74
contrib/sdk/sources/sound/src/sndgetmvol.asm
Normal file
@@ -0,0 +1,74 @@
|
||||
format MS COFF
|
||||
|
||||
include "snd.inc"
|
||||
include "proc32.inc"
|
||||
|
||||
section '.text' align 16 code readable executable
|
||||
|
||||
public _GetMasterVol@4
|
||||
|
||||
extrn hrdwSound
|
||||
|
||||
align 4
|
||||
proc _GetMasterVol@4 stdcall, pvol:dword
|
||||
locals
|
||||
handle dd ?
|
||||
io_code dd ?
|
||||
input dd ?
|
||||
inp_size dd ?
|
||||
output dd ?
|
||||
out_size dd ?
|
||||
endl
|
||||
|
||||
push ebx
|
||||
push ecx
|
||||
mov eax, [hrdwSound]
|
||||
mov ecx, [pvol]
|
||||
xor ebx, ebx
|
||||
mov [handle], eax
|
||||
mov [io_code], DEV_GET_MASTERVOL
|
||||
mov [input], ebx
|
||||
mov [inp_size], ebx
|
||||
mov [output], ecx
|
||||
mov [out_size], 4
|
||||
|
||||
mov eax, 68
|
||||
mov ebx, 17
|
||||
lea ecx, [handle]
|
||||
int 0x40
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret
|
||||
endp
|
||||
|
||||
if 0
|
||||
align 4
|
||||
proc _GetDevInfo@8 stdcall, hSrv:dword, p_info:dword
|
||||
locals
|
||||
handle dd ?
|
||||
io_code dd ?
|
||||
input dd ?
|
||||
inp_size dd ?
|
||||
output dd ?
|
||||
out_size dd ?
|
||||
endl
|
||||
|
||||
push ebx
|
||||
mov eax, [hSrv]
|
||||
xor ebx, ebx
|
||||
mov ecx, [p_info]
|
||||
|
||||
mov [handle], eax
|
||||
mov [io_code], DEV_GET_INFO
|
||||
mov [input], ebx
|
||||
mov [inp_size], ebx
|
||||
mov [output], ecx
|
||||
mov [out_size], CTRL_INFO_SIZE
|
||||
|
||||
lea eax, [handle]
|
||||
stdcall CallServiceEx, eax
|
||||
pop ebx
|
||||
ret
|
||||
endp
|
||||
|
||||
end if
|
35
contrib/sdk/sources/sound/src/sndgetpan.asm
Normal file
35
contrib/sdk/sources/sound/src/sndgetpan.asm
Normal file
@@ -0,0 +1,35 @@
|
||||
format MS COFF
|
||||
|
||||
include "snd.inc"
|
||||
include "proc32.inc"
|
||||
|
||||
section '.text' align 16 code readable executable
|
||||
|
||||
public _GetPan@8
|
||||
|
||||
extrn hSound
|
||||
|
||||
align 4
|
||||
_GetPan@8: ;str:dword, p_pan:dword
|
||||
push ebx
|
||||
push ecx
|
||||
|
||||
lea eax, [esp+16]
|
||||
lea ebx, [esp+12] ;[stream]
|
||||
|
||||
push 4 ;.out_size
|
||||
push eax ;.output
|
||||
push 4 ;.inp_size
|
||||
push ebx ;.input
|
||||
push SND_GETPAN ;.code
|
||||
push dword [hSound] ;.handle
|
||||
|
||||
mov eax, 68
|
||||
mov ebx, 17
|
||||
mov ecx, esp
|
||||
int 0x40
|
||||
add esp, 24
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret 8
|
||||
|
36
contrib/sdk/sources/sound/src/sndgetpos.asm
Normal file
36
contrib/sdk/sources/sound/src/sndgetpos.asm
Normal file
@@ -0,0 +1,36 @@
|
||||
format MS COFF
|
||||
|
||||
include "snd.inc"
|
||||
include "proc32.inc"
|
||||
|
||||
section '.text' align 16 code readable executable
|
||||
|
||||
extrn hSound
|
||||
|
||||
public _GetBufferPos@8
|
||||
|
||||
align 4
|
||||
_GetBufferPos@8: ;str:dword, p_pos:dword
|
||||
|
||||
push ebx
|
||||
push ecx
|
||||
|
||||
lea eax, [esp+16]
|
||||
lea ebx, [esp+12] ;[stream]
|
||||
|
||||
push 4 ;.out_size
|
||||
push eax ;.output
|
||||
push 4 ;.inp_size
|
||||
push ebx ;.input
|
||||
push SND_GETPOS ;.code
|
||||
push dword [hSound] ;.handle
|
||||
|
||||
mov eax, 68
|
||||
mov ebx, 17
|
||||
mov ecx, esp
|
||||
int 0x40
|
||||
add esp, 24
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret 8
|
||||
|
63
contrib/sdk/sources/sound/src/sndgetsize.asm
Normal file
63
contrib/sdk/sources/sound/src/sndgetsize.asm
Normal file
@@ -0,0 +1,63 @@
|
||||
format MS COFF
|
||||
|
||||
include "snd.inc"
|
||||
include "proc32.inc"
|
||||
|
||||
section '.text' align 16 code readable executable
|
||||
|
||||
public _GetBufferSize@8
|
||||
public _GetBufferFree@8
|
||||
|
||||
extrn hSound
|
||||
|
||||
align 4
|
||||
_GetBufferSize@8: ;str:dword, p_size:dword
|
||||
|
||||
push ebx
|
||||
push ecx
|
||||
|
||||
lea eax, [esp+16]
|
||||
lea ebx, [esp+12] ;[stream]
|
||||
|
||||
push 4 ;.out_size
|
||||
push eax ;.output
|
||||
push 4 ;.inp_size
|
||||
push ebx ;.input
|
||||
push SND_GETBUFFSIZE;.code
|
||||
push dword [hSound] ;.handle
|
||||
|
||||
mov eax, 68
|
||||
mov ebx, 17
|
||||
mov ecx, esp
|
||||
int 0x40
|
||||
add esp, 24
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret 8
|
||||
|
||||
align 4
|
||||
_GetBufferFree@8: ;str:dword, p_free:dword
|
||||
push ebx
|
||||
push ecx
|
||||
|
||||
lea ebx, [esp+12] ;[stream]
|
||||
push 0 ;storage for free_space
|
||||
mov eax, esp
|
||||
|
||||
push 4 ;.out_size
|
||||
push eax ;.output
|
||||
push 4 ;.inp_size
|
||||
push ebx ;.input
|
||||
push SND_GETFREESPACE ;.code
|
||||
push dword [hSound] ;.handle
|
||||
|
||||
mov eax, 68
|
||||
mov ebx, 17
|
||||
mov ecx, esp
|
||||
int 0x40
|
||||
add esp, 24
|
||||
mov ecx, [esp+20] ; p_free
|
||||
pop dword [ecx]
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret 8
|
44
contrib/sdk/sources/sound/src/sndgetvol.asm
Normal file
44
contrib/sdk/sources/sound/src/sndgetvol.asm
Normal file
@@ -0,0 +1,44 @@
|
||||
format MS COFF
|
||||
|
||||
include "snd.inc"
|
||||
include "proc32.inc"
|
||||
|
||||
section '.text' align 16 code readable executable
|
||||
|
||||
public _GetVolume@12
|
||||
|
||||
extrn hSound
|
||||
|
||||
align 4
|
||||
proc _GetVolume@12 stdcall, str:dword, pleft:dword,pright:dword
|
||||
locals
|
||||
handle dd ?
|
||||
io_code dd ?
|
||||
input dd ?
|
||||
inp_size dd ?
|
||||
output dd ?
|
||||
out_size dd ?
|
||||
endl
|
||||
|
||||
push ebx
|
||||
push ecx
|
||||
mov eax, [hSound]
|
||||
lea ebx, [str]
|
||||
lea ecx, [pleft]
|
||||
mov [handle], eax
|
||||
mov [io_code], SND_GETVOLUME
|
||||
mov [input], ebx
|
||||
mov [inp_size], 4
|
||||
mov [output], ecx
|
||||
mov [out_size], 8
|
||||
|
||||
mov eax, 68
|
||||
mov ebx, 17
|
||||
lea ecx, [handle]
|
||||
int 0x40
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret
|
||||
endp
|
||||
|
||||
|
34
contrib/sdk/sources/sound/src/sndout.asm
Normal file
34
contrib/sdk/sources/sound/src/sndout.asm
Normal file
@@ -0,0 +1,34 @@
|
||||
format MS COFF
|
||||
|
||||
include "snd.inc"
|
||||
include "proc32.inc"
|
||||
|
||||
section '.text' align 16 code readable executable
|
||||
|
||||
extrn hSound
|
||||
|
||||
public _WaveOut@12
|
||||
|
||||
align 4
|
||||
_WaveOut@12: ;str:dword, src:dword, size:dword
|
||||
push ebx
|
||||
push ecx
|
||||
|
||||
xor eax, eax
|
||||
lea ebx, [esp+12] ;[stream]
|
||||
|
||||
push eax ;.out_size
|
||||
push eax ;.output
|
||||
push 12 ;.inp_size
|
||||
push ebx ;.input
|
||||
push SND_OUT ;.code
|
||||
push dword [hSound] ;.handle
|
||||
|
||||
mov eax, 68
|
||||
mov ebx, 17
|
||||
mov ecx, esp
|
||||
int 0x40
|
||||
add esp, 24
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret 12
|
36
contrib/sdk/sources/sound/src/sndreset.asm
Normal file
36
contrib/sdk/sources/sound/src/sndreset.asm
Normal file
@@ -0,0 +1,36 @@
|
||||
format MS COFF
|
||||
|
||||
include "snd.inc"
|
||||
include "proc32.inc"
|
||||
|
||||
section '.text' align 16 code readable executable
|
||||
|
||||
extrn hSound
|
||||
|
||||
public _ResetBuffer@8
|
||||
|
||||
align 4
|
||||
_ResetBuffer@8: ;str:dword, flags:dword
|
||||
|
||||
push ebx
|
||||
push ecx
|
||||
|
||||
xor eax, eax
|
||||
lea ebx, [esp+12] ;[stream]
|
||||
|
||||
push eax ;.out_size
|
||||
push eax ;.output
|
||||
push 12 ;.inp_size
|
||||
push ebx ;.input
|
||||
push SND_RESET ;.code
|
||||
push dword [hSound] ;.handle
|
||||
|
||||
mov eax, 68
|
||||
mov ebx, 17
|
||||
mov ecx, esp
|
||||
int 0x40
|
||||
add esp, 24
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret 8
|
||||
|
35
contrib/sdk/sources/sound/src/sndsetfmt.asm
Normal file
35
contrib/sdk/sources/sound/src/sndsetfmt.asm
Normal file
@@ -0,0 +1,35 @@
|
||||
format MS COFF
|
||||
|
||||
include "snd.inc"
|
||||
include "proc32.inc"
|
||||
|
||||
section '.text' align 16 code readable executable
|
||||
|
||||
extrn hSound
|
||||
|
||||
public _SetFormat@8
|
||||
|
||||
align 4
|
||||
_SetFormat@8: ;str:dword, fmt:dword
|
||||
|
||||
push ebx
|
||||
push ecx
|
||||
|
||||
xor eax, eax
|
||||
lea ebx, [esp+12] ;[stream]
|
||||
|
||||
push eax ;.out_size
|
||||
push eax ;.output
|
||||
push 8 ;.inp_size
|
||||
push ebx ;.input
|
||||
push SND_SETFORMAT ;.code
|
||||
push dword [hSound] ;.handle
|
||||
|
||||
mov eax, 68
|
||||
mov ebx, 17
|
||||
mov ecx, esp
|
||||
int 0x40
|
||||
add esp, 24
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret 8
|
36
contrib/sdk/sources/sound/src/sndsetmvol.asm
Normal file
36
contrib/sdk/sources/sound/src/sndsetmvol.asm
Normal file
@@ -0,0 +1,36 @@
|
||||
format MS COFF
|
||||
|
||||
include "snd.inc"
|
||||
include "proc32.inc"
|
||||
|
||||
section '.text' align 16 code readable executable
|
||||
|
||||
public _SetMasterVol@4
|
||||
|
||||
extrn hrdwSound
|
||||
|
||||
align 4
|
||||
_SetMasterVol@4: ;vol:dword
|
||||
|
||||
push ebx
|
||||
push ecx
|
||||
|
||||
xor eax, eax
|
||||
lea ebx, [esp+12] ;[stream]
|
||||
|
||||
push eax ;.out_size
|
||||
push eax ;.output
|
||||
push 4 ;.inp_size
|
||||
push ebx ;.input
|
||||
push DEV_SET_MASTERVOL ;.code
|
||||
push dword [hrdwSound] ;.handle
|
||||
|
||||
mov eax, 68
|
||||
mov ebx, 17
|
||||
mov ecx, esp
|
||||
int 0x40
|
||||
add esp, 24
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret 4
|
||||
|
34
contrib/sdk/sources/sound/src/sndsetpan.asm
Normal file
34
contrib/sdk/sources/sound/src/sndsetpan.asm
Normal file
@@ -0,0 +1,34 @@
|
||||
format MS COFF
|
||||
|
||||
include "snd.inc"
|
||||
include "proc32.inc"
|
||||
|
||||
section '.text' align 16 code readable executable
|
||||
|
||||
public _SetPan@8
|
||||
|
||||
extrn hSound
|
||||
|
||||
align 4
|
||||
_SetPan@8: ;str:dword, pan:dword
|
||||
push ebx
|
||||
push ecx
|
||||
|
||||
xor eax, eax
|
||||
lea ebx, [esp+12] ;[stream]
|
||||
|
||||
push eax ;.out_size
|
||||
push eax ;.output
|
||||
push 12 ;.inp_size
|
||||
push ebx ;.input
|
||||
push SND_SETPAN ;.code
|
||||
push dword [hSound] ;.handle
|
||||
|
||||
mov eax, 68
|
||||
mov ebx, 17
|
||||
mov ecx, esp
|
||||
int 0x40
|
||||
add esp, 24
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret 8
|
36
contrib/sdk/sources/sound/src/sndsetpos.asm
Normal file
36
contrib/sdk/sources/sound/src/sndsetpos.asm
Normal file
@@ -0,0 +1,36 @@
|
||||
format MS COFF
|
||||
|
||||
include "snd.inc"
|
||||
include "proc32.inc"
|
||||
|
||||
section '.text' align 16 code readable executable
|
||||
|
||||
extrn hSound
|
||||
|
||||
public _SetBufferPos@8
|
||||
|
||||
align 4
|
||||
_SetBufferPos@8: ;str:dword, offs:dword
|
||||
|
||||
push ebx
|
||||
push ecx
|
||||
|
||||
xor eax, eax
|
||||
lea ebx, [esp+12] ;[stream]
|
||||
|
||||
push eax ;.out_size
|
||||
push eax ;.output
|
||||
push 8 ;.inp_size
|
||||
push ebx ;.input
|
||||
push SND_SETPOS ;.code
|
||||
push dword [hSound] ;.handle
|
||||
|
||||
mov eax, 68
|
||||
mov ebx, 17
|
||||
mov ecx, esp
|
||||
int 0x40
|
||||
add esp, 24
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret 8
|
||||
|
36
contrib/sdk/sources/sound/src/sndsetvol.asm
Normal file
36
contrib/sdk/sources/sound/src/sndsetvol.asm
Normal file
@@ -0,0 +1,36 @@
|
||||
format MS COFF
|
||||
|
||||
include "snd.inc"
|
||||
include "proc32.inc"
|
||||
|
||||
section '.text' align 16 code readable executable
|
||||
|
||||
public _SetVolume@12
|
||||
|
||||
extrn hSound
|
||||
|
||||
align 4
|
||||
_SetVolume@12: ;str:dword, lvol:dword,rvol:dword
|
||||
|
||||
push ebx
|
||||
push ecx
|
||||
|
||||
xor eax, eax
|
||||
lea ebx, [esp+12] ;[stream]
|
||||
|
||||
push eax ;.out_size
|
||||
push eax ;.output
|
||||
push 12 ;.inp_size
|
||||
push ebx ;.input
|
||||
push SND_SETVOLUME ;.code
|
||||
push dword [hSound] ;.handle
|
||||
|
||||
mov eax, 68
|
||||
mov ebx, 17
|
||||
mov ecx, esp
|
||||
int 0x40
|
||||
add esp, 24
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret 12
|
||||
|
90
contrib/sdk/sources/sound/src/sndtime.asm
Normal file
90
contrib/sdk/sources/sound/src/sndtime.asm
Normal file
@@ -0,0 +1,90 @@
|
||||
format MS COFF
|
||||
|
||||
include "snd.inc"
|
||||
include "proc32.inc"
|
||||
|
||||
section '.text' align 16 code readable executable
|
||||
|
||||
public _SetTimeBase@12
|
||||
public _GetTimeStamp@8
|
||||
public _GetDevTime@4
|
||||
|
||||
extrn hSound
|
||||
extrn hrdwSound
|
||||
|
||||
align 4
|
||||
_SetTimeBase@12: ;stdcall str:dword, timebase:qword
|
||||
|
||||
push ebx
|
||||
push ecx
|
||||
|
||||
xor eax, eax
|
||||
lea ebx, [esp+12] ;[stream]
|
||||
|
||||
push eax ;.out_size
|
||||
push eax ;.output
|
||||
push 12 ;.inp_size
|
||||
push ebx ;.input
|
||||
push SND_SETTIMEBASE ;.code
|
||||
push dword [hSound] ;.handle
|
||||
|
||||
mov eax, 68
|
||||
mov ebx, 17
|
||||
mov ecx, esp
|
||||
int 0x40
|
||||
add esp, 24
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret 12
|
||||
|
||||
align 4
|
||||
_GetTimeStamp@8: ; stdcall, str:dword, pstamp:dword
|
||||
|
||||
push ebx
|
||||
push ecx
|
||||
|
||||
lea ebx, [esp+12] ;[stream]
|
||||
mov eax, [esp+16] ;[pstamp]
|
||||
|
||||
push 8 ;.out_size
|
||||
push eax ;.output
|
||||
push 4 ;.inp_size
|
||||
push ebx ;.input
|
||||
push SND_GETTIMESTAMP ;.code
|
||||
push dword [hSound] ;.handle
|
||||
|
||||
mov eax, 68
|
||||
mov ebx, 17
|
||||
mov ecx, esp
|
||||
int 0x40
|
||||
add esp, 24
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret 8
|
||||
|
||||
align 4
|
||||
_GetDevTime@4: ; pstamp:dword
|
||||
|
||||
push ebx
|
||||
push ecx
|
||||
|
||||
xor ebx, ebx
|
||||
mov eax, [esp+12] ;[pstamp]
|
||||
|
||||
push 4 ;.out_size
|
||||
push eax ;.output
|
||||
push ebx ;.inp_size
|
||||
push ebx ;.input
|
||||
push 9 ;.code
|
||||
push dword [hrdwSound] ;.handle
|
||||
|
||||
mov eax, 68
|
||||
mov ebx, 17
|
||||
mov ecx, esp
|
||||
int 0x40
|
||||
add esp, 24
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret 4
|
||||
|
||||
|
37
contrib/sdk/sources/sound/src/stopbuf.asm
Normal file
37
contrib/sdk/sources/sound/src/stopbuf.asm
Normal file
@@ -0,0 +1,37 @@
|
||||
format MS COFF
|
||||
|
||||
include "snd.inc"
|
||||
include "proc32.inc"
|
||||
|
||||
section '.text' align 16 code readable executable
|
||||
|
||||
extrn hSound
|
||||
|
||||
public _StopBuffer@4
|
||||
|
||||
align 4
|
||||
_StopBuffer@4: ;str:dword
|
||||
|
||||
push ebx
|
||||
push ecx
|
||||
|
||||
xor eax, eax
|
||||
lea ebx, [esp+12] ;[stream]
|
||||
|
||||
push eax ;.out_size
|
||||
push eax ;.output
|
||||
push 4 ;.inp_size
|
||||
push ebx ;.input
|
||||
push SND_STOP ;.code
|
||||
push dword [hSound] ;.handle
|
||||
|
||||
mov eax, 68
|
||||
mov ebx, 17
|
||||
mov ecx, esp
|
||||
int 0x40
|
||||
add esp, 24
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret 4
|
||||
|
||||
|
170
contrib/sdk/sources/sound/src/wavhdr.asm
Normal file
170
contrib/sdk/sources/sound/src/wavhdr.asm
Normal file
@@ -0,0 +1,170 @@
|
||||
format MS COFF
|
||||
|
||||
include "snd.inc"
|
||||
include "proc32.inc"
|
||||
|
||||
section '.text' align 16 code readable executable
|
||||
|
||||
public _test_wav@4
|
||||
|
||||
; convert WAVEHEADER into PCM_x_xx_xx constant
|
||||
|
||||
align 4
|
||||
proc _test_wav@4 stdcall, hdr:dword
|
||||
|
||||
mov eax, [hdr]
|
||||
cmp dword [eax], 0x46464952
|
||||
jne .fail
|
||||
|
||||
cmp dword [eax+8], 0x45564157
|
||||
jne .fail
|
||||
|
||||
cmp word [eax+20], 1
|
||||
jne .fail
|
||||
|
||||
mov ecx, dword [eax+24]
|
||||
mov edx, 22050
|
||||
cmp ecx, edx
|
||||
ja .high
|
||||
je .l_22
|
||||
|
||||
cmp ecx, 8000
|
||||
je .l_8
|
||||
|
||||
cmp ecx, 11025
|
||||
je .l_11
|
||||
|
||||
cmp ecx, 12000
|
||||
je .l_12
|
||||
|
||||
cmp ecx, 16000
|
||||
je .l_16
|
||||
.fail:
|
||||
xor eax, eax
|
||||
ret
|
||||
.high:
|
||||
cmp ecx, 24000
|
||||
je .LN56
|
||||
cmp ecx, 32000
|
||||
je .LN65
|
||||
cmp ecx, 44100
|
||||
je .LN74
|
||||
cmp ecx, 48000
|
||||
jne .fail
|
||||
|
||||
movzx ecx, word [eax+22]
|
||||
dec ecx
|
||||
je .LN79
|
||||
dec ecx
|
||||
jne .LN74
|
||||
|
||||
mov edx, 19
|
||||
jmp .done
|
||||
.LN79:
|
||||
mov edx, 20
|
||||
jmp .done
|
||||
.LN74:
|
||||
movzx ecx, word [eax+22]
|
||||
dec ecx
|
||||
je .LN70
|
||||
dec ecx
|
||||
jne .LN65
|
||||
|
||||
mov edx, 21
|
||||
jmp .done
|
||||
.LN70:
|
||||
mov edx, 22
|
||||
jmp .done
|
||||
.LN65:
|
||||
movzx ecx, word [eax+22]
|
||||
dec ecx
|
||||
je .LN61
|
||||
dec ecx
|
||||
jne .LN56
|
||||
|
||||
mov edx, 23
|
||||
jmp .done
|
||||
.LN61:
|
||||
mov edx, 24
|
||||
jmp .done
|
||||
.LN56:
|
||||
movzx ecx, word [eax+22]
|
||||
dec ecx
|
||||
je .LN52
|
||||
dec ecx
|
||||
je .LN50
|
||||
.l_22:
|
||||
movzx ecx, word [eax+22]
|
||||
dec ecx
|
||||
je .LN43
|
||||
dec ecx
|
||||
je .LN41
|
||||
.l_16:
|
||||
movzx ecx, word [eax+22]
|
||||
dec ecx
|
||||
je .LN34
|
||||
dec ecx
|
||||
je .LN32
|
||||
.l_12:
|
||||
movzx ecx, word [eax+22]
|
||||
dec ecx
|
||||
je .LN25
|
||||
dec ecx
|
||||
je .LN23
|
||||
.l_11:
|
||||
movzx ecx, word [eax+22]
|
||||
dec ecx
|
||||
je .LN16
|
||||
dec ecx
|
||||
je .LN14
|
||||
.l_8:
|
||||
movzx ecx, word [eax+22]
|
||||
dec ecx
|
||||
je .LN7
|
||||
dec ecx
|
||||
jne .fail
|
||||
|
||||
mov edx, 35
|
||||
jmp .done
|
||||
.LN7:
|
||||
mov edx, 36
|
||||
jmp .done
|
||||
.LN14:
|
||||
mov edx, 33
|
||||
jmp .done
|
||||
.LN16:
|
||||
mov edx, 34
|
||||
jmp .done
|
||||
.LN23:
|
||||
mov edx, 31
|
||||
jmp .done
|
||||
.LN25:
|
||||
mov edx, 32
|
||||
jmp .done
|
||||
.LN32:
|
||||
mov edx, 29
|
||||
jmp .done
|
||||
.LN34:
|
||||
mov edx, 30
|
||||
jmp .done
|
||||
.LN41:
|
||||
mov edx, 27
|
||||
jmp .done
|
||||
.LN43:
|
||||
mov edx, 28
|
||||
jmp .done
|
||||
.LN50:
|
||||
mov edx, 25
|
||||
jmp .done
|
||||
.LN52:
|
||||
mov edx, 26
|
||||
.done:
|
||||
xor ecx, ecx
|
||||
cmp word [eax+34], 16
|
||||
setne cl
|
||||
dec ecx
|
||||
and ecx, -18
|
||||
add ecx, edx
|
||||
mov eax, ecx
|
||||
ret
|
||||
endp
|
Reference in New Issue
Block a user