You get the dependency error because portaudio dll file cannot be found. This can be fixed with the following steps:
- Inside the folder with the code to be compiled, create a subfolder, let's say resources, where you copy the portaudio dll files from the PsychSound folder.
- Inside the folder with the code to be compiled create a copy of the InitializePsychSound.m file renamed InitializePsychSound2compile.m
- Edit InitializePsychSound2compile.m to point PsychtoolboxRoot to the resources folder, by adding the following line to the top of the InitializePsychSound2compile function
PsychtoolboxRoot = 'resources/';
- In the code where psychportaudio is needed, use InitializePsychSound2compile instead of the original InitializePsychSound.m.
- You may also need to delete the PsychHardware folder from the psychtoolbox folder before attempting to compile - unless, of course, your code requires code from that folder.
When using your compiled code, make sure that the resources folder is always a subfolder in the folder you have the resulting executable file.
You can run your compiled code directly, or you can run it through the command line, which will allow you to see warnings, errors and output to standard output. On Windows, you can create a .cmd file to call your aplication, using
call yourappname.exe
You can of course create a desktop link to the .cmd file for ease of access.