Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 375 → Rev 376

/programs/develop/sdk/trunk/sound/include/sound.h
76,18 → 76,18
 
typedef unsigned int SNDBUF;
 
int _stdcall InitSound();
int _stdcall InitSound(int *version);
 
SNDBUF _stdcall CreateBuffer(unsigned int format,int size);
int _stdcall CreateBuffer(unsigned int format,int size,SNDBUF *buf);
int _stdcall DestroyBuffer(SNDBUF hBuff);
 
int _stdcall SetFormat(SNDBUF hBuff, unsigned int format);
int _stdcall GetFormat(SNDBUF hBuff);
int _stdcall GetFormat(SNDBUF hBuff, unsigned int *format);
 
int _stdcall ResetBuffer(SNDBUF hBuff, unsigned int flags);
int _stdcall SetBufferPos(SNDBUF hBuff, int offset);
int _stdcall GetBufferPos(SNDBUF hBuff);
int _stdcall GetBufferSize(SNDBUF hBuff);
int _stdcall GetBufferPos(SNDBUF hBuff, int *offset);
int _stdcall GetBufferSize(SNDBUF hBuff, int *size);
 
int _stdcall SetBuffer(SNDBUF hBuff,void* buff,
int offs, int size);
98,11 → 98,32
int _stdcall SetVolume(SNDBUF hBuff, int left, int right);
int _stdcall GetVolume(SNDBUF hBuff, int *left, int *right);
int _stdcall SetPan(SNDBUF hBuff, int pan);
int _stdcall GetPan(SNDBUF hBuff);
int _stdcall GetPan(SNDBUF hBuff, int *pan);
int _stdcall GetMasterVol(int* vol);
int _stdcall SetMasterVol(int vol);
 
 
typedef struct
{
unsigned int riff_id;
unsigned int riff_size;
unsigned int riff_format;
 
unsigned int fmt_id;
unsigned int fmt_size;
 
unsigned short int wFormatTag;
unsigned short int nChannels;
unsigned int nSamplesPerSec;
unsigned int nAvgBytesPerSec;
unsigned short int nBlockAlign;
unsigned short int wBitsPerSample;
unsigned int data_id;
unsigned int data_size;
} WAVEHEADER;
 
 
unsigned int _stdcall test_wav(WAVEHEADER *hdr);
 
#ifdef __cplusplus
/programs/develop/sdk/trunk/sound/src/init.asm
5,23 → 5,16
 
section '.text' align 16 code readable executable
 
public _InitSound@0
public _CreateBuffer@8
public _InitSound@4
public _CreateBuffer@12
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
_InitSound@4: ;p_ver:dword
 
push ebx
push ecx
 
mov eax, 68
mov ebx, 16
mov ecx, szInfinity
36,96 → 29,81
int 0x40
mov [hrdwSound], eax
mov eax, [hSound]
lea eax, [esp+12] ;p_ver
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
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
lea ecx, [handle]
mov ecx, esp ;[handle]
int 0x40
add esp, 24
pop ecx
pop ebx
ret 4
.fail:
 
.done:
or eax, -1
pop ecx
pop ebx
ret
endp
ret 4
 
 
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
_CreateBuffer@12: ;format:dword,size:dword,p_str:dword
 
push ebx
push ecx
mov eax, [hSound]
lea ebx, [format]
xor ecx, ecx
lea eax, [esp+20] ;p_str
lea ebx, [esp+12] ;format
 
mov [handle], eax
mov [io_code], SND_CREATE_BUFF
mov [input], ebx
mov [inp_size], 4
mov [output], ecx
mov [out_size], ecx
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
lea ecx, [handle]
mov ecx, esp
int 0x40
add esp, 24 ;io_cintrol
pop ecx
pop ebx
ret
endp
ret 12
 
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
_DestroyBuffer@4: ;str:dword
 
push ebx
push ecx
mov eax, [hSound]
lea ebx, [str]
xor ecx, ecx
xor eax, eax
lea ebx, [esp+12] ;[stream]
 
mov [handle], eax
mov [io_code], SND_DESTROY_BUFF
mov [input], ebx
mov [inp_size], 4
mov [output], ecx
mov [out_size], ecx
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
lea ecx, [handle]
mov ecx, esp ;[handle]
int 0x40
add esp, 24
pop ecx
pop ebx
ret
endp
ret 4
 
 
section '.data' align 16 data readable writable
 
public hSound
/programs/develop/sdk/trunk/sound/src/setbuf.asm
11,67 → 11,52
public _PlayBuffer@8
 
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
_SetBuffer@16: ;str:dword, src:dword, offs:dword, size:dword
 
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
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
lea ecx, [handle]
mov ecx, esp
int 0x40
add esp, 24
pop ecx
pop ebx
ret
endp
ret 16
 
align 4
proc _PlayBuffer@8 stdcall, str:dword,flags:dword
locals
handle dd ?
io_code dd ?
input dd ?
inp_size dd ?
output dd ?
out_size dd ?
endl
_PlayBuffer@8: ;str:dword,flags:dword
 
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
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
lea ecx, [handle]
mov ecx, esp
int 0x40
add esp, 24
pop ecx
pop ebx
ret
endp
ret 8
 
/programs/develop/sdk/trunk/sound/src/sndgetfmt.asm
7,37 → 7,29
 
extrn hSound
 
public _GetFormat@4
public _GetFormat@8
 
align 4
proc _GetFormat@4 stdcall, str:dword
locals
handle dd ?
io_code dd ?
input dd ?
inp_size dd ?
output dd ?
out_size dd ?
endl
 
_GetFormat@8: ;str:dword, p_fmt:dword
push ebx
push ecx
mov eax, [hSound]
lea ebx, [str]
xor ecx, ecx
 
mov [handle], eax
mov [io_code], SND_GETFORMAT
mov [input], ebx
mov [inp_size], 4
mov [output], ecx
mov [out_size], 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
lea ecx, [handle]
mov ecx, esp
int 0x40
add esp, 24
pop ecx
pop ebx
ret
endp
ret 8
/programs/develop/sdk/trunk/sound/src/sndgetpan.asm
5,39 → 5,31
 
section '.text' align 16 code readable executable
 
public _GetPan@4
public _GetPan@8
 
extrn hSound
 
align 4
proc _GetPan@4 stdcall, str:dword
locals
handle dd ?
io_code dd ?
input dd ?
inp_size dd ?
output dd ?
out_size dd ?
endl
_GetPan@8: ;str:dword, p_pan:dword
push ebx
push ecx
mov eax, [hSound]
lea ebx, [str]
xor ecx, ecx
 
mov [handle], eax
mov [io_code], SND_GETPAN
mov [input], ebx
mov [inp_size], 4
mov [output], ecx
mov [out_size], 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
lea ecx, [handle]
mov ecx, esp
int 0x40
add esp, 24
pop ecx
pop ebx
ret
endp
ret 8
 
/programs/develop/sdk/trunk/sound/src/sndgetpos.asm
7,37 → 7,30
 
extrn hSound
 
public _GetBufferPos@4
public _GetBufferPos@8
 
align 4
proc _GetBufferPos@4 stdcall, str:dword
locals
handle dd ?
io_code dd ?
input dd ?
inp_size dd ?
output dd ?
out_size dd ?
endl
_GetBufferPos@8: ;str:dword, p_pos:dword
 
push ebx
push ecx
mov eax, [hSound]
lea ebx, [str]
xor ecx, ecx
 
mov [handle], eax
mov [io_code], SND_GETPOS
mov [input], ebx
mov [inp_size], 4
mov [output], ecx
mov [out_size], 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
lea ecx, [handle]
mov ecx, esp
int 0x40
add esp, 24
pop ecx
pop ebx
ret
endp
ret 8
/programs/develop/sdk/trunk/sound/src/sndgetsize.asm
5,39 → 5,32
 
section '.text' align 16 code readable executable
 
public _GetBufferSize@4
public _GetBufferSize@8
 
extrn hSound
 
align 4
proc _GetBufferSize@4 stdcall, str:dword
locals
handle dd ?
io_code dd ?
input dd ?
inp_size dd ?
output dd ?
out_size dd ?
endl
_GetBufferSize@8: ;str:dword, p_size:dword
push ebx
push ecx
mov eax, [hSound]
lea ebx, [str]
xor ecx, ecx
 
mov [handle], eax
mov [io_code], SND_GETBUFFSIZE
mov [input], ebx
mov [inp_size], 4
mov [output], ecx
mov [out_size], 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
lea ecx, [handle]
mov ecx, esp
int 0x40
add esp, 24
pop ecx
pop ebx
ret
endp
ret 8
/programs/develop/sdk/trunk/sound/src/sndout.asm
10,34 → 10,25
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
 
_WaveOut@12: ;str:dword, src:dword, size:dword
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
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
lea ecx, [handle]
mov ecx, esp
int 0x40
add esp, 24
pop ecx
pop ebx
ret
endp
ret 12
/programs/develop/sdk/trunk/sound/src/sndreset.asm
10,34 → 10,27
public _ResetBuffer@8
 
align 4
proc _ResetBuffer@8 stdcall, str:dword, flags:dword
locals
handle dd ?
io_code dd ?
input dd ?
inp_size dd ?
output dd ?
out_size dd ?
endl
_ResetBuffer@8: ;str:dword, flags:dword
 
push ebx
push ecx
mov eax, [hSound]
lea ebx, [str]
xor ecx, ecx
 
mov [handle], eax
mov [io_code], SND_RESET
mov [input], ebx
mov [inp_size], 8
mov [output], ecx
mov [out_size], 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
lea ecx, [handle]
mov ecx, esp
int 0x40
add esp, 24
pop ecx
pop ebx
ret
endp
ret 8
/programs/develop/sdk/trunk/sound/src/sndsetfmt.asm
10,34 → 10,26
public _SetFormat@8
 
align 4
proc _SetFormat@8 stdcall, str:dword, fmt:dword
locals
handle dd ?
io_code dd ?
input dd ?
inp_size dd ?
output dd ?
out_size dd ?
endl
_SetFormat@8: ;str:dword, fmt:dword
 
push ebx
push ecx
mov eax, [hSound]
lea ebx, [str]
xor ecx, ecx
 
mov [handle], eax
mov [io_code], SND_SETFORMAT
mov [input], ebx
mov [inp_size], 8
mov [output], ecx
mov [out_size], 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
lea ecx, [handle]
mov ecx, esp
int 0x40
add esp, 24
pop ecx
pop ebx
ret
endp
ret 8
/programs/develop/sdk/trunk/sound/src/sndsetmvol.asm
10,35 → 10,27
extrn hrdwSound
 
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
_SetMasterVol@4: ;vol:dword
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
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
lea ecx, [handle]
mov ecx, esp
int 0x40
add esp, 24
pop ecx
pop ebx
ret
endp
ret 4
 
/programs/develop/sdk/trunk/sound/src/sndsetpan.asm
10,34 → 10,25
extrn hSound
 
align 4
proc _SetPan@8 stdcall, str:dword, pan:dword
locals
handle dd ?
io_code dd ?
input dd ?
inp_size dd ?
output dd ?
out_size dd ?
endl
_SetPan@8: ;str:dword, pan:dword
push ebx
push ecx
mov eax, [hSound]
lea ebx, [str]
xor ecx, ecx
 
mov [handle], eax
mov [io_code], SND_SETPAN
mov [input], ebx
mov [inp_size], 8
mov [output], ecx
mov [out_size], 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
lea ecx, [handle]
mov ecx, esp
int 0x40
add esp, 24
pop ecx
pop ebx
ret
endp
ret 8
/programs/develop/sdk/trunk/sound/src/sndsetpos.asm
10,34 → 10,27
public _SetBufferPos@8
 
align 4
proc _SetBufferPos@8 stdcall, str:dword, offs:dword
locals
handle dd ?
io_code dd ?
input dd ?
inp_size dd ?
output dd ?
out_size dd ?
endl
_SetBufferPos@8: ;str:dword, offs:dword
 
push ebx
push ecx
mov eax, [hSound]
lea ebx, [str]
xor ecx, ecx
 
mov [handle], eax
mov [io_code], SND_SETPOS
mov [input], ebx
mov [inp_size], 8
mov [output], ecx
mov [out_size], 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
lea ecx, [handle]
mov ecx, esp
int 0x40
add esp, 24
pop ecx
pop ebx
ret
endp
ret 8
/programs/develop/sdk/trunk/sound/src/sndsetvol.asm
10,35 → 10,27
extrn hSound
 
align 4
proc _SetVolume@12 stdcall, str:dword, lvol:dword,rvol:dword
locals
handle dd ?
io_code dd ?
input dd ?
inp_size dd ?
output dd ?
out_size dd ?
endl
_SetVolume@12: ;str:dword, lvol:dword,rvol:dword
push ebx
push ecx
mov eax, [hSound]
lea ebx, [str]
xor ecx, ecx
 
mov [handle], eax
mov [io_code], SND_SETVOLUME
mov [input], ebx
mov [inp_size], 12
mov [output], ecx
mov [out_size], 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
lea ecx, [handle]
mov ecx, esp
int 0x40
add esp, 24
pop ecx
pop ebx
ret
endp
ret 12
 
/programs/develop/sdk/trunk/sound/src/stopbuf.asm
10,34 → 10,28
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
_StopBuffer@4: ;str:dword
 
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
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
lea ecx, [handle]
mov ecx, esp
int 0x40
add esp, 24
pop ecx
pop ebx
ret
endp
ret 4