示例#1
0
        //static void nes_set_chip_option(UINT8 ChipID);

        public void nes_stream_update(byte ChipID, Int32[][] outputs, Int32 samples)
        {
            nes_state info = NESAPUData[ChipID];
            int       CurSmpl;

            Int32[] BufferA = new Int32[2];
            Int32[] BufferD = new Int32[2];
            Int32[] BufferF = new Int32[2];

            //            switch (EMU_CORE)
            //            {
            //# ifdef ENABLE_ALL_CORES
            //                case EC_MAME:
            //                    nes_psg_update_sound(info->chip_apu, outputs, samples);
            //                   break;
            //#endif
            //                case EC_NSFPLAY:
            for (CurSmpl = 0x00; CurSmpl < samples; CurSmpl++)
            {
                nes_apu.NES_APU_np_Render(info.chip_apu, BufferA);
                nes_dmc.NES_DMC_np_Render(info.chip_dmc, BufferD);
                outputs[0][CurSmpl]       = (short)((Limit(BufferA[0], 0x7fff, -0x8000) * apuVolume) >> 14);
                outputs[1][CurSmpl]       = (short)((Limit(BufferA[1], 0x7fff, -0x8000) * apuVolume) >> 14);
                outputs[0][CurSmpl]      += (short)((Limit(BufferD[0], 0x7fff, -0x8000) * dmcVolume) >> 14);
                outputs[1][CurSmpl]      += (short)((Limit(BufferD[1], 0x7fff, -0x8000) * dmcVolume) >> 14);
                MDSound.np_nes_apu_volume = Math.Abs(BufferA[0]);
                MDSound.np_nes_dmc_volume = Math.Abs(BufferD[0]);
            }
            //                    break;
            //            }

            if (info.chip_fds != null)
            {
                for (CurSmpl = 0x00; CurSmpl < samples; CurSmpl++)
                {
                    nes_fds.NES_FDS_Render(info.chip_fds, BufferF);
                    outputs[0][CurSmpl]      += (short)((Limit(BufferF[0], 0x7fff, -0x8000) * fdsVolume) >> 14);
                    outputs[1][CurSmpl]      += (short)((Limit(BufferF[1], 0x7fff, -0x8000) * fdsVolume) >> 14);
                    MDSound.np_nes_fds_volume = Math.Abs(BufferF[0]);
                }
            }

            return;
        }
示例#2
0
        //static void nes_set_chip_option(UINT8 ChipID);

        public void nes_stream_update(byte ChipID, Int32[][] outputs, Int32 samples)
        {
            nes_state info = NESAPUData[ChipID];
            int       CurSmpl;

            Int32[] BufferA = new Int32[2];
            Int32[] BufferD = new Int32[2];
            Int32[] BufferF = new Int32[2];

            //            switch (EMU_CORE)
            //            {
            //# ifdef ENABLE_ALL_CORES
            //                case EC_MAME:
            //                    nes_psg_update_sound(info->chip_apu, outputs, samples);
            //                   break;
            //#endif
            //                case EC_NSFPLAY:
            for (CurSmpl = 0x00; CurSmpl < samples; CurSmpl++)
            {
                nes_apu.NES_APU_np_Render(info.chip_apu, BufferA);
                nes_dmc.NES_DMC_np_Render(info.chip_dmc, BufferD);
                outputs[0][CurSmpl] = BufferA[0] + BufferD[0];
                outputs[1][CurSmpl] = BufferA[1] + BufferD[1];
            }
            //                    break;
            //            }

            if (info.chip_fds != null)
            {
                for (CurSmpl = 0x00; CurSmpl < samples; CurSmpl++)
                {
                    nes_fds.NES_FDS_Render(info.chip_fds, BufferF);
                    outputs[0][CurSmpl] += BufferF[0];
                    outputs[1][CurSmpl] += BufferF[1];
                }
            }

            return;
        }