MIDI.H 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*
  2. Copyright (C) 1994-1995 Apogee Software, Ltd.
  3. This program is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU General Public License
  5. as published by the Free Software Foundation; either version 2
  6. of the License, or (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. See the GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  14. */
  15. /**********************************************************************
  16. module: MIDI.H
  17. author: James R. Dose
  18. date: May 25, 1994
  19. Public header for MIDI.C. Midi song file playback routines.
  20. (c) Copyright 1994 James R. Dose. All Rights Reserved.
  21. **********************************************************************/
  22. #ifndef __MIDI_H
  23. #define __MIDI_H
  24. enum MIDI_Errors
  25. {
  26. MIDI_Warning = -2,
  27. MIDI_Error = -1,
  28. MIDI_Ok = 0,
  29. MIDI_NullMidiModule,
  30. MIDI_InvalidMidiFile,
  31. MIDI_UnknownMidiFormat,
  32. MIDI_NoTracks,
  33. MIDI_InvalidTrack,
  34. MIDI_NoMemory,
  35. MIDI_DPMI_Error
  36. };
  37. #define MIDI_PASS_THROUGH 1
  38. #define MIDI_DONT_PLAY 0
  39. #define MIDI_MaxVolume 255
  40. extern char MIDI_PatchMap[ 128 ];
  41. typedef struct
  42. {
  43. void ( *NoteOff )( int channel, int key, int velocity );
  44. void ( *NoteOn )( int channel, int key, int velocity );
  45. void ( *PolyAftertouch )( int channel, int key, int pressure );
  46. void ( *ControlChange )( int channel, int number, int value );
  47. void ( *ProgramChange )( int channel, int program );
  48. void ( *ChannelAftertouch )( int channel, int pressure );
  49. void ( *PitchBend )( int channel, int lsb, int msb );
  50. void ( *ReleasePatches )( void );
  51. void ( *LoadPatch )( int number );
  52. void ( *SetVolume )( int volume );
  53. int ( *GetVolume )( void );
  54. } midifuncs;
  55. void MIDI_RerouteMidiChannel( int channel, int cdecl ( *function )( int event, int c1, int c2 ) );
  56. int MIDI_AllNotesOff( void );
  57. void MIDI_SetUserChannelVolume( int channel, int volume );
  58. void MIDI_ResetUserChannelVolume( void );
  59. int MIDI_Reset( void );
  60. int MIDI_SetVolume( int volume );
  61. int MIDI_GetVolume( void );
  62. void MIDI_SetMidiFuncs( midifuncs *funcs );
  63. void MIDI_SetContext( int context );
  64. int MIDI_GetContext( void );
  65. void MIDI_SetLoopFlag( int loopflag );
  66. void MIDI_ContinueSong( void );
  67. void MIDI_PauseSong( void );
  68. int MIDI_SongPlaying( void );
  69. void MIDI_StopSong( void );
  70. int MIDI_PlaySong( unsigned char *song, int loopflag );
  71. void MIDI_SetTempo( int tempo );
  72. int MIDI_GetTempo( void );
  73. void MIDI_SetSongTick( unsigned long PositionInTicks );
  74. void MIDI_SetSongTime( unsigned long milliseconds );
  75. void MIDI_SetSongPosition( int measure, int beat, int tick );
  76. void MIDI_GetSongPosition( songposition *pos );
  77. void MIDI_GetSongLength( songposition *pos );
  78. void MIDI_LoadTimbres( void );
  79. void MIDI_UnlockMemory( void );
  80. int MIDI_LockMemory( void );
  81. #endif