コード例 #1
0
        private IEnumerator yieldChunks(BigArray <float> data, int chunkSize, float chunkDuration)
        {
            int readHead = 0;

            while (readHead < data.Length)
            {
                int remainder = chunkSize;
                if (readHead + chunkSize >= data.Length)
                {
                    remainder = data.Length - readHead;
                }

                BigArray <float> temp = new BigArray <float>(remainder, 0);
                temp.Resize(remainder);
                temp.CopyFrom(data.Items, readHead * 4, 0, remainder * 4);
                AudioUtils.Resample(temp, testClip.frequency, AudioUtils.GetFrequency(ResampleFrequency));

                bufferReady(temp, AudioUtils.GetFrequency(ResampleFrequency));

                readHead += remainder;

                yield return(new WaitForSeconds(chunkDuration));
            }
        }