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);
}