Exemplo n.º 1
0
        public static void sound_init()
        {
            iRecord = 0;

            leftmix  = new int[0x3c0];
            rightmix = new int[0x3c0];

            finalmixb = new byte[0xf00];

            sound_muted = 0;

            buf2.Play(0, BufferPlayFlags.Looping);

            last_update_second = 0;
            //WavWrite.CreateSoundFile(@"\VS2008\compare1\compare1\bin\Debug\2.wav");
            Atime update_frequency = new Atime(0, Attotime.ATTOSECONDS_PER_SECOND / 50);

            switch (Machine.sBoard)
            {
            case "CPS-1":
                latched_value      = new ushort[2];
                utempdata          = new ushort[2];
                sound_update       = sound_updateC;
                sound_update_timer = Timer.timer_alloc_common(sound_update, "sound_update", false);
                YM2151.ym2151_init(3579545);
                OKI6295.okim6295_start();
                ym2151stream = new sound_stream(55930, 0, 2, YM2151.ym2151_update_one);
                okistream    = new sound_stream(1000000 / 132, 0, 1, OKI6295.okim6295_update);
                mixerstream  = new sound_stream(48000, 3, 0, null);
                break;

            case "CPS-1(QSound)":
            case "CPS2":
                sound_update       = sound_updateQ;
                sound_update_timer = Timer.timer_alloc_common(sound_update, "sound_update", false);
                QSound.qsound_start();
                qsoundstream = new sound_stream(4000000 / 166, 0, 2, QSound.qsound_update);
                mixerstream  = new sound_stream(48000, 2, 0, null);
                break;

            case "Neo Geo":
                latched_value      = new ushort[2];
                utempdata          = new ushort[2];
                sound_update       = sound_updateN;
                sound_update_timer = Timer.timer_alloc_common(sound_update, "sound_update", false);
                YM2610.ym2610_start();
                ay8910stream = new sound_stream(250000, 0, 1, AY8910.ay8910_update);
                ym2610stream = new sound_stream(111111, 0, 2, FM.ym2610_update_one);
                mixerstream  = new sound_stream(48000, 3, 0, null);
                break;

            case "Namco System 1":
                sound_update       = sound_updateNa;
                sound_update_timer = Timer.timer_alloc_common(sound_update, "sound_update", false);
                YM2151.ym2151_init(3579580);
                Namco.namco_start();
                DAC.dac_start();
                ym2151stream = new sound_stream(55930, 0, 2, YM2151.ym2151_update_one);
                namcostream  = new sound_stream(192000, 0, 2, Namco.namco_update_stereo);
                dacstream    = new sound_stream(192000, 0, 1, DAC.DAC_update);
                mixerstream  = new sound_stream(48000, 5, 0, null);
                break;

            case "IGS011":
                sound_update       = sound_updateIGS011;
                sound_update_timer = Timer.timer_alloc_common(sound_update, "sound_update", false);
                OKI6295.okim6295_start();
                YM3812.ym3812_start(3579545);
                okistream    = new sound_stream(1047600 / 132, 0, 1, OKI6295.okim6295_update);
                ym3812stream = new sound_stream(49715, 0, 1, FMOpl.ym3812_update_one);
                mixerstream  = new sound_stream(48000, 2, 0, null);
                break;

            case "PGM":
                latched_value      = new ushort[3];
                utempdata          = new ushort[3];
                sound_update       = sound_updatePGM;
                sound_update_timer = Timer.timer_alloc_common(sound_update, "sound_update", false);
                ICS2115.ics2115_start();
                ics2115stream = new sound_stream(33075, 0, 2, ICS2115.ics2115_update);
                mixerstream   = new sound_stream(48000, 2, 0, null);
                break;

            case "M72":
                latched_value      = new ushort[1];
                utempdata          = new ushort[1];
                sound_update       = sound_updateM72;
                sound_update_timer = Timer.timer_alloc_common(sound_update, "sound_update", false);
                YM2151.ym2151_init(3579545);
                DAC.dac_start();
                ym2151stream = new sound_stream(55930, 0, 2, YM2151.ym2151_update_one);
                dacstream    = new sound_stream(192000, 0, 1, DAC.DAC_update);
                mixerstream  = new sound_stream(48000, 3, 0, null);
                break;

            case "M92":
                latched_value      = new ushort[1];
                utempdata          = new ushort[1];
                sound_update       = sound_updateM92;
                sound_update_timer = Timer.timer_alloc_common(sound_update, "sound_update", false);
                YM2151.ym2151_init(3579545);
                Iremga20.iremga20_start();
                ym2151stream   = new sound_stream(55930, 0, 2, YM2151.ym2151_update_one);
                iremga20stream = new sound_stream(894886, 0, 2, Iremga20.iremga20_update);
                mixerstream    = new sound_stream(48000, 4, 0, null);
                break;
            }
            Timer.timer_adjust_periodic(sound_update_timer, update_frequency, update_frequency);
        }
Exemplo n.º 2
0
 public static void namcos1_update_DACs()
 {
     DAC.dac_signed_data_16_w(0, (ushort)(0x8000 + (dac0_value * dac0_gain) + (dac1_value * dac1_gain)));
 }
Exemplo n.º 3
0
 public static void m72_sample_w(byte data)
 {
     DAC.dac_signed_data_w(0, data);
     sample_addr = (sample_addr + 1) & (samplesrom.Length - 1);
 }