W pascalu nie ma dużych problemów z odtworzeniem dźwięków. Poniższy moduł pozwala na odtworzenie wave'ów 8-bitowych, o częstotliwości próbkowania do 11khz. Żeby nagrać taki dźwięk najlepiej posłużyć się programem CoolEdit2000. W internecie powinna być jego darmowa wersja Shareware. Można oczywiście samemu programowo wytworzyć falę, którą później odtworzy komputer.
Najpierw trzeba wywołać funkcję Init('nazwapliku.wav');Później tylko Play; Jeśli Twoja karta muzyczna spełnia standardy Sound Blastera powinienneś usłyszeć dźwięk.
{$G+}Unit wavplay;{$M 4096,0,65500}InterfaceUses DOS,Crt;Procedure Init(GN:STRING);Procedure Play;ImplementationConst dma = 4096;Type id_t = Array[1..4] of Char; riff_t = Record R_Ident : id_t; length : Longint; C_Ident : id_t; S_Ident : id_t; s_length: Longint; Format , Modus : Word; freq , byte_p_s: LongInt; byte_sam, bit_sam : Word; D_Ident : id_t; d_length: LongInt; End; blaster_T = Record port : Word; dmac , hdmac, irq : Byte; End; buffer_T = Array[1..dma] of Byte;Var id : riff_T; fn : String; wav : File; sbb : Word; Ende : Boolean; blaster : Blaster_T; alt_irq : Pointer; dma_buf_1, dma_buf_2, zwi : ^Buffer_T; Channel : Byte;Const RIFF : id_t = ('R','I','F','F'); WAVE : id_t = ('W','A','V','E'); FMT_ : id_t = ('f','m','t',' '); DATA : id_t = ('d','a','t','a'); DMA_Dat : Array [0..7,1..6] of Byte= (($A,$C,$B,$0,$87,$1), ($A,$C,$B,$2,$83,$3), ($A,$C,$B,$4,$81,$5), ...
Slayer413