/** Adds a single frame of sound data to the buffer */
        public void OutputSound(IAudioOutput audioOutput)
        {
            if (soundEnabled)
            {
                return;
            }

            int numChannels = 2;             // Always stereo for Game Boy
            int numSamples  = audioOutput.GetSamplesAvailable();

            byte[] b = new byte[numChannels * numSamples];

            if (channel1Enable)
            {
                channel1.Play(b, numSamples, numChannels);
            }
            if (channel2Enable)
            {
                channel2.Play(b, numSamples, numChannels);
            }
            if (channel3Enable)
            {
                channel3.Play(b, numSamples, numChannels);
            }
            if (channel4Enable)
            {
                channel4.Play(b, numSamples, numChannels);
            }

            audioOutput.Play(b);
        }
Esempio n. 2
0
        /** Adds a single frame of sound data to the buffer */
        public void OutputSound(IAudioOutput audioOutput)
        {
            if (soundEnabled)
                return;

            int numChannels = 2; // Always stereo for Game Boy
            int numSamples = audioOutput.GetSamplesAvailable();

            byte[] b = new byte[numChannels * numSamples];

            if (channel1Enable)
                channel1.Play(b, numSamples, numChannels);
            if (channel2Enable)
                channel2.Play(b, numSamples, numChannels);
            if (channel3Enable)
                channel3.Play(b, numSamples, numChannels);
            if (channel4Enable)
                channel4.Play(b, numSamples, numChannels);

            audioOutput.Play(b);
        }