ofSoundPlayer and audioOut

Hi, I’m currently adapting an ambisonic library for sound spatialization.
I’m trying to do examples that don’t need other addons but I’ve found no way to access the data of ofSoundPlayer. I dug into the code but found nothing that wouldn’t alter the core of oF.
Here’s what I’m trying to do in pseudo code:

void ofApp::audioOut(float * output, int bufferSize, int nChannels) {

for (int i = 0; i < bufferSize; i++) {
audioBuffer[i] = soundPlayer.playCurrentSample();
output[i] = audioFx.process(audioBuffer[i]);
}
}

I’m using oF 0.8.4.
I know there is a soundBuffer object in oF 0.9.0, but haven’t tested it yet.
Is there any solution other then implementing my own soundplayer or using other addons?

Hello @cabral1349,

You would want to preload wave files into RAM to be able to use the ‘audioOut’ callback with an ofSoundStream. That way you work more ‘closely’ with the audio hardware. Check the ofxMaxim or ofxStk addons/toolkits for more info. They provide means of loading and writing audiofiles getting the audio (double) data to feed the callback.
I use STK extensively in a project and it’s a very stable way of working in direct with the audio. It also provides some effects like delay and reverb, …

Best,
V

Hi @Vjacobs,
i know what I’ve to do and have used ofxMaxim and ofxStk (sorry, that wasn’t clear in the original post). I like them very much, but I want to load a wave into RAM without having to uese any addons.
This is because I’m working in the examples for a future addon and would like them to work without other addons for simplicity purposes, though the addon works very well with ofxMaxim and OfxStk

Any ideas in that regard?

Thanks,
Claudio