OpenWatcom clib and sdk/sound
git-svn-id: svn://kolibrios.org@359 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
84
programs/develop/sdk/trunk/sound/include/sound.h
Normal file
84
programs/develop/sdk/trunk/sound/include/sound.h
Normal file
@@ -0,0 +1,84 @@
|
||||
|
||||
#ifndef _SOUND_H_
|
||||
#define _SOUND_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#define SOUND_VERSION 5
|
||||
|
||||
#define PCM_ALL 0
|
||||
#define PCM_STATIC 0x80000000
|
||||
#define PCM_2_16_48 1
|
||||
#define PCM_1_16_48 2
|
||||
#define PCM_2_16_44 3
|
||||
#define PCM_1_16_44 4
|
||||
#define PCM_2_16_32 5
|
||||
#define PCM_1_16_32 6
|
||||
#define PCM_2_16_24 7
|
||||
#define PCM_1_16_24 8
|
||||
#define PCM_2_16_22 9
|
||||
#define PCM_1_16_22 10
|
||||
#define PCM_2_16_16 11
|
||||
#define PCM_1_16_16 12
|
||||
#define PCM_2_16_12 13
|
||||
#define PCM_1_16_12 14
|
||||
#define PCM_2_16_11 15
|
||||
#define PCM_1_16_11 16
|
||||
#define PCM_2_16_8 17
|
||||
#define PCM_1_16_8 18
|
||||
#define PCM_2_8_48 19
|
||||
#define PCM_1_8_48 20
|
||||
#define PCM_2_8_44 21
|
||||
#define PCM_1_8_44 22
|
||||
#define PCM_2_8_32 23
|
||||
#define PCM_1_8_32 24
|
||||
#define PCM_2_8_24 25
|
||||
#define PCM_1_8_24 26
|
||||
#define PCM_2_8_22 27
|
||||
#define PCM_1_8_22 28
|
||||
#define PCM_2_8_16 29
|
||||
#define PCM_1_8_16 30
|
||||
#define PCM_2_8_12 31
|
||||
#define PCM_1_8_12 32
|
||||
#define PCM_2_8_11 33
|
||||
#define PCM_1_8_11 34
|
||||
#define PCM_2_8_8 35
|
||||
#define PCM_1_8_8 36
|
||||
|
||||
#define SRV_GETVERSION 0
|
||||
#define SND_CREATE_BUFF 1
|
||||
#define SND_DESTROY_BUFF 2
|
||||
#define SND_SETFORMAT 3
|
||||
#define SND_RESET 4
|
||||
#define SND_SETPOS 5
|
||||
#define SND_SETBUFF 6
|
||||
#define SND_SETVOLUME 7
|
||||
#define SND_GETVOLUME 8
|
||||
#define SND_OUT 9
|
||||
#define SND_PLAY 10
|
||||
#define SND_STOP 11
|
||||
|
||||
typedef unsigned int SNDBUF;
|
||||
|
||||
int _stdcall InitSound();
|
||||
SNDBUF _stdcall CreateBuffer(unsigned int format,int size);
|
||||
int _stdcall DestroyBuffer(SNDBUF hBuff);
|
||||
int _stdcall SetBuffer(SNDBUF hBuff,void* buff,
|
||||
int offs, int size);
|
||||
int _stdcall WaveOut(SNDBUF hBuff,void *buff, int size);
|
||||
|
||||
int _stdcall PlayBuffer(SNDBUF hBuff);
|
||||
int _stdcall StopBuffer(SNDBUF hBuff);
|
||||
|
||||
int _stdcall GetMasterVol(int* vol);
|
||||
int _stdcall SetMasterVol(int vol);
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //_SOUND_H_
|
137
programs/develop/sdk/trunk/sound/src/init.asm
Normal file
137
programs/develop/sdk/trunk/sound/src/init.asm
Normal file
@@ -0,0 +1,137 @@
|
||||
format MS COFF
|
||||
|
||||
include "snd.inc"
|
||||
include "proc32.inc"
|
||||
|
||||
section '.text' align 16 code readable executable
|
||||
|
||||
public _InitSound@0
|
||||
public _CreateBuffer@8
|
||||
public _DestroyBuffer@4
|
||||
|
||||
align 4
|
||||
proc _InitSound@0
|
||||
locals
|
||||
handle dd ?
|
||||
io_code dd ?
|
||||
input dd ?
|
||||
inp_size dd ?
|
||||
output dd ?
|
||||
out_size dd ?
|
||||
endl
|
||||
|
||||
push ebx
|
||||
push ecx
|
||||
mov eax, 68
|
||||
mov ebx, 16
|
||||
mov ecx, szInfinity
|
||||
int 0x40
|
||||
test eax, eax
|
||||
jz .fail
|
||||
|
||||
mov [hSound], eax
|
||||
mov eax, 68
|
||||
mov ebx, 16
|
||||
mov ecx, szSound
|
||||
int 0x40
|
||||
mov [hrdwSound], eax
|
||||
|
||||
mov eax, [hSound]
|
||||
xor ebx, ebx
|
||||
|
||||
mov [handle], eax
|
||||
mov [io_code], SRV_GETVERSION
|
||||
mov [input], ebx
|
||||
mov [inp_size], ebx
|
||||
mov [output], ebx
|
||||
mov [out_size], ebx
|
||||
|
||||
mov eax, 68
|
||||
mov ebx, 17
|
||||
lea ecx, [handle]
|
||||
int 0x40
|
||||
.fail:
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret
|
||||
endp
|
||||
|
||||
|
||||
align 4
|
||||
proc _CreateBuffer@8 stdcall, format:dword, size: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, [format]
|
||||
xor ecx, ecx
|
||||
|
||||
mov [handle], eax
|
||||
mov [io_code], SND_CREATE_BUFF
|
||||
mov [input], ebx
|
||||
mov [inp_size], 4
|
||||
mov [output], ecx
|
||||
mov [out_size], ecx
|
||||
|
||||
mov eax, 68
|
||||
mov ebx, 17
|
||||
lea ecx, [handle]
|
||||
int 0x40
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
proc _DestroyBuffer@4 stdcall, str: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]
|
||||
xor ecx, ecx
|
||||
|
||||
mov [handle], eax
|
||||
mov [io_code], SND_DESTROY_BUFF
|
||||
mov [input], ebx
|
||||
mov [inp_size], 4
|
||||
mov [output], ecx
|
||||
mov [out_size], ecx
|
||||
|
||||
mov eax, 68
|
||||
mov ebx, 17
|
||||
lea ecx, [handle]
|
||||
int 0x40
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret
|
||||
endp
|
||||
|
||||
section '.data' align 16 data readable writable
|
||||
|
||||
szInfinity db 'INFINITY',0
|
||||
szSound db 'SOUND',0
|
||||
|
||||
public hSound
|
||||
public hrdwSound
|
||||
|
||||
align 4
|
||||
hSound dd ?
|
||||
hrdwSound dd ?
|
268
programs/develop/sdk/trunk/sound/src/proc32.inc
Normal file
268
programs/develop/sdk/trunk/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 }
|
77
programs/develop/sdk/trunk/sound/src/setbuf.asm
Normal file
77
programs/develop/sdk/trunk/sound/src/setbuf.asm
Normal file
@@ -0,0 +1,77 @@
|
||||
format MS COFF
|
||||
|
||||
include "snd.inc"
|
||||
include "proc32.inc"
|
||||
|
||||
section '.text' align 16 code readable executable
|
||||
|
||||
extrn hSound
|
||||
|
||||
public _SetBuffer@16
|
||||
public _PlayBuffer@4
|
||||
|
||||
align 4
|
||||
proc _SetBuffer@16 stdcall,str:dword, src:dword, offs:dword, size: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]
|
||||
xor ecx, ecx
|
||||
|
||||
mov [handle], eax
|
||||
mov [io_code], SND_SETBUFF
|
||||
mov [input], ebx
|
||||
mov [inp_size], 16
|
||||
mov [output], ecx
|
||||
mov [out_size], ecx
|
||||
|
||||
mov eax, 68
|
||||
mov ebx, 17
|
||||
lea ecx, [handle]
|
||||
int 0x40
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
proc _PlayBuffer@4 stdcall, str: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]
|
||||
xor ecx, ecx
|
||||
|
||||
mov [handle], eax
|
||||
mov [io_code], SND_PLAY
|
||||
mov [input], ebx
|
||||
mov [inp_size], 4
|
||||
mov [output], ecx
|
||||
mov [out_size], ecx
|
||||
|
||||
mov eax, 68
|
||||
mov ebx, 17
|
||||
lea ecx, [handle]
|
||||
int 0x40
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret
|
||||
endp
|
34
programs/develop/sdk/trunk/sound/src/snd.inc
Normal file
34
programs/develop/sdk/trunk/sound/src/snd.inc
Normal file
@@ -0,0 +1,34 @@
|
||||
|
||||
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_RESET equ 4
|
||||
SND_SETPOS equ 5
|
||||
SND_SETBUFF equ 6
|
||||
SND_SETVOLUME equ 7
|
||||
SND_GETVOLUME equ 8
|
||||
SND_OUT equ 9
|
||||
SND_PLAY equ 10
|
||||
SND_STOP equ 11
|
||||
SND_GETFREESIZE equ 12
|
||||
|
||||
DEV_SET_BUFF equ 4
|
||||
DEV_NOTIFY equ 5
|
||||
DEV_SET_MASTERVOL equ 6
|
||||
DEV_GET_MASTERVOL equ 7
|
||||
DEV_GET_INFO equ 8
|
||||
|
43
programs/develop/sdk/trunk/sound/src/sndout.asm
Normal file
43
programs/develop/sdk/trunk/sound/src/sndout.asm
Normal file
@@ -0,0 +1,43 @@
|
||||
format MS COFF
|
||||
|
||||
include "snd.inc"
|
||||
include "proc32.inc"
|
||||
|
||||
section '.text' align 16 code readable executable
|
||||
|
||||
extrn hSound
|
||||
|
||||
public _WaveOut@12
|
||||
|
||||
align 4
|
||||
proc _WaveOut@12 stdcall,str:dword, src:dword, size: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]
|
||||
xor ecx, ecx
|
||||
|
||||
mov [handle], eax
|
||||
mov [io_code], SND_OUT
|
||||
mov [input], ebx
|
||||
mov [inp_size], 12
|
||||
mov [output], ecx
|
||||
mov [out_size], ecx
|
||||
|
||||
mov eax, 68
|
||||
mov ebx, 17
|
||||
lea ecx, [handle]
|
||||
int 0x40
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret
|
||||
endp
|
108
programs/develop/sdk/trunk/sound/src/sndvol.asm
Normal file
108
programs/develop/sdk/trunk/sound/src/sndvol.asm
Normal file
@@ -0,0 +1,108 @@
|
||||
format MS COFF
|
||||
|
||||
include "snd.inc"
|
||||
include "proc32.inc"
|
||||
|
||||
section '.text' align 16 code readable executable
|
||||
|
||||
public _GetMasterVol@4
|
||||
public _SetMasterVol@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
|
||||
|
||||
align 4
|
||||
proc _SetMasterVol@4 stdcall,vol: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]
|
||||
lea ebx, [vol]
|
||||
xor ecx, ecx
|
||||
|
||||
mov [handle], eax
|
||||
mov [io_code], DEV_SET_MASTERVOL
|
||||
mov [input], ebx
|
||||
mov [inp_size], 4
|
||||
mov [output], ecx
|
||||
mov [out_size], ecx
|
||||
|
||||
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
|
372
programs/develop/sdk/trunk/sound/src/sound.asm
Normal file
372
programs/develop/sdk/trunk/sound/src/sound.asm
Normal file
@@ -0,0 +1,372 @@
|
||||
format MS COFF
|
||||
|
||||
include "snd.inc"
|
||||
include "proc32.inc"
|
||||
|
||||
section '.text' align 16 code readable executable
|
||||
|
||||
|
||||
public _InitSound@0
|
||||
public _CreateBuffer@8
|
||||
public _DestroyBuffer@4
|
||||
public _SetBuffer@16
|
||||
public _WaveOut@12
|
||||
public _PlayBuffer@4
|
||||
public _StopBuffer@4
|
||||
|
||||
public _GetMasterVol@4
|
||||
public _SetMasterVol@4
|
||||
|
||||
align 4
|
||||
proc _InitSound@0
|
||||
locals
|
||||
handle dd ?
|
||||
io_code dd ?
|
||||
input dd ?
|
||||
inp_size dd ?
|
||||
output dd ?
|
||||
out_size dd ?
|
||||
endl
|
||||
|
||||
push ebx
|
||||
push ecx
|
||||
mov eax, 68
|
||||
mov ebx, 16
|
||||
mov ecx, szInfinity
|
||||
int 0x40
|
||||
test eax, eax
|
||||
jz .fail
|
||||
|
||||
mov [hSound], eax
|
||||
mov eax, 68
|
||||
mov ebx, 16
|
||||
mov ecx, szSound
|
||||
int 0x40
|
||||
mov [hrdwSound], eax
|
||||
|
||||
mov eax, [hSound]
|
||||
xor ebx, ebx
|
||||
|
||||
mov [handle], eax
|
||||
mov [io_code], SRV_GETVERSION
|
||||
mov [input], ebx
|
||||
mov [inp_size], ebx
|
||||
mov [output], ebx
|
||||
mov [out_size], ebx
|
||||
|
||||
mov eax, 68
|
||||
mov ebx, 17
|
||||
lea ecx, [handle]
|
||||
int 0x40
|
||||
.fail:
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret
|
||||
endp
|
||||
|
||||
|
||||
align 4
|
||||
proc _CreateBuffer@8 stdcall, format:dword, size: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, [format]
|
||||
xor ecx, ecx
|
||||
|
||||
mov [handle], eax
|
||||
mov [io_code], SND_CREATE_BUFF
|
||||
mov [input], ebx
|
||||
mov [inp_size], 4
|
||||
mov [output], ecx
|
||||
mov [out_size], ecx
|
||||
|
||||
mov eax, 68
|
||||
mov ebx, 17
|
||||
lea ecx, [handle]
|
||||
int 0x40
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
proc _DestroyBuffer@4 stdcall, str: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]
|
||||
xor ecx, ecx
|
||||
|
||||
mov [handle], eax
|
||||
mov [io_code], SND_DESTROY_BUFF
|
||||
mov [input], ebx
|
||||
mov [inp_size], 4
|
||||
mov [output], ecx
|
||||
mov [out_size], ecx
|
||||
|
||||
mov eax, 68
|
||||
mov ebx, 17
|
||||
lea ecx, [handle]
|
||||
int 0x40
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret
|
||||
endp
|
||||
|
||||
|
||||
align 4
|
||||
proc _SetBuffer@16 stdcall,str:dword, src:dword, offs:dword, size: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]
|
||||
xor ecx, ecx
|
||||
|
||||
mov [handle], eax
|
||||
mov [io_code], SND_SETBUFF
|
||||
mov [input], ebx
|
||||
mov [inp_size], 16
|
||||
mov [output], ecx
|
||||
mov [out_size], ecx
|
||||
|
||||
mov eax, 68
|
||||
mov ebx, 17
|
||||
lea ecx, [handle]
|
||||
int 0x40
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
proc _WaveOut@12 stdcall,str:dword, src:dword, size: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]
|
||||
xor ecx, ecx
|
||||
|
||||
mov [handle], eax
|
||||
mov [io_code], SND_OUT
|
||||
mov [input], ebx
|
||||
mov [inp_size], 12
|
||||
mov [output], ecx
|
||||
mov [out_size], ecx
|
||||
|
||||
mov eax, 68
|
||||
mov ebx, 17
|
||||
lea ecx, [handle]
|
||||
int 0x40
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
proc _PlayBuffer@4 stdcall, str: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]
|
||||
xor ecx, ecx
|
||||
|
||||
mov [handle], eax
|
||||
mov [io_code], SND_PLAY
|
||||
mov [input], ebx
|
||||
mov [inp_size], 4
|
||||
mov [output], ecx
|
||||
mov [out_size], ecx
|
||||
|
||||
mov eax, 68
|
||||
mov ebx, 17
|
||||
lea ecx, [handle]
|
||||
int 0x40
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
proc _StopBuffer@4 stdcall, str: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]
|
||||
xor ecx, ecx
|
||||
|
||||
mov [handle], eax
|
||||
mov [io_code], SND_STOP
|
||||
mov [input], ebx
|
||||
mov [inp_size], 4
|
||||
mov [output], ecx
|
||||
mov [out_size], ecx
|
||||
|
||||
mov eax, 68
|
||||
mov ebx, 17
|
||||
lea ecx, [handle]
|
||||
int 0x40
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret
|
||||
endp
|
||||
|
||||
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
|
||||
|
||||
align 4
|
||||
proc _SetMasterVol@4 stdcall,vol: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]
|
||||
lea ebx, [vol]
|
||||
xor ecx, ecx
|
||||
|
||||
mov [handle], eax
|
||||
mov [io_code], DEV_SET_MASTERVOL
|
||||
mov [input], ebx
|
||||
mov [inp_size], 4
|
||||
mov [output], ecx
|
||||
mov [out_size], ecx
|
||||
|
||||
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
|
||||
|
||||
section '.data' align 16 data readable writable
|
||||
|
||||
szInfinity db 'INFINITY',0
|
||||
szSound db 'SOUND',0
|
||||
|
||||
align 4
|
||||
hSound dd ?
|
||||
hrdwSound dd ?
|
43
programs/develop/sdk/trunk/sound/src/stopbuf.asm
Normal file
43
programs/develop/sdk/trunk/sound/src/stopbuf.asm
Normal file
@@ -0,0 +1,43 @@
|
||||
format MS COFF
|
||||
|
||||
include "snd.inc"
|
||||
include "proc32.inc"
|
||||
|
||||
section '.text' align 16 code readable executable
|
||||
|
||||
extrn hSound
|
||||
|
||||
public _StopBuffer@4
|
||||
|
||||
align 4
|
||||
proc _StopBuffer@4 stdcall, str: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]
|
||||
xor ecx, ecx
|
||||
|
||||
mov [handle], eax
|
||||
mov [io_code], SND_STOP
|
||||
mov [input], ebx
|
||||
mov [inp_size], 4
|
||||
mov [output], ecx
|
||||
mov [out_size], ecx
|
||||
|
||||
mov eax, 68
|
||||
mov ebx, 17
|
||||
lea ecx, [handle]
|
||||
int 0x40
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret
|
||||
endp
|
Reference in New Issue
Block a user