/programs/media/ac97snd/trunk/ac97.sln |
---|
10,10 → 10,13 |
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 |
{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 |
/programs/media/ac97snd/trunk/ac97wav.c |
---|
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,31 → 29,12 |
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; |
60,6 → 41,10 |
FILEINFO fileinfo; |
int m_vol; |
int l_vol=-500; |
int r_vol=-500; |
int pan =0; |
DWORD status; |
DWORD offset; |
DWORD first_sync; |
74,9 → 59,7 |
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_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,7 → 114,9 |
char *thread_stack; |
DWORD r_bytes; |
int retval; |
int err; |
int ver; |
fname = argv[1]; |
//debug_out_str(fname); |
139,20 → 124,19 |
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); |
offset = 0; |
174,23 → 158,28 |
touch(outbuf, 32768); |
} |
else |
{ 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; |
{ 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; |
}; |
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 |
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,13 → 243,7 |
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; |
int totalout; |
277,11 → 260,7 |
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 |
}; |
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 |
}; |
*/ |
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_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 |
{ done = 1; |
break; |
}; |
wave_out(outbuf); |
WaveOut(hBuff,outbuf,32768); |
}; |
if(status != ST_EXIT) |
373,7 → 348,7 |
void snd_stop() |
{ |
StopBuffer(hSound, hBuff); |
StopBuffer(hBuff); |
}; |
void thread_proc() |
381,17 → 356,21 |
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,24 → 381,50 |
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; |
case EV_BUTTON: |
439,24 → 444,25 |
// 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 |
}; |
}; |
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_infinite() |
{ void *a; |
int retval; |
{ int retval; |
_asm |
{ mov eax,10 |
int 0x40 |
/programs/media/ac97snd/trunk/ac97wav.h |
---|
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 |
DWORD data_size; |
} WAVEHEADER; |
DWORD test_wav(WAVEHEADER *hdr); |
DWORD test_mp3(char *buf); |
//void (*snd_play)(); |
/programs/media/ac97snd/trunk/k_lib.asm |
---|
4,24 → 4,13 |
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 |
.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 |
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,29 → 144,7 |
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 |
mov eax, 51 |
213,265 → 161,13 |
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 |
int 0x40 |
pop ebx |
ret |
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 |
pop ebx |
ret |
endp |
align 4 |
proc _DrawWindow@36 stdcall, x:dword, y:dword, sx:dword, sy:dword,\ |
workcolor:dword, style:dword, captioncolor:dword,\ |
windowtype:dword, bordercolor:dword |
/programs/media/ac97snd/trunk/kolibri.h |
---|
1,18 → 1,9 |
// |
// 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 |
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 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 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 |