Create new array, the fast way
Hi there,
I have a buffer of binary data (void*) of known length in bytes.
This buffer contains a chunk of audio data, stereo samples which are interleaved. So the buffer of audio data is essentially of the form -
[L R L R L R ...]
Where L is a left sample, and R is a right sample.
This audio data is placed in a circular buffer as raw binary data at the producer end, and re-interpreted as Signed Integer of 32 Bit at the Consumer end.
I would like to add some extra information to my initial buffer at the producer end. Essentially I would like to add an additional 'channel', though this will essentially be timing information.
So my buffer will become -
[L R X L R X L R X ...]
Where X is the timing information.
I have used an initial for-loop, to iterate over the buffer and populate a new array with the data. However it is too slow for real-time audio work.
Is there a fast way to create a new array from an existing array i.e to perform the following quickly -
[L R L R L R ...] -> [L R X L R X L R X ...]
Thanks for any tips!
Re: Create new array, the fast way
Can't you use a separate array for the X data?
Re: Create new array, the fast way
This sounds (no pun intended) like it might be a good candidate for offloading to the GPU. If you are using Visual Studio 2012 you can use AMP <http://msdn.microsoft.com/en-us/libr.../hh265136.aspx>. Otherwise you could use OpenCL or Cuda. Apparently a cross-platform version of AMP is in the works <http://www.phoronix.com/scan.php?pag...tem&px=MTIyOTk>.
Re: Create new array, the fast way
Hi there,
Thanks for your answers. I thinking some kind of parallel array might be the best option for now.. I will go with that for now!
Thanks!