Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. #ifndef __FMOPL_H_
  2. #define __FMOPL_H_
  3.  
  4. #define HAS_YM3812 1
  5.  
  6. /* --- select emulation chips --- */
  7. #define BUILD_YM3812 (HAS_YM3812)
  8. #define BUILD_YM3526 (HAS_YM3526)
  9. #define BUILD_Y8950  (HAS_Y8950)
  10.  
  11. /* select output bits size of output : 8 or 16 */
  12. #define OPL_SAMPLE_BITS 16
  13.  
  14. /* compiler dependence */
  15. #ifndef OSD_CPU_H
  16. #define OSD_CPU_H
  17. typedef unsigned char   UINT8;   /* unsigned  8bit */
  18. typedef unsigned short  UINT16;  /* unsigned 16bit */
  19. typedef unsigned int    UINT32;  /* unsigned 32bit */
  20. typedef signed char             INT8;    /* signed  8bit   */
  21. typedef signed short    INT16;   /* signed 16bit   */
  22. typedef signed int              INT32;   /* signed 32bit   */
  23.  
  24. typedef int BOOL;
  25. #endif
  26.  
  27. #if (OPL_SAMPLE_BITS==16)
  28. typedef INT16 OPLSAMPLE;
  29. #endif
  30. #if (OPL_SAMPLE_BITS==8)
  31. typedef INT8 OPLSAMPLE;
  32. #endif
  33.  
  34.  
  35. typedef void (*OPL_TIMERHANDLER)(int channel,double interval_Sec);
  36. typedef void (*OPL_IRQHANDLER)(int param,int irq);
  37. typedef void (*OPL_UPDATEHANDLER)(int param,int min_interval_us);
  38. typedef void (*OPL_PORTHANDLER_W)(int param,unsigned char data);
  39. typedef unsigned char (*OPL_PORTHANDLER_R)(int param);
  40.  
  41.  
  42. #if BUILD_YM3812
  43.  
  44. int  YM3812Init(int num, int clock, int rate);
  45. void YM3812Shutdown(void);
  46. void YM3812ResetChip(int which);
  47. int  YM3812Write(int which, int a, int v);
  48. unsigned char YM3812Read(int which, int a);
  49. void YM3812Mute(int which,int channel,BOOL mute);
  50. int  YM3812TimerOver(int which, int c);
  51. void YM3812UpdateOne(int which, INT16 *buffer, int length);
  52.  
  53. void YM3812SetTimerHandler(int which, OPL_TIMERHANDLER TimerHandler, int channelOffset);
  54. void YM3812SetIRQHandler(int which, OPL_IRQHANDLER IRQHandler, int param);
  55. void YM3812SetUpdateHandler(int which, OPL_UPDATEHANDLER UpdateHandler, int param);
  56.  
  57. #endif
  58.  
  59.  
  60. #if BUILD_YM3526
  61.  
  62. /*
  63. ** Initialize YM3526 emulator(s).
  64. **
  65. ** 'num' is the number of virtual YM3526's to allocate
  66. ** 'clock' is the chip clock in Hz
  67. ** 'rate' is sampling rate
  68. */
  69. int  YM3526Init(int num, int clock, int rate);
  70. /* shutdown the YM3526 emulators*/
  71. void YM3526Shutdown(void);
  72. void YM3526ResetChip(int which);
  73. int  YM3526Write(int which, int a, int v);
  74. unsigned char YM3526Read(int which, int a);
  75. int  YM3526TimerOver(int which, int c);
  76. /*
  77. ** Generate samples for one of the YM3526's
  78. **
  79. ** 'which' is the virtual YM3526 number
  80. ** '*buffer' is the output buffer pointer
  81. ** 'length' is the number of samples that should be generated
  82. */
  83. void YM3526UpdateOne(int which, INT16 *buffer, int length);
  84.  
  85. void YM3526SetTimerHandler(int which, OPL_TIMERHANDLER TimerHandler, int channelOffset);
  86. void YM3526SetIRQHandler(int which, OPL_IRQHANDLER IRQHandler, int param);
  87. void YM3526SetUpdateHandler(int which, OPL_UPDATEHANDLER UpdateHandler, int param);
  88.  
  89. #endif
  90.  
  91.  
  92. #if BUILD_Y8950
  93.  
  94. /* Y8950 port handlers */
  95. void Y8950SetPortHandler(int which, OPL_PORTHANDLER_W PortHandler_w, OPL_PORTHANDLER_R PortHandler_r, int param);
  96. void Y8950SetKeyboardHandler(int which, OPL_PORTHANDLER_W KeyboardHandler_w, OPL_PORTHANDLER_R KeyboardHandler_r, int param);
  97. void Y8950SetDeltaTMemory(int which, void * deltat_mem_ptr, int deltat_mem_size );
  98.  
  99. int  Y8950Init (int num, int clock, int rate);
  100. void Y8950Shutdown (void);
  101. void Y8950ResetChip (int which);
  102. int  Y8950Write (int which, int a, int v);
  103. unsigned char Y8950Read (int which, int a);
  104. int  Y8950TimerOver (int which, int c);
  105. void Y8950UpdateOne (int which, INT16 *buffer, int length);
  106.  
  107. void Y8950SetTimerHandler (int which, OPL_TIMERHANDLER TimerHandler, int channelOffset);
  108. void Y8950SetIRQHandler (int which, OPL_IRQHANDLER IRQHandler, int param);
  109. void Y8950SetUpdateHandler (int which, OPL_UPDATEHANDLER UpdateHandler, int param);
  110.  
  111. #endif
  112.  
  113.  
  114. #endif /* __FMOPL_H_ */
  115.