forked from KolibriOS/kolibrios
updated soundlib, DOOM, ac97snd
git-svn-id: svn://kolibrios.org@376 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
b07dfce332
commit
6cf25c8bd8
@ -76,18 +76,18 @@ extern "C"
|
||||
|
||||
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 StopBuffer(SNDBUF hBuff);
|
||||
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
|
||||
|
@ -5,23 +5,16 @@ include "proc32.inc"
|
||||
|
||||
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,95 +29,80 @@ proc _InitSound@0
|
||||
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
|
||||
|
||||
|
@ -11,67 +11,52 @@ public _SetBuffer@16
|
||||
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
|
||||
|
||||
|
@ -7,37 +7,29 @@ section '.text' align 16 code readable executable
|
||||
|
||||
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
|
||||
|
||||
|
@ -5,39 +5,31 @@ include "proc32.inc"
|
||||
|
||||
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
|
||||
|
||||
|
@ -7,37 +7,30 @@ section '.text' align 16 code readable executable
|
||||
|
||||
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
|
||||
|
||||
|
@ -5,39 +5,32 @@ include "proc32.inc"
|
||||
|
||||
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
|
||||
|
||||
|
@ -10,34 +10,25 @@ 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
|
||||
|
||||
_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
|
||||
|
@ -10,34 +10,27 @@ extrn hSound
|
||||
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
|
||||
|
||||
|
@ -10,34 +10,26 @@ extrn hSound
|
||||
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
|
||||
|
@ -10,35 +10,27 @@ public _SetMasterVol@4
|
||||
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
|
||||
|
||||
|
@ -10,34 +10,25 @@ public _SetPan@8
|
||||
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
|
||||
|
@ -10,34 +10,27 @@ extrn hSound
|
||||
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
|
||||
|
||||
|
@ -10,35 +10,27 @@ public _SetVolume@12
|
||||
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
|
||||
|
||||
|
@ -10,34 +10,28 @@ 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
|
||||
_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
|
||||
|
||||
|
@ -456,8 +456,6 @@ void I_UpdateSound( void )
|
||||
// Mixing channel index.
|
||||
int chan;
|
||||
int i;
|
||||
int flags;
|
||||
int size = 0;
|
||||
|
||||
// Left and right channel
|
||||
// are in global mixbuffer, alternating.
|
||||
@ -481,15 +479,12 @@ void I_UpdateSound( void )
|
||||
// Love thy L2 chache - made this a loop.
|
||||
// Now more channels could be set at compile time
|
||||
// as well. Thus loop those channels.
|
||||
// flags=0;
|
||||
|
||||
for ( chan = 0; chan < NUM_CHANNELS; chan++ )
|
||||
{
|
||||
// Check channel, if active.
|
||||
if (channels[ chan ])
|
||||
{
|
||||
// flags=1;
|
||||
|
||||
// Get the raw data from the channel.
|
||||
sample = *channels[ chan ];
|
||||
// Add left and right part
|
||||
@ -535,22 +530,9 @@ void I_UpdateSound( void )
|
||||
// Increment current pointers in mixbuffer.
|
||||
leftout += step;
|
||||
rightout += step;
|
||||
// if (flags)
|
||||
// size+=4;
|
||||
}
|
||||
|
||||
SetBuffer(hMixBuff,mixbuffer,mix_offset,mix_size);
|
||||
|
||||
|
||||
// WaveOut(hMixBuff,(char*)&mixbuffer[0],4096);
|
||||
|
||||
// if(size)
|
||||
// {
|
||||
// WaveOut(hMixBuff,(char*)&mixbuffer[0],size);
|
||||
// SetBufferPos(hMixBuff, 0);
|
||||
// SetBuffer(hMixBuff,(char*)&mixbuffer[0],mix_offset,4096);
|
||||
// PlayBuffer(hMixBuff, PCM_SYNC);
|
||||
// };
|
||||
}
|
||||
|
||||
|
||||
|
@ -76,18 +76,18 @@ extern "C"
|
||||
|
||||
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,7 +98,7 @@ int _stdcall StopBuffer(SNDBUF hBuff);
|
||||
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 pan);
|
||||
int _stdcall GetPan(SNDBUF hBuff, int *pan);
|
||||
|
||||
int _stdcall GetMasterVol(int* vol);
|
||||
int _stdcall SetMasterVol(int vol);
|
||||
|
@ -178,7 +178,6 @@ void S_Init
|
||||
{
|
||||
int i;
|
||||
char *thread_stack;
|
||||
int ver;
|
||||
|
||||
numChannels = NUM_CHANNELS;
|
||||
|
||||
@ -243,34 +242,70 @@ extern signed short *mixbuffer;
|
||||
void sound_proc(void)
|
||||
{
|
||||
int ver;
|
||||
int err;
|
||||
SND_EVENT evnt;
|
||||
int i;
|
||||
|
||||
if((ver = InitSound())< SOUND_VERSION )
|
||||
if(err = InitSound(&ver))
|
||||
{
|
||||
printf("Error %x Sound service not installed\n\r", err);
|
||||
_asm
|
||||
{
|
||||
mov eax, -1
|
||||
int 0x40
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
if(ver< SOUND_VERSION)
|
||||
{
|
||||
printf("Sound service version mismatch\n\r");
|
||||
printf("Installed version: %d, required version %d\n\r",
|
||||
ver, SOUND_VERSION);
|
||||
_asm
|
||||
{
|
||||
mov eax, -1
|
||||
int 0x40
|
||||
};
|
||||
};
|
||||
|
||||
hMixBuff=CreateBuffer(PCM_2_16_11|PCM_RING,0);
|
||||
|
||||
if(!hMixBuff)
|
||||
if (err = CreateBuffer(PCM_2_16_11|PCM_RING,0, &hMixBuff))
|
||||
{
|
||||
printf("sound not available\n\r");
|
||||
printf("Error %x sound not available\n\r", err);
|
||||
printf("handle = %x\n\r", hMixBuff);
|
||||
_asm
|
||||
{
|
||||
mov eax, -1
|
||||
int 0x40
|
||||
};
|
||||
}
|
||||
|
||||
if(err = GetBufferSize(hMixBuff, &mix_size))
|
||||
{
|
||||
printf("Error %x get buffer size\n\r", err);
|
||||
printf("size = %x\n\r", mix_size);
|
||||
_asm
|
||||
{
|
||||
mov eax, -1
|
||||
int 0x40
|
||||
};
|
||||
};
|
||||
mix_size= mix_size/2;
|
||||
|
||||
mix_size=GetBufferSize(hMixBuff)/2;
|
||||
printf("mixer size %d\n\r", mix_size);
|
||||
|
||||
if(err=PlayBuffer(hMixBuff, 0))
|
||||
{
|
||||
printf("Error %x play buffer\n\r", err);
|
||||
_asm
|
||||
{
|
||||
mov eax, -1
|
||||
int 0x40
|
||||
};
|
||||
}
|
||||
|
||||
mixbuffer = malloc(mix_size);
|
||||
|
||||
PlayBuffer(hMixBuff, 0);
|
||||
while(sound_state)
|
||||
{
|
||||
GetNotify(&evnt);
|
||||
|
@ -10,10 +10,13 @@ EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ac97", "ac97\ac97.vcproj", "{1C94A897-DA4F-45B2-B8A6-B97AD837828E}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{CF807B93-2860-41DF-A4D2-5B92B52DFD96} = {CF807B93-2860-41DF-A4D2-5B92B52DFD96}
|
||||
{C8D44F9A-B5DF-4A94-AA92-47D9945FD4F1} = {C8D44F9A-B5DF-4A94-AA92-47D9945FD4F1}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mpg", "mpg\mpg.vcproj", "{CF807B93-2860-41DF-A4D2-5B92B52DFD96}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sound", "sound\sound.vcproj", "{C8D44F9A-B5DF-4A94-AA92-47D9945FD4F1}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
@ -23,23 +26,21 @@ Global
|
||||
{50E3FB09-4E3A-4998-A824-6830405193AE}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{50E3FB09-4E3A-4998-A824-6830405193AE}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{50E3FB09-4E3A-4998-A824-6830405193AE}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{50E3FB09-4E3A-4998-A824-6830405193AE}.Release|Win32.Build.0 = Release|Win32
|
||||
{97BF69A3-826A-47D6-94E4-05FDD8CFF1FC}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{97BF69A3-826A-47D6-94E4-05FDD8CFF1FC}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{97BF69A3-826A-47D6-94E4-05FDD8CFF1FC}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{97BF69A3-826A-47D6-94E4-05FDD8CFF1FC}.Release|Win32.Build.0 = Release|Win32
|
||||
{9FE40739-2ADC-4241-8182-20E1B3C661A7}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{9FE40739-2ADC-4241-8182-20E1B3C661A7}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{9FE40739-2ADC-4241-8182-20E1B3C661A7}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{9FE40739-2ADC-4241-8182-20E1B3C661A7}.Release|Win32.Build.0 = Release|Win32
|
||||
{1C94A897-DA4F-45B2-B8A6-B97AD837828E}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{1C94A897-DA4F-45B2-B8A6-B97AD837828E}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{1C94A897-DA4F-45B2-B8A6-B97AD837828E}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{1C94A897-DA4F-45B2-B8A6-B97AD837828E}.Release|Win32.Build.0 = Release|Win32
|
||||
{CF807B93-2860-41DF-A4D2-5B92B52DFD96}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{CF807B93-2860-41DF-A4D2-5B92B52DFD96}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{CF807B93-2860-41DF-A4D2-5B92B52DFD96}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{CF807B93-2860-41DF-A4D2-5B92B52DFD96}.Release|Win32.Build.0 = Release|Win32
|
||||
{C8D44F9A-B5DF-4A94-AA92-47D9945FD4F1}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{C8D44F9A-B5DF-4A94-AA92-47D9945FD4F1}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{C8D44F9A-B5DF-4A94-AA92-47D9945FD4F1}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{C8D44F9A-B5DF-4A94-AA92-47D9945FD4F1}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -14,12 +14,12 @@
|
||||
// GNU General Public License for more details.
|
||||
|
||||
#include "kolibri.h"
|
||||
//#include "stdio.h"
|
||||
#include "string.h"
|
||||
#include "ac97wav.h"
|
||||
#include "mpg/mpg123.h"
|
||||
#include "sound.h"
|
||||
|
||||
#define MP3_ERROR_OUT_OF_BUFFER 5
|
||||
#define MP3_ERROR_OUT_OF_BUFFER 5
|
||||
int m_last_error;
|
||||
|
||||
void thread_proc();
|
||||
@ -29,37 +29,22 @@ int stream_read_raw(struct reader *rd,unsigned char *buf, int size);
|
||||
|
||||
char *fname;
|
||||
|
||||
//extern char __path;
|
||||
|
||||
/***** for debug output only
|
||||
char formats[37][12] =
|
||||
{ "PCM_ALL",
|
||||
"PCM_2_16_48","PCM_1_16_48","PCM_2_16_44","PCM_1_16_44",
|
||||
"PCM_2_16_32","PCM_1_16_32","PCM_2_16_24","PCM_1_16_24",
|
||||
"PCM_2_16_22","PCM_1_16_22","PCM_2_16_16","PCM_1_16_16",
|
||||
"PCM_2_16_12","PCM_1_16_12","PCM_2_16_11","PCM_1_16_11",
|
||||
"PCM_2_16_8","PCM_1_16_8","PCM_2_8_48","PCM_1_8_48",
|
||||
"PCM_2_8_44","PCM_1_8_44","PCM_2_8_32","PCM_1_8_32",
|
||||
"PCM_2_8_24","PCM_1_8_24","PCM_2_8_22","PCM_1_8_22",
|
||||
"PCM_2_8_16","PCM_1_8_16","PCM_2_8_12","PCM_1_8_12",
|
||||
"PCM_2_8_11","PCM_1_8_11","PCM_2_8_8","PCM_1_8_8"
|
||||
};
|
||||
*******/
|
||||
//int freqs[9] = {44100,48000,32000,22050,24000,16000 ,11025 ,12000 ,8000};
|
||||
|
||||
struct reader rd;
|
||||
struct frame fr;
|
||||
|
||||
DWORD hDrv;
|
||||
DWORD hSound;
|
||||
DWORD hBuff;
|
||||
DWORD event[2];
|
||||
SNDBUF hBuff;
|
||||
|
||||
CTRL_INFO info;
|
||||
|
||||
FILEINFO fileinfo;
|
||||
|
||||
int m_vol;
|
||||
int l_vol=-500;
|
||||
int r_vol=-500;
|
||||
int pan =0;
|
||||
|
||||
DWORD status;
|
||||
DWORD offset;
|
||||
DWORD first_sync;
|
||||
@ -75,8 +60,6 @@ int outremain;
|
||||
int totalout;
|
||||
int done;
|
||||
|
||||
char srv_name[] = "INFINITY";
|
||||
char srv_intel[] = "SOUND";
|
||||
char header[] = "AC97 MP3 player";
|
||||
char buttons_text[]=" Play Stop << >> Vol- Vol+";
|
||||
|
||||
@ -111,10 +94,10 @@ void draw_window()
|
||||
|
||||
void draw_progress_bar()
|
||||
{ DWORD x;
|
||||
x = 286.0f * (float)(rd.filepos-rd.strremain)/(float)fileinfo.size;
|
||||
x = 287.0f * (float)(rd.filepos-rd.strremain)/(float)fileinfo.size;
|
||||
if(x==0) return;
|
||||
draw_bar(7,41,x,11,0xA0A0A0);
|
||||
draw_bar(x+7,41,286-x,11,0x404040);
|
||||
draw_bar(x+7,41,287-x,11,0x404040);
|
||||
};
|
||||
|
||||
void debug_out_str(char* str)
|
||||
@ -131,6 +114,8 @@ int main(int argc, char *argv[]) //int argc, char *argv[])
|
||||
char *thread_stack;
|
||||
DWORD r_bytes;
|
||||
int retval;
|
||||
int err;
|
||||
int ver;
|
||||
|
||||
fname = argv[1];
|
||||
//debug_out_str(fname);
|
||||
@ -139,19 +124,18 @@ int main(int argc, char *argv[]) //int argc, char *argv[])
|
||||
if(get_fileinfo(fname, &fileinfo)==FILE_NOT_FOUND)
|
||||
return 0;
|
||||
|
||||
if((hDrv=GetService(srv_intel))==0)
|
||||
return 0;
|
||||
|
||||
if ((hSound=GetService(srv_name))==0)
|
||||
if(err = InitSound(&ver))
|
||||
{
|
||||
debug_out_str("Sound service not installed\n\r");
|
||||
return 0;
|
||||
}
|
||||
|
||||
GetDevInfo(hDrv, &info);
|
||||
|
||||
m_vol = GetMasterVol(hDrv,&m_vol);
|
||||
if (m_vol > 85)
|
||||
{ m_vol = 85;
|
||||
SetMasterVol(hDrv,m_vol);
|
||||
};
|
||||
if( ver != SOUND_VERSION)
|
||||
{
|
||||
debug_out_str("Sound service version mismatch\n\r");
|
||||
return 0;
|
||||
}
|
||||
|
||||
testbuff = UserAlloc(4096);
|
||||
get_fileinfo(fname, &fileinfo);
|
||||
@ -174,23 +158,28 @@ int main(int argc, char *argv[]) //int argc, char *argv[])
|
||||
touch(outbuf, 32768);
|
||||
}
|
||||
else
|
||||
{ fmt = test_mp3(testbuff);
|
||||
if(fmt ==0) return 0;
|
||||
snd_play = &play_mp3;
|
||||
{ fmt = test_mp3(testbuff);
|
||||
if(fmt ==0) return 0;
|
||||
snd_play = &play_mp3;
|
||||
|
||||
outremain = 0x40000 ;
|
||||
outbuf = UserAlloc(outremain);
|
||||
touch(outbuf, outremain);
|
||||
make_decode_tables(32767);
|
||||
init_layer2();
|
||||
init_layer3(32);
|
||||
fr.single = -1;
|
||||
outremain = 0x40000 ;
|
||||
outbuf = UserAlloc(outremain);
|
||||
touch(outbuf, outremain);
|
||||
make_decode_tables(32767);
|
||||
init_layer2();
|
||||
init_layer3(32);
|
||||
fr.single = -1;
|
||||
};
|
||||
|
||||
status = ST_PLAY;
|
||||
|
||||
hBuff = CreateBuffer(hSound,fmt);
|
||||
if (hBuff == 0) return 0;
|
||||
if (err = CreateBuffer(fmt,0, &hBuff))
|
||||
{
|
||||
debug_out_str("create buffer return error\n\r");
|
||||
return 0;
|
||||
}
|
||||
|
||||
SetVolume(hBuff,l_vol,r_vol);
|
||||
thread_stack = UserAlloc(4096);
|
||||
thread_stack+=4092;
|
||||
|
||||
@ -204,13 +193,13 @@ int main(int argc, char *argv[]) //int argc, char *argv[])
|
||||
continue;
|
||||
|
||||
case ST_STOP:
|
||||
StopBuffer(hSound, hBuff);
|
||||
StopBuffer(hBuff);
|
||||
status = ST_DONE;
|
||||
continue;
|
||||
|
||||
case ST_EXIT:
|
||||
StopBuffer(hSound, hBuff);
|
||||
DestroyBuffer(hSound, hBuff);
|
||||
StopBuffer(hBuff);
|
||||
DestroyBuffer(hBuff);
|
||||
return 0;
|
||||
};
|
||||
};
|
||||
@ -254,12 +243,6 @@ DWORD test_mp3(char *buf)
|
||||
return test_wav(&whdr);
|
||||
};
|
||||
|
||||
void wave_out(char* buff)
|
||||
{ DWORD ev[6];
|
||||
|
||||
GetNotify(&ev[0]);
|
||||
SetBuffer(hSound,hBuff,buff,ev[1],0x8000);
|
||||
}
|
||||
|
||||
void play_mp3()
|
||||
{ char *outPtr;
|
||||
@ -277,11 +260,7 @@ void play_mp3()
|
||||
outremain=0x40000;
|
||||
|
||||
memset(outbuf,0,0x40000);
|
||||
|
||||
set_reader(&rd, 0); //;first_sync);
|
||||
SetBuffer(hSound,hBuff,outbuf,0,0x8000);
|
||||
SetBuffer(hSound,hBuff,outbuf,0x8000,0x8000);
|
||||
PlayBuffer(hSound, hBuff);
|
||||
|
||||
while(1)
|
||||
{ if(status!=ST_PLAY)
|
||||
@ -302,13 +281,14 @@ void play_mp3()
|
||||
};
|
||||
|
||||
if(done)
|
||||
{ if(totalout < 32768)
|
||||
{ memset(outPtr,0,32768-totalout);
|
||||
totalout = 32768;
|
||||
{ if(totalout < 4096)
|
||||
{ memset(outPtr,0,4096-totalout);
|
||||
totalout = 4096;
|
||||
};
|
||||
};
|
||||
if(totalout < 32768)
|
||||
continue;
|
||||
}
|
||||
else
|
||||
if(totalout < 8192)
|
||||
continue;
|
||||
/*
|
||||
_asm
|
||||
{ push edx
|
||||
@ -321,13 +301,22 @@ void play_mp3()
|
||||
};
|
||||
*/
|
||||
outPtr = outbuf;
|
||||
while (totalout > 32768)
|
||||
{ wave_out(outPtr);
|
||||
totalout-=0x8000;
|
||||
outPtr+=0x8000;
|
||||
outremain+=0x8000;
|
||||
while (totalout >= 4096)
|
||||
{
|
||||
|
||||
WaveOut(hBuff,outPtr,4096);
|
||||
if(status!=ST_PLAY)
|
||||
{ if(status != ST_EXIT)
|
||||
status = ST_STOP;
|
||||
return;
|
||||
};
|
||||
totalout-=4096;
|
||||
outPtr+=4096;
|
||||
outremain+=4096;
|
||||
};
|
||||
if(done) break;
|
||||
if(done)
|
||||
break;
|
||||
|
||||
memmove(outbuf,outPtr, totalout);
|
||||
outPtr = outbuf+totalout;
|
||||
}
|
||||
@ -337,23 +326,9 @@ void play_mp3()
|
||||
};
|
||||
|
||||
void play_wave()
|
||||
{ DWORD ev[6];
|
||||
int retval;
|
||||
int remain;
|
||||
int i;
|
||||
{ int retval;
|
||||
|
||||
// offset = 44;
|
||||
|
||||
// read_file (fname,outbuf,offset,32*1024,0);
|
||||
// offset+=32*1024;
|
||||
set_reader(&rd,44);
|
||||
stream_read_raw(&rd,outbuf,32768);
|
||||
SetBuffer(hSound,hBuff,outbuf,0,0x8000);
|
||||
stream_read_raw(&rd,outbuf,32768);
|
||||
SetBuffer(hSound,hBuff,outbuf,0x8000,0x8000);
|
||||
|
||||
PlayBuffer(hSound, hBuff);
|
||||
|
||||
retval = 0;
|
||||
while(1)
|
||||
{
|
||||
@ -364,7 +339,7 @@ void play_wave()
|
||||
{ done = 1;
|
||||
break;
|
||||
};
|
||||
wave_out(outbuf);
|
||||
WaveOut(hBuff,outbuf,32768);
|
||||
};
|
||||
|
||||
if(status != ST_EXIT)
|
||||
@ -373,7 +348,7 @@ void play_wave()
|
||||
|
||||
void snd_stop()
|
||||
{
|
||||
StopBuffer(hSound, hBuff);
|
||||
StopBuffer(hBuff);
|
||||
};
|
||||
|
||||
void thread_proc()
|
||||
@ -381,17 +356,21 @@ void thread_proc()
|
||||
int pos;
|
||||
int key;
|
||||
|
||||
_asm { fninit };
|
||||
|
||||
_asm
|
||||
{
|
||||
mov eax, 66
|
||||
mov ebx, 1
|
||||
mov ecx, 1
|
||||
int 0x40
|
||||
};
|
||||
|
||||
draw_window();
|
||||
|
||||
while(1)
|
||||
{ if(status==ST_PLAY)
|
||||
{ draw_progress_bar();
|
||||
evnt = wait_for_event(80);
|
||||
// debug_out_str("BIG ERROR...\x0D\x0A\x00");
|
||||
}
|
||||
{ draw_progress_bar();
|
||||
evnt = wait_for_event(80);
|
||||
}
|
||||
else
|
||||
evnt = wait_for_event_infinite();
|
||||
|
||||
@ -402,22 +381,48 @@ void thread_proc()
|
||||
break;
|
||||
|
||||
case EV_KEY:
|
||||
key = get_key();
|
||||
if(key==27)
|
||||
{ status = ST_EXIT;
|
||||
exit();
|
||||
};
|
||||
if((key==45)||key==54)
|
||||
{ if(m_vol > 0)
|
||||
{ m_vol--;
|
||||
SetMasterVol(hDrv,m_vol);
|
||||
};
|
||||
break;
|
||||
};
|
||||
if((key==61)||key==56)
|
||||
{ if(m_vol < 90)
|
||||
{ m_vol++;
|
||||
SetMasterVol(hDrv,m_vol);
|
||||
if(!get_key(&key))
|
||||
{
|
||||
|
||||
switch(key)
|
||||
{ case 0xE0:
|
||||
case 0xE1:
|
||||
break;
|
||||
default:
|
||||
switch (key)
|
||||
{
|
||||
case 0x01: //Esc
|
||||
status = ST_EXIT;
|
||||
exit();
|
||||
break;
|
||||
|
||||
case 0x47: //Home
|
||||
if(l_vol < 0)
|
||||
{ l_vol+=100;
|
||||
r_vol+=100;
|
||||
SetVolume(hBuff,l_vol,r_vol);
|
||||
};
|
||||
break;
|
||||
case 0x4F: //End
|
||||
if(l_vol > -10000)
|
||||
{ l_vol-=100;
|
||||
r_vol-=100;
|
||||
SetVolume(hBuff,l_vol,r_vol);
|
||||
};
|
||||
break;
|
||||
case 0x53:
|
||||
if(pan > -10000)
|
||||
{ pan -=100;
|
||||
SetPan(hBuff,pan);
|
||||
};
|
||||
break;
|
||||
case 0x51:
|
||||
if(pan < 10000)
|
||||
{ pan +=100;
|
||||
SetPan(hBuff,pan);
|
||||
};
|
||||
break;
|
||||
}
|
||||
};
|
||||
};
|
||||
break;
|
||||
@ -439,24 +444,25 @@ void thread_proc()
|
||||
// case 0x12:
|
||||
// case 0x13:
|
||||
case 0x14:
|
||||
if(m_vol > 0)
|
||||
{ m_vol--;
|
||||
SetMasterVol(hDrv,m_vol);
|
||||
};
|
||||
break;
|
||||
if(l_vol > -10000)
|
||||
{
|
||||
l_vol-=100;
|
||||
r_vol-=100;
|
||||
SetVolume(hBuff,l_vol,r_vol);
|
||||
};
|
||||
break;
|
||||
|
||||
case 0x15:
|
||||
if(m_vol < 90)
|
||||
{ m_vol++;
|
||||
SetMasterVol(hDrv,m_vol);
|
||||
};
|
||||
break;
|
||||
if(l_vol < 0)
|
||||
{ l_vol+=100;
|
||||
r_vol+=100;
|
||||
SetVolume(hBuff,l_vol,r_vol);
|
||||
};
|
||||
break;
|
||||
|
||||
case 0x30:
|
||||
if(status==ST_DONE)
|
||||
break;
|
||||
// if(snd_play == play_mp3)
|
||||
// continue;
|
||||
pos = (GetMousePos(REL_WINDOW)>>16)-7;
|
||||
offset = ((fileinfo.size-44)/286*pos+44)&0xFFFFFFFC;
|
||||
set_reader(&rd, offset);
|
||||
@ -467,157 +473,6 @@ void thread_proc()
|
||||
};
|
||||
};
|
||||
|
||||
DWORD test_wav(WAVEHEADER *hdr)
|
||||
{
|
||||
if(hdr->riff_id != 0x46464952)
|
||||
return 0;
|
||||
|
||||
if(hdr->riff_format != 0x45564157)
|
||||
return 0;
|
||||
|
||||
if (hdr->wFormatTag != 0x01)
|
||||
return 0;
|
||||
|
||||
switch(hdr->nSamplesPerSec)
|
||||
{ case 48000:
|
||||
switch (hdr->nChannels)
|
||||
{ case 1:
|
||||
if(hdr->wBitsPerSample == 16)
|
||||
return PCM_1_16_48;
|
||||
else
|
||||
return PCM_1_8_48;
|
||||
|
||||
case 2:
|
||||
if(hdr->wBitsPerSample == 16)
|
||||
return PCM_2_16_48;
|
||||
else
|
||||
return PCM_2_8_48;
|
||||
};
|
||||
|
||||
case 44100:
|
||||
switch (hdr->nChannels)
|
||||
{ case 1:
|
||||
if(hdr->wBitsPerSample == 16)
|
||||
return PCM_1_16_44;
|
||||
else
|
||||
return PCM_1_8_44;
|
||||
|
||||
case 2:
|
||||
if(hdr->wBitsPerSample == 16)
|
||||
return PCM_2_16_44;
|
||||
else
|
||||
return PCM_2_8_44;
|
||||
};
|
||||
|
||||
case 32000:
|
||||
switch (hdr->nChannels)
|
||||
{ case 1:
|
||||
if(hdr->wBitsPerSample == 16)
|
||||
return PCM_1_16_32;
|
||||
else
|
||||
return PCM_1_8_32;
|
||||
|
||||
case 2:
|
||||
if(hdr->wBitsPerSample == 16)
|
||||
return PCM_2_16_32;
|
||||
else
|
||||
return PCM_2_8_32;
|
||||
};
|
||||
|
||||
case 24000:
|
||||
switch (hdr->nChannels)
|
||||
{ case 1:
|
||||
if(hdr->wBitsPerSample == 16)
|
||||
return PCM_1_16_24;
|
||||
else
|
||||
return PCM_1_8_24;
|
||||
|
||||
case 2:
|
||||
if(hdr->wBitsPerSample == 16)
|
||||
return PCM_2_16_24;
|
||||
else
|
||||
return PCM_2_8_24;
|
||||
};
|
||||
|
||||
case 22050:
|
||||
switch (hdr->nChannels)
|
||||
{ case 1:
|
||||
if(hdr->wBitsPerSample == 16)
|
||||
return PCM_1_16_22;
|
||||
else
|
||||
return PCM_1_8_22;
|
||||
|
||||
case 2:
|
||||
if(hdr->wBitsPerSample == 16)
|
||||
return PCM_2_16_22;
|
||||
else
|
||||
return PCM_2_8_22;
|
||||
};
|
||||
|
||||
case 16000:
|
||||
switch (hdr->nChannels)
|
||||
{ case 1:
|
||||
if(hdr->wBitsPerSample == 16)
|
||||
return PCM_1_16_16;
|
||||
else
|
||||
return PCM_1_8_16;
|
||||
|
||||
case 2:
|
||||
if(hdr->wBitsPerSample == 16)
|
||||
return PCM_2_16_16;
|
||||
else
|
||||
return PCM_2_8_16;
|
||||
};
|
||||
|
||||
case 12000:
|
||||
switch (hdr->nChannels)
|
||||
{ case 1:
|
||||
if(hdr->wBitsPerSample == 16)
|
||||
return PCM_1_16_12;
|
||||
else
|
||||
return PCM_1_8_12;
|
||||
|
||||
case 2:
|
||||
if(hdr->wBitsPerSample == 16)
|
||||
return PCM_2_16_12;
|
||||
else
|
||||
return PCM_2_8_12;
|
||||
};
|
||||
|
||||
case 11025:
|
||||
switch (hdr->nChannels)
|
||||
{ case 1:
|
||||
if(hdr->wBitsPerSample == 16)
|
||||
return PCM_1_16_11;
|
||||
else
|
||||
return PCM_1_8_11;
|
||||
|
||||
case 2:
|
||||
if(hdr->wBitsPerSample == 16)
|
||||
return PCM_2_16_11;
|
||||
else
|
||||
return PCM_2_8_11;
|
||||
};
|
||||
|
||||
case 8000:
|
||||
switch (hdr->nChannels)
|
||||
{ case 1:
|
||||
if(hdr->wBitsPerSample == 16)
|
||||
return PCM_1_16_8;
|
||||
else
|
||||
return PCM_1_8_8;
|
||||
|
||||
case 2:
|
||||
if(hdr->wBitsPerSample == 16)
|
||||
return PCM_2_16_8;
|
||||
else
|
||||
return PCM_2_8_8;
|
||||
};
|
||||
default:
|
||||
return 0;
|
||||
};
|
||||
};
|
||||
|
||||
void delay (int val)
|
||||
{
|
||||
_asm
|
||||
@ -639,8 +494,7 @@ int wait_for_event(int time)
|
||||
};
|
||||
|
||||
int wait_for_event_infinite()
|
||||
{ void *a;
|
||||
int retval;
|
||||
{ int retval;
|
||||
_asm
|
||||
{ mov eax,10
|
||||
int 0x40
|
||||
|
@ -14,43 +14,6 @@
|
||||
// GNU General Public License for more details.
|
||||
|
||||
|
||||
#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 ST_DONE 0x0
|
||||
#define ST_PLAY 0x1
|
||||
#define ST_EXIT 0x2
|
||||
@ -74,7 +37,6 @@ typedef struct
|
||||
DWORD data_size;
|
||||
} WAVEHEADER;
|
||||
|
||||
DWORD test_wav(WAVEHEADER *hdr);
|
||||
DWORD test_mp3(char *buf);
|
||||
|
||||
//void (*snd_play)();
|
||||
|
@ -4,24 +4,13 @@ include "proc32.inc"
|
||||
|
||||
section '.text' code readable executable
|
||||
|
||||
public _GetService@4
|
||||
public _GetDevInfo@8
|
||||
public _GetMasterVol@8
|
||||
public _SetMasterVol@8
|
||||
public _CreateBuffer@8
|
||||
public _DestroyBuffer@8
|
||||
public _SetBuffer@20
|
||||
public _PlayBuffer@8
|
||||
public _StopBuffer@8
|
||||
|
||||
public _InitHeap@4
|
||||
public _UserAlloc@4
|
||||
public _GetNotify@4
|
||||
public _CreateThread@8
|
||||
public _GetMousePos@4
|
||||
public _get_fileinfo@8
|
||||
public _read_file@20
|
||||
public _get_key
|
||||
public _get_key@4
|
||||
public _get_button_id
|
||||
public _DrawWindow@36
|
||||
public _make_button@24
|
||||
@ -42,34 +31,6 @@ struc FILEIO
|
||||
.name dd ?
|
||||
};
|
||||
|
||||
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
|
||||
|
||||
|
||||
SND_CREATE_DEV equ 1
|
||||
SND_CREATE_BUFF equ 2
|
||||
SND_PLAY equ 3
|
||||
SND_STOP equ 4
|
||||
SND_SETBUFF equ 5
|
||||
SND_DESTROY_BUFF equ 6
|
||||
|
||||
DEV_SET_BUFF equ 4
|
||||
DEV_NOTIFY equ 5
|
||||
DEV_SET_MASTERVOL equ 6
|
||||
DEV_GET_MASTERVOL equ 7
|
||||
DEV_GET_INFO equ 8
|
||||
|
||||
|
||||
align 4
|
||||
proc _get_button_id
|
||||
mov eax,17
|
||||
@ -145,13 +106,22 @@ proc _read_file@20 stdcall,name:dword, buff:dword, offset:dword,\
|
||||
endp
|
||||
|
||||
align 4
|
||||
proc _get_key
|
||||
proc _get_key@4 stdcall, key:dword
|
||||
push ebx
|
||||
push ecx
|
||||
mov eax, 2
|
||||
int 0x40
|
||||
shr eax, 8
|
||||
mov ebx, [key]
|
||||
mov ecx, eax
|
||||
shr ecx, 8
|
||||
mov [ebx], ecx
|
||||
movzx eax, al
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret
|
||||
endp
|
||||
|
||||
|
||||
align 4
|
||||
proc _InitHeap@4 stdcall, heap_size:dword
|
||||
push ebx
|
||||
@ -174,28 +144,6 @@ proc _UserAlloc@4 stdcall, alloc_size:dword
|
||||
ret
|
||||
endp
|
||||
|
||||
;align 4
|
||||
;proc _GetNotify@4 stdcall, p_ev:dword
|
||||
; push ebx
|
||||
; mov eax, 68
|
||||
; mov ebx, 14
|
||||
; mov ecx, [p_ev]
|
||||
; int 0x40
|
||||
; pop ebx
|
||||
; ret
|
||||
;endp
|
||||
|
||||
align 4
|
||||
proc _GetNotify@4 stdcall, p_ev:dword
|
||||
push ebx
|
||||
mov eax, 68
|
||||
mov ebx, 14
|
||||
mov ecx, [p_ev]
|
||||
int 0x40
|
||||
pop ebx
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
proc _CreateThread@8 stdcall, fn:dword, p_stack:dword
|
||||
push ebx
|
||||
@ -213,264 +161,12 @@ proc _GetMousePos@4 stdcall,rel_type:dword
|
||||
push ebx
|
||||
mov eax, 37
|
||||
mov ebx, [rel_type]
|
||||
int 0x40
|
||||
pop ebx
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
proc CallServiceEx stdcall, ioctl:dword
|
||||
push ebx
|
||||
mov eax, 68
|
||||
mov ebx, 17
|
||||
mov ecx, [ioctl]
|
||||
int 0x40
|
||||
pop ebx
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
proc _GetService@4 stdcall, name:dword
|
||||
push ebx
|
||||
mov eax, 68
|
||||
mov ebx, 16
|
||||
mov ecx, [name]
|
||||
int 0x40
|
||||
pop ebx
|
||||
ret
|
||||
endp
|
||||
|
||||
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
|
||||
|
||||
align 4
|
||||
proc _GetMasterVol@8 stdcall, hSrv:dword,pvol:dword
|
||||
locals
|
||||
handle dd ?
|
||||
io_code dd ?
|
||||
input dd ?
|
||||
inp_size dd ?
|
||||
output dd ?
|
||||
out_size dd ?
|
||||
endl
|
||||
|
||||
push ebx
|
||||
mov eax, [hSrv]
|
||||
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
|
||||
|
||||
lea eax, [handle]
|
||||
stdcall CallServiceEx, eax
|
||||
pop ebx
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
proc _SetMasterVol@8 stdcall,hSrv:dword,vol:dword
|
||||
locals
|
||||
handle dd ?
|
||||
io_code dd ?
|
||||
input dd ?
|
||||
inp_size dd ?
|
||||
output dd ?
|
||||
out_size dd ?
|
||||
endl
|
||||
|
||||
push ebx
|
||||
mov eax, [hSrv]
|
||||
lea ecx, [vol]
|
||||
xor ebx, ebx
|
||||
|
||||
mov [handle], eax
|
||||
mov [io_code], DEV_SET_MASTERVOL
|
||||
mov [input], ecx
|
||||
mov [inp_size], 4
|
||||
mov [output], ebx
|
||||
mov [out_size], 0
|
||||
|
||||
lea eax, [handle]
|
||||
stdcall CallServiceEx, eax
|
||||
pop ebx
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
proc _CreateBuffer@8 stdcall, hSound:dword,format:dword
|
||||
locals
|
||||
handle dd ?
|
||||
io_code dd ?
|
||||
input dd ?
|
||||
inp_size dd ?
|
||||
output dd ?
|
||||
out_size dd ?
|
||||
endl
|
||||
|
||||
push ebx
|
||||
mov eax, [hSound]
|
||||
lea ecx, [format]
|
||||
xor ebx, ebx
|
||||
|
||||
mov [handle], eax
|
||||
mov [io_code], SND_CREATE_BUFF
|
||||
mov [input], ecx
|
||||
mov [inp_size], 4
|
||||
mov [output], ebx
|
||||
mov [out_size], 0
|
||||
|
||||
lea eax, [handle]
|
||||
stdcall CallServiceEx, eax
|
||||
pop ebx
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
proc _DestroyBuffer@8 stdcall, hSound:dword, str:dword
|
||||
locals
|
||||
handle dd ?
|
||||
io_code dd ?
|
||||
input dd ?
|
||||
inp_size dd ?
|
||||
output dd ?
|
||||
out_size dd ?
|
||||
endl
|
||||
|
||||
push ebx
|
||||
mov eax, [hSound]
|
||||
lea ecx, [str]
|
||||
xor ebx, ebx
|
||||
|
||||
mov [handle], eax
|
||||
mov [io_code], SND_DESTROY_BUFF
|
||||
mov [input], ecx
|
||||
mov [inp_size], 4
|
||||
mov [output], ebx
|
||||
mov [out_size], 0
|
||||
|
||||
lea eax, [handle]
|
||||
stdcall CallServiceEx, eax
|
||||
pop ebx
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
proc _SetBuffer@20 stdcall,hSound:dword, 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
|
||||
mov eax, [hSound]
|
||||
lea ecx, [str]
|
||||
xor ebx, ebx
|
||||
|
||||
mov [handle], eax
|
||||
mov [io_code], SND_SETBUFF
|
||||
mov [input], ecx
|
||||
mov [inp_size], 16
|
||||
mov [output], ebx
|
||||
mov [out_size], 0
|
||||
|
||||
lea eax, [handle]
|
||||
stdcall CallServiceEx, eax
|
||||
pop ebx
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
proc _PlayBuffer@8 stdcall, hSound:dword, str:dword
|
||||
locals
|
||||
handle dd ?
|
||||
io_code dd ?
|
||||
input dd ?
|
||||
inp_size dd ?
|
||||
output dd ?
|
||||
out_size dd ?
|
||||
endl
|
||||
|
||||
push ebx
|
||||
mov eax, [hSound]
|
||||
lea ecx, [str]
|
||||
xor ebx, ebx
|
||||
|
||||
mov [handle], eax
|
||||
mov [io_code], SND_PLAY
|
||||
mov [input], ecx
|
||||
mov [inp_size], 4
|
||||
mov [output], ebx
|
||||
mov [out_size], 0
|
||||
|
||||
lea eax, [handle]
|
||||
stdcall CallServiceEx, eax
|
||||
pop ebx
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
proc _StopBuffer@8 stdcall, hSound:dword, str:dword
|
||||
locals
|
||||
handle dd ?
|
||||
io_code dd ?
|
||||
input dd ?
|
||||
inp_size dd ?
|
||||
output dd ?
|
||||
out_size dd ?
|
||||
endl
|
||||
|
||||
push ebx
|
||||
mov eax, [hSound]
|
||||
lea ecx, [str]
|
||||
xor ebx, ebx
|
||||
|
||||
mov [handle], eax
|
||||
mov [io_code], SND_STOP
|
||||
mov [input], ecx
|
||||
mov [inp_size], 4
|
||||
mov [output], ebx
|
||||
mov [out_size], 0
|
||||
|
||||
lea eax, [handle]
|
||||
stdcall CallServiceEx, eax
|
||||
int 0x40
|
||||
pop ebx
|
||||
ret
|
||||
endp
|
||||
|
||||
|
||||
align 4
|
||||
proc _DrawWindow@36 stdcall, x:dword, y:dword, sx:dword, sy:dword,\
|
||||
workcolor:dword, style:dword, captioncolor:dword,\
|
||||
|
@ -1,17 +1,8 @@
|
||||
//
|
||||
// This file is part of the AC97 mp3 player.
|
||||
// (C) copyright Serge 2006
|
||||
// email: infinity_sound@mail.ru
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#define FONT0 0x00000000
|
||||
#define FONT1 0x10000000
|
||||
@ -31,9 +22,9 @@
|
||||
#define FILE_NOT_FOUND 5
|
||||
#define FILE_EOF 6
|
||||
|
||||
|
||||
typedef unsigned int DWORD;
|
||||
typedef unsigned short int WORD;
|
||||
typedef unsigned int size_t;
|
||||
|
||||
typedef struct
|
||||
{ DWORD pci_cmd;
|
||||
@ -70,22 +61,11 @@ typedef struct
|
||||
DWORD size_high;
|
||||
} FILEINFO;
|
||||
|
||||
void _stdcall InitHeap(int heap_size);
|
||||
void* _stdcall UserAlloc(int size);
|
||||
void _stdcall GetNotify(DWORD *event);
|
||||
void _stdcall InitHeap(size_t heap_size);
|
||||
void* _stdcall UserAlloc(size_t size);
|
||||
|
||||
void _stdcall CreateThread(void *fn, char *p_stack);
|
||||
DWORD _stdcall GetMousePos(DWORD rel_type);
|
||||
int _stdcall GetService(char *srv_name);
|
||||
void _stdcall GetDevInfo(DWORD hSrv,CTRL_INFO *pInfo);
|
||||
int _stdcall GetMasterVol(DWORD hSrv,int* vol);
|
||||
int _stdcall SetMasterVol(DWORD hSrv, int vol);
|
||||
DWORD _stdcall CreateBuffer(DWORD hSrv, DWORD format);
|
||||
int _stdcall DestroyBuffer(DWORD hSrv, DWORD hBuff);
|
||||
int _stdcall SetBuffer(DWORD hSrv, DWORD hBuff,char* buff,
|
||||
DWORD offs, int size);
|
||||
int _stdcall PlayBuffer(DWORD hSrv, DWORD hBuff);
|
||||
int _stdcall StopBuffer(DWORD hSrv, DWORD hBuff);
|
||||
|
||||
void _stdcall debug_out_hex(DWORD val);
|
||||
void debug_out_str(char* str);
|
||||
@ -94,7 +74,7 @@ int _stdcall get_fileinfo(char *name,FILEINFO* pinfo);
|
||||
int _stdcall read_file (char *name,char*buff,int offset,int count,int *reads);
|
||||
|
||||
void exit();
|
||||
int _cdecl get_key(void);
|
||||
int _stdcall get_key(int *key);
|
||||
int _cdecl get_button_id();
|
||||
void delay(int val);
|
||||
int wait_for_event(int time);
|
||||
@ -108,3 +88,7 @@ void _stdcall make_button(int x, int y, int xsize, int ysize, int id, int color)
|
||||
void _stdcall draw_bar(int x, int y, int xsize, int ysize, int color);
|
||||
void _stdcall write_text(int x,int y,int color,char* text,int len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user