Program SBDemo;
Uses
  CRT, SBDrive, SBBKBAS, SBOPiano, SBNPiano, SBOMulti;
Const
  TempInst : Array [0..9] Of InstType = (
    ($21,$11,$4C,$00,$F1,$F2,$63,$72,         { Instrument 0 }
    $00,$00,$04,$00,$00,$00,$00,$00),
    ($A5,$B1,$D2,$80,$81,$F1,$03,$05,         { Instrument 1 }
    $00,$00,$02,$00,$00,$00,$00,$00),
    ($72,$62,$1C,$05,$51,$52,$03,$13,         { Instrument 2 }
    $00,$00,$0E,$00,$00,$00,$00,$00),
    ($11,$01,$8A,$40,$F1,$F1,$11,$B3,         { Instrument 3 }
    $00,$00,$06,$00,$00,$00,$00,$00),
    ($21,$11,$11,$00,$A3,$C4,$43,$22,         { Instrument 4 }
    $02,$00,$0D,$00,$00,$00,$00,$00),
    ($31,$A1,$1C,$80,$41,$92,$0B,$3B,         { Instrument 5 }
    $00,$00,$0E,$00,$00,$00,$00,$00),
    ($71,$62,$C5,$05,$6E,$8B,$17,$0E,         { Instrument 6 }
    $00,$00,$02,$00,$00,$00,$00,$00),
    ($41,$91,$83,$00,$65,$32,$05,$74,         { Instrument 7 }
    $00,$00,$0A,$00,$00,$00,$00,$00),
    ($32,$16,$87,$80,$A1,$7D,$10,$33,         { Instrument 8 }
    $00,$00,$08,$00,$00,$00,$00,$00),
    ($01,$13,$8D,$00,$51,$52,$53,$7C,         { Instrument 9 }
    $01,$00,$0C,$00,$00,$00,$00,$00));
Var X : Word;
    Ch : Char;
    B : Boolean;

Begin
  WriteLn('Turbo Pascal SoundBlaster Toolkit Demo');
  WriteLn('Driver version TP',Hi(SBDVersion),'.',Lo(SBDVersion));
  WriteLn;
  WriteLn('Loading instrument cello...');
  LoadInstrument(1,TempInst[9]);
  WriteLn(' Playing Solfeggietto by Carl Phillipp Emanuel Bach');
  B := BasicBackInit;
  BasicPlay('MB');
  If Not PlayBasicFile('Solfe.Muz') Then
    WriteLn('  Unable to open Solfe.Muz.');
  WriteLn;
  X := 0;
  While BasicPlayingInBack And Not KeyPressed Do Begin
    Inc(X);
    Write('Look, Ma!  It''s playing in the background!  ',X,#13);
  End;
  WriteLn;
  While KeyPressed Do Ch := ReadKey;
  BasicPlayingMode(StopSong);
  BasicShutdownBack;
  WriteLn;
  WriteLn('Loading instrument piano...');
  LoadInstrument(1,TempInst[0]);
  WriteLn(' Playing C Minor');
  If Not PlayOldPiano('CMinor.Mus') Then
    WriteLn('  Unable to open CMinor.Mus.');
  WriteLn;
  WriteLn('Loading instrument harp...');
  LoadInstrument(1,TempInst[4]);
  WriteLn(' Playing Dixie by Daniel Decatur Emmett');
  WriteLn;
  WriteLn(' Oh I wish I was in the land of cot-ton,');
  WriteLn(' Old times there are not for-got-ten,');
  WriteLn(' Look a-way! Look a-way! Look a-way! Dixie Land.');
  WriteLn(' Oh I wish I was in the land of cot-ton,');
  WriteLn(' Old times there are not for-got-ten,');
  WriteLn(' Look a-way! Look a-way! Look a-way! Dixie Land.');
  WriteLn(' I wish I was in Dixie, Hoo-ray!  Hoo-ray!');
  WriteLn(' In Dixie Land I''ll take my stand,');
  WriteLn(' To live and die in Dixie,');
  WriteLn(' A-way, a-way, a-way down south in Dixie,');
  WriteLn(' A-way, a-way, a-way down south in Dixie.');
  If Not PlayNewPiano('Dixie.Muz') Then
    WriteLn(#13,#10,'  Unable to open Dixie.Muz.');
  WriteLn;
  WriteLn('Loading instrument accordian...');
  LoadInstrument(1,TempInst[7]);
  OldAddFile('ENTRTAN1.MUS');
  LoadInstrument(2,TempInst[7]);
  OldAddFile('ENTRTAN2.MUS');
  LoadInstrument(3,TempInst[7]);
  OldAddFile('ENTRTAN3.MUS');
  LoadInstrument(4,TempInst[7]);
  OldAddFile('ENTRTAN4.MUS');
  WriteLn(' Playing The Entertainer by Scott Joplin');
  If Not PlayOldMulti Then
    WriteLn('  Unable to open Entertainer files.');
  WriteLn;
  LoadInstrument(1,TempInst[1]);
  OldAddFile('C:\SB\PAKLBEL1.MUS');
  LoadInstrument(2,TempInst[1]);
  OldAddFile('C:\SB\PAKLBEL2.MUS');
  LoadInstrument(3,TempInst[1]);
  OldAddFile('C:\SB\PAKLBEL3.MUS');
  LoadInstrument(4,TempInst[1]);
  OldAddFile('C:\SB\PAKLBEL4.MUS');
  WriteLn(' Playing PAKLBEL');
  If Not PlayOldMulti Then
    WriteLn('  Unable to open PAKLBEL files.');
  WriteLn;
End.

