OSDN Git Service

[VM][General] Merge upstream 2016-02-13. Still don't implement OSD/Gui part of joysti...
[csp-qt/common_source_project-fm7.git] / source / src / vm / ym2203.h
index 3dbb99e..d091406 100644 (file)
@@ -18,7 +18,7 @@
 
 #if !(defined(HAS_AY_3_8910) || defined(HAS_AY_3_8912) || defined(HAS_AY_3_8913))
 #define HAS_YM_SERIES
-#if defined(_WIN32)
+#ifdef SUPPORT_WIN32_DLL
 #define SUPPORT_MAME_FM_DLL
 #include "fmdll/fmdll.h"
 #endif
@@ -62,17 +62,20 @@ private:
                uint8 data;
        } port_log[0x200];
 #endif
+       int base_decibel_fm, base_decibel_psg;
+       int decibel_vol;
        
        uint8 ch;
-#ifdef SUPPORT_YM2203_PORT
-       uint8 mode;
-#endif
+       uint8 fnum2;
 #ifdef HAS_YM2608
        uint8 ch1, data1;
+       uint8 fnum21;
 #endif
 
        int32 right_volume;
        int32 left_volume;
+       int32 v_right_volume;
+       int32 v_left_volume;
 #ifdef SUPPORT_YM2203_PORT
        struct {
                uint8 wreg;
@@ -81,6 +84,7 @@ private:
                // output signals
                outputs_t outputs;
        } port[2];
+       uint8 mode;
 #endif
        
        int chip_clock;
@@ -89,11 +93,13 @@ private:
        uint32 clock_prev;
        uint32 clock_accum;
        uint32 clock_const;
+       int timer_event_id;
        
        uint32 clock_busy;
        bool busy;
        
        void update_count();
+       void update_event();
 #ifdef HAS_YM_SERIES
        // output signals
        outputs_t outputs_irq;
@@ -114,6 +120,8 @@ public:
 #ifdef HAS_YM2608
                is_ym2608 = true;
 #endif
+               base_decibel_fm = base_decibel_psg = 0;
+               decibel_vol = 0 + 5;
        }
        ~YM2203() {}
        
@@ -125,10 +133,21 @@ public:
        uint32 read_io8(uint32 addr);
        void write_signal(int id, uint32 data, uint32 mask);
        void event_vline(int v, int clock);
+       void event_callback(int event_id, int error);
        void mix(int32* buffer, int cnt);
+       void set_volume(int ch, int decibel_l, int decibel_r);
        void update_timing(int new_clocks, double new_frames_per_sec, int new_lines_per_frame);
        void save_state(FILEIO* state_fio);
        bool load_state(FILEIO* state_fio);
+       const _TCHAR *get_device_name(void)
+       {
+#ifdef HAS_YM2608
+               if(is_ym2608) {
+                       return "FM_OPNA_YM2608";
+               }
+#endif
+               return "FM_OPN_YM2203";
+       }
        
        // unique functions
 #ifdef HAS_YM_SERIES
@@ -149,7 +168,7 @@ public:
                register_output_signal(&port[1].outputs, device, id, mask, shift);
        }
 #endif
-       void init(int rate, int clock, int samples, int volf, int volp);
+       void init(int rate, int clock, int samples, int decibel_fm, int decibel_psg);
        void SetReg(uint addr, uint data); // for patch
 #ifdef HAS_YM2608
        bool is_ym2608;