About the OggVorbis sound library
The OggVorbis sound library is one of the greatest sound libraries available on the net.
The advantages of OggVorbis are the same like those of the mp3 format.
- sound compression with (nearly) no loss of quality.
- easy to use and implement in applications
- SDK available
and the most important which makes OggVorbis our favorite sound library: it’s free. No royalties.
The last point is maybe the most important. While implementing mp3 sound in your applications means the payment of royalties to the Frauenhofer Institute in Germany, you can use OggVorbis for free. The SDK contains everything a developer dreams of.
Why not use other sound libraries like fmod or bass?
Sure the fmod library is a really great and advanced sound library and provides really everything for developers. It’s implementation is easy and its usage is great, but the disadvantage is, that you have to provide the dynamic link library with your application in order to use this. Now imagine you are developing a game or a game engine 🙂 and your design already includes enough libraries. Why not implementing the sound in one of your own without the need of an additional dll?
Why releasing a package
With installing the SDK you are ready to go for developing, as long as you use Microsoft Visual C++. If you want to use the OggVorbis SDK with MinGW you have to rebuild the libraries to readable format for the MinGW compiler. It was kind of work get this done, so we thought of providing this devpak to the public and below a step-by-step instruction on how to compile the OggVorbis stuff yourself.
What the DevPak contains
- the dynamic link libraries
- the documents provided from the original OggVorbis SDK
- the example code from the original OggVorbis SDK
- the header files in their appropriate folders
- the static libraries
For a detailed description what will be copied on your system, refer to the readme file included with the devpak.
What the SDK contains
The OggVorbis SDK contains the necessary header files for using the sound library and it contains the static and dynamic libraries. The static libs are divided in two parts. The first part includes all the libraries necessary to link to the dll’s the second part includes all libs for linking the sound stuff into your application. These libraries are specified with the word static which is included in the lib name before the extension. Example: ogg_static.lib If we take a closer look at these libraries we will recognize, that these libraries are not readable from the MinGW linker. They are for Visual C++ only, so we have to build these libraries manually. The good thing is, that you can use the libraries for dll linking since they are readable. That means that if you are going to use the dll’s provided with the SDK you don’t need to do the steps below. That also means, that you have to include the dll’s with your application and that is not the way we want to go on. So let’s build the libraries ourselves.
What do we need?
What we need is:
- the libogg source. Download the file libogg-1.1.zip at OggVorbis homepage
- the libvorbis source. Download the file libvorbis-1.0.1.zip at the same location as above.
- the MSYS package. Download the package at the MinGW site
- a modified version of the os_types.h header file which can be downloaded here
The first step
..is to install MSYS. This is a great collection of tools for MinGW and makes life easier.
After installing MSYS (by the way, MSYS stands for Minimal SYStem) unzip the libogg-1.1.zip and the libvorbis source on your harddisk (I would recommend you to unzip them in separate folders).
Now replace the file {MyDrive}:{MyFolder}libogg-1.1includeoggos_types.h with the new header file you downloaded at the above location. If you aren’t able to find the location of the file on your hard disk replace {MyDrive}:{MyFolder} with the drive and folder name you unzipped the SDK.
Now we are ready to go. Start the MSYS console with a double click on the icon on your desktop and switch to the root folder of the libogg SDK. The console prompt is UNIX like so some of you may have problems at first but believe me it’s easy and similar to DOS. Once you are in the root folder of your libogg SDK type the following into the console prompt:
$ configure –disable-shared
Now MSYS will do all the work for us, like checking the compiler version, running some tests etc…
When MSYS finished creating the makefiles we need type the following into the console prompt:
$ make
This will build at least the desired libraries we need. Watch the console output. If you followed the steps above no error should occur. Otherwise check if you really followed the steps above and use the recommended versions of the tools and packages we mentioned. Now the first step finished. Now we have to build the vorbis libraries.
The second step
Copy the ogg folder of your libogg-1.1include folder into your MinGW include folder. Go to your src.libs folder and copy the file libogg.a into your MinGW lib folder. NOTE: the library can directly be copied to the lib folder of your MinGW installation but you have to copy the complete folder ogg of your Include folder into your MinGW include folder. Switch on the MSYS console into your libvorbis-1.0.1 root folder. Type the following into your MSYS console prompt:
$ configure –disable-shared
Now MSYS will work again and build the makefiles for the vorbis SDK. If the console output reports an error, you most probably didn’t copy the ogg folder of your libogg-1.1include folder into your MinGW include folder. After finishing the makefiles and dependencies type the following into the MSYS console prompt:
$ make
Now the vorbis libraries are compiled. After finishing the compile process you should have a new directory within your libvorbis-1.0.1lib folder named .libs Switch into this directory and here you are the last libraries. Now let’s check if we did everything right.
In your libogg-1.1src.libs folder should be the following files:
- libogg.a
- libogg.la
- libogg.lai
In your libvorbis-1.0.1lib.libs folder should be the following files:
- libvorbis.a
- libvorbis.la
- libvorbis.lai
- libvorbisenc.a
- libvorbisenc.la
- libvorbisenc.lai
- libvorbisfile.a
- libvorbisfile.la
- libvorbisfile.lai
Congratulations, you have build all the static libraries to use the complete OggVorbis sound library with your application. Copy all the *.a files into your MinGW lib folder
Copy the folder:
– libogg-1.1include
– libvorbis-1.0.1include
into your MinGW include folder. You’re done. Happy programming. If you encountered any errors or are not able to compile after following the above steps, just mail us or head over to the forums. If you are too lazy to do the steps again download the compiled libraries from here.
Download: OggVorbis-win32sdk.7z