Compiling SndObj

Compiling the library

The library is compiled by using the Makefile included in the sources, which will need just a little editing to adjust it to the platform used:

  1. Choose the compiler: usually g++ for the GNU c++ compiler, but also CC on certain systems, when using a different compiler (for instance, MIPSPro on Irix). Just change g++ for CC, if necessary.
  2. Choose the realtime audio/midi define: -DWIN for Windows (currently under cygwin), -DOSS for OSS on Linux etc or -DSGI for Irix. If the platform you are building the library is not one of the above, leave the option in blank (none of the above).

Compiling a derived class

Supposing the derived class is declared in MyClass.h and implemented in MyClass.cpp, you can generate a binary object file with the following command:

g++ -O -c -I/usr/local/SndObj/include -oMyClass.o MyClass.cpp

This assumes that: a) the SndObj distribution directory is /usr/local/SndObj, b) a #include "MyClass.h" was added at the top of the MyClass.cpp file and c) g++ is the compiler being used.

The derived class is now compiled in MyClass.o

Compiling/linking an application

This supposes the application is called MyApp and its source file is MyApp.cpp. The SndObj distribution is, again, located in /usr/local/SndObj and the compiler is g++. If you are using realtime audio or midi, you will also have to include one of: -DWIN, -DOSS or -DSGI. This will depend on the platform you are using. Also, if you choose -DWIN, you will also need a -lwinmm at the end. In the case of -DSGI, you will need at least -lm,-laudio for realtime audio and -lmd for MIDI. If you are using a SndThread object, you will also need a -lpthread (SGI and OSS). On OSS you will also need need -DOSS (instead of -DSGI or -DWIN, and, of course, -lsndobj):

g++ -O -oMyApp -I/usr/local/SndObj/include -DOSS MyApp.cpp
-L/usr/local/SndObj/lib -lsndobj -lpthread

In case the derived class MyClass compiled above is used, then all you have to do is to add MyClass.o to the arguments above (not forgeting to include the relevant header file in MyApp.cpp):

g++ -O -oMyApp -I/usr/local/SndObj/include -DOSS MyApp.cpp MyClass.o
-L/usr/local/SndObj/lib -lsndobj


SndObj Library version 2.0
© Victor Lazzarini, 2001
Music Technology Laboratory
NUI Maynooth