home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 December
/
simtel1292_SIMTEL_1292_Walnut_Creek.iso
/
msdos
/
turbopas
/
tlist23.arc
/
TEST.LIB
< prev
next >
Wrap
Text File
|
1987-12-20
|
2KB
|
72 lines
{.PTEPSON} { Only Processed If This File Is Listed By Itself }
{.MHTest Library For Turbo Pascal Source Code Lister - @D - @T} { This too! }
{.MFVersion ##1.0 Page - # -} { This too! }
{.PA}
{
Play -
This procedure will play a note in octave duration milliseconds.
The frequency is computed by first computing C in Octave then
increasing the frequency by Note-1 times the twelfth root of 2.
If the duration is zero the note will be played until you activate
the procedure NoSound.
}
procedure Play(Octave,Note,Duration: integer);
var
Frequency: real;
I: integer;
begin { Play }
Frequency:=32.625;
{ Compute C in Octave }
for I:=1 to Octave do Frequency:=Frequency*2;
{ Increase frequency Note-1 times }
for I:=1 to Note-1 do Frequency:=Frequency*1.059463094;
if Duration<>0 then
begin
Sound(Round(Frequency));
Delay(Duration);
NoSound;
end else Sound(Round(Frequency));
end; { Play }
{.PC20}
{
SoftAlarm -
This procedure will play the notes G and D in octave three,
seven times, each with a duration of 70 milliseconds.
}
procedure SoftAlarm;
var
I: integer;
begin { SoftAlarm }
for I:=1 to 7 do with Notes do
begin
Play(4,G,70);
Play(4,D,70);
end;
Delay(1000);
end; { SoftAlarm }
{.PC15}
{
Sirene -
This procedure demonstrates the method used to generate
a sirene like sound.
}
procedure Sirene;
var
Frequency: integer;
begin { Sirene }
for Frequency:= 500 to 2000 do begin Delay(1); Sound(Frequency); end;
for Frequency:=2000 downto 500 do begin Delay(1); Sound(Frequency); end;
end; { Sirene }