home *** CD-ROM | disk | FTP | other *** search
/ Millennium Time Capsule / AC2000.BIN / disks / ac11disk / midiseq / midimsgs.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-06-10  |  1011 b   |  51 lines

  1. /*
  2.  *
  3.  *    MIDI message routines for Mini-MIDI sequencer...
  4.  *    this file processes all of the messages sent by the
  5.  *    Atari to the connected MIDI synthesizer, and the
  6.  *    function for reading the time from the system clock
  7.  *
  8.  *
  9.  */
  10.  
  11. #include "globals.h"
  12.  
  13. void note_off(BYTE channel, BYTE note)
  14. {
  15.     midi_out(0x80+channel);        /* note off message plus channel number */
  16.     midi_out(note);
  17.     midi_out(0x20);                /* note-off velocity! */
  18. }
  19.  
  20. void note_on(BYTE channel, BYTE note, BYTE vel)
  21. {
  22.     midi_out(0x90+channel);        /* note on message plus channel number */
  23.     midi_out(note);
  24.     midi_out(vel);
  25. }
  26.  
  27. void send_program_change(BYTE channel, BYTE patch)
  28. {
  29.     midi_out(0xc0+channel);
  30.     midi_out(patch);
  31. }
  32.  
  33.  
  34. unsigned long clock_timer(void)
  35. {
  36.     unsigned long *old_ssp = Super(0L);
  37.     unsigned long time_value = *((unsigned long*)0x04BA);
  38.     Super(old_ssp);
  39.     return time_value;
  40. }
  41.  
  42. void all_notes_off(void)
  43. {
  44.     int x;
  45.     for(x=0;x<16;x++){
  46.         midi_out(0xb0+x);
  47.         midi_out(0x7b);
  48.         midi_out(0);
  49.     }
  50. }
  51.