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

Update() public abstract method

Called periodically on a thread.
public abstract Update ( Action ReadStream ) : void
ReadStream Action
return void
        public abstract void Update(Action<short[]> ReadStream);

Usage Example

        /// <summary>
        ///
        /// </summary>
        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]);
                    }
                }
            });
        }
All Usage Examples Of CSPspEmu.Core.Audio.PspAudioImpl::Update