示例#1
0
        public override SIDVoice CreateVoice(int _voiceNo)
        {
            SIDVoice v = new SIDVoice();

            v.VoiceNo = _voiceNo;
            return(v);
        }
示例#2
0
        public override byte Read(int _fullAddress, bool _internal)
        {
            int ofs = _fullAddress - BaseAddress;

            switch (ofs)
            {
            case 27:     //  Oszillator Stimme 3
            {
                byte[] b = new byte[1];

                Random.NextBytes(b);
                return(b[0]);
            }

            case 28:     //  gain of voice #3
            {
                SIDVoice v   = GetVoice(2);
                byte     vol = (byte)(v.currGain * 15.0f);

                return(vol);
            }

            case 29:
            case 30:
            case 31:
            {
                return(0xfF);
            }
            }

            return(base.Read(_fullAddress, _internal));
        }
示例#3
0
        public override void Process(int _ticks)
        {
            TicksToWait -= _ticks;
            if (TicksToWait > 0)
            {
                return;
            }

            TicksToWait += 250; // microseconds

            int ticksElapsed = 250;

            // int ticksElapsed = _ticks;

            for (int i = 0; i < 3; i++)
            {
                SIDVoice v = GetVoice(i);
                if (v != null)
                {
                    v.Process(ticksElapsed);
                }
            }

            base.Process(ticksElapsed);
        }
示例#4
0
 public void SetSIDVolume(float _volume)
 {
     for (int i = 0; i < 3; i++)
     {
         SIDVoice v = GetVoice(i);
         v.SetVolume(_volume);
     }
 }
示例#5
0
        public override void Write(int _fullAddress, byte _val, bool _internal)
        {
            byte xval = Read(_fullAddress, true);

            base.Write(_fullAddress, _val, _internal);

            int ofs = _fullAddress - BaseAddress;

            ofs         %= 32;
            _fullAddress = BaseAddress + ofs;

            //  voices
            if ((ofs >= 0) && (ofs < 21))
            {
                int currVoice = 0;
                if (ofs >= 7)
                {
                    currVoice = 1;
                }
                if (ofs >= 14)
                {
                    currVoice = 2;
                }

                SIDVoice v = GetVoice(currVoice);
                v.Write(_fullAddress - BaseAddress, _val);
            }

            switch (_fullAddress)
            {
            case 0xd417:
            {
                FilterSettings = GetFilterSettings();
                break;
            }

            case 0xd418:
            {
                FilterSettings = GetFilterSettings();

                SetSIDVolume(FilterSettings.Volume);

                SIDVoice v = GetVoice(2);
                v.Mute = FilterSettings.Voice3Muted;

                break;
            }
            }
        }
示例#6
0
        public override void Reset()
        {
            Voice = new SIDVoice[3];

            Voice[0] = CreateVoice(1);
            Voice[1] = CreateVoice(2);
            Voice[2] = CreateVoice(3);

            Voice[0].SetGain(0);
            Voice[1].SetGain(0);
            Voice[2].SetGain(0);

            Random = new Random((int)DateTime.Now.Ticks);

            for (int i = 0; i < 3; i++)
            {
                SIDVoice v = GetVoice(i);
                if (v != null)
                {
                    v.Reset();
                }
            }
        }