Core C++ wrapper
TheCsound class (defined in csound.hpp) provides an object-oriented wrapper around the C API. It encapsulates a CSOUND* instance and provides virtual methods for all major Csound operations.
Key features:
- RAII-based resource management with automatic cleanup
- Virtual methods for compilation, performance, and configuration
- Multiple overloaded convenience methods
- Channel communication (control, audio, string, array, PVS)
- Message handling with buffering support
- MIDI and audio I/O configuration
include/csound.hpp
Plugin framework (csnd namespace)
Thecsnd namespace (defined in plugin.h) provides a modern C++ framework for writing Csound plugins with:
Template-based plugin classes:
Plugin<N, M>- Base class for N outputs and M inputsInPlug<N>- Base class for N inputs (no outputs)FPlugin<N, M>- Specialized for fsig (frequency-domain) processing
Vector<T>- One-dimensional arraysAudioSig- Audio signal wrapper with sample-accurate timingFsig- Frequency-domain signal containerTable- Function table accessAuxMem<T>- Auxiliary memory allocation
Csound- Engine access with convenience methodsThread- Base class for threadingParam<N>- Parameter access template
include/plugin.h
Performance thread
TheCsoundPerformanceThread class (defined in csPerfThread.hpp) provides a high-level interface for running Csound performance in a separate thread.
Key features:
- Automatic thread management with Play/Pause/Stop control
- Score event queuing during performance
- Real-time audio recording to disk
- Orchestra code compilation during performance
- Process callbacks for custom processing
- Thread-safe message queue for communication
include/csPerfThread.hpp
Threading utilities
For systems with pthread spinlock support,csound.hpp provides:
Spinlock- Lightweight synchronization primitiveSpinlocker- RAII-style spinlock guard
C++ standard requirements
The C++ API supports:- C++98/C++03 - Basic functionality
- C++11 and later - Enhanced features including:
- Deleted copy constructors
explicitconstructors- Better type safety
Related pages
- Csound class - Core C++ wrapper
- Plugin framework - csnd namespace for plugins
- Performance thread - CsoundPerformanceThread class