The STK (abbreviation for 'Systhesis ToolKit') is a free C++ audio library.
Installing the STK
Under Ubuntu and Lubuntu, the STK can be installed from Ubuntu's Software Center:
sudo apt-get install libstk0-dev
Adding STK to the project file
In Qt Creator, to be able to use the STK, add the following lines to your project file:
INCLUDEPATH += /usr/include/stk LIBS += -L/usr/lib -lstk -lrtaudio
Thanks to Michael Jenkinson for his '-lrtaudio' suggestion in the project file.
STK examples
Critique on STK
The STK is the only audio library I got to produce beeps from source code.
It hurts me that I have much critique on the coding style of the STK:
- The STK is not const correct. One should use const whenever possible/feasible [1][2][3][4][5][6]. One should be const correct [7][8][9][10].
- The STK uses the keyword register. In this case, one should not use register [11].
- The STK uses C-style casts. One should use C++ style casts [12][13].
- Bjarne Stroustrup. The C++ Programming Language (3rd edition). ISBN: 0-201-88954-4 7.9.3: 'Use const extensively and consistently'.
- Scott Meyers. Effective C++ (3rd edition).ISBN: 0-321-33487-6. Item 3: 'Use const whenever possible'.
- Jarrod Hollingworth, Bob Swart, Mark Cashman, Paul Gustavson. Sams C++ Builder 6 Developer's Guide. ISBN: 0-672-32480-6. Chapter 3: 'Understand and use const in your code'.
- Jesse Liberty. Sams teach yourself C++ in 24 hours. ISBN: 0-672-32224-2. Hour 8, chapter 'Const member functions': 'Use const whenever possible.'.
- Scott Meyers. Effective C++ (3rd edition). ISBN: 0-321-33487-6. Item 2: 'Prefer consts, enums and inlines to #defines'.
- Herb Sutter, Andrei Alexandrescu. C++ coding standards: 101 rules, guidelines, and best practices. ISBN: 0-32-111358-6. Item 15: 'Use const proactively'.
- Herb Sutter. Exceptional C++ style. 2005. ISBN: 0-201-76042-8. Item 1 guideline: 'Be const correct'.
- Marshall Cline, Greg Lomow and Mike Girou. C++ FAQs. ISBN: 0-201-3098301. FAQ 14.05: 'Is const correctness tedious?' (Answer: no).
- The C++ FAQ Lite. Item 18.1: What is 'const correctness' (Answer: 'A good thing')?
- Bruce Eckel. Thinking in C++, second edition, volume 1. 2000. ISBN: 0-13-979809-9. Item 8: 'Constants', paragraph 'Summary': 'const-correctness can be a lifesaver for projects'.
- Herb Sutter. Exceptional C++ style. 2005. ISBN: 0-201-76042-8. Item 28 guideline: 'Never write register [...]'.
- Bjarne Stroustrup. The C++ Programming Language (3rd edition). ISBN: 0-201-88954-4 6.5.5: 'When explicit type conversion is necessary, prefer the more specific cast operators to the C-style cast'.
- Herb Sutter, Andrei Alexandrescu. C++ coding standards: 101 rules, guidelines, and best practices. ISBN: 0-32-111358-6. Item 95: 'Don't use C-style casts'.