home *** CD-ROM | disk | FTP | other *** search
/ Sound Sensations! / sound_sensations.iso / miscprog / sngedt / play.pas < prev    next >
Pascal/Delphi Source File  |  1990-04-23  |  1KB  |  48 lines

  1. {  This pascal procedure is for work with Song Editor Data files. 
  2.  
  3.   In Turbo Pascal one has to use Crt unit. (uses Crt;)  
  4.   Crt unit is for functions: Sound, Delay and NoSound. 
  5.  
  6.   To call procedure Play one should:
  7.          Play( [FileName], [SongName]);
  8.   For example: 
  9.          Play('music.dat','Glory');
  10. }
  11. procedure Play (FileName, SongName : string);
  12. var
  13.   q : integer;
  14.   ch : char;
  15.   st : string;
  16.   Data : text;
  17. begin
  18.   assign(Data,FileName);
  19.   reset(Data);
  20.   st := '';
  21.   while not EOF(Data) do
  22.     begin
  23.       st := '';
  24.       repeat
  25.         read(Data,ch);
  26.         st := st + ch;
  27.       until ch = ' ';
  28.       if (st = SongName + ' ')
  29.            then
  30.              begin
  31.                while not Eoln(Data) do
  32.                  begin
  33.                    read(Data,q);
  34.                    Sound(q);
  35.                    read(Data,q);
  36.                    Delay(q);
  37.                    NoSound;
  38.                  end;
  39.                Close(Data);
  40.                Exit;
  41.              end;
  42.       readln(Data);
  43.     end;
  44.   Close(Data);
  45.   Writeln(SongName,' song is not found!');
  46. end;
  47.  
  48.