Exemplo n.º 1
0
 /// <summary>
 /// Add remaining audio data to back buffer to be played in next audio thread cycles.
 /// </summary>
 private void AddToBackBuffer(int channels)
 {
     if (maxBackBufferSize > 0)
     {
         if (_index != -1 && _index < _clipData.Length)
         {
             float[] newBackBuffer = new float[_clipData.Length - _index];
             for (int i = _index; i < _clipData.Length / _clipChannels; i++)
             {
                 int clipChannel = 0;
                 while (clipChannel < _clipChannels)
                 {
                     newBackBuffer[(i - _index) * _clipChannels + clipChannel] = _clipData[i * _clipChannels + clipChannel];
                     clipChannel++;
                 }
             }
             BackBuffer bb = BackBufferFactory();
             if (bb)
             {
                 bb.SetData(newBackBuffer);
                 if (log)
                 {
                     print("New BackBuffer[" + newBackBuffer.Length + "] added. Total: " +
                           _activeBackBuffers.Count + "/" + _activeBackBuffers.Capacity);
                 }
             }
         }
     }
 }