CSPspEmu.Hle.Modules.audio.sceAudio._sceAudioChReserve C# (CSharp) Method

_sceAudioChReserve() private method

private _sceAudioChReserve ( Func ChannelGet, int SampleCount, PspAudio Format ) : int
ChannelGet Func
SampleCount int
Format CSPspEmu.Core.Audio.PspAudio
return int
        private int _sceAudioChReserve(Func<PspAudioChannel> ChannelGet, int SampleCount, PspAudio.FormatEnum Format)
        {
            if (!Enum.IsDefined(typeof(PspAudio.FormatEnum), Format))
            {
                throw (new SceKernelException(SceKernelErrors.ERROR_AUDIO_INVALID_FORMAT));
            }

            try
            {
                var Channel = ChannelGet();
                if (!Channel.Available) throw (new InvalidChannelException());
                Channel.Available = false;
                Channel.SampleCount = SampleCount;
                Channel.Format = Format;
                Channel.Updated();
                return Channel.Index;
            }
            catch (NoChannelsAvailableException)
            {
                throw (new SceKernelException(SceKernelErrors.ERROR_AUDIO_NO_CHANNELS_AVAILABLE));
            }
            catch (InvalidChannelException)
            {
                throw (new SceKernelException(SceKernelErrors.ERROR_AUDIO_INVALID_CHANNEL));
            }
        }

Same methods

sceAudio::_sceAudioChReserve ( int ChannelId, int SampleCount, PspAudio Format ) : int