Rev 286 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 286 | Rev 376 | ||
---|---|---|---|
Line 12... | Line 12... | ||
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | // GNU General Public License for more details. |
14 | // GNU General Public License for more details. |
Line 15... | Line 15... | ||
15 | 15 | ||
16 | #include "kolibri.h" |
- | |
17 | //#include "stdio.h" |
16 | #include "kolibri.h" |
18 | #include "string.h" |
17 | #include "string.h" |
19 | #include "ac97wav.h" |
18 | #include "ac97wav.h" |
- | 19 | #include "mpg/mpg123.h" |
|
Line 20... | Line 20... | ||
20 | #include "mpg/mpg123.h" |
20 | #include "sound.h" |
21 | 21 | ||
Line 22... | Line 22... | ||
22 | #define MP3_ERROR_OUT_OF_BUFFER 5 |
22 | #define MP3_ERROR_OUT_OF_BUFFER 5 |
Line 27... | Line 27... | ||
27 | int mp3FindSync(byte* buf, int size, int* sync); |
27 | int mp3FindSync(byte* buf, int size, int* sync); |
28 | int stream_read_raw(struct reader *rd,unsigned char *buf, int size); |
28 | int stream_read_raw(struct reader *rd,unsigned char *buf, int size); |
Line 29... | Line 29... | ||
29 | 29 | ||
Line 30... | Line -... | ||
30 | char *fname; |
- | |
31 | - | ||
32 | //extern char __path; |
- | |
33 | - | ||
34 | /***** for debug output only |
- | |
35 | char formats[37][12] = |
- | |
36 | { "PCM_ALL", |
- | |
37 | "PCM_2_16_48","PCM_1_16_48","PCM_2_16_44","PCM_1_16_44", |
- | |
38 | "PCM_2_16_32","PCM_1_16_32","PCM_2_16_24","PCM_1_16_24", |
- | |
39 | "PCM_2_16_22","PCM_1_16_22","PCM_2_16_16","PCM_1_16_16", |
- | |
40 | "PCM_2_16_12","PCM_1_16_12","PCM_2_16_11","PCM_1_16_11", |
- | |
41 | "PCM_2_16_8","PCM_1_16_8","PCM_2_8_48","PCM_1_8_48", |
- | |
42 | "PCM_2_8_44","PCM_1_8_44","PCM_2_8_32","PCM_1_8_32", |
- | |
43 | "PCM_2_8_24","PCM_1_8_24","PCM_2_8_22","PCM_1_8_22", |
- | |
44 | "PCM_2_8_16","PCM_1_8_16","PCM_2_8_12","PCM_1_8_12", |
- | |
45 | "PCM_2_8_11","PCM_1_8_11","PCM_2_8_8","PCM_1_8_8" |
- | |
46 | }; |
- | |
47 | *******/ |
- | |
48 | //int freqs[9] = {44100,48000,32000,22050,24000,16000 ,11025 ,12000 ,8000}; |
30 | char *fname; |
49 | 31 | ||
Line 50... | Line 32... | ||
50 | struct reader rd; |
32 | struct reader rd; |
51 | struct frame fr; |
33 | struct frame fr; |
52 | 34 | ||
53 | DWORD hDrv; |
- | |
Line 54... | Line 35... | ||
54 | DWORD hSound; |
35 | DWORD hDrv; |
Line 55... | Line 36... | ||
55 | DWORD hBuff; |
36 | DWORD hSound; |
Line 56... | Line 37... | ||
56 | DWORD event[2]; |
37 | SNDBUF hBuff; |
- | 38 | ||
- | 39 | CTRL_INFO info; |
|
- | 40 | ||
- | 41 | FILEINFO fileinfo; |
|
57 | 42 | ||
58 | CTRL_INFO info; |
43 | int m_vol; |
59 | 44 | int l_vol=-500; |
|
Line 60... | Line 45... | ||
60 | FILEINFO fileinfo; |
45 | int r_vol=-500; |
Line 73... | Line 58... | ||
73 | int outsize; |
58 | int outsize; |
74 | int outremain; |
59 | int outremain; |
75 | int totalout; |
60 | int totalout; |
76 | int done; |
61 | int done; |
Line 77... | Line -... | ||
77 | - | ||
78 | char srv_name[] = "INFINITY"; |
- | |
79 | char srv_intel[] = "SOUND"; |
62 | |
80 | char header[] = "AC97 MP3 player"; |
63 | char header[] = "AC97 MP3 player"; |
Line 81... | Line 64... | ||
81 | char buttons_text[]=" Play Stop << >> Vol- Vol+"; |
64 | char buttons_text[]=" Play Stop << >> Vol- Vol+"; |
Line 109... | Line 92... | ||
109 | EndDraw(); |
92 | EndDraw(); |
110 | }; |
93 | }; |
Line 111... | Line 94... | ||
111 | 94 | ||
112 | void draw_progress_bar() |
95 | void draw_progress_bar() |
113 | { DWORD x; |
96 | { DWORD x; |
114 | x = 286.0f * (float)(rd.filepos-rd.strremain)/(float)fileinfo.size; |
97 | x = 287.0f * (float)(rd.filepos-rd.strremain)/(float)fileinfo.size; |
115 | if(x==0) return; |
98 | if(x==0) return; |
116 | draw_bar(7,41,x,11,0xA0A0A0); |
99 | draw_bar(7,41,x,11,0xA0A0A0); |
117 | draw_bar(x+7,41,286-x,11,0x404040); |
100 | draw_bar(x+7,41,287-x,11,0x404040); |
Line 118... | Line 101... | ||
118 | }; |
101 | }; |
119 | 102 | ||
120 | void debug_out_str(char* str) |
103 | void debug_out_str(char* str) |
Line 129... | Line 112... | ||
129 | int main(int argc, char *argv[]) //int argc, char *argv[]) |
112 | int main(int argc, char *argv[]) //int argc, char *argv[]) |
130 | { DWORD fmt; |
113 | { DWORD fmt; |
131 | char *thread_stack; |
114 | char *thread_stack; |
132 | DWORD r_bytes; |
115 | DWORD r_bytes; |
133 | int retval; |
116 | int retval; |
- | 117 | int err; |
|
- | 118 | int ver; |
|
Line 134... | Line 119... | ||
134 | 119 | ||
135 | fname = argv[1]; |
120 | fname = argv[1]; |
Line 136... | Line 121... | ||
136 | //debug_out_str(fname); |
121 | //debug_out_str(fname); |
137 | 122 | ||
138 | InitHeap(1024*1024); |
123 | InitHeap(1024*1024); |
Line 139... | Line -... | ||
139 | if(get_fileinfo(fname, &fileinfo)==FILE_NOT_FOUND) |
- | |
140 | return 0; |
- | |
Line 141... | Line 124... | ||
141 | 124 | if(get_fileinfo(fname, &fileinfo)==FILE_NOT_FOUND) |
|
- | 125 | return 0; |
|
- | 126 | ||
142 | if((hDrv=GetService(srv_intel))==0) |
127 | |
- | 128 | if(err = InitSound(&ver)) |
|
Line 143... | Line 129... | ||
143 | return 0; |
129 | { |
144 | 130 | debug_out_str("Sound service not installed\n\r"); |
|
145 | if ((hSound=GetService(srv_name))==0) |
131 | return 0; |
146 | return 0; |
- | |
147 | 132 | } |
|
148 | GetDevInfo(hDrv, &info); |
- | |
149 | 133 | ||
Line 150... | Line 134... | ||
150 | m_vol = GetMasterVol(hDrv,&m_vol); |
134 | if( ver != SOUND_VERSION) |
151 | if (m_vol > 85) |
135 | { |
152 | { m_vol = 85; |
136 | debug_out_str("Sound service version mismatch\n\r"); |
153 | SetMasterVol(hDrv,m_vol); |
137 | return 0; |
Line 187... | Line 171... | ||
187 | fr.single = -1; |
171 | fr.single = -1; |
188 | }; |
172 | }; |
Line 189... | Line 173... | ||
189 | 173 | ||
Line 190... | Line 174... | ||
190 | status = ST_PLAY; |
174 | status = ST_PLAY; |
- | 175 | ||
- | 176 | if (err = CreateBuffer(fmt,0, &hBuff)) |
|
191 | 177 | { |
|
- | 178 | debug_out_str("create buffer return error\n\r"); |
|
- | 179 | return 0; |
|
- | 180 | } |
|
192 | hBuff = CreateBuffer(hSound,fmt); |
181 | |
193 | if (hBuff == 0) return 0; |
182 | SetVolume(hBuff,l_vol,r_vol); |
Line 194... | Line 183... | ||
194 | thread_stack = UserAlloc(4096); |
183 | thread_stack = UserAlloc(4096); |
Line 202... | Line 191... | ||
202 | { case ST_PLAY: |
191 | { case ST_PLAY: |
203 | snd_play(); |
192 | snd_play(); |
204 | continue; |
193 | continue; |
Line 205... | Line 194... | ||
205 | 194 | ||
206 | case ST_STOP: |
195 | case ST_STOP: |
207 | StopBuffer(hSound, hBuff); |
196 | StopBuffer(hBuff); |
208 | status = ST_DONE; |
197 | status = ST_DONE; |
Line 209... | Line 198... | ||
209 | continue; |
198 | continue; |
210 | 199 | ||
211 | case ST_EXIT: |
200 | case ST_EXIT: |
212 | StopBuffer(hSound, hBuff); |
201 | StopBuffer(hBuff); |
213 | DestroyBuffer(hSound, hBuff); |
202 | DestroyBuffer(hBuff); |
214 | return 0; |
203 | return 0; |
215 | }; |
204 | }; |
216 | }; |
205 | }; |
Line 252... | Line 241... | ||
252 | whdr.wBitsPerSample = 16; |
241 | whdr.wBitsPerSample = 16; |
Line 253... | Line 242... | ||
253 | 242 | ||
254 | return test_wav(&whdr); |
243 | return test_wav(&whdr); |
Line 255... | Line -... | ||
255 | }; |
- | |
256 | - | ||
257 | void wave_out(char* buff) |
- | |
258 | { DWORD ev[6]; |
- | |
259 | - | ||
260 | GetNotify(&ev[0]); |
- | |
Line 261... | Line 244... | ||
261 | SetBuffer(hSound,hBuff,buff,ev[1],0x8000); |
244 | }; |
262 | } |
245 | |
263 | 246 | ||
264 | void play_mp3() |
247 | void play_mp3() |
Line 275... | Line 258... | ||
275 | totalout=0; |
258 | totalout=0; |
276 | done = 0; |
259 | done = 0; |
277 | outremain=0x40000; |
260 | outremain=0x40000; |
Line 278... | Line 261... | ||
278 | 261 | ||
279 | memset(outbuf,0,0x40000); |
- | |
280 | 262 | memset(outbuf,0,0x40000); |
|
281 | set_reader(&rd, 0); //;first_sync); |
- | |
282 | SetBuffer(hSound,hBuff,outbuf,0,0x8000); |
- | |
283 | SetBuffer(hSound,hBuff,outbuf,0x8000,0x8000); |
- | |
Line 284... | Line 263... | ||
284 | PlayBuffer(hSound, hBuff); |
263 | set_reader(&rd, 0); //;first_sync); |
285 | 264 | ||
286 | while(1) |
265 | while(1) |
Line 300... | Line 279... | ||
300 | if(outremain < outcount*2) |
279 | if(outremain < outcount*2) |
301 | break; |
280 | break; |
302 | }; |
281 | }; |
Line 303... | Line 282... | ||
303 | 282 | ||
304 | if(done) |
283 | if(done) |
305 | { if(totalout < 32768) |
284 | { if(totalout < 4096) |
306 | { memset(outPtr,0,32768-totalout); |
285 | { memset(outPtr,0,4096-totalout); |
307 | totalout = 32768; |
286 | totalout = 4096; |
308 | }; |
287 | }; |
- | 288 | } |
|
309 | }; |
289 | else |
310 | if(totalout < 32768) |
290 | if(totalout < 8192) |
311 | continue; |
291 | continue; |
312 | /* |
292 | /* |
313 | _asm |
293 | _asm |
314 | { push edx |
294 | { push edx |
Line 319... | Line 299... | ||
319 | pop eax |
299 | pop eax |
320 | pop edx |
300 | pop edx |
321 | }; |
301 | }; |
322 | */ |
302 | */ |
323 | outPtr = outbuf; |
303 | outPtr = outbuf; |
324 | while (totalout > 32768) |
304 | while (totalout >= 4096) |
- | 305 | { |
|
- | 306 | ||
325 | { wave_out(outPtr); |
307 | WaveOut(hBuff,outPtr,4096); |
- | 308 | if(status!=ST_PLAY) |
|
- | 309 | { if(status != ST_EXIT) |
|
- | 310 | status = ST_STOP; |
|
- | 311 | return; |
|
- | 312 | }; |
|
326 | totalout-=0x8000; |
313 | totalout-=4096; |
327 | outPtr+=0x8000; |
314 | outPtr+=4096; |
328 | outremain+=0x8000; |
315 | outremain+=4096; |
329 | }; |
316 | }; |
330 | if(done) break; |
317 | if(done) |
- | 318 | break; |
|
- | 319 | ||
331 | memmove(outbuf,outPtr, totalout); |
320 | memmove(outbuf,outPtr, totalout); |
332 | outPtr = outbuf+totalout; |
321 | outPtr = outbuf+totalout; |
333 | } |
322 | } |
Line 334... | Line 323... | ||
334 | 323 | ||
335 | if(status != ST_EXIT) |
324 | if(status != ST_EXIT) |
336 | status = ST_STOP; |
325 | status = ST_STOP; |
Line 337... | Line 326... | ||
337 | }; |
326 | }; |
338 | - | ||
339 | void play_wave() |
327 | |
340 | { DWORD ev[6]; |
- | |
341 | int retval; |
- | |
342 | int remain; |
- | |
343 | int i; |
- | |
Line 344... | Line -... | ||
344 | - | ||
345 | // offset = 44; |
- | |
346 | 328 | void play_wave() |
|
347 | // read_file (fname,outbuf,offset,32*1024,0); |
- | |
348 | // offset+=32*1024; |
- | |
349 | set_reader(&rd,44); |
- | |
350 | stream_read_raw(&rd,outbuf,32768); |
- | |
351 | SetBuffer(hSound,hBuff,outbuf,0,0x8000); |
- | |
352 | stream_read_raw(&rd,outbuf,32768); |
- | |
353 | SetBuffer(hSound,hBuff,outbuf,0x8000,0x8000); |
- | |
354 | 329 | { int retval; |
|
355 | PlayBuffer(hSound, hBuff); |
330 | |
356 | 331 | set_reader(&rd,44); |
|
357 | retval = 0; |
332 | retval = 0; |
358 | while(1) |
333 | while(1) |
Line 359... | Line 334... | ||
359 | { |
334 | { |
360 | if(status!=ST_PLAY) |
335 | if(status!=ST_PLAY) |
361 | break; |
336 | break; |
362 | 337 | ||
363 | if( !stream_read_raw(&rd,outbuf,32768)) |
338 | if( !stream_read_raw(&rd,outbuf,32768)) |
364 | { done = 1; |
339 | { done = 1; |
Line 365... | Line 340... | ||
365 | break; |
340 | break; |
366 | }; |
341 | }; |
367 | wave_out(outbuf); |
342 | WaveOut(hBuff,outbuf,32768); |
Line 368... | Line 343... | ||
368 | }; |
343 | }; |
369 | 344 | ||
370 | if(status != ST_EXIT) |
345 | if(status != ST_EXIT) |
371 | status = ST_STOP; |
346 | status = ST_STOP; |
Line 372... | Line 347... | ||
372 | }; |
347 | }; |
373 | 348 | ||
374 | void snd_stop() |
349 | void snd_stop() |
375 | { |
350 | { |
Line -... | Line 351... | ||
- | 351 | StopBuffer(hBuff); |
|
- | 352 | }; |
|
376 | StopBuffer(hSound, hBuff); |
353 | |
- | 354 | void thread_proc() |
|
- | 355 | { int evnt; |
|
- | 356 | int pos; |
|
377 | }; |
357 | int key; |
Line 378... | Line 358... | ||
378 | 358 | ||
Line 379... | Line 359... | ||
379 | void thread_proc() |
359 | _asm |
380 | { int evnt; |
360 | { |
381 | int pos; |
361 | mov eax, 66 |
382 | int key; |
362 | mov ebx, 1 |
383 | - | ||
384 | _asm { fninit }; |
363 | mov ecx, 1 |
385 | 364 | int 0x40 |
|
386 | 365 | }; |
|
Line 387... | Line 366... | ||
387 | draw_window(); |
366 | |
Line 400... | Line 379... | ||
400 | case EV_REDRAW: |
379 | case EV_REDRAW: |
401 | draw_window(); |
380 | draw_window(); |
402 | break; |
381 | break; |
Line 403... | Line 382... | ||
403 | 382 | ||
404 | case EV_KEY: |
383 | case EV_KEY: |
- | 384 | if(!get_key(&key)) |
|
- | 385 | { |
|
405 | key = get_key(); |
386 | |
- | 387 | switch(key) |
|
- | 388 | { case 0xE0: |
|
- | 389 | case 0xE1: |
|
- | 390 | break; |
|
- | 391 | default: |
|
- | 392 | switch (key) |
|
- | 393 | { |
|
406 | if(key==27) |
394 | case 0x01: //Esc |
407 | { status = ST_EXIT; |
395 | status = ST_EXIT; |
408 | exit(); |
- | |
409 | }; |
- | |
410 | if((key==45)||key==54) |
- | |
411 | { if(m_vol > 0) |
- | |
412 | { m_vol--; |
- | |
413 | SetMasterVol(hDrv,m_vol); |
- | |
414 | }; |
396 | exit(); |
- | 397 | break; |
|
- | 398 | ||
- | 399 | case 0x47: //Home |
|
- | 400 | if(l_vol < 0) |
|
- | 401 | { l_vol+=100; |
|
- | 402 | r_vol+=100; |
|
- | 403 | SetVolume(hBuff,l_vol,r_vol); |
|
- | 404 | }; |
|
- | 405 | break; |
|
- | 406 | case 0x4F: //End |
|
- | 407 | if(l_vol > -10000) |
|
- | 408 | { l_vol-=100; |
|
- | 409 | r_vol-=100; |
|
- | 410 | SetVolume(hBuff,l_vol,r_vol); |
|
- | 411 | }; |
|
- | 412 | break; |
|
- | 413 | case 0x53: |
|
- | 414 | if(pan > -10000) |
|
- | 415 | { pan -=100; |
|
- | 416 | SetPan(hBuff,pan); |
|
- | 417 | }; |
|
- | 418 | break; |
|
- | 419 | case 0x51: |
|
- | 420 | if(pan < 10000) |
|
- | 421 | { pan +=100; |
|
415 | break; |
422 | SetPan(hBuff,pan); |
416 | }; |
- | |
417 | if((key==61)||key==56) |
423 | }; |
418 | { if(m_vol < 90) |
424 | break; |
419 | { m_vol++; |
- | |
420 | SetMasterVol(hDrv,m_vol); |
425 | } |
421 | }; |
426 | }; |
422 | }; |
427 | }; |
Line 423... | Line 428... | ||
423 | break; |
428 | break; |
Line 437... | Line 442... | ||
437 | status = ST_STOP; |
442 | status = ST_STOP; |
438 | break; |
443 | break; |
439 | // case 0x12: |
444 | // case 0x12: |
440 | // case 0x13: |
445 | // case 0x13: |
441 | case 0x14: |
446 | case 0x14: |
442 | if(m_vol > 0) |
447 | if(l_vol > -10000) |
- | 448 | { |
|
443 | { m_vol--; |
449 | l_vol-=100; |
- | 450 | r_vol-=100; |
|
444 | SetMasterVol(hDrv,m_vol); |
451 | SetVolume(hBuff,l_vol,r_vol); |
445 | }; |
452 | }; |
446 | break; |
453 | break; |
Line 447... | Line 454... | ||
447 | 454 | ||
448 | case 0x15: |
455 | case 0x15: |
- | 456 | if(l_vol < 0) |
|
449 | if(m_vol < 90) |
457 | { l_vol+=100; |
450 | { m_vol++; |
458 | r_vol+=100; |
451 | SetMasterVol(hDrv,m_vol); |
459 | SetVolume(hBuff,l_vol,r_vol); |
452 | }; |
460 | }; |
Line 453... | Line 461... | ||
453 | break; |
461 | break; |
454 | 462 | ||
455 | case 0x30: |
463 | case 0x30: |
456 | if(status==ST_DONE) |
- | |
457 | break; |
- | |
458 | // if(snd_play == play_mp3) |
464 | if(status==ST_DONE) |
459 | // continue; |
465 | break; |
460 | pos = (GetMousePos(REL_WINDOW)>>16)-7; |
466 | pos = (GetMousePos(REL_WINDOW)>>16)-7; |
461 | offset = ((fileinfo.size-44)/286*pos+44)&0xFFFFFFFC; |
467 | offset = ((fileinfo.size-44)/286*pos+44)&0xFFFFFFFC; |
462 | set_reader(&rd, offset); |
468 | set_reader(&rd, offset); |
463 | draw_progress_bar(); |
469 | draw_progress_bar(); |
464 | break; |
470 | break; |
465 | }; |
471 | }; |
466 | }; |
472 | }; |
Line 467... | Line -... | ||
467 | }; |
- | |
468 | }; |
- | |
469 | - | ||
470 | DWORD test_wav(WAVEHEADER *hdr) |
- | |
471 | { |
- | |
472 | if(hdr->riff_id != 0x46464952) |
- | |
473 | return 0; |
- | |
474 | - | ||
475 | if(hdr->riff_format != 0x45564157) |
- | |
476 | return 0; |
- | |
477 | - | ||
478 | if (hdr->wFormatTag != 0x01) |
- | |
479 | return 0; |
- | |
480 | - | ||
481 | switch(hdr->nSamplesPerSec) |
- | |
482 | { case 48000: |
- | |
483 | switch (hdr->nChannels) |
- | |
484 | { case 1: |
- | |
485 | if(hdr->wBitsPerSample == 16) |
- | |
486 | return PCM_1_16_48; |
- | |
487 | else |
- | |
488 | return PCM_1_8_48; |
- | |
489 | - | ||
490 | case 2: |
- | |
491 | if(hdr->wBitsPerSample == 16) |
- | |
492 | return PCM_2_16_48; |
- | |
493 | else |
- | |
494 | return PCM_2_8_48; |
- | |
495 | }; |
- | |
496 | - | ||
497 | case 44100: |
- | |
498 | switch (hdr->nChannels) |
- | |
499 | { case 1: |
- | |
500 | if(hdr->wBitsPerSample == 16) |
- | |
501 | return PCM_1_16_44; |
- | |
502 | else |
- | |
503 | return PCM_1_8_44; |
- | |
504 | - | ||
505 | case 2: |
- | |
506 | if(hdr->wBitsPerSample == 16) |
- | |
507 | return PCM_2_16_44; |
- | |
508 | else |
- | |
509 | return PCM_2_8_44; |
- | |
510 | }; |
- | |
511 | - | ||
512 | case 32000: |
- | |
513 | switch (hdr->nChannels) |
- | |
514 | { case 1: |
- | |
515 | if(hdr->wBitsPerSample == 16) |
- | |
516 | return PCM_1_16_32; |
- | |
517 | else |
- | |
518 | return PCM_1_8_32; |
- | |
519 | - | ||
520 | case 2: |
- | |
521 | if(hdr->wBitsPerSample == 16) |
- | |
522 | return PCM_2_16_32; |
- | |
523 | else |
- | |
524 | return PCM_2_8_32; |
- | |
525 | }; |
- | |
526 | - | ||
527 | case 24000: |
- | |
528 | switch (hdr->nChannels) |
- | |
529 | { case 1: |
- | |
530 | if(hdr->wBitsPerSample == 16) |
- | |
531 | return PCM_1_16_24; |
- | |
532 | else |
- | |
533 | return PCM_1_8_24; |
- | |
534 | - | ||
535 | case 2: |
- | |
536 | if(hdr->wBitsPerSample == 16) |
- | |
537 | return PCM_2_16_24; |
- | |
538 | else |
- | |
539 | return PCM_2_8_24; |
- | |
540 | }; |
- | |
541 | - | ||
542 | case 22050: |
- | |
543 | switch (hdr->nChannels) |
- | |
544 | { case 1: |
- | |
545 | if(hdr->wBitsPerSample == 16) |
- | |
546 | return PCM_1_16_22; |
- | |
547 | else |
- | |
548 | return PCM_1_8_22; |
- | |
549 | - | ||
550 | case 2: |
- | |
551 | if(hdr->wBitsPerSample == 16) |
- | |
552 | return PCM_2_16_22; |
- | |
553 | else |
- | |
554 | return PCM_2_8_22; |
- | |
555 | }; |
- | |
556 | - | ||
557 | case 16000: |
- | |
558 | switch (hdr->nChannels) |
- | |
559 | { case 1: |
- | |
560 | if(hdr->wBitsPerSample == 16) |
- | |
561 | return PCM_1_16_16; |
- | |
562 | else |
- | |
563 | return PCM_1_8_16; |
- | |
564 | - | ||
565 | case 2: |
- | |
566 | if(hdr->wBitsPerSample == 16) |
- | |
567 | return PCM_2_16_16; |
- | |
568 | else |
- | |
569 | return PCM_2_8_16; |
- | |
570 | }; |
- | |
571 | - | ||
572 | case 12000: |
- | |
573 | switch (hdr->nChannels) |
- | |
574 | { case 1: |
- | |
575 | if(hdr->wBitsPerSample == 16) |
- | |
576 | return PCM_1_16_12; |
- | |
577 | else |
- | |
578 | return PCM_1_8_12; |
- | |
579 | - | ||
580 | case 2: |
- | |
581 | if(hdr->wBitsPerSample == 16) |
- | |
582 | return PCM_2_16_12; |
- | |
583 | else |
- | |
584 | return PCM_2_8_12; |
- | |
585 | }; |
- | |
586 | - | ||
587 | case 11025: |
- | |
588 | switch (hdr->nChannels) |
- | |
589 | { case 1: |
- | |
590 | if(hdr->wBitsPerSample == 16) |
- | |
591 | return PCM_1_16_11; |
- | |
592 | else |
- | |
593 | return PCM_1_8_11; |
- | |
594 | - | ||
595 | case 2: |
- | |
596 | if(hdr->wBitsPerSample == 16) |
- | |
597 | return PCM_2_16_11; |
- | |
598 | else |
- | |
599 | return PCM_2_8_11; |
- | |
600 | }; |
- | |
601 | - | ||
602 | case 8000: |
- | |
603 | switch (hdr->nChannels) |
- | |
604 | { case 1: |
- | |
605 | if(hdr->wBitsPerSample == 16) |
- | |
606 | return PCM_1_16_8; |
- | |
607 | else |
- | |
608 | return PCM_1_8_8; |
- | |
609 | - | ||
610 | case 2: |
- | |
611 | if(hdr->wBitsPerSample == 16) |
- | |
612 | return PCM_2_16_8; |
- | |
613 | else |
- | |
614 | return PCM_2_8_8; |
- | |
615 | }; |
- | |
616 | default: |
- | |
617 | return 0; |
- | |
618 | }; |
473 | }; |
619 | }; |
474 | }; |
620 | 475 | ||
621 | void delay (int val) |
476 | void delay (int val) |
622 | { |
477 | { |
Line 637... | Line 492... | ||
637 | }; |
492 | }; |
638 | return retval; |
493 | return retval; |
639 | }; |
494 | }; |
Line 640... | Line 495... | ||
640 | 495 | ||
641 | int wait_for_event_infinite() |
- | |
642 | { void *a; |
496 | int wait_for_event_infinite() |
643 | int retval; |
497 | { int retval; |
644 | _asm |
498 | _asm |
645 | { mov eax,10 |
499 | { mov eax,10 |
646 | int 0x40 |
500 | int 0x40 |
647 | mov [retval], eax |
501 | mov [retval], eax |