コード例 #1
0
        private void checkBoxConnSCC_CheckedChanged(object sender, EventArgs e)
        {
            if (checkBoxConnSCC.Checked)
            {
                switch (Settings.Default.SCC_IF)
                {
                case 0:
                    comPortSCC = VsifManager.TryToConnectVSIF(VsifSoundModuleType.MSX_FTDI,
                                                              (PortId)Settings.Default.SCC_Port, false);
                    if (comPortSCC != null)
                    {
                        enableScc(SCCType.SCC1, SCCSlotNo[comboBoxSccSlot.SelectedIndex]);
                    }
                    break;
                }
                checkBoxConnSCC.Checked = comPortSCC != null;
                comboBoxSCC.Enabled     = comPortSCC == null;
                comboBoxPortSCC.Enabled = comPortSCC == null;
                comboBoxSccSlot.Enabled = comPortSCC == null;
            }
            else
            {
                comboBoxSCC.Enabled     = true;
                comboBoxPortSCC.Enabled = true;
                comboBoxSccSlot.Enabled = true;

                comPortSCC?.Dispose();
            }
        }
コード例 #2
0
        private void checkBoxConnOPNA2_CheckedChanged(object sender, EventArgs e)
        {
            if (checkBoxConnOPNA2.Checked)
            {
                switch (Settings.Default.OPNA2_IF)
                {
                case 0:
                    comPortOPNA2 = VsifManager.TryToConnectVSIF(VsifSoundModuleType.Genesis,
                                                                (PortId)Settings.Default.OPNA2_Port, false);
                    break;

                case 1:
                    comPortOPNA2 = VsifManager.TryToConnectVSIF(VsifSoundModuleType.Genesis_FTDI,
                                                                (PortId)Settings.Default.OPNA2_Port, false);
                    break;

                case 2:
                    comPortOPNA2 = VsifManager.TryToConnectVSIF(VsifSoundModuleType.Genesis_Low,
                                                                (PortId)Settings.Default.OPNA2_Port, false);
                    break;
                }
                checkBoxConnOPNA2.Checked  = comPortOPNA2 != null;
                comboBoxOPNA2.Enabled      = comPortOPNA2 == null;
                comboBoxPortYM2612.Enabled = comPortOPNA2 == null;
            }
            else
            {
                comboBoxOPNA2.Enabled      = true;
                comboBoxPortYM2612.Enabled = true;
                comPortOPNA2?.Dispose();
            }
        }
コード例 #3
0
        private void checkBoxConnOPLL_CheckedChanged(object sender, EventArgs e)
        {
            if (checkBoxConnOPLL.Checked)
            {
                switch (Settings.Default.OPLL_IF)
                {
                case 0:
                    comPortOPLL = VsifManager.TryToConnectVSIF(VsifSoundModuleType.SMS,
                                                               (PortId)Settings.Default.OPLL_Port, false);
                    break;

                case 1:
                    comPortOPLL = VsifManager.TryToConnectVSIF(VsifSoundModuleType.MSX_FTDI,
                                                               (PortId)Settings.Default.OPLL_Port, false);
                    break;
                }

                checkBoxConnOPLL.Checked   = comPortOPLL != null;
                comboBoxOPLL.Enabled       = comPortOPLL == null;
                comboBoxPortYm2413.Enabled = comPortOPLL == null;
            }
            else
            {
                comboBoxOPLL.Enabled       = true;
                comboBoxPortYm2413.Enabled = true;
                comPortOPLL?.Dispose();
            }
        }
コード例 #4
0
        private void checkBoxConnDCSG_CheckedChanged(object sender, EventArgs e)
        {
            if (checkBoxConnDCSG.Checked)
            {
                switch (Settings.Default.DCSG_IF)
                {
                case 0:
                    comPortDCSG = VsifManager.TryToConnectVSIF(VsifSoundModuleType.Genesis,
                                                               (PortId)Settings.Default.DCSG_Port, false);
                    break;

                case 1:
                    comPortDCSG = VsifManager.TryToConnectVSIF(VsifSoundModuleType.Genesis_FTDI,
                                                               (PortId)Settings.Default.DCSG_Port, false);
                    break;

                case 2:
                    comPortDCSG = VsifManager.TryToConnectVSIF(VsifSoundModuleType.SMS,
                                                               (PortId)Settings.Default.DCSG_Port, false);
                    break;

                case 3:
                    comPortDCSG = VsifManager.TryToConnectVSIF(VsifSoundModuleType.Genesis_Low,
                                                               (PortId)Settings.Default.DCSG_Port, false);
                    break;
                }

                checkBoxConnDCSG.Checked    = comPortDCSG != null;
                comboBoxDCSG.Enabled        = comPortDCSG == null;
                comboBoxPortSN76489.Enabled = comPortDCSG == null;
            }
            else
            {
                comboBoxDCSG.Enabled        = true;
                comboBoxPortSN76489.Enabled = true;
                comPortDCSG?.Dispose();
            }
        }
コード例 #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns></returns>
        private bool openVGMFile(string fileName)
        {
            //Read size
            using (FileStream vgmFile = File.Open(fileName, FileMode.Open))
            {
                var fileSize = (uint)vgmFile.Length;
                xgmReader = new BinaryReader(vgmFile);

                uint fccHeader;
                fccHeader = (uint)xgmReader.ReadUInt32();
                if (fccHeader != FCC_VGM)
                {
                    return(false);
                }

                for (int i = 0; i < 63; i++)
                {
                    ushort adr = xgmReader.ReadUInt16();
                    ushort sz  = xgmReader.ReadUInt16();
                    if (adr == 0xffff && sz == 0x1)
                    {
                        SampleDataTable[i] = new SampleData(this, 0, 0);
                    }
                    else
                    {
                        SampleDataTable[i] = new SampleData(this, (uint)(adr * 256), (uint)(sz * 256));
                    }
                }

                xgmMHead = readXGMHeader(xgmReader);

                //read dac
                dacData = xgmReader.ReadBytes(xgmMHead.shtSampleDataBlkSize * 256);

                uint mlen = xgmReader.ReadUInt32();
                if (mlen < 0)
                {
                    return(false);
                }

                //read vgm
                vgmData = xgmReader.ReadBytes((int)mlen);

                xgmReader = new BinaryReader(new MemoryStream(vgmData));

                switch (Settings.Default.DCSG_IF)
                {
                case 0:
                    comPortDCSG = VsifManager.TryToConnectVSIF(VsifSoundModuleType.Genesis,
                                                               (PortId)Settings.Default.DCSG_Port);
                    break;

                case 1:
                    comPortDCSG = VsifManager.TryToConnectVSIF(VsifSoundModuleType.Genesis_FTDI,
                                                               (PortId)Settings.Default.DCSG_Port);
                    break;

                case 2:
                    comPortDCSG = VsifManager.TryToConnectVSIF(VsifSoundModuleType.SMS,
                                                               (PortId)Settings.Default.DCSG_Port);
                    break;

                case 3:
                    comPortDCSG = VsifManager.TryToConnectVSIF(VsifSoundModuleType.Genesis_Low,
                                                               (PortId)Settings.Default.DCSG_Port);
                    break;
                }
                switch (Settings.Default.OPNA2_IF)
                {
                case 0:
                    comPortOPNA2 = VsifManager.TryToConnectVSIF(VsifSoundModuleType.Genesis,
                                                                (PortId)Settings.Default.OPNA2_Port);
                    break;

                case 1:
                    comPortOPNA2 = VsifManager.TryToConnectVSIF(VsifSoundModuleType.Genesis_FTDI,
                                                                (PortId)Settings.Default.OPNA2_Port);
                    break;

                case 2:
                    comPortOPNA2 = VsifManager.TryToConnectVSIF(VsifSoundModuleType.Genesis_Low,
                                                                (PortId)Settings.Default.OPNA2_Port);
                    break;
                }

                return(true);
            }
        }