1 #pragma once 2 3 //#include "attotime.h" 4 5 /* --- select emulation chips --- */ 6 //#define BUILD_YM3812 (HAS_YM3812) 7 //#define BUILD_YM3526 (HAS_YM3526) 8 //#define BUILD_Y8950 (HAS_Y8950) 9 #define BUILD_YM3812 1 10 #define BUILD_YM3526 1 11 #ifndef NO_Y8950 12 #define BUILD_Y8950 1 13 #else 14 #define BUILD_Y8950 0 15 #endif 16 17 /* select output bits size of output : 8 or 16 */ 18 #define OPL_SAMPLE_BITS 16 19 20 /* compiler dependence */ 21 /*#ifndef __OSDCOMM_H__ 22 #define __OSDCOMM_H__ 23 typedef unsigned char UINT8; // unsigned 8bit 24 typedef unsigned short UINT16; // unsigned 16bit 25 typedef unsigned int UINT32; // unsigned 32bit 26 typedef signed char INT8; // signed 8bit 27 typedef signed short INT16; // signed 16bit 28 typedef signed int INT32; // signed 32bit 29 #endif*/ /* __OSDCOMM_H__ */ 30 31 typedef stream_sample_t OPLSAMPLE; 32 /* 33 #if (OPL_SAMPLE_BITS==16) 34 typedef INT16 OPLSAMPLE; 35 #endif 36 #if (OPL_SAMPLE_BITS==8) 37 typedef INT8 OPLSAMPLE; 38 #endif 39 */ 40 41 //typedef void (*OPL_TIMERHANDLER)(void *param,int timer,attotime period); 42 typedef void (*OPL_TIMERHANDLER)(void *param,int timer,int period); 43 typedef void (*OPL_IRQHANDLER)(void *param,int irq); 44 typedef void (*OPL_UPDATEHANDLER)(void *param/*,int min_interval_us*/); 45 typedef void (*OPL_PORTHANDLER_W)(void *param,unsigned char data); 46 typedef unsigned char (*OPL_PORTHANDLER_R)(void *param); 47 48 49 #if BUILD_YM3812 50 51 void *ym3812_init(UINT32 clock, UINT32 rate); 52 void ym3812_shutdown(void *chip); 53 void ym3812_reset_chip(void *chip); 54 int ym3812_write(void *chip, int a, int v); 55 unsigned char ym3812_read(void *chip, int a); 56 int ym3812_timer_over(void *chip, int c); 57 void ym3812_update_one(void *chip, OPLSAMPLE **buffer, int length); 58 59 void ym3812_set_timer_handler(void *chip, OPL_TIMERHANDLER TimerHandler, void *param); 60 void ym3812_set_irq_handler(void *chip, OPL_IRQHANDLER IRQHandler, void *param); 61 void ym3812_set_update_handler(void *chip, OPL_UPDATEHANDLER UpdateHandler, void *param); 62 63 #endif /* BUILD_YM3812 */ 64 65 66 #if BUILD_YM3526 67 68 /* 69 ** Initialize YM3526 emulator(s). 70 ** 71 ** 'num' is the number of virtual YM3526's to allocate 72 ** 'clock' is the chip clock in Hz 73 ** 'rate' is sampling rate 74 */ 75 void *ym3526_init(UINT32 clock, UINT32 rate); 76 /* shutdown the YM3526 emulators*/ 77 void ym3526_shutdown(void *chip); 78 void ym3526_reset_chip(void *chip); 79 int ym3526_write(void *chip, int a, int v); 80 unsigned char ym3526_read(void *chip, int a); 81 int ym3526_timer_over(void *chip, int c); 82 /* 83 ** Generate samples for one of the YM3526's 84 ** 85 ** 'which' is the virtual YM3526 number 86 ** '*buffer' is the output buffer pointer 87 ** 'length' is the number of samples that should be generated 88 */ 89 void ym3526_update_one(void *chip, OPLSAMPLE **buffer, int length); 90 91 void ym3526_set_timer_handler(void *chip, OPL_TIMERHANDLER TimerHandler, void *param); 92 void ym3526_set_irq_handler(void *chip, OPL_IRQHANDLER IRQHandler, void *param); 93 void ym3526_set_update_handler(void *chip, OPL_UPDATEHANDLER UpdateHandler, void *param); 94 95 #endif /* BUILD_YM3526 */ 96 97 98 #if BUILD_Y8950 99 100 /* Y8950 port handlers */ 101 void y8950_set_port_handler(void *chip, OPL_PORTHANDLER_W PortHandler_w, OPL_PORTHANDLER_R PortHandler_r, void *param); 102 void y8950_set_keyboard_handler(void *chip, OPL_PORTHANDLER_W KeyboardHandler_w, OPL_PORTHANDLER_R KeyboardHandler_r, void *param); 103 void y8950_set_delta_t_memory(void *chip, void * deltat_mem_ptr, int deltat_mem_size ); 104 void y8950_write_pcmrom(void *chip, offs_t ROMSize, offs_t DataStart, 105 offs_t DataLength, const UINT8* ROMData); 106 107 void * y8950_init(UINT32 clock, UINT32 rate); 108 void y8950_shutdown(void *chip); 109 void y8950_reset_chip(void *chip); 110 int y8950_write(void *chip, int a, int v); 111 unsigned char y8950_read (void *chip, int a); 112 int y8950_timer_over(void *chip, int c); 113 void y8950_update_one(void *chip, OPLSAMPLE **buffer, int length); 114 115 void y8950_set_timer_handler(void *chip, OPL_TIMERHANDLER TimerHandler, void *param); 116 void y8950_set_irq_handler(void *chip, OPL_IRQHANDLER IRQHandler, void *param); 117 void y8950_set_update_handler(void *chip, OPL_UPDATEHANDLER UpdateHandler, void *param); 118 119 #endif /* BUILD_Y8950 */ 120 121 void opl_set_mute_mask(void *chip, UINT32 MuteMask); 122 123