Hi all, I’m looking for a way to access the current audio mix, or buffer of samples, of whatever sounds I have playing through ofSoundPlayer. Ideally I’d like to get a mix of the current samples, a composite of all of the sounds currently playing so that I might save the samples to disk.
Is there any way to do this with stock OF? if not is there a simple solution to be had by hacking into the underlying sound library? I’m looking into it now, but if anyone can save me some time, I’d be much obliged.
The best way I’ve come up with to do this is to add an FMOD DSP into the mix at the system level which acts as a passthrough and saves the incoming buffer into a user accessible vector. It works perfectly, but the problem is I had to modify the ofFmodSoundPlayer.h/cpp. Ideally I would be able to make a DSP addon which can be tacked on without modifying the oF source. however, I dont know of any way to tap into the FMOD system from outside of these files, as the pointer to the fmod system object is declared as static.
static FMOD_SYSTEM * sys;
Does anyone with more FMOD chops than me know a way to do this? this solution is fine for me, but it would be really nice to have a DSP addon that can be used with ofSoundPlayer. Or maybe DSPs can be added to the core at some point, it doesn’t look like it would be that difficult to do, im not sure about an OpenAL equivalent though.
I’m attaching the modified files if anyone is interested.
I’ve had to do similar things with FMOD to get at some of its functionality, 3D positioning of sounds in particular. The cleanest way I found was to subclass ofFmodSoundPlayer and then instantiate that (so it has access to the FMOD_SYSTEM pointer) I’m sure you could do the same thing with Maximilian (https://github.com/micknoise/Maximilian/tree/master/ofxMaxim) but you lose some of the file loading friendliness of FMOD. You
joshua, subclassing ofFmodSoundPlayer sounds promising, but I’m getting stuck. I still can’t use the sys pointer because it was declared as static in the .cpp file, and never in the .h.
I’ve tried using the extern keyword but then the linker says it cant find the sys symbol.