timidity.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. TiMidity -- Experimental MIDI to WAVE converter
  3. Copyright (C) 1995 Tuukka Toivonen <toivonen@clinet.fi>
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  15. */
  16. #ifndef _TIMIDITY_H_
  17. #define _TIMIDITY_H_
  18. /* Audio format flags (defaults to LSB byte order) */
  19. #define AUDIO_U8 0x0008 /* Unsigned 8-bit samples */
  20. #define AUDIO_S8 0x8008 /* Signed 8-bit samples */
  21. #define AUDIO_U16LSB 0x0010 /* Unsigned 16-bit samples */
  22. #define AUDIO_S16LSB 0x8010 /* Signed 16-bit samples */
  23. #define AUDIO_U16MSB 0x1010 /* As above, but big-endian byte order */
  24. #define AUDIO_S16MSB 0x9010 /* As above, but big-endian byte order */
  25. #define AUDIO_U16 AUDIO_U16LSB
  26. #define AUDIO_S16 AUDIO_S16LSB
  27. #include "structs.h"
  28. typedef struct _MidiSong MidiSong;
  29. extern int Timidity_Init(int rate, int format, int channels, int samples, const char* config);
  30. extern char *Timidity_Error(void);
  31. extern void Timidity_SetVolume(int volume);
  32. extern int Timidity_PlaySome(void *stream, int samples, int* bytes_written);
  33. extern MidiSong *Timidity_LoadSong(char *midifile);
  34. extern MidiSong *Timidity_LoadSongMem(unsigned char* buffer, size_t length);
  35. extern void Timidity_Start(MidiSong *song);
  36. extern int Timidity_Active(void);
  37. extern void Timidity_Stop(void);
  38. extern void Timidity_FreeSong(MidiSong *song);
  39. extern void Timidity_Shutdown(void);
  40. extern void *Real_Tim_Malloc( int sz );
  41. extern void Real_Tim_Free( void *pt );
  42. typedef struct {
  43. int rate, encoding;
  44. char *id_name;
  45. FILE* fp;
  46. char *file_name;
  47. int (*open_output)(void); /* 0=success, 1=warning, -1=fatal error */
  48. void (*close_output)(void);
  49. void (*output_data)(int *buf, int count, int* bytes_written);
  50. void (*flush_output)(void);
  51. void (*purge_output)(void);
  52. } PlayMode;
  53. extern PlayMode *play_mode_list[], *play_mode;
  54. #endif