Example #1
0
            /// <summary>
            ///
            /// </summary>
            /// <param name="parentModule"></param>
            /// <param name="noteOnEvent"></param>
            /// <param name="programNumber"></param>
            /// <param name="slot"></param>
            public GbSound(GB_APU parentModule, GBSoundManager manager, TimbreBase timbre, int tindex, TaggedNoteOnEvent noteOnEvent, int slot) : base(parentModule, manager, timbre, tindex, noteOnEvent, slot)
            {
                this.parentModule = parentModule;
                this.timbre       = (GBAPUTimbre)timbre;

                lastSoundType = this.timbre.SoundType;
                if (lastSoundType == SoundType.PSG && this.timbre.PartialReserveSPSG)
                {
                    partialReserveSpsg = 1;
                }
            }
Example #2
0
        /// <summary>
        ///
        /// </summary>
        public GB_APU(uint unitNumber) : base(unitNumber)
        {
            GainLeft  = DEFAULT_GAIN;
            GainRight = DEFAULT_GAIN;

            Timbres = new GBAPUTimbre[InstrumentBase.DEFAULT_MAX_TIMBRES];
            for (int i = 0; i < InstrumentBase.DEFAULT_MAX_TIMBRES; i++)
            {
                Timbres[i] = new GBAPUTimbre();
            }
            setPresetInstruments();

            this.soundManager = new GBSoundManager(this);
        }
Example #3
0
            /// <summary>
            ///
            /// </summary>
            /// <returns></returns>
            private (GB_APU inst, int slot) searchEmptySlot(TaggedNoteOnEvent note, GBAPUTimbre timbre)
            {
                var emptySlot = (parentModule, -1);

                switch (timbre.SoundType)
                {
                case SoundType.SPSG:
                {
                    emptySlot = SearchEmptySlotAndOffForLeader(parentModule, spsgOnSounds, note, 1);
                    break;
                }

                case SoundType.PSG:
                {
                    if (timbre.PartialReserveSPSG)
                    {
                        emptySlot = SearchEmptySlotAndOffForLeader(parentModule, psgOnSounds, note, 1);
                    }
                    else
                    {
                        emptySlot = SearchEmptySlotAndOffForLeader(parentModule, psgOnSounds, note, 2);
                    }
                    break;
                }

                case SoundType.WAV:
                {
                    emptySlot = SearchEmptySlotAndOffForLeader(parentModule, wavOnSounds, note, 1);
                    break;
                }

                case SoundType.NOISE:
                {
                    emptySlot = SearchEmptySlotAndOffForLeader(parentModule, noiseOnSounds, note, 1);
                    break;
                }
                }

                return(emptySlot);
            }