Advertisement
Guest User

Untitled

a guest
Apr 28th, 2015
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.59 KB | None | 0 0
  1. public int Read(float[] buffer, int offset, int count)
  2.         {
  3.             int samplesRead = source.Read(buffer, offset, count);
  4.             // TODO: examine and optionally change the contents of buffer
  5.  
  6.             stereo2mono(ref buffer);
  7.  
  8.             return samplesRead;
  9.         }
  10.  
  11.         private void stereo2mono(ref float[] buffer)
  12.         {
  13.             for (int i = 0; i < buffer.Count(); i = i + 2)
  14.             {
  15.                 float temp = buffer[i] + buffer[i + 1];
  16.                 buffer[i] = temp / 2;
  17.                 buffer[i + 1] = temp / 2;
  18.             }
  19.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement