试试看行不? 原程序: { By Wan Changsheng No:99080049 } { Play - (C)opyright 2002 Version 0.01Bata Autor : Wan Changsheng eMail : s2k@163.net Internet : http://www.lovend.com }
program play(input,output,list); uses CRT,dos; const key:array [0..21,0..1] of integer=((131,122),(147,120),(165,99),(175,118),(196,98), (220,110),(247,109),(262,97),(294,115),(330,100),(349,102),(392,103),(440,104), (494,106),(524,113),(587,119),(659,101),(698,114),(784,116),(880,121),(998,117),(-1,32)); var inpu:char; list:text; i:integer; filename:string; begin if paramcount=0 then begin writeln ('Program By Wan Changsheng No:99080049'); writeln ('Play music:music only for PCM 8bit!'); writeln ('Useage:'); writeln (' play [filename]'); writeln ('EXAMPLE:play deom.wav'); end else if paramcount=1 then begin filename:=paramstr(1); {$i-} assign (list,filename); reset (list); {$i+} if (ioresult<>0) then writeln ('File not find!') else begin clrscr; repeat read (list,inpu); for i:=0 to 20 do if (key[i][1]=ord(inpu)) then begin nosound; delay (1); {Sound speed} sound (key[i][0]); end else if (inpu>='0')and(inpu<='9') then delay ((ord(inpu)-48)*10); {Sound delay} until (eof(list)) or (keypressed); nosound; close (list); clrscr; end; end; end.
----------------------------------------------