Exemplo n.º 1
0
        private void setSoundEngine(SoundEngineType value)
        {
            AllSoundOff();

            lock (sndEnginePtrLock)
            {
                if (spfmPtr != IntPtr.Zero)
                {
                    ScciManager.ReleaseSoundChip(spfmPtr);
                    spfmPtr = IntPtr.Zero;
                }
                if (vsifClient != null)
                {
                    vsifClient.Dispose();
                    vsifClient = null;
                }

                f_SoundEngineType = value;

                switch (f_SoundEngineType)
                {
                case SoundEngineType.Software:
                    f_CurrentSoundEngineType = f_SoundEngineType;
                    SetDevicePassThru(false);
                    break;

                case SoundEngineType.SPFM:
                    spfmPtr = ScciManager.TryGetSoundChip(SoundChipType.SC_TYPE_AY8910, (SC_CHIP_CLOCK)MasterClock);
                    if (spfmPtr != IntPtr.Zero)
                    {
                        f_CurrentSoundEngineType = f_SoundEngineType;
                        SetDevicePassThru(true);
                    }
                    else
                    {
                        f_CurrentSoundEngineType = SoundEngineType.Software;
                        SetDevicePassThru(false);
                    }
                    break;

                case SoundEngineType.VSIF_MSX_FTDI:
                    vsifClient = VsifManager.TryToConnectVSIF(VsifSoundModuleType.MSX_FTDI, PortId, false);
                    if (vsifClient != null)
                    {
                        f_CurrentSoundEngineType = f_SoundEngineType;
                        SetDevicePassThru(true);
                    }
                    else
                    {
                        f_CurrentSoundEngineType = SoundEngineType.Software;
                        SetDevicePassThru(false);
                    }
                    break;
                }
                PrepareSound();
            }
        }
Exemplo n.º 2
0
        private void setSoundEngine(SoundEngineType value)
        {
            AllSoundOff();

            lock (vsifLock)
            {
                if (vsifClient != null)
                {
                    vsifClient.Dispose();
                    vsifClient = null;
                }

                f_SoundEngineType = value;

                switch (f_SoundEngineType)
                {
                case SoundEngineType.Software:
                    f_CurrentSoundEngineType = f_SoundEngineType;
                    SetDevicePassThru(false);
                    break;

                case SoundEngineType.VSIF_SMS:
                    vsifClient = VsifManager.TryToConnectVSIF(VsifSoundModuleType.SMS, PortId, false);
                    if (vsifClient != null)
                    {
                        f_CurrentSoundEngineType = f_SoundEngineType;
                        SetDevicePassThru(true);
                    }
                    else
                    {
                        f_CurrentSoundEngineType = SoundEngineType.Software;
                        SetDevicePassThru(false);
                    }
                    break;

                case SoundEngineType.VSIF_Genesis:
                    vsifClient = VsifManager.TryToConnectVSIF(VsifSoundModuleType.Genesis, PortId, false);
                    if (vsifClient != null)
                    {
                        f_CurrentSoundEngineType = f_SoundEngineType;
                        SetDevicePassThru(true);
                    }
                    else
                    {
                        f_CurrentSoundEngineType = SoundEngineType.Software;
                        SetDevicePassThru(false);
                    }
                    break;

                case SoundEngineType.VSIF_Genesis_Low:
                    vsifClient = VsifManager.TryToConnectVSIF(VsifSoundModuleType.Genesis_Low, PortId, false);
                    if (vsifClient != null)
                    {
                        f_CurrentSoundEngineType = f_SoundEngineType;
                        SetDevicePassThru(true);
                    }
                    else
                    {
                        f_CurrentSoundEngineType = SoundEngineType.Software;
                        SetDevicePassThru(false);
                    }
                    break;

                case SoundEngineType.VSIF_Genesis_FTDI:
                    vsifClient = VsifManager.TryToConnectVSIF(VsifSoundModuleType.Genesis_FTDI, PortId, false);
                    if (vsifClient != null)
                    {
                        f_CurrentSoundEngineType = f_SoundEngineType;
                        SetDevicePassThru(true);
                    }
                    else
                    {
                        f_CurrentSoundEngineType = SoundEngineType.Software;
                        SetDevicePassThru(false);
                    }
                    break;
                }
            }
            PrepareSound();
        }