Compiling CsoundAV

(for expert programmers only)

At present time, the executables of CsoundAV are compiled using Microsoft Visual C++ Developer Studio version 5.0. The projects, workspaces and makefiles provided with the sources are generated with this compiler. A Developer Studio workspace can contain several projects (it is the case of CsoundAV workspace).

CsoundAV Workspace is provided with three main projects:

  1. CsoundVST (an attempt to turn Csound into a VST Plugin. This is a very alpha version, and I don't recommend to attempt to use it, because it is very unreliable and instable)
  2. CsoundAV_Con is the console-based version of CsoundAV
  3. CsoundAV_Win is the GUI version of CsoundAV

Both CsoundAV_Con and CsoundAV_Win projects are provided with four Configurations:

  1. Win32 Debug
  2. Win32 Release
  3. Win32 double Debug (64-bit floating point version)
  4. Win32 double Release (64-bit floating point version)

To build one or more targets of CsoundAV you can

If you are using Developer Studio, be sure to activate the correct project and Configuration first.

Even if later version of Visual C++ should be compatible with earlier ones, actually, this is not always true, since I noticed that many users run into difficulties when attempting to compile CsoundAV with a version of MSVC different from the 5.0. In this case you should reconstruct the Project by scratch, and  I give the following suggestions:

  1. Include all source files contained in the project of old MSVC version.
  2. Set all global macro #defines (for each project you intend to build)
  3. Set the runtime library type to Multithreaded
  4. Provide special libraries and include files (for DirectSound, EAX and Paintlib)
  5. Set alternative include directory paths and library paths (if you put the special libraries in a custom directory)
  6. Set particular compilation directives (different from project defaults) for some special files

1. Including source files

You can see the files to include by opening a project file (with extension .dsp) with a text editor and by observing included files having C, CPP, and CXX extension. For example:

# Begin Source File
SOURCE=.\DirectXcapture.c
# End Source File

# Begin Source File
SOURCE=.\DirectXout.c
# End Source File

# Begin Source File
SOURCE=.\DirectXset.c
# ADD CPP /D "INITGUID"
# End Source File

...... etcetera ......

You have to include all source files: this can be done by using the IDE interface by left-clicking the project name (in the following case "CsoundAV_Win files") and by choosing "Add Files to Project".

[Image]

A browse-file dialog-box will appear and you can select the files you intend to add to the project. [Image]

I don't know if later versions of MSVC allow the same procedure.

2. Setting global #defines macros

Next pass is to provide the correct settings for the project. You can do this by selecting the "Project-settings" options. A dialog box will appear, and you have to select the "C/C++" tab.

[Image]

In the "Preprocessor definitions" text field you have to put the following macro definitions:

For CsoundAV_Con project:

Win32 Debug Configuration:
WIN32, _DEBUG, _CONSOLE, _MBCS, _WINDOWS, SFIRCAM, PIPES, MACROS, RTAUDIO, MSVC, GAB_RT, STRICT, GAB_EAX
Win32 Release Configuration:
WIN32, NDEBUG, _CONSOLE, _MBCS, _WINDOWS, SFIRCAM, PIPES, MACROS, RTAUDIO, MSVC, GAB_RT, STRICT, GAB_EAX
Win32 double Debug Configuration:
WIN32, _DEBUG, _CONSOLE, _MBCS, _WINDOWS, SFIRCAM, PIPES, MACROS, RTAUDIO, MSVC, GAB_RT, STRICT, GAB_EAX, MYFLT=double
Win32 double Release Configuration:
WIN32, NDEBUG, _CONSOLE,_MBCS, _WINDOWS, SFIRCAM, PIPES, MACROS, RTAUDIO, MSVC, GAB_RT, STRICT, GAB_EAX, MYFLT=double

For CsoundAV_Win project:

Win32 Debug Configuration:
WIN32, _DEBUG, _WINDOWS, SFIRCAM, PIPES, MACROS, RTAUDIO, MSVC, GAB_RT, STRICT, GAB_EAX, GAB_WIN, RESET
Win32 Release Configuration:
WIN32, NDEBUG, _WINDOWS, SFIRCAM, PIPES, MACROS, RTAUDIO, MSVC, GAB_RT, STRICT, GAB_EAX, GAB_WIN, RESET
Win32 double Debug Configuration:
WIN32, _DEBUG, _WINDOWS, SFIRCAM, PIPES, MACROS, RTAUDIO, MSVC, GAB_RT, STRICT, GAB_EAX, GAB_WIN, RESET, MYFLT=double
Win32 double Release Configuration:
WIN32, NDEBUG, _WINDOWS, SFIRCAM, PIPES, MACROS, RTAUDIO, MSVC, GAB_RT, STRICT, GAB_EAX, GAB_WIN, RESET, MYFLT=double

3. Setting Runtime Library Type

You have to set the runtime library to "Debug Multithreaded" for "Win32 Debug" and "Win32 double Debug" configurations and "Multithreaded" for "Win32 Release" and "Win32 double Release" configurations:

[Image]

4. Providing special libraries

Special libraries are needed to make a full compilation of CsoundAV. These libraries (together with their include files) should be put in MSVC include directory and lib directory or in a custom user path. In the last case you have to provide this path to each project.

The required libraries are:

Microsoft DirectSound libraries:

dsound.h and dsound.lib got from Microsoft DirectX 7.0 SDK (or later version)

EAX 2.0:  

eax.h,   eax.lib and eaxguid.lib
You can get the EAX 2.0 SDK at the following URL:
http://developer.soundblaster.com/dev-resources/
note: you can avoid to provide this library if you don't have a soundblaster Live or you don't intend to use EAX 3D sound extensions in CsoundAV. To do that, simply delete the GAB_EAX macro define in the corresponding project

Paintlib:

all include files of paintlib plus paintlib.lib, libtiff.lib, libjpeg.lib, libpng.lib
You can get paintlib sources at the following URL:
http://www.paintlib.de/paintlib/

FLTK:

all include files of FLTK (Fast Light Tool Kit) plus fltk.lib (for release version) or fltkd.lib (for debug version). You can download FLTK at the following URL: http://www.fltk.org/

OpenGL:

all include files of OpenGL, GLUT and GLU plus opengl32.lib and glut32.lib. You have to download the GLUT library. There are several internet sites that provide it. Make a web search to find it.

GLE:

gle.h and gle.lib at http://www.linas.org/gle

Once you placed the include and lib files in a directory, you have to add the library to the link directory options. To do that, you have to select "Project-Settings" and the "Link" tab of the Settings dialog box, then filling the "Object/library modules" text field with the required libraries:

[Image]

...that are

dsound.lib eaxguid.lib winmm.lib wsock32.lib paintlib.lib libtiff.lib libjpeg.lib libpng.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib fltk.lib fltkgl.lib opengl32.lib glut32static.lib glu32.lib vfw32.lib

5. Setting additional directory paths for include files and libraries

If you placed the special library in a path different from ..\DevStudio\VC\lib and corresponding include files in a path different from ..\DevStudio\VC\include, you have to provide the custom directories where you placed these libraries, by setting corresponding path in the Project-Setting dialog box:

[Image]

... and ...

[Image]

6. Setting particular compilation directives (different from project defaults) for some special files

Some source files have project settings slightly different from project defaults. These are:

sfont.c

with this file you have to set "Struct member alignment" to "1 Byte":

[Image]

rtaudio2.c, aops.c and lptrkfns.c

probably due to a bug of MSVC 5.0 with these files you have to remove all speed optimizations except:
Generate Intrinsic Fuctions
Favor Fast Code
Frame Pointer Omission

[Image]

... otherwise some problems will rise during compilation or run-time.

DirectXset.c

you have to add the INIGUID define macro

[Image]