home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / m / m003_1 / sdk_dos.ddi / TPASCAL / MIDI / MIDIOUT.PAS < prev   
Encoding:
Pascal/Delphi Source File  |  1991-09-27  |  2.8 KB  |  75 lines

  1. { ------------------------------------------------------------------------ }
  2. {  @@ Source Documentation                           *** TP6 Version ***   }
  3. {                                                                          }
  4. {  Copyright (c) Creative Technology Pte Ltd, 1991. All rights reserved.   }
  5. {                                                                          }
  6. {   TITLE       : MIDIOUT.PAS                                              }
  7. {                                                                          }
  8. {   DESCRIPTION :                                                          }
  9. {       This program demostrates how to use the SBK MIDI interface         }
  10. {       functions to play a 'C major scale'. It calls the MIDI low         }
  11. {       level interface functions to send the MIDI commands to MIDI        }
  12. {       keyboard.                                                          }
  13. {                                                                          }
  14. {       The program checks BLASTER environment for the Card settings.      }
  15. {       It also performs test base on BLASTER environment settings to      }
  16. {       ensure they are tally with the hardware settings on the Card.      }
  17. {                                                                          }
  18. { ------------------------------------------------------------------------ }
  19.  
  20. program midiout;
  21.  
  22. { Include the SBC Unit, and any other units needed }
  23. uses sbc_tp6, dos, crt;
  24.  
  25. const
  26.     { look up table for a scale starting from 'Middle C' }
  27.     note_num : array[0..7] of byte = ( 60,62,64,65,67,69,71,72 );
  28.  
  29.  
  30. { ------------------------------------------------------------------------ }
  31.  
  32. { main function }
  33. var
  34.     i, j, note, dummy : word;
  35.     pnum : byte;
  36.  
  37.  
  38. begin
  39.  
  40.     if GetEnvSetting = 0 then begin
  41.  
  42.         if boolean( sbc_check_card and $0004 ) then begin
  43.  
  44.             for pnum := 0 to 4 do begin
  45.  
  46.                 { program change command }
  47.                 dummy := sbmidi_out_shortmsg( $C0, pnum, 0 );
  48.  
  49.                 { play the Middle C scale }
  50.                 for note := 0 to 7 do begin
  51.  
  52.                     { Note On command }
  53.                     dummy := sbmidi_out_shortmsg( $90, note_num[note], $40 );
  54.  
  55.                     { delay loop }
  56.                     for i := 0 to 150 do
  57.                         for j := 0 to 1000 do begin
  58.                         end;
  59.  
  60.                     { Note Off command }
  61.                     dummy := sbmidi_out_shortmsg( $80, note_num[note], $40 );
  62.  
  63.                 end;
  64.  
  65.             end;
  66.  
  67.         end
  68.         else
  69.             writeln('Sound Blaster card not found or wrong I/O setting.');
  70.     end
  71.     else
  72.         writeln('BLASTER environment variable not set or incomplete or invalid.');
  73.  
  74. end.
  75.