Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You need to pass it a <code>float **</code>, i.e. pointer to pointers to floats. The <code>const</code>s just tell you that the function isn't going to modify any of the values being pointed to.</p> <p>If you have a potentially variable number of channels <code>nChannels</code>, of <code>bufferSize</code> floats per channel, then you could set up the necessary storage with e.g.</p> <pre><code>float **data = new float *[nChannels]; for (int c = 0; c &lt; nChannels; ++c) { data[c] = new float[bufferSize]; } </code></pre> <p>after which <code>data</code> is in the right format to pass to this function. (The function knows how big these things are, because you have previously provided the channel count and block size to the plugin constructor.)</p> <p>Your example code shows you have a single-pointer <code>float *</code>, which suggests you might be starting with data in an interleaved format (i.e. alternating channel values within a single array). If that's the case, you will need to de-interleave into separate channels in order to pass to the <code>process</code> function:</p> <pre><code>for (int i = 0; i &lt; bufferSize; ++i) { for (int c = 0; c &lt; nChannels; ++c) { data[c][i] = input[i * nChannels + c]; } } myPlugin-&gt;process(data, rt); </code></pre> <p>Finally, don't forget to <code>delete[]</code> the member pointers as well as the double pointer afterwards.</p> <pre><code>for (int c = 0; c &lt; nChannels; ++c) { delete[] data[c]; } delete[] data; </code></pre> <p>If, on the other hand, you know that you will only ever have a single channel of data -- and you have supplied 1 as the channel count in the plugin constructor -- then you can just do an extra indirection as others have suggested:</p> <pre><code>myPlugin-&gt;process(&amp;input, rt); </code></pre> <p>(disclosure: I wrote the code that was confusing the questioner)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload