[Stk] RtAudio - Read entire file to memory
Stephen Sinclair
sinclair at music.mcgill.ca
Tue Mar 30 04:32:55 PDT 2010
On Tue, Mar 30, 2010 at 12:10 PM, TJF <tjfoerster at web.de> wrote:
> Yes Steve, you understand correctly.
>
> Now I've added "buffer" to the OutputData struct (s.b.). But how can I
> "copy it into
> outputBuffer"?
Note, you'll have to also put the file size "count" into OutputData,
and a position tracker, I'll call it "position", which should be
initialized to zero.
Then something like, (not tested):
------------------------------------
// Interleaved buffers
int output( void *outputBuffer, void *inputBuffer, unsigned int nBufferFrames,
double streamTime, RtAudioStreamStatus status, void *data )
{
int i;
OutputData *oData = (OutputData*) data;
MY_TYPE *out = (MY_TYPE *)outputBuffer;
MY_TYPE *buf = &((MY_TYPE *)oData->buffer)[oData->position];
for (i=0; i < nBufferFrames; i++) {
if (oData->position < oData->count) {
*out++ = *buf++;
++oData->position;
} else
*out++ = 0.0;
}
return (oData->position >= oData->count);
}
------------------------------------
Steve
More information about the Stk
mailing list