Rev 109 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 109 | Rev 139 | ||
---|---|---|---|
Line 9... | Line 9... | ||
9 | ; 0.06 November 17, 2004 fixed many bugs |
9 | ; 0.06 November 17, 2004 fixed many bugs |
10 | ; 0.07 Nov 20, 2004 deactivates text box when 'play' pressed |
10 | ; 0.07 Nov 20, 2004 deactivates text box when 'play' pressed |
11 | ; stops playing before closing a window |
11 | ; stops playing before closing a window |
12 | ; 0.08 Nov 24, 2004 added support for 8bit and mono modes |
12 | ; 0.08 Nov 24, 2004 added support for 8bit and mono modes |
13 | ; +variable rate for some chipsets |
13 | ; +variable rate for some chipsets |
- | 14 | ; 0.09 August 26, 2006 modified to use function 70 |
|
14 | ; |
15 | ; |
15 | ; Use [flat assembler 1.56] to compile. |
16 | ; Use [flat assembler 1.64] to compile. |
16 | ; |
17 | ; |
17 | ;--------------------------------------------------------------------- |
18 | ;--------------------------------------------------------------------- |
Line 18... | Line 19... | ||
18 | 19 | ||
19 | use32 ; turn on 32 bit mode |
20 | use32 ; turn on 32 bit mode |
Line 29... | Line 30... | ||
29 | ; dd 0x0 ; address of buffer for parameters (not used) |
30 | ; dd 0x0 ; address of buffer for parameters (not used) |
30 | dd 0x0 ; reserved |
31 | dd 0x0 ; reserved |
Line 31... | Line 32... | ||
31 | 32 | ||
Line 32... | Line -... | ||
32 | ;--------------------------------------------------------------------- |
- | |
33 | 33 | ;--------------------------------------------------------------------- |
|
34 | include "lang.inc" |
34 | |
35 | include "macros.inc" ; standart macros & constants |
35 | include "macros.inc" ; standart macros & constants |
36 | include "meosfunc.inc" ; MenuetOS API functions names |
36 | include "meosfunc.inc" ; MenuetOS API functions names |
37 | include "debug.inc" ; printing to debug board |
37 | include "debug.inc" ; printing to debug board |
Line 447... | Line 447... | ||
447 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
447 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
448 | ;; play - plays wav file! |
448 | ;; play - plays wav file! |
449 | ;; in: nothing |
449 | ;; in: nothing |
450 | ;; out: nothing (but sound :) !corrupts registers! |
450 | ;; out: nothing (but sound :) !corrupts registers! |
451 | play: |
451 | play: |
452 | ; at first, reset file |
452 | ; at first, reset file and get file size |
- | 453 | mcall MF_SYSTREE, attrinfo |
|
- | 454 | test eax, eax |
|
- | 455 | jnz .notfound |
|
- | 456 | mov eax, [fileattr+32] |
|
- | 457 | mov [file_size], eax |
|
453 | mov [fileinfo.first_block], 0 |
458 | mov [fileinfo.first_byte], 0 |
454 | mcall MF_SYSTREE, fileinfo ; load a block, returns error code in eax |
459 | mcall MF_SYSTREE, fileinfo ; load a block, returns error code in eax |
455 | ; and size of the file in ebx |
460 | ; and size of the file in ebx |
456 | test eax, eax ; 0 - successful |
461 | test eax, eax ; 0 - successful |
457 | jz @f |
462 | jz @f |
- | 463 | cmp eax, 6 ; 6 = eof - successful too |
|
- | 464 | jz @f |
|
- | 465 | .notfound: |
|
458 | print "AC97: File not found!" |
466 | print "AC97: File not found!" |
459 | mov [status], ST_STOP |
467 | mov [status], ST_STOP |
460 | jmp .exit |
468 | jmp .exit |
461 | @@: |
469 | @@: |
462 | shr ebx, 9 ; size_of_file / 512 = number_of_blocks |
- | |
463 | mov [file_size], ebx |
- | |
464 | - | ||
Line 465... | Line 470... | ||
465 | 470 | ||
466 | mov al, [LOAD_BUFFER+32] ; bytes per sample |
471 | mov al, [LOAD_BUFFER+32] ; bytes per sample |
467 | dec al |
472 | dec al |
468 | jz @f |
473 | jz @f |
Line 606... | Line 611... | ||
606 | update_next_buffer: |
611 | update_next_buffer: |
607 | push esi edi |
612 | push esi edi |
Line 608... | Line 613... | ||
608 | 613 | ||
609 | movzx edx, byte [wav_mode] |
614 | movzx edx, byte [wav_mode] |
610 | mov ecx, [blocks + edx * 4] |
615 | mov ecx, [blocks + edx * 4] |
Line 611... | Line 616... | ||
611 | mov [fileinfo.blocks], ecx |
616 | mov [fileinfo.bytes], ecx |
612 | 617 | ||
613 | mov esi, LOAD_BUFFER |
618 | mov esi, LOAD_BUFFER |
614 | mov edi, [buffers+eax*4] |
619 | mov edi, [buffers+eax*4] |
615 | push eax ;save buffer index |
620 | push eax ;save buffer index |
616 | start_attempts: |
621 | start_attempts: |
617 | mcall MF_SYSTREE, fileinfo |
622 | mcall MF_SYSTREE, fileinfo |
- | 623 | test eax, eax |
|
- | 624 | jz @f |
|
618 | test eax, eax |
625 | cmp eax, 6 |
619 | jz @f |
626 | jz @f |
620 | cmp [attempts],100 |
627 | cmp [attempts],100 |
621 | je @f |
628 | je @f |
622 | inc [attempts] |
629 | inc [attempts] |
623 | jmp start_attempts |
630 | jmp start_attempts |
624 | dpd eax |
631 | ; dpd eax |
625 | newline |
632 | ; newline |
626 | dpd [fileinfo.first_block] |
633 | ; dpd [fileinfo.first_block] |
627 | newline |
634 | ; newline |
Line 628... | Line 635... | ||
628 | @@: |
635 | @@: |
629 | ; print " loaded!" |
636 | ; print " loaded!" |
Line 650... | Line 657... | ||
650 | inc ecx |
657 | inc ecx |
651 | temp_12_7: |
658 | temp_12_7: |
Line 652... | Line 659... | ||
652 | 659 | ||
653 | pop edx ebx |
660 | pop edx ebx |
654 | mov eax,[esp+4] ;restore buffer index |
661 | mov eax,[esp+4] ;restore buffer index |
655 | add [fileinfo.first_block], ecx ; +60Kb |
662 | add [fileinfo.first_byte], ecx ; +60Kb |
656 | call [convert + edx * 4] |
663 | call [convert + edx * 4] |
657 | ;start fix for MM (4) |
664 | ;start fix for MM (4) |
658 | mov eax,[esp+4] ;restore buffer index |
665 | mov eax,[esp+4] ;restore buffer index |
659 | test eax,not 1 |
666 | test eax,not 1 |
Line 879... | Line 886... | ||
879 | schetchik dd 0 |
886 | schetchik dd 0 |
880 | znak db 0 |
887 | znak db 0 |
881 | type_of_conversion db 0 |
888 | type_of_conversion db 0 |
Line 882... | Line 889... | ||
882 | 889 | ||
883 | convert dd c8mono, c8stereo, c16mono, c16stereo |
890 | convert dd c8mono, c8stereo, c16mono, c16stereo |
Line 884... | Line 891... | ||
884 | blocks dd 30, 60, 60, 120 |
891 | blocks dd 30*512, 60*512, 60*512, 120*512 |
885 | 892 | ||
886 | 893 | ||
Line 991... | Line 998... | ||
991 | ;--------------------------------------------------------------------- |
998 | ;--------------------------------------------------------------------- |
992 | ;--- DATA OF PROGRAM ----------------------------------------------- |
999 | ;--- DATA OF PROGRAM ----------------------------------------------- |
993 | ;--------------------------------------------------------------------- |
1000 | ;--------------------------------------------------------------------- |
994 | volume dd 15 |
1001 | volume dd 15 |
Line -... | Line 1002... | ||
- | 1002 | ||
- | 1003 | attrinfo: |
|
- | 1004 | dd 5 |
|
- | 1005 | dd 0 |
|
- | 1006 | dd 0 |
|
- | 1007 | dd 0 |
|
- | 1008 | dd fileattr |
|
- | 1009 | db 0 |
|
- | 1010 | dd textbox_string |
|
995 | 1011 | ||
996 | fileinfo: |
1012 | fileinfo: |
997 | .mode dd 0 ; READ |
1013 | .mode dd 0 ; READ |
- | 1014 | .first_byte dd 0 |
|
998 | .first_block dd 0 |
1015 | dd 0 |
999 | .blocks dd 120 ; 120 Kb |
1016 | .bytes dd 60*1024 ; 60 Kb |
1000 | .dest dd LOAD_BUFFER ;file_data |
- | |
1001 | .work dd work_area |
1017 | .dest dd LOAD_BUFFER ;file_data |
1002 | ; db "/HD/1/WINDOWS/MEDIA/WICEB7~1.WAV",0 |
1018 | ; db "/HD/1/WINDOWS/MEDIA/WICEB7~1.WAV",0 |
1003 | ;sz textbox_string, "/hd/1/testmuz/menuet11.wav",0 |
- | |
1004 | sz textbox_string, " ",0 |
1019 | ;sz textbox_string, "/hd/1/testmuz/menuet11.wav",0 |
1005 | ; rb 256 |
1020 | textbox_string: |
Line 1006... | Line 1021... | ||
1006 | ;--------------------------------------------------------------------- |
1021 | ;--------------------------------------------------------------------- |
- | 1022 | ||
1007 | 1023 | IMAGE_END: ; end of program's image |
|
1008 | IMAGE_END: ; end of program's image |
1024 | rb 257 |
Line 1009... | Line 1025... | ||
1009 | rb 100-textbox_string.size |
1025 | ; rb 257-textbox_string.size |
Line 1010... | Line 1026... | ||
1010 | ; textbox_string.size |
1026 | ; textbox_string.size |
Line 1033... | Line 1049... | ||
1033 | ST_EXIT = 0x2 |
1049 | ST_EXIT = 0x2 |
1034 | ST_STOP = 0x4 |
1050 | ST_STOP = 0x4 |
Line 1035... | Line 1051... | ||
1035 | 1051 | ||
Line -... | Line 1052... | ||
- | 1052 | status db ? |
|
- | 1053 | ||
1036 | status db ? |
1054 | fileattr: rb 40 |
1037 | 1055 | ||
1038 | ;--------------------------------------------------------------------- |
1056 | ;--------------------------------------------------------------------- |
1039 | phys_bdl_buffer rd 1 |
1057 | phys_bdl_buffer rd 1 |
1040 | phys_wav_buffer1 rd 1 |
1058 | phys_wav_buffer1 rd 1 |