CSPspEmu.Core.Audio.PspAudio.Update C# (CSharp) Method

Update() public method

public Update ( ) : void
return void
        public void Update()
        {
            PspAudioImpl.Update((MixedSamples) =>
            {
                var RequiredSamples = MixedSamples.Length;
                fixed (short* MixedSamplesPtr = MixedSamples)
                {
                    var MixedSamplesDenormalized = stackalloc int[RequiredSamples];

                    foreach (var Channel in Channels)
                    {
                        var ChannelSamples = Channel.Read(RequiredSamples);

                        fixed (short* ChannelSamplesPtr = ChannelSamples)
                        {
                            for (int n = 0; n < ChannelSamples.Length; n++)
                            {
                                MixedSamplesDenormalized[n] += ChannelSamplesPtr[n];
                            }
                        }
                    }

                    for (int n = 0; n < RequiredSamples; n++)
                    {
                        MixedSamplesPtr[n] = StereoShortSoundSample.Clamp(MixedSamplesDenormalized[n]);
                    }
                }
            });
        }