Hi,
maybe this is a stupid question, but I’m trying to get my head around C++ and the JUCE Framework for the first time and there so much going on with types, pointers and other stuff that I maybe missing some basics here. I hope you can help me.
I’m loading a sofa file with this particular library (GitHub - superkittens/libBasicSOFA: Basic library for spatial audio SOFA files) which is working fine and I’m getting back a pointer to a memory location where the HRIR sits.
Now I’m trying to get this HRIR into a AudioBuffer which I can feed into the Convolution.loadImpulseResponse() method. The problem is, that the pointer points to double. When I create a AudioBuffer I can’t get this buffer into the loadImpulseResponse() method. Is it possible to simply cast the double to float or is there a better way to do this?
Thank you for the help!
bool success = sofa.readSOFAFile("PATH_TO_FILE");
if (!success)
return;
auto samplingFrequency = sofa.getFs();
auto numSourcePositions = sofa.getM();
auto theta = 150.0;
auto phi = 0.0;
auto radius = 0.0;
auto channel = 0;
auto size = sofa.getN();
auto hrirBuffer = AudioBuffer<double>(sofa.getHRIR(channel, theta, phi, radius), 1, sofa.getN());
conv.loadImpulseResponse(hrirBuffer,
getSampleRate(),
dsp::Convolution::Stereo::no,
dsp::Convolution::Trim::yes,
dsp::Convolution::Normalise::no
);