I wanted to capture audio through microphone in C/C++. After searching a lot i decided to go for OpenAL, an open source library for audio manipulation operations. I have just started with it. Here is the procedure i followed to get my first OpenAL code working. (I am using MS Visual Studio 2008 compiler on windows).
Official Site for OpenAL downloads: http://connect.creativelabs.com/openal/Downloads/Forms/AllItems.aspx
Download the following files:
3. ALUT > freealut-1.1.0-src (Windows Source)
ALUT is a starting point for learning OpenAL. Contains simple programs to get familiar with OpenAL.
and extract all.
Working with OpenAL
1. Install OpenAL “oalinst.exe”. Its very small.
2. Install OpenAL “OpenAL11CoreSDK.exe”. Check if u got the folder named “C:\Program Files\OpenAL 1.1 SDK”
3. Open Visual Studio. Goto Tools> Options> Project & solutions> VC++ Directories.
–> Show directories for Library files.
Add “C:\Program Files\OpenAL 1.1 SDK\libs\Win32”.
Building the “freealut” project
1. Go to “freealut-1.1.0-src\admin\VisualStudioDotNET” folder & open “ault.sln”. If it is in previous version of Visual Studio, it’ll ask to convert to VC9. Do it.
There will be 3 projects in the solution file:
2. For each of the projects, go to “Project > Properties” and make the following modification:
Configuration Properties> C/C++ > General > Additional Include directiories:
change “C:\Program Files\OpenAL 1.1 with EFX SDK\include” to “C:\Program Files\OpenAL 1.1 SDK\include” (the exact pathname where OpenAL SDK is installed).
Remember to do this for Debug and Release modes.
3. I prefer to have the generated output .exe files to be in a separate folder near the solution file.
So change the Output Directory in “Configuration properties > General” to “..\Debug” (for Debug mode) and “..\Release” (for Release mode).
Now if u build (F7) the solution, u’ll get the corresponding output .exe files in the “Debug” or “Release” folder in the directory where the .sln is present.
Double click “hello_world.exe” to HEAR “hello world”!
“playfile.exe” needs to be run from command prompt with a audio .wav file as argument. eg: C:..\Debug>playfile file1.wav