Csound API  6.07
Realtime Audio I/O

Functions

PUBLIC void csoundSetRTAudioModule (CSOUND *csound, char *module)
 Sets the current RT audio module. More...
 
PUBLIC int csoundGetModule (CSOUND *csound, int number, char **name, char **type)
 retrieves a module name and type ("audio" or "midi") given a number Modules are added to list as csound loads them returns CSOUND_SUCCESS on success and CSOUND_ERROR if module number was not found More...
 
PUBLIC long csoundGetInputBufferSize (CSOUND *)
 Returns the number of samples in Csound's input buffer. More...
 
PUBLIC long csoundGetOutputBufferSize (CSOUND *)
 Returns the number of samples in Csound's output buffer. More...
 
PUBLIC MYFLT * csoundGetInputBuffer (CSOUND *)
 Returns the address of the Csound audio input buffer. More...
 
PUBLIC MYFLT * csoundGetOutputBuffer (CSOUND *)
 Returns the address of the Csound audio output buffer. More...
 
PUBLIC MYFLT * csoundGetSpin (CSOUND *)
 Returns the address of the Csound audio input working buffer (spin). More...
 
PUBLIC void csoundAddSpinSample (CSOUND *csound, int frame, int channel, MYFLT sample)
 Adds the indicated sample into the audio input woriing buffer (spin); this only ever makes sense before calling csoundPerformKsmps(). More...
 
PUBLIC MYFLT * csoundGetSpout (CSOUND *csound)
 Returns the address of the Csound audio output working buffer (spout). More...
 
PUBLIC MYFLT csoundGetSpoutSample (CSOUND *csound, int frame, int channel)
 Returns the indicated sample from the Csound audio output working buffer (spout); only ever makes sense after calling csoundPerformKsmps(). More...
 
PUBLIC void ** csoundGetRtRecordUserData (CSOUND *)
 Return pointer to user data pointer for real time audio input. More...
 
PUBLIC void ** csoundGetRtPlayUserData (CSOUND *)
 Return pointer to user data pointer for real time audio output. More...
 
PUBLIC void csoundSetHostImplementedAudioIO (CSOUND *, int state, int bufSize)
 Calling this function with a non-zero 'state' value between csoundCreate() and the start of performance will disable all default handling of sound I/O by the Csound library, allowing the host application to use the spin/spout/input/output buffers directly. More...
 
PUBLIC int csoundGetAudioDevList (CSOUND *csound, CS_AUDIODEVICE *list, int isOutput)
 This function can be called to obtain a list of available input or output audio devices. More...
 
PUBLIC void csoundSetPlayopenCallback (CSOUND *, int(*playopen__)(CSOUND *, const csRtAudioParams *parm))
 Sets a function to be called by Csound for opening real-time audio playback. More...
 
PUBLIC void csoundSetRtplayCallback (CSOUND *, void(*rtplay__)(CSOUND *, const MYFLT *outBuf, int nbytes))
 Sets a function to be called by Csound for performing real-time audio playback. More...
 
PUBLIC void csoundSetRecopenCallback (CSOUND *, int(*recopen_)(CSOUND *, const csRtAudioParams *parm))
 Sets a function to be called by Csound for opening real-time audio recording. More...
 
PUBLIC void csoundSetRtrecordCallback (CSOUND *, int(*rtrecord__)(CSOUND *, MYFLT *inBuf, int nbytes))
 Sets a function to be called by Csound for performing real-time audio recording. More...
 
PUBLIC void csoundSetRtcloseCallback (CSOUND *, void(*rtclose__)(CSOUND *))
 Sets a function to be called by Csound for closing real-time audio playback and recording. More...
 
PUBLIC void csoundSetAudioDeviceListCallback (CSOUND *csound, int(*audiodevlist__)(CSOUND *, CS_AUDIODEVICE *list, int isOutput))
 Sets a function that is called to obtain a list of audio devices. More...
 

Detailed Description

Function Documentation

PUBLIC void csoundAddSpinSample ( CSOUND csound,
int  frame,
int  channel,
MYFLT  sample 
)

Adds the indicated sample into the audio input woriing buffer (spin); this only ever makes sense before calling csoundPerformKsmps().

The frame and channel must be in bounds relative to ksmps and nchnls.

PUBLIC int csoundGetAudioDevList ( CSOUND csound,
CS_AUDIODEVICE list,
int  isOutput 
)

This function can be called to obtain a list of available input or output audio devices.

If list is NULL, the function will only return the number of devices (isOutput=1 for out devices, 0 for in devices). If list is non-NULL, then it should contain enough memory for one CS_AUDIODEVICE structure per device. Hosts will typically call this function twice: first to obtain a number of devices, then, after allocating space for each device information structure, pass an array of CS_AUDIODEVICE structs to be filled:

1 int i,n = csoundGetAudioDevList(csound,NULL,1);
2 CS_AUDIODEVICE *devs = (CS_AUDIODEVICE *)
3  malloc(n*sizeof(CS_AUDIODEVICE));
4 csoundGetAudioDevList(csound,devs,1);
5 for(i=0; i < n; i++)
6  csound->Message(csound, " %d: %s (%s)\n",
7  i, devs[i].device_id, devs[i].device_name);
8 free(devs);
PUBLIC MYFLT* csoundGetInputBuffer ( CSOUND )

Returns the address of the Csound audio input buffer.

Enables external software to write audio into Csound before calling csoundPerformBuffer.

PUBLIC long csoundGetInputBufferSize ( CSOUND )

Returns the number of samples in Csound's input buffer.

PUBLIC int csoundGetModule ( CSOUND csound,
int  number,
char **  name,
char **  type 
)

retrieves a module name and type ("audio" or "midi") given a number Modules are added to list as csound loads them returns CSOUND_SUCCESS on success and CSOUND_ERROR if module number was not found

1 char *name, *type;
2 int n = 0;
3 while(!csoundGetModule(csound, n++, &name, &type))
4  printf("Module %d: %s (%s) \n", n, name, type);
PUBLIC MYFLT* csoundGetOutputBuffer ( CSOUND )

Returns the address of the Csound audio output buffer.

Enables external software to read audio from Csound after calling csoundPerformBuffer.

PUBLIC long csoundGetOutputBufferSize ( CSOUND )

Returns the number of samples in Csound's output buffer.

PUBLIC void** csoundGetRtPlayUserData ( CSOUND )

Return pointer to user data pointer for real time audio output.

PUBLIC void** csoundGetRtRecordUserData ( CSOUND )

Return pointer to user data pointer for real time audio input.

PUBLIC MYFLT* csoundGetSpin ( CSOUND )

Returns the address of the Csound audio input working buffer (spin).

Enables external software to write audio into Csound before calling csoundPerformKsmps.

PUBLIC MYFLT* csoundGetSpout ( CSOUND csound)

Returns the address of the Csound audio output working buffer (spout).

Enables external software to read audio from Csound after calling csoundPerformKsmps.

PUBLIC MYFLT csoundGetSpoutSample ( CSOUND csound,
int  frame,
int  channel 
)

Returns the indicated sample from the Csound audio output working buffer (spout); only ever makes sense after calling csoundPerformKsmps().

The frame and channel must be in bounds relative to ksmps and nchnls.

PUBLIC void csoundSetAudioDeviceListCallback ( CSOUND csound,
int(*)(CSOUND *, CS_AUDIODEVICE *list, int isOutput)  audiodevlist__ 
)

Sets a function that is called to obtain a list of audio devices.

This should be set by rtaudio modules and should not be set by hosts. (See csoundGetAudioDevList())

PUBLIC void csoundSetHostImplementedAudioIO ( CSOUND ,
int  state,
int  bufSize 
)

Calling this function with a non-zero 'state' value between csoundCreate() and the start of performance will disable all default handling of sound I/O by the Csound library, allowing the host application to use the spin/spout/input/output buffers directly.

If 'bufSize' is greater than zero, the buffer size (-b) will be set to the integer multiple of ksmps that is nearest to the value specified.

PUBLIC void csoundSetPlayopenCallback ( CSOUND ,
int(*)(CSOUND *, const csRtAudioParams *parm)  playopen__ 
)

Sets a function to be called by Csound for opening real-time audio playback.

PUBLIC void csoundSetRecopenCallback ( CSOUND ,
int(*)(CSOUND *, const csRtAudioParams *parm)  recopen_ 
)

Sets a function to be called by Csound for opening real-time audio recording.

PUBLIC void csoundSetRTAudioModule ( CSOUND csound,
char *  module 
)

Sets the current RT audio module.

PUBLIC void csoundSetRtcloseCallback ( CSOUND ,
void(*)(CSOUND *)  rtclose__ 
)

Sets a function to be called by Csound for closing real-time audio playback and recording.

PUBLIC void csoundSetRtplayCallback ( CSOUND ,
void(*)(CSOUND *, const MYFLT *outBuf, int nbytes)  rtplay__ 
)

Sets a function to be called by Csound for performing real-time audio playback.

PUBLIC void csoundSetRtrecordCallback ( CSOUND ,
int(*)(CSOUND *, MYFLT *inBuf, int nbytes)  rtrecord__ 
)

Sets a function to be called by Csound for performing real-time audio recording.