Ejemplo n.º 1
0
        /// <summary>
        /// 角度に対応するサウンドデータ取得
        /// WebGLでない場合はサブスレッドから実行される
        /// </summary>
        public void GetBlockBuffer(int angle, int sampleoffset, AudioClipStreamingPlayer.BlockBuffer buffer)
        {
            if (angle >= 0)
            {
                ImpulseResponses.Data data;
                data = ImpulseResponses.GetTransformedImpulseResponse(angle);
                overlapAddLeft.SetTransformedImpulseResponse(data.channelLX, data.channelLY);
                overlapAddRight.SetTransformedImpulseResponse(data.channelRX, data.channelRY);
            }
            else
            {
                overlapAddLeft.SetIdentifyImpulseResponse();
                overlapAddRight.SetIdentifyImpulseResponse();
            }

            waveAudioClip.GetData(bufferSample, sampleoffset, c.blockSamples);
            overlapAddLeft.Convolution(bufferSample);
            overlapAddRight.Convolution(bufferSample);
            float[] ret_l = overlapAddLeft.GetConvolution();
            float[] ret_r = overlapAddRight.GetConvolution();
            Buffer.BlockCopy(ret_l, 0, buffer.left, 0, c.blockSamples * SizeofFloat);
            Buffer.BlockCopy(ret_r, 0, buffer.right, 0, c.blockSamples * SizeofFloat);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// AudioClipStreamingPlayerからのコールバック
 /// 再生するサウンド情報を渡す
 /// </summary>
 public void GetBlockBuffer(int angle, int sampleoffset, AudioClipStreamingPlayer.BlockBuffer block)
 {
     waveAudioClip.GetData(block.left, sampleoffset, block.left.Length);
     waveAudioClip.GetData(block.right, sampleoffset, block.right.Length);
 }