CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Hybrid View

  1. #1
    Join Date
    Apr 2013

    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!

  2. #2
    Join Date
    May 2009

    Re: Create new array, the fast way

    Can't you use a separate array for the X data?

  3. #3
    Join Date
    Mar 2006

    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>.

  4. #4
    Join Date
    Apr 2013

    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!


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.