PageRenderTime 74ms CodeModel.GetById 35ms RepoModel.GetById 0ms app.codeStats 0ms

/doc/doxygen/compile.txt

https://github.com/devNaroo/stk
Plain Text | 127 lines | 98 code | 29 blank | 0 comment | 0 complexity | 601e8776f240d9afbe12e706053b5756 MD5 | raw file
  1. /*! \page compile Compiling
  2. The Synthesis ToolKit can be used in a variety of ways, depending on your particular needs. Some people choose the classes they need for a particular project and copy those to their working directory. Others create <TT>Makefiles</TT> that compile project-specific class objects from common <TT>src</TT> and <TT>include</TT> directories. And still others like to compile and link to a common library of object files. STK was not designed with one particular style of use in mind.
  3. \section rtvsnonrt "Realtime" vs. "Non-Realtime"
  4. Most of the Synthesis ToolKit classes are platform independent. That
  5. means that they should compile on any reasonably current C++ compiler.
  6. The functionality needed for realtime audio and MIDI input/output, as
  7. well as realtime control message acquistion, is inherently platform
  8. and operating-system (OS) <I>dependent</I>. STK classes that require
  9. specific platform/OS support include RtAudio, RtWvOut, RtWvIn,
  10. RtDuplex, RtMidi, InetWvIn, InetWvOut, Socket, UdpSocket, TcpServer,
  11. TcpClient, Thread, and Mutex. These classes currently can only be
  12. compiled on Linux, Macintosh OS X, and Windows systems.
  13. Without the "realtime" classes, it is still possible to read SKINI
  14. scorefiles for control input and to read and write to/from a variety
  15. of audio file formats (WAV, SND, AIFF, MAT-file, and RAW). If
  16. compiling for a "little-endian" host processor, the
  17. <TT>__LITTLE_ENDIAN__</TT> preprocessor definition should be provided.
  18. \section unix Unix Systems:
  19. STK compiles with realtime support on the following flavors of the Unix operating system: Linux, Irix, and Macintosh OS X. Aside from differences in compilers, audio/MIDI APIs, and host endianness, the steps necessary to compile STK programs and classes on these platforms are the same. The following table summarizes these differences.
  20. <CENTER>
  21. <TABLE BORDER=2 COLS=5 WIDTH="100%">
  22. <TR BGCOLOR="beige">
  23. <TD WIDTH="5%"><B>OS:</B></TD>
  24. <TD WIDTH="5%"><B>Realtime Audio/MIDI API:</B></TD>
  25. <TD WIDTH="5%"><B>Preprocessor Definition:</B></TD>
  26. <TD WIDTH="5%"><B>Library or Framework:</B></TD>
  27. </TR>
  28. <TR>
  29. <TD>Linux</TD>
  30. <TD>ALSA</TD>
  31. <TD>__LINUX_ALSA__, __LITTLE_ENDIAN__</TD>
  32. <TD><TT>asound, pthread</TT></TD>
  33. </TR>
  34. <TR>
  35. <TD>Linux</TD>
  36. <TD>OSS (version 4.0 only, use ALSA for MIDI support)</TD>
  37. <TD>__LINUX_OSS__, __LINUX_ALSA__, __LITTLE_ENDIAN__</TD>
  38. <TD><TT>asound, pthread</TT></TD>
  39. </TR>
  40. <TR>
  41. <TD>Linux and Macintosh OS-X</TD>
  42. <TD>Jack</TD>
  43. <TD>__UNIX_JACK__, __LITTLE_ENDIAN__</TD>
  44. <TD><TT>asound, pthread, jack</TT></TD>
  45. </TR>
  46. <TR>
  47. <TD>Macintosh OS X</TD>
  48. <TD>CoreAudio</TD>
  49. <TD>__MACOSX_CORE__</TD>
  50. <TD><TT>pthread, CoreAudio, CoreMidi, CoreFoundation</TT></TD>
  51. </TR>
  52. </TABLE>
  53. </CENTER>
  54. The available C++ compilers on any of these systems can vary.
  55. One approach in using STK is to simply copy the class files needed for
  56. a particular program into a project directory. Taking the
  57. <TT>sineosc.cpp</TT> example from the previous tutorial chapter, it
  58. would be necessary to set up a directory that includes the files
  59. <TT>sineosc.cpp</TT>, the rawwave file <TT>sinewave.raw</TT> in a
  60. subdirectory called <TT>rawwaves</TT>, and the header and source files
  61. for the classes Stk, FileRead, FileWrite, FileWvIn, FileLoop, and
  62. FileWvOut. The program could then be compiled on a little-endian
  63. system, such as a PC running Linux, using the GNU g++ compiler as
  64. follows:
  65. \code g++ -Wall -D__LITTLE_ENDIAN__ -o sineosc Stk.cpp FileRead.cpp FileWrite.cpp FileWvIn.cpp FileLoop.cpp FileWvOut.cpp sineosc.cpp \endcode
  66. Note that the <TT>sineosc.cpp</TT> example does not make use of realtime audio or MIDI input/output classes. For programs using any of the STK realtime classes mentioned above, it is necessary to specify an audio/MIDI API preprocessor definition and link with the appropriate libraries or frameworks.
  67. When working with a number of different projects that make use of ToolKit classes, the above approach can become cumbersome (especially when trying to synchronize with new STK releases). Most of the STK projects (e.g., demo, effects, ...) contain <TT>Makefiles</TT> (built by the configure script) that compile project-specific class objects from the distribution <TT>src</TT> and <TT>include</TT> directories. This approach makes it relatively easy when upgrading to a new STK release (by making path substitutions in the <TT>Makefile</TT> or by moving the projects to a similar relative path within the new STK source tree). A <TT>Makefile</TT> is provided in the <TT>projects/examples</TT> directory for compiling all the tutorial programs, as well as other example programs. To compile the <TT>sineosc.cpp</TT> program, for example, one need only type <TT>make sineosc</TT> from within the <TT>projects/examples</TT> directory.
  68. \subsection library Library Use:
  69. The STK distribution provides a <TT>Makefile</TT> that can be used on Unix systems to build a static library. After unpacking the distribution (<TT>tar -xzf stk-4.x.x.tar.gz</TT>), run the configure script by typing <TT>./configure</TT> from the top level distribution directory (see the INSTALL file in the same directory for more information). Then from within the <TT>src</TT> directory, type <TT>make</TT>. After a successful build, you may wish to move the library (<TT>libstk.a</TT>) and the contents of the <TT>include</TT> directory to standard library and include search paths on your system. For example, the linux RPM distribution of STK puts the library in <TT>/usr/lib/</TT> and the STK header files in <TT>/usr/include/stk/</TT>.
  70. Assuming the library is located in a standard search path and the header files are located in <TT>/usr/include/stk/</TT>, the <TT>sineosc.cpp</TT> example from the previous tutorial chapter can be compiled on a little-endian system using the GNU g++ compiler as follows:
  71. \code
  72. g++ -Wall -D__LITTLE_ENDIAN__ -I/usr/include/stk -o sineosc sineosc.cpp -lstk
  73. \endcode
  74. With the header files in a standard search path, it is possible to modify the <TT>\#include</TT> statements in the <TT>sineosc.cpp</TT> program as follows:
  75. \code
  76. #include "stk/FileLoop.h"
  77. #include "stk/FileWvOut.h"
  78. \endcode
  79. and then compile without an explicit include path argument to the compiler:
  80. \code
  81. g++ -Wall -D__LITTLE_ENDIAN__ -o sineosc sineosc.cpp -lstk
  82. \endcode
  83. \section compileWin Windows:
  84. STK has been tested on Windows platforms using the Visual .NET compiler
  85. only. It is assumed here that you're familiar with Visual C++ and its
  86. particular idiosyncrasies. STK won't compile in Visual C++ 6.0 any more.
  87. The approach when using Visual C++ is to build a project that
  88. includes the necessary ToolKit files from the distribution
  89. <TT>src</TT> and <TT>include</TT> directories. For the example
  90. program from the previous tutorial chapter, create a VC++ console
  91. application project, add the Stk, FileRead, FileWrite, WvIn, FileWvIn,
  92. FileLoop, WvOut, and FileWvOut class files, as well as
  93. <TT>sineosc.cpp</TT>, and make sure the <TT>sinewave.raw</TT> file is
  94. in the subdirectory <TT>rawwaves</TT>.
  95. For programs using any of the STK realtime classes mentioned above, it is necessary to link with the DirectSound (<TT>dsound.lib</TT>), <TT>winmm.lib</TT>, and <TT>Wsock32.lib</TT> libraries, select the multithreaded library, and provide the <TT>__LITTLE_ENDIAN__</TT>, <TT>__WINDOWS_DS__</TT>, and <TT>__WINDOWS_MM__</TT> preprocessor definitions.
  96. For Steinberg ASIO support, use the <TT>__WINDOWS_ASIO__</TT> preprocessor definition (and the <TT>__WINDOWS_MM__</TT> definition for RtMidi support), include all the files in the <TT>src/asio/</TT> directory (i.e., <TT>asio.h,cpp</TT>, <TT>asiodrivers.h,cpp</TT>, ...), and link with the <TT>winmm.lib</TT>, and <TT>Wsock32.lib</TT> libraries.
  97. [<A HREF="tutorial.html">Main tutorial page</A>] &nbsp; [<A HREF="filtering.html">Next tutorial</A>]
  98. */