Construct_Internal() private method

private Construct_Internal ( ) : AudioClip
return AudioClip
Example #1
0
        public static AudioClip Create(string name, int lengthSamples, int channels, int frequency, bool stream, AudioClip.PCMReaderCallback pcmreadercallback, AudioClip.PCMSetPositionCallback pcmsetpositioncallback)
        {
            if (name == null)
            {
                throw new NullReferenceException();
            }
            if (lengthSamples <= 0)
            {
                throw new ArgumentException("Length of created clip must be larger than 0");
            }
            if (channels <= 0)
            {
                throw new ArgumentException("Number of channels in created clip must be greater than 0");
            }
            if (frequency <= 0)
            {
                throw new ArgumentException("Frequency in created clip must be greater than 0");
            }
            AudioClip audioClip = AudioClip.Construct_Internal();

            if (pcmreadercallback != null)
            {
                audioClip.m_PCMReaderCallback += pcmreadercallback;
            }
            if (pcmsetpositioncallback != null)
            {
                audioClip.m_PCMSetPositionCallback += pcmsetpositioncallback;
            }
            audioClip.Init_Internal(name, lengthSamples, channels, frequency, stream);
            return(audioClip);
        }
Example #2
0
        public static AudioClip Create(string name, int lengthSamples, int channels, int frequency, bool stream, AudioClip.PCMReaderCallback pcmreadercallback, AudioClip.PCMSetPositionCallback pcmsetpositioncallback)
        {
            bool flag = name == null;

            if (flag)
            {
                throw new NullReferenceException();
            }
            bool flag2 = lengthSamples <= 0;

            if (flag2)
            {
                throw new ArgumentException("Length of created clip must be larger than 0");
            }
            bool flag3 = channels <= 0;

            if (flag3)
            {
                throw new ArgumentException("Number of channels in created clip must be greater than 0");
            }
            bool flag4 = frequency <= 0;

            if (flag4)
            {
                throw new ArgumentException("Frequency in created clip must be greater than 0");
            }
            AudioClip audioClip = AudioClip.Construct_Internal();
            bool      flag5     = pcmreadercallback != null;

            if (flag5)
            {
                audioClip.m_PCMReaderCallback += pcmreadercallback;
            }
            bool flag6 = pcmsetpositioncallback != null;

            if (flag6)
            {
                audioClip.m_PCMSetPositionCallback += pcmsetpositioncallback;
            }
            audioClip.CreateUserSound(name, lengthSamples, channels, frequency, stream);
            return(audioClip);
        }