/programs/develop/sdk/trunk/sound/include/snd.inc |
---|
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_SETPAN 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 |
/programs/develop/sdk/trunk/sound/include/sound.h |
---|
11,6 → 11,9 |
#define PCM_ALL 0 |
#define PCM_STATIC 0x80000000 |
#define PCM_FILTER 0x40000000 |
#define PCM_FLOAT 0x20000000 |
#define PCM_2_16_48 1 |
#define PCM_1_16_48 2 |
#define PCM_2_16_44 3 |
68,17 → 71,41 |
int _stdcall DestroyBuffer(SNDBUF hBuff); |
int _stdcall SetBuffer(SNDBUF hBuff,void* buff, |
int offs, int size); |
int _stdcall SetFormat(SNDBUF hBuff, unsigned int format); |
int _stdcall ResetBuffer(SNDBUF hBuff, unsigned int flags); |
int _stdcall SetBufferPos(SNDBUF hBuff, int offset); |
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 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); |
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 |
extern "C" |
} |
#endif |
#endif //_SOUND_H_ |
#endif //_SOUND_H_ |
/programs/develop/sdk/trunk/sound/src/sound.asm |
---|
File deleted |
\ No newline at end of file |
/programs/develop/sdk/trunk/sound/src/init.asm |
---|
26,10 → 26,10 |
mov ebx, 16 |
mov ecx, szInfinity |
int 0x40 |
mov [hSound], eax |
test eax, eax |
jz .fail |
mov [hSound], eax |
mov eax, 68 |
mov ebx, 16 |
mov ecx, szSound |
51,6 → 51,8 |
lea ecx, [handle] |
int 0x40 |
.fail: |
.done: |
pop ecx |
pop ebx |
ret |
/programs/develop/sdk/trunk/sound/src/snd.inc |
---|
24,7 → 24,7 |
SND_OUT equ 9 |
SND_PLAY equ 10 |
SND_STOP equ 11 |
SND_GETFREESIZE equ 12 |
SND_SETPAN equ 12 |
DEV_SET_BUFF equ 4 |
DEV_NOTIFY equ 5 |
/programs/develop/sdk/trunk/sound/src/sndfmt.asm |
---|
0,0 → 1,43 |
format MS COFF |
include "snd.inc" |
include "proc32.inc" |
section '.text' align 16 code readable executable |
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 |
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 |
mov eax, 68 |
mov ebx, 17 |
lea ecx, [handle] |
int 0x40 |
pop ecx |
pop ebx |
ret |
endp |
/programs/develop/sdk/trunk/sound/src/sndpan.asm |
---|
0,0 → 1,44 |
format MS COFF |
include "snd.inc" |
include "proc32.inc" |
section '.text' align 16 code readable executable |
public _SetPan@8 |
;public _GetPan@4 |
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 |
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 |
mov eax, 68 |
mov ebx, 17 |
lea ecx, [handle] |
int 0x40 |
pop ecx |
pop ebx |
ret |
endp |
/programs/develop/sdk/trunk/sound/src/sndreset.asm |
---|
0,0 → 1,43 |
format MS COFF |
include "snd.inc" |
include "proc32.inc" |
section '.text' align 16 code readable executable |
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 |
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 |
mov eax, 68 |
mov ebx, 17 |
lea ecx, [handle] |
int 0x40 |
pop ecx |
pop ebx |
ret |
endp |
/programs/develop/sdk/trunk/sound/src/sndsetpos.asm |
---|
0,0 → 1,43 |
format MS COFF |
include "snd.inc" |
include "proc32.inc" |
section '.text' align 16 code readable executable |
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 |
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 |
mov eax, 68 |
mov ebx, 17 |
lea ecx, [handle] |
int 0x40 |
pop ecx |
pop ebx |
ret |
endp |
/programs/develop/sdk/trunk/sound/src/sndvol.asm |
---|
5,12 → 5,81 |
section '.text' align 16 code readable executable |
public _SetVolume@12 |
public _GetVolume@12 |
public _GetMasterVol@4 |
public _SetMasterVol@4 |
extrn hSound |
extrn hrdwSound |
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 |
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 |
mov eax, 68 |
mov ebx, 17 |
lea ecx, [handle] |
int 0x40 |
pop ecx |
pop ebx |
ret |
endp |
align 4 |
proc _GetVolume@12 stdcall, str:dword, pleft:dword,pright:dword |
locals |
handle dd ? |
io_code dd ? |
input dd ? |
inp_size dd ? |
output dd ? |
out_size dd ? |
endl |
push ebx |
push ecx |
mov eax, [hSound] |
lea ebx, [str] |
lea ecx, [pleft] |
mov [handle], eax |
mov [io_code], SND_GETVOLUME |
mov [input], ebx |
mov [inp_size], 4 |
mov [output], ecx |
mov [out_size], 8 |
mov eax, 68 |
mov ebx, 17 |
lea ecx, [handle] |
int 0x40 |
pop ecx |
pop ebx |
ret |
endp |
align 4 |
proc _GetMasterVol@4 stdcall, pvol:dword |
locals |
handle dd ? |
/programs/develop/sdk/trunk/sound/src/wavhdr.asm |
---|
0,0 → 1,170 |
format MS COFF |
include "snd.inc" |
include "proc32.inc" |
section '.text' align 16 code readable executable |
public _test_wav@4 |
; convert WAVEHEADER into PCM_x_xx_xx constant |
align 4 |
proc _test_wav@4 stdcall, hdr:dword |
mov eax, [hdr] |
cmp dword [eax], 0x46464952 |
jne .fail |
cmp dword [eax+8], 0x45564157 |
jne .fail |
cmp word [eax+20], 1 |
jne .fail |
mov ecx, dword [eax+24] |
mov edx, 22050 |
cmp ecx, edx |
ja .high |
je .l_22 |
cmp ecx, 8000 |
je .l_8 |
cmp ecx, 11025 |
je .l_11 |
cmp ecx, 12000 |
je .l_12 |
cmp ecx, 16000 |
je .l_16 |
.fail: |
xor eax, eax |
ret |
.high: |
cmp ecx, 24000 |
je .LN56 |
cmp ecx, 32000 |
je .LN65 |
cmp ecx, 44100 |
je .LN74 |
cmp ecx, 48000 |
jne .fail |
movzx ecx, word [eax+22] |
dec ecx |
je .LN79 |
dec ecx |
jne .LN74 |
mov edx, 19 |
jmp .done |
.LN79: |
mov edx, 20 |
jmp .done |
.LN74: |
movzx ecx, word [eax+22] |
dec ecx |
je .LN70 |
dec ecx |
jne .LN65 |
mov edx, 21 |
jmp .done |
.LN70: |
mov edx, 22 |
jmp .done |
.LN65: |
movzx ecx, word [eax+22] |
dec ecx |
je .LN61 |
dec ecx |
jne .LN56 |
mov edx, 23 |
jmp .done |
.LN61: |
mov edx, 24 |
jmp .done |
.LN56: |
movzx ecx, word [eax+22] |
dec ecx |
je .LN52 |
dec ecx |
je .LN50 |
.l_22: |
movzx ecx, word [eax+22] |
dec ecx |
je .LN43 |
dec ecx |
je .LN41 |
.l_16: |
movzx ecx, word [eax+22] |
dec ecx |
je .LN34 |
dec ecx |
je .LN32 |
.l_12: |
movzx ecx, word [eax+22] |
dec ecx |
je .LN25 |
dec ecx |
je .LN23 |
.l_11: |
movzx ecx, word [eax+22] |
dec ecx |
je .LN16 |
dec ecx |
je .LN14 |
.l_8: |
movzx ecx, word [eax+22] |
dec ecx |
je .LN7 |
dec ecx |
jne .fail |
mov edx, 35 |
jmp .done |
.LN7: |
mov edx, 36 |
jmp .done |
.LN14: |
mov edx, 33 |
jmp .done |
.LN16: |
mov edx, 34 |
jmp .done |
.LN23: |
mov edx, 31 |
jmp .done |
.LN25: |
mov edx, 32 |
jmp .done |
.LN32: |
mov edx, 29 |
jmp .done |
.LN34: |
mov edx, 30 |
jmp .done |
.LN41: |
mov edx, 27 |
jmp .done |
.LN43: |
mov edx, 28 |
jmp .done |
.LN50: |
mov edx, 25 |
jmp .done |
.LN52: |
mov edx, 26 |
.done: |
xor ecx, ecx |
cmp word [eax+34], 16 |
setne cl |
dec ecx |
and ecx, -18 |
add ecx, edx |
mov eax, ecx |
ret |
endp |