Пример #1
0
        public RSoundChip SearchOPNA()
        {
            if (nScci != null)
            {
                int iCount = nScci.NSoundInterfaceManager_.getInterfaceCount();
                for (int i = 0; i < iCount; i++)
                {
                    NSoundInterface      iIntfc = nScci.NSoundInterfaceManager_.getInterface(i);
                    NSCCI_INTERFACE_INFO iInfo  = nScci.NSoundInterfaceManager_.getInterfaceInfo(i);
                    int sCount = iIntfc.getSoundChipCount();
                    for (int s = 0; s < sCount; s++)
                    {
                        NSoundChip sc = iIntfc.getSoundChip(s);
                        int        t  = sc.getSoundChipType();
                        if (t != 1)
                        {
                            continue;
                        }

                        string         ChipName      = sc.getSoundChipInfo().cSoundChipName;
                        string         InterfaceName = iInfo.cInterfaceName;
                        RScciSoundChip rsc           = new RScciSoundChip(0, i, s);
                        rsc.scci = nScci;

                        return(rsc);
                    }
                }
            }

            if (nc86ctl != null)
            {
                int iCount = nc86ctl.getNumberOfChip();
                for (int i = 0; i < iCount; i++)
                {
                    NIRealChip rc  = nc86ctl.getChipInterface(i);
                    NIGimic2   gm  = rc.QueryInterface();
                    ChipType   cct = gm.getModuleType();

                    if (cct != ChipType.CHIP_YM2608 && cct != ChipType.CHIP_YMF288)
                    {
                        continue;
                    }

                    int    o    = -1;
                    string seri = gm.getModuleInfo().Serial;
                    if (!int.TryParse(seri, out o))
                    {
                        o = -1;
                    }
                    string ChipName      = gm.getModuleInfo().Devname;
                    string InterfaceName = gm.getMBInfo().Devname;

                    RC86ctlSoundChip rsc = new RC86ctlSoundChip(-1, i, o);
                    rsc.c86ctl = nc86ctl;
                    return(rsc);
                }
            }

            return(null);
        }
Пример #2
0
        public List <Setting.ChipType> GetRealChipList()
        {
            List <Setting.ChipType> ret = new List <Setting.ChipType>();

            if (nScci != null)
            {
                int iCount = nScci.NSoundInterfaceManager_.getInterfaceCount();
                for (int i = 0; i < iCount; i++)
                {
                    NSoundInterface      iIntfc = nScci.NSoundInterfaceManager_.getInterface(i);
                    NSCCI_INTERFACE_INFO iInfo  = nScci.NSoundInterfaceManager_.getInterfaceInfo(i);
                    int sCount = iIntfc.getSoundChipCount();
                    for (int s = 0; s < sCount; s++)
                    {
                        NSoundChip       sc = iIntfc.getSoundChip(s);
                        int              t  = sc.getSoundChipType();
                        Setting.ChipType ct = new Setting.ChipType();
                        ct.SoundLocation = 0;
                        ct.BusID         = i;
                        ct.SoundChip     = s;
                        ct.ChipName      = sc.getSoundChipInfo().cSoundChipName;
                        ct.Type          = t;
                        ct.InterfaceName = iInfo.cInterfaceName;
                        ret.Add(ct);
                    }
                }
            }

            if (nc86ctl != null)
            {
                int iCount = nc86ctl.getNumberOfChip();
                for (int i = 0; i < iCount; i++)
                {
                    NIRealChip       rc  = nc86ctl.getChipInterface(i);
                    NIGimic2         gm  = rc.QueryInterface();
                    ChipType         cct = gm.getModuleType();
                    Setting.ChipType ct  = null;
                    int o = -1;
                    ct = new Setting.ChipType();
                    ct.SoundLocation = -1;
                    ct.BusID         = i;
                    string seri = gm.getModuleInfo().Serial;
                    if (!int.TryParse(seri, out o))
                    {
                        o = -1;
                    }
                    ct.SoundChip     = o;
                    ct.ChipName      = gm.getModuleInfo().Devname;
                    ct.InterfaceName = gm.getMBInfo().Devname;
                    ct.Type          = (int)cct;
                    ret.Add(ct);
                }
            }

            return(ret);
        }
Пример #3
0
        private static RSoundChip CheckDevice()
        {
            SChipType ct     = null;
            int       iCount = 0;

            switch (device)
            {
            case 1:    //GIMIC存在チェック
                nc86ctl = new Nc86ctl.Nc86ctl();
                nc86ctl.initialize();
                iCount = nc86ctl.getNumberOfChip();
                if (iCount == 0)
                {
                    nc86ctl.deinitialize();
                    nc86ctl = null;
                    Log.WriteLine(LogLevel.ERROR, "Not found G.I.M.I.C.");
                    device = 0;
                    break;
                }
                for (int i = 0; i < iCount; i++)
                {
                    NIRealChip rc  = nc86ctl.getChipInterface(i);
                    NIGimic2   gm  = rc.QueryInterface();
                    ChipType   cct = gm.getModuleType();
                    int        o   = -1;
                    if (cct == ChipType.CHIP_YM2608 || cct == ChipType.CHIP_YMF288 || cct == ChipType.CHIP_YM2203)
                    {
                        ct = new SChipType();
                        ct.SoundLocation = -1;
                        ct.BusID         = i;
                        string seri = gm.getModuleInfo().Serial;
                        if (!int.TryParse(seri, out o))
                        {
                            o  = -1;
                            ct = null;
                            continue;
                        }
                        ct.SoundChip     = o;
                        ct.ChipName      = gm.getModuleInfo().Devname;
                        ct.InterfaceName = gm.getMBInfo().Devname;
                        break;
                    }
                }
                RC86ctlSoundChip rsc = null;
                if (ct == null)
                {
                    nc86ctl.deinitialize();
                    nc86ctl = null;
                    Log.WriteLine(LogLevel.ERROR, "Not found G.I.M.I.C.(OPNA module)");
                    device = 0;
                }
                else
                {
                    rsc        = new RC86ctlSoundChip(-1, ct.BusID, ct.SoundChip);
                    rsc.c86ctl = nc86ctl;
                    rsc.init();

                    rsc.SetMasterClock(7987200); //SoundBoardII
                    rsc.setSSGVolume(63);        //PC-8801
                }
                return(rsc);

            case 2:    //SCCI存在チェック
                nScci  = new NScci.NScci();
                iCount = nScci.NSoundInterfaceManager_.getInterfaceCount();
                if (iCount == 0)
                {
                    nScci.Dispose();
                    nScci = null;
                    Log.WriteLine(LogLevel.ERROR, "Not found SCCI.");
                    device = 0;
                    break;
                }
                for (int i = 0; i < iCount; i++)
                {
                    NSoundInterface      iIntfc = nScci.NSoundInterfaceManager_.getInterface(i);
                    NSCCI_INTERFACE_INFO iInfo  = nScci.NSoundInterfaceManager_.getInterfaceInfo(i);
                    int sCount = iIntfc.getSoundChipCount();
                    for (int s = 0; s < sCount; s++)
                    {
                        NSoundChip sc = iIntfc.getSoundChip(s);
                        int        t  = sc.getSoundChipType();
                        if (t == 1)
                        {
                            ct = new SChipType();
                            ct.SoundLocation = 0;
                            ct.BusID         = i;
                            ct.SoundChip     = s;
                            ct.ChipName      = sc.getSoundChipInfo().cSoundChipName;
                            ct.InterfaceName = iInfo.cInterfaceName;
                            goto scciExit;
                        }
                    }
                }
                scciExit :;
                RScciSoundChip rssc = null;
                if (ct == null)
                {
                    nScci.Dispose();
                    nScci = null;
                    Log.WriteLine(LogLevel.ERROR, "Not found SCCI(OPNA module).");
                    device = 0;
                }
                else
                {
                    rssc      = new RScciSoundChip(0, ct.BusID, ct.SoundChip);
                    rssc.scci = nScci;
                    rssc.init();
                }
                return(rssc);
            }

            return(null);
        }
Пример #4
0
        public List <Setting.ChipType> GetRealChipList(EnmRealChipType realChipType)
        {
            List <Setting.ChipType> ret = new List <Setting.ChipType>();

            if (nScci != null)
            {
                int iCount = nScci.NSoundInterfaceManager_.getInterfaceCount();
                for (int i = 0; i < iCount; i++)
                {
                    NSoundInterface      iIntfc = nScci.NSoundInterfaceManager_.getInterface(i);
                    NSCCI_INTERFACE_INFO iInfo  = nScci.NSoundInterfaceManager_.getInterfaceInfo(i);
                    int sCount = iIntfc.getSoundChipCount();
                    for (int s = 0; s < sCount; s++)
                    {
                        NSoundChip sc = iIntfc.getSoundChip(s);
                        int        t  = sc.getSoundChipType();
                        if (t == (int)realChipType)
                        {
                            Setting.ChipType ct = new Setting.ChipType();
                            ct.SoundLocation = 0;
                            ct.BusID         = i;
                            ct.SoundChip     = s;
                            ct.ChipName      = sc.getSoundChipInfo().cSoundChipName;
                            ct.InterfaceName = iInfo.cInterfaceName;
                            ret.Add(ct);
                        }
                        else
                        {
                            //互換指定をチェック
                            NSCCI_SOUND_CHIP_INFO chipInfo = sc.getSoundChipInfo();
                            for (int n = 0; n < chipInfo.iCompatibleSoundChip.Length; n++)
                            {
                                if ((int)realChipType != chipInfo.iCompatibleSoundChip[n])
                                {
                                    continue;
                                }

                                Setting.ChipType ct = new Setting.ChipType();
                                ct.SoundLocation = 0;
                                ct.BusID         = i;
                                ct.SoundChip     = s;
                                ct.ChipName      = sc.getSoundChipInfo().cSoundChipName;
                                ct.InterfaceName = iInfo.cInterfaceName;
                                ret.Add(ct);
                                break;
                            }
                        }
                    }
                }
            }

            if (nc86ctl != null)
            {
                int iCount = nc86ctl.getNumberOfChip();
                for (int i = 0; i < iCount; i++)
                {
                    NIRealChip       rc  = nc86ctl.getChipInterface(i);
                    NIGimic2         gm  = rc.QueryInterface();
                    ChipType         cct = gm.getModuleType();
                    Setting.ChipType ct  = null;
                    int o = -1;
                    switch (realChipType)
                    {
                    case EnmRealChipType.AY8910:
                        if (cct == ChipType.CHIP_UNKNOWN || cct == ChipType.CHIP_YM2608 || cct == ChipType.CHIP_YMF288 || cct == ChipType.CHIP_YM2203)
                        {
                            ct = new Setting.ChipType();
                            ct.SoundLocation = -1;
                            ct.BusID         = i;
                            string seri = gm.getModuleInfo().Serial;
                            if (!int.TryParse(seri, out o))
                            {
                                o = -1;
                            }
                            ct.SoundChip     = o;
                            ct.ChipName      = gm.getModuleInfo().Devname;
                            ct.InterfaceName = gm.getMBInfo().Devname;
                            ct.Type          = (int)cct;
                        }
                        break;

                    case EnmRealChipType.YM2203:
                    case EnmRealChipType.YM2608:
                        if (cct == ChipType.CHIP_YM2608 || cct == ChipType.CHIP_YMF288 || cct == ChipType.CHIP_YM2203)
                        {
                            ct = new Setting.ChipType();
                            ct.SoundLocation = -1;
                            ct.BusID         = i;
                            string seri = gm.getModuleInfo().Serial;
                            if (!int.TryParse(seri, out o))
                            {
                                o = -1;
                            }
                            ct.SoundChip     = o;
                            ct.ChipName      = gm.getModuleInfo().Devname;
                            ct.InterfaceName = gm.getMBInfo().Devname;
                            ct.Type          = (int)cct;
                        }
                        break;

                    case EnmRealChipType.YM2413:
                        if (cct == ChipType.CHIP_YM2413 || cct == ChipType.CHIP_UNKNOWN)
                        {
                            ct = new Setting.ChipType();
                            ct.SoundLocation = -1;
                            ct.BusID         = i;
                            string seri = gm.getModuleInfo().Serial;
                            if (!int.TryParse(seri, out o))
                            {
                                o = -1;
                            }
                            ct.SoundChip     = o;
                            ct.ChipName      = gm.getModuleInfo().Devname;
                            ct.InterfaceName = gm.getMBInfo().Devname;
                        }
                        break;

                    case EnmRealChipType.YM2610:
                        if (cct == ChipType.CHIP_YM2608 || cct == ChipType.CHIP_YMF288)
                        {
                            ct = new Setting.ChipType();
                            ct.SoundLocation = -1;
                            ct.BusID         = i;
                            string seri = gm.getModuleInfo().Serial;
                            if (!int.TryParse(seri, out o))
                            {
                                o = -1;
                            }
                            ct.SoundChip     = o;
                            ct.ChipName      = gm.getModuleInfo().Devname;
                            ct.InterfaceName = gm.getMBInfo().Devname;
                            ct.Type          = (int)cct;
                        }
                        break;

                    case EnmRealChipType.YM2151:
                        if (cct == ChipType.CHIP_YM2151)
                        {
                            ct = new Setting.ChipType();
                            ct.SoundLocation = -1;
                            ct.BusID         = i;
                            string seri = gm.getModuleInfo().Serial;
                            if (!int.TryParse(seri, out o))
                            {
                                o = -1;
                            }
                            ct.SoundChip     = o;
                            ct.ChipName      = gm.getModuleInfo().Devname;
                            ct.InterfaceName = gm.getMBInfo().Devname;
                            ct.Type          = (int)cct;
                        }
                        break;

                    case EnmRealChipType.YM3526:
                    case EnmRealChipType.YM3812:
                    case EnmRealChipType.YMF262:
                        if (cct == ChipType.CHIP_OPL3)
                        {
                            ct = new Setting.ChipType();
                            ct.SoundLocation = -1;
                            ct.BusID         = i;
                            string seri = gm.getModuleInfo().Serial;
                            if (!int.TryParse(seri, out o))
                            {
                                o = -1;
                            }
                            ct.SoundChip     = o;
                            ct.ChipName      = gm.getModuleInfo().Devname;
                            ct.InterfaceName = gm.getMBInfo().Devname;
                            ct.Type          = (int)cct;
                        }
                        break;
                    }

                    if (ct != null)
                    {
                        ret.Add(ct);
                    }
                }
            }

            return(ret);
        }
Пример #5
0
        public RSoundChip GetRealChip(Setting.ChipType chipType, int ind = 0)
        {
            if (nScci != null)
            {
                int iCount = nScci.NSoundInterfaceManager_.getInterfaceCount();
                for (int i = 0; i < iCount; i++)
                {
                    NSoundInterface      iIntfc = nScci.NSoundInterfaceManager_.getInterface(i);
                    NSCCI_INTERFACE_INFO iInfo  = nScci.NSoundInterfaceManager_.getInterfaceInfo(i);
                    int sCount = iIntfc.getSoundChipCount();
                    for (int s = 0; s < sCount; s++)
                    {
                        NSoundChip sc = iIntfc.getSoundChip(s);

                        switch (ind)
                        {
                        case 0:
                            if (0 == chipType.SoundLocation &&
                                i == chipType.BusID &&
                                s == chipType.SoundChip)
                            {
                                RScciSoundChip rsc = new RScciSoundChip(0, i, s, chipType.Type);
                                rsc.scci = nScci;
                                return(rsc);
                            }
                            break;

                        case 1:
                            if (0 == chipType.SoundLocation2A &&
                                i == chipType.BusID2A &&
                                s == chipType.SoundChip2A)
                            {
                                RScciSoundChip rsc = new RScciSoundChip(0, i, s, chipType.Type2A);
                                rsc.scci = nScci;
                                return(rsc);
                            }
                            break;

                        case 2:
                            if (0 == chipType.SoundLocation2B &&
                                i == chipType.BusID2B &&
                                s == chipType.SoundChip2B)
                            {
                                RScciSoundChip rsc = new RScciSoundChip(0, i, s, chipType.Type2B);
                                rsc.scci = nScci;
                                return(rsc);
                            }
                            break;
                        }
                    }
                }
            }

            if (nc86ctl != null)
            {
                int iCount = nc86ctl.getNumberOfChip();
                for (int i = 0; i < iCount; i++)
                {
                    NIRealChip rc   = nc86ctl.getChipInterface(i);
                    NIGimic2   gm   = rc.QueryInterface();
                    ChipType   cct  = gm.getModuleType();
                    int        o    = -1;
                    string     seri = gm.getModuleInfo().Serial;
                    if (!int.TryParse(seri, out o))
                    {
                        o = -1;
                    }

                    switch (ind)
                    {
                    case 0:
                        if (-1 == chipType.SoundLocation &&
                            i == chipType.BusID &&
                            o == chipType.SoundChip)
                        {
                            RC86ctlSoundChip rsc = new RC86ctlSoundChip(-1, i, o, chipType.Type);
                            rsc.c86ctl = nc86ctl;
                            return(rsc);
                        }
                        break;

                    case 1:
                        if (-1 == chipType.SoundLocation2A &&
                            i == chipType.BusID2A &&
                            o == chipType.SoundChip2A)
                        {
                            RC86ctlSoundChip rsc = new RC86ctlSoundChip(-1, i, o, chipType.Type2A);
                            rsc.c86ctl = nc86ctl;
                            return(rsc);
                        }
                        break;

                    case 2:
                        if (-1 == chipType.SoundLocation2B &&
                            i == chipType.BusID2B &&
                            o == chipType.SoundChip2B)
                        {
                            RC86ctlSoundChip rsc = new RC86ctlSoundChip(-1, i, o, chipType.Type2B);
                            rsc.c86ctl = nc86ctl;
                            return(rsc);
                        }
                        break;
                    }
                }
            }

            return(null);
        }
Пример #6
0
        public List <Setting.ChipType> GetRealChipList(EnmRealChipType realChipType)
        {
            List <Setting.ChipType> ret = new List <Setting.ChipType>();

            if (nScci != null)
            {
                int iCount = nScci.NSoundInterfaceManager_.getInterfaceCount();
                for (int i = 0; i < iCount; i++)
                {
                    NSoundInterface      iIntfc = nScci.NSoundInterfaceManager_.getInterface(i);
                    NSCCI_INTERFACE_INFO iInfo  = nScci.NSoundInterfaceManager_.getInterfaceInfo(i);
                    int sCount = iIntfc.getSoundChipCount();
                    for (int s = 0; s < sCount; s++)
                    {
                        NSoundChip sc = iIntfc.getSoundChip(s);
                        int        t  = sc.getSoundChipType();
                        if (t == (int)realChipType ||
                            (realChipType == EnmRealChipType.YM2203 && t == (int)EnmRealChipType.YM2608) ||
                            (realChipType == EnmRealChipType.YM2610 && t == (int)EnmRealChipType.YM2608) ||
                            (realChipType == EnmRealChipType.AY8910 && t == (int)EnmRealChipType.YM2203) ||
                            (realChipType == EnmRealChipType.AY8910 && t == (int)EnmRealChipType.YM2608) ||
                            (realChipType == EnmRealChipType.AY8910 && t == (int)EnmRealChipType.YM2610)
                            )
                        {
                            Setting.ChipType ct = new Setting.ChipType();
                            ct.SoundLocation = 0;
                            ct.BusID         = i;
                            ct.SoundChip     = s;
                            ct.ChipName      = sc.getSoundChipInfo().cSoundChipName;
                            ct.Type          = t;
                            ct.InterfaceName = iInfo.cInterfaceName;
                            ret.Add(ct);
                        }
                    }
                }
            }

            if (nc86ctl != null)
            {
                int iCount = nc86ctl.getNumberOfChip();
                for (int i = 0; i < iCount; i++)
                {
                    NIRealChip       rc  = nc86ctl.getChipInterface(i);
                    NIGimic2         gm  = rc.QueryInterface();
                    ChipType         cct = gm.getModuleType();
                    Setting.ChipType ct  = null;
                    int o = -1;
                    switch (realChipType)
                    {
                    case EnmRealChipType.AY8910:
                        if (cct == ChipType.CHIP_YM2608 || cct == ChipType.CHIP_YMF288 || cct == ChipType.CHIP_YM2203)
                        {
                            ct = new Setting.ChipType();
                            ct.SoundLocation = -1;
                            ct.BusID         = i;
                            string seri = gm.getModuleInfo().Serial;
                            if (!int.TryParse(seri, out o))
                            {
                                o = -1;
                            }
                            ct.SoundChip     = o;
                            ct.ChipName      = gm.getModuleInfo().Devname;
                            ct.InterfaceName = gm.getMBInfo().Devname;
                            ct.Type          = (int)cct;
                        }
                        break;

                    case EnmRealChipType.YM2203:
                    case EnmRealChipType.YM2608:
                        if (cct == ChipType.CHIP_YM2608 || cct == ChipType.CHIP_YMF288 || cct == ChipType.CHIP_YM2203)
                        {
                            ct = new Setting.ChipType();
                            ct.SoundLocation = -1;
                            ct.BusID         = i;
                            string seri = gm.getModuleInfo().Serial;
                            if (!int.TryParse(seri, out o))
                            {
                                o = -1;
                            }
                            ct.SoundChip     = o;
                            ct.ChipName      = gm.getModuleInfo().Devname;
                            ct.InterfaceName = gm.getMBInfo().Devname;
                            ct.Type          = (int)cct;
                        }
                        break;

                    case EnmRealChipType.YM2610:
                        if (cct == ChipType.CHIP_YM2608 || cct == ChipType.CHIP_YMF288)
                        {
                            ct = new Setting.ChipType();
                            ct.SoundLocation = -1;
                            ct.BusID         = i;
                            string seri = gm.getModuleInfo().Serial;
                            if (!int.TryParse(seri, out o))
                            {
                                o = -1;
                            }
                            ct.SoundChip     = o;
                            ct.ChipName      = gm.getModuleInfo().Devname;
                            ct.InterfaceName = gm.getMBInfo().Devname;
                            ct.Type          = (int)cct;
                        }
                        break;

                    case EnmRealChipType.YM2151:
                        if (cct == ChipType.CHIP_YM2151)
                        {
                            ct = new Setting.ChipType();
                            ct.SoundLocation = -1;
                            ct.BusID         = i;
                            string seri = gm.getModuleInfo().Serial;
                            if (!int.TryParse(seri, out o))
                            {
                                o = -1;
                            }
                            ct.SoundChip     = o;
                            ct.ChipName      = gm.getModuleInfo().Devname;
                            ct.InterfaceName = gm.getMBInfo().Devname;
                            ct.Type          = (int)cct;
                        }
                        break;
                    }

                    if (ct != null)
                    {
                        ret.Add(ct);
                    }
                }
            }

            return(ret);
        }