Exemple #1
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);
        }
Exemple #2
0
        private void Form1_Shown(object sender, EventArgs e)
        {
            for (int i = 0; i < 1; i++)
            {
                try
                {
                    MsgDisp("SCCI:処理開始");

                    MsgDisp("SCCI:コンストラクタ開始");
                    scci = new NScci.NScci();
                    MsgDisp("SCCI:コンストラクタ終了");

                    MsgDisp("SCCI:getInterfaceCount開始");
                    int n = scci.NSoundInterfaceManager_.getInterfaceCount();
                    MsgDisp("SCCI:getInterfaceCount完了");
                    if (n == 0)
                    {
                        MsgDisp("SCCI:SCCI見つからず");
                        scci.Dispose();
                        scci = null;
                    }
                    else
                    {
                        for (int j = 0; j < n; j++)
                        {
                            MsgDisp(string.Format("SCCI:====================== Interface {0}", j));
                            MsgDisp("SCCI:getInterface 開始");
                            NSoundInterface nsif = scci.NSoundInterfaceManager_.getInterface(j);
                            MsgDisp("SCCI:getInterface 完了");

                            MsgDisp("SCCI:getSoundChipCount 開始");
                            int c = nsif.getSoundChipCount();
                            MsgDisp("SCCI:getSoundChipCount 完了");

                            for (int k = 0; k < c; k++)
                            {
                                MsgDisp("SCCI:------------------- Chip Information");

                                MsgDisp("SCCI:getSoundChip 開始");
                                NSoundChip nsc = nsif.getSoundChip(k);
                                MsgDisp("SCCI:getSoundChip 完了");

                                MsgDisp("SCCI:getSoundChipInfo 開始");
                                NSCCI_SOUND_CHIP_INFO nssci = nsc.getSoundChipInfo();
                                MsgDisp("SCCI:getSoundChipInfo 完了");

                                MsgDisp(string.Format("SCCI:cSoundChipName {0}", nssci.cSoundChipName));
                                MsgDisp(string.Format("SCCI:dClock {0}", nssci.dClock));
                                MsgDisp(string.Format("SCCI:iSoundChip {0}", nssci.iSoundChip));
                                MsgDisp(string.Format("SCCI:bIsUsed {0}", nssci.bIsUsed));
                            }
                        }

                        if (scci != null)
                        {
                            scci.Dispose();
                            scci = null;
                        }
                    }
                }
                catch (Exception escci)
                {
                    MsgDisp("SCCI:Exception発生");
                    MsgDisp(string.Format("SCCI:Message:{0}", escci.Message));
                    MsgDisp(string.Format("SCCI:StackTrace:{0}", escci.StackTrace));
                }

                try
                {
                    MsgDisp("c86ctl:処理開始");

                    MsgDisp("c86ctl:Nc86ctl 開始");
                    c86 = new Nc86ctl.Nc86ctl();
                    MsgDisp("c86ctl:Nc86ctl 完了");

                    MsgDisp("c86ctl:initialize 開始");
                    c86.initialize();
                    MsgDisp("c86ctl:initialize 完了");

                    MsgDisp("c86ctl:getNumberOfChip 開始");
                    int nc = c86.getNumberOfChip();
                    MsgDisp("c86ctl:getNumberOfChip 完了");
                    if (nc == 0)
                    {
                        MsgDisp("c86ctl:deinitialize 開始");
                        c86.deinitialize();
                        MsgDisp("c86ctl:deinitialize 完了");
                        MsgDisp("c86ctl:c86ctl見つからず");
                        c86.Dispose();
                        c86 = null;
                    }
                    else
                    {
                        MsgDisp("c86ctl:getChipInterface 開始");
                        NIRealChip nirc = c86.getChipInterface(0);
                        MsgDisp("c86ctl:getChipInterface 完了");

                        MsgDisp("c86ctl:reset 開始");
                        nirc.reset();
                        MsgDisp("c86ctl:reset 完了");

                        MsgDisp("c86ctl:QueryInterface 開始");
                        NIGimic2 nig = nirc.QueryInterface();
                        MsgDisp("c86ctl:QueryInterface 完了");

                        UInt16 aa = 0;
                        UInt16 bb = 0;
                        UInt16 cc = 0;
                        UInt16 dd = 0;
                        MsgDisp("c86ctl:getFWVer 開始");
                        nig.getFWVer(ref aa, ref bb, ref cc, ref dd);
                        MsgDisp(string.Format("c86ctl:getFWVer 完了({0}.{1}.{2}.{3})", aa, bb, cc, dd));

                        MsgDisp("c86ctl:getMBInfo 開始");
                        Devinfo dv = nig.getMBInfo();
                        MsgDisp(string.Format("c86ctl:getMBInfo 完了 {0}", dv.Devname));

                        MsgDisp("c86ctl:getModuleType 開始");
                        ChipType tp = nig.getModuleType();
                        MsgDisp(string.Format("c86ctl:getModuleType 完了 {0}", tp));

                        MsgDisp("c86ctl:getModuleInfo 開始");
                        Devinfo di = nig.getModuleInfo();
                        MsgDisp(string.Format("c86ctl:getModuleInfo 完了 {0}", di.Devname));

                        MsgDisp("c86ctl:getSSGVolume 開始");
                        byte vol = nig.getSSGVolume();
                        MsgDisp(string.Format("c86ctl:getSSGVolume 完了 {0}", vol));

                        MsgDisp("c86ctl:getPLLClock 開始");
                        uint clock = nig.getPLLClock();
                        MsgDisp(string.Format("c86ctl:getPLLClock 完了 {0}", clock));
                    }
                }
                catch (Exception ec86)
                {
                    MsgDisp("c86ctl:Exception発生");
                    MsgDisp(string.Format("c86ctl:Message:{0}", ec86.Message));
                    MsgDisp(string.Format("c86ctl:StackTrace:{0}", ec86.StackTrace));
                }
            }
        }
Exemple #3
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);
        }
Exemple #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();
                    Devinfo          di  = gm.getModuleInfo();
                    Setting.ChipType ct  = null;
                    int o = -1;
                    switch (realChipType)
                    {
                    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      = di.Devname;
                            ct.InterfaceName = di.Devname;
                            ct.Type          = (int)cct;
                        }
                        break;

                    case EnmRealChipType.AY8910:
                        if ((cct == ChipType.CHIP_UNKNOWN && di.Devname == "GMC-S2149") ||
                            (cct == ChipType.CHIP_UNKNOWN && di.Devname == "GMC-S8910") ||
                            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      = di.Devname;
                            ct.InterfaceName = di.Devname;
                            ct.Type          = (int)cct;
                        }
                        break;

                    case EnmRealChipType.YM2413:
                        if (cct == ChipType.CHIP_YM2413 ||
                            (cct == ChipType.CHIP_UNKNOWN && di.Devname == "GMC-S2413")
                            )
                        {
                            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      = di.Devname;
                            ct.InterfaceName = di.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      = di.Devname;
                            ct.InterfaceName = di.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);
        }