Hi guys. I have created a very simple convolution audio application (im a beginner). The code to load the Impulse response into the class is like so :
IRfile.getCurrentWorkingDirectory().getChildFile(“MyImpulse.wav”), false, true, maxSize);
So, as far as I understand, it looks to the working directory of my newly created file, and looks for a file named" MyImpulse.wav". And it works like a charm when run from the IDE. However, when I build the actual standalone application, and include the impulse Wav file to the applications directory, it gets completely bypassed, leaving only a dry signal. I can only assume it can’t actually find the wav file.
Could anyone share any insight into this?
The working directory is not guaranteed to be the same directory where the executable file is. Use File::getSpecialLocation with currentExecutableFile instead.
Thank you for your reply! Okay, so I’m trying it like this:
convEngine.loadImpulseResponse(IRFile.getSpecialLocation(File::currentExecutableFile).getChildFile(“IR.wav”), false , true , 0);
However, it doesn’t work when run from either the IDE, or the standalone applications. Tried for both release and debug builds, with the wav files definitely included in the directories. Really unsure of what’s happening here, Unless I’m making some obvious syntactical error, it should at least load it in the IDE, since the previous implementation was fetching the file.
my .wav file is in the same exact directory level as the executable, so I tried .getSiblingFile as well, but to no avail.
You are calling a static function, when you do the
The correct call should look like:
File::getSpecialLocation (File::currentExecutableFile).getSiblingFile ("IR.wav").
Next remark, for a first test I use a folder that I know for sure it exists and I know where it is: user desktop:
auto impulsFile = File::getSpecialLocation (File::userDesktopDirectory).getChildFile ("IR.wav");
convEngine.loadImpulseResponse (impulsFile, false , true , 0);
Once that works I move to a folder I can bundle easier, like the one you tried…
After changing to the static member function it seems to work for both builds! Not sure why this is the case, but I have a new priority topic to study and understand better.
Thank you very much for the advice.
That made it work for me!!
Take that back, the desktop worked, but not using currentExecutableFile