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

sceAudioSRCChReserve() private method

private sceAudioSRCChReserve ( int SampleCount, int Frequency, int Channels ) : int
SampleCount int
Frequency int
Channels int
return int
        public int sceAudioSRCChReserve(int SampleCount, int Frequency, int Channels)
        {
            if (Frequency != 44100) throw (new Exception(String.Format("sceAudioSRCChReserve: {0}", Frequency)));
            var ValidFrequencies = new int[] { 0, 8000, 11025, 12000, 16000, 22050, 24000, 32000, 48000 };
            if (!ValidFrequencies.Contains(Frequency)) throw(new SceKernelException(SceKernelErrors.ERROR_AUDIO_INVALID_FREQUENCY));
            if (Channels == 4) throw (new SceKernelException(SceKernelErrors.PSP_AUDIO_ERROR_SRC_FORMAT_4));
            if (Channels != 2) throw (new SceKernelException(SceKernelErrors.ERROR_INVALID_SIZE));
            if (!PspAudio.SrcOutput2Channel.Available) throw (new SceKernelException(SceKernelErrors.ERROR_AUDIO_CHANNEL_ALREADY_RESERVED));
            if (!IsValidSampleCountOutput2(SampleCount)) throw (new SceKernelException(SceKernelErrors.ERROR_INVALID_SIZE));
            _sceAudioChReserve(() => PspAudio.SrcOutput2Channel, SampleCount, (Channels == 2) ? Core.Audio.PspAudio.FormatEnum.Stereo : Core.Audio.PspAudio.FormatEnum.Mono);
            PspAudio.SrcOutput2Channel.Frequency = Frequency;
            return 0;
        }