Csound class provides an object-oriented C++ interface to the Csound engine, wrapping the C API with virtual methods and automatic resource management.
Class definition
include/csound.hpp:103
Constructors
Default constructor
csoundCreate().
From existing CSOUND pointer
CSOUND* pointer. The Csound object will call csoundDestroy() on the pointer when destroyed.
With host data
hostData- Pointer to host application dataopcodedir- Optional path to plugin opcodes directory
Compilation methods
CompileOrc
str- Orchestra code as stringasync- If non-zero, compile asynchronously (default: 0)
CSOUND_SUCCESS on success
Compile
CompileCSD
csd- CSD content as stringmode- Compilation modeasync- Asynchronous compilation flag
Performance methods
Start
Compile() and before PerformKsmps().
PerformKsmps
0- Performance continuing- Non-zero - End of score or error
Reset
csoundReset() and performs cleanup.
Audio parameter methods
GetSr
GetKr
GetKsmps
Get0dBFS
GetChannels
isInput- If non-zero, returns input channels; otherwise output channels
Channel communication
SetControlChannel
GetControlChannel
name- Channel nameerr- Optional pointer to error code
SetStringChannel
GetStringChannel
SetAudioChannel / GetAudioChannel
GetChannelPtr
Score events
Event
type- Event type character (e.g., ‘i’, ‘f’, ‘e’)pFields- Array of p-fieldsnumFields- Number of p-fieldsasync- Asynchronous flag
EventString
Function table methods
TableLength
GetTable
TableCopyIn / TableCopyOut
Message handling
Message
SetMessageCallback
CreateMessageBuffer / DestroyMessageBuffer
GetFirstMessage
Configuration methods
SetOption
SetHostData / GetHostData
GetVersion
Advanced features
GetSpin / GetSpout
GetCsound
CSOUND* pointer.