Logo Search packages:      
Sourcecode: csound version File versions  Download package

csound.h File Reference


Detailed Description

Declares the public Csound application programming interface (API).

Author:
John P. Fitch, Michael Gogins, Matt Ingalls, and John D. Ramsdell
Purposes

The purposes of the Csound API are as follows:

Users

Users of the Csound API fall into two main categories: hosts, and plugins.

Hosts using the Csound API must include <csound.h>, and link with the Csound API library.

Hosts must first create an instance of Csound using the csoundCreate API function. When hosts are finished using Csound, they must destroy the instance of csound using the csoundDestroy API function. Most of the other Csound API functions take the Csound instance as their first argument. Hosts can call either the standalone API functions defined in csound.h, e.g. csoundGetSr(csound), or the function pointers in the Csound instance structure, e.g. csound->GetSr(csound). Each function in the Csound API has a corresponding function pointer in the Csound instance structure.

Here is the complete code for the simplest possible Csound API host, a command-line Csound application:

 #include <csound.h>

 int main(int argc, char **argv)
 {
               void *csound = csoundCreate(0);
               int result = csoundPerform(csound, argc, argv);
               csoundCleanup(csound);
               csoundReset(csound);
               csoundDestroy(csound);
               return result;
       }

All opcodes, including plugins, receive a pointer to their host instance of Csound in the opcode structure itself. Therefore, plugins MUST NOT create an instance of Csound, and MUST call the Csound API function pointers off the Csound instance pointer in the insdshead member of the OPDS structure, for example:

 MYFLT sr = MyOpcodeStructure->h.insdshead->csound->GetSr(MyOpcodeStructure->h.insdshead->csound);

In general, plugins should ONLY access Csound functionality through the API function pointers.

TODO

The Csound API is not finished. At this time, Csound does not support creating multiple instances of Csound in a single process, and the Csound API functions do not all take a pointer to the Csound instance as their first argument. This needs to be changed.

In addition, some new functions need to be added to the API for various purposes:

Definition in file csound.h.

#include "sysdep.h"
#include "cwindow.h"
#include "opcode.h"
#include <stdarg.h>

Go to the source code of this file.

Typedefs

typedef PUBLIC int(* CsoundRegisterExternalType )(void *csound)

Enumerations

enum  CSOUND_STATUS {
  CSOUND_SUCCESS = 0, CSOUND_ERROR = -1, CSOUND_INITIALIZATION = -2, CSOUND_PERFORMANCE = -3,
  CSOUND_MEMORY = -4
}

Functions

PUBLIC int csoundAppendOpcode (char *opname, int dsblksiz, int thread, char *outypes, char *intypes, void(*iopadr)(void *), void(*kopadr)(void *), void(*aopadr)(void *), void(*dopadr)(void *))
PUBLIC void csoundCleanup (void *csound)
PUBLIC void * csoundCloseLibrary (void *library)
PUBLIC int csoundCompile (void *csound, int argc, char **argv)
PUBLIC void * csoundCreate (void *hostData)
PUBLIC void csoundDestroy (void *csound)
PUBLIC void csoundDisposeOpcodeList (opcodelist *opcodelist_)
PUBLIC MYFLT csoundGetCpuUsage (void *csound)
PUBLIC int csoundGetFLTKThreadLocking (void *csound)
PUBLIC void * csoundGetHostData (void *csound)
PUBLIC void * csoundGetInputBuffer (void *csound)
PUBLIC long csoundGetInputBufferSize (void *csound)
PUBLIC MYFLT csoundGetKr (void *csound)
PUBLIC int csoundGetKsmps (void *csound)
PUBLIC void * csoundGetLibrarySymbol (void *library, const char *symbolName)
PUBLIC int csoundGetMessageLevel (void *csound)
PUBLIC int csoundGetNchnls (void *csound)
PUBLIC void * csoundGetOutputBuffer (void *csound)
PUBLIC long csoundGetOutputBufferSize (void *csound)
PUBLIC MYFLT csoundGetProfile (void *csound)
PUBLIC MYFLT csoundGetProgress (void *csound)
PUBLIC int csoundGetSampleFormat (void *csound)
PUBLIC int csoundGetSampleSize (void *csound)
PUBLIC MYFLT csoundGetScoreOffsetSeconds (void *csound)
PUBLIC MYFLT csoundGetScoreTime (void *csound)
PUBLIC MYFLT * csoundGetSpin (void *csound)
PUBLIC MYFLT * csoundGetSpout (void *csound)
PUBLIC MYFLT csoundGetSr (void *csound)
PUBLIC int csoundGetVersion (void)
PUBLIC void csoundInputMessage (void *csound, const char *message)
PUBLIC int csoundIsExternalMidiEnabled (void *csound)
PUBLIC int csoundIsScorePending (void *csound)
PUBLIC void csoundKeyPress (void *csound, char c)
PUBLIC int csoundLoadExternal (void *csound, const char *libraryPath)
PUBLIC int csoundLoadExternals (void *csound)
PUBLIC void csoundMessage (void *csound, const char *format,...)
PUBLIC void csoundMessageS (void *csound, const char *format, va_list args)
PUBLIC void csoundMessageV (void *csound, const char *format, va_list args)
PUBLIC opcodelist * csoundNewOpcodeList (void)
PUBLIC void * csoundOpenLibrary (const char *libraryPath)
PUBLIC int csoundPerform (void *csound, int argc, char **argv)
PUBLIC int csoundPerformBuffer (void *csound)
PUBLIC int csoundPerformKsmps (void *csound)
PUBLIC int csoundQueryInterface (const char *name, void **iface, int *version)
PUBLIC void csoundReset (void *csound)
PUBLIC void csoundRewindScore (void *csound)
PUBLIC void csoundScoreEvent (void *csound, char type, MYFLT *pFields, long numFields)
PUBLIC void csoundSetDrawGraphCallback (void *csound, void(*drawGraphCallback)(void *csound, WINDAT *windat))
PUBLIC void csoundSetEnv (void *csound, const char *environmentVariableName, const char *path)
PUBLIC void csoundSetExitGraphCallback (void *csound, int(*exitGraphCallback)(void *csound))
PUBLIC void csoundSetExternalMidiCloseCallback (void *csound, void(*closeMidiCallback)(void *csound))
PUBLIC void csoundSetExternalMidiEnabled (void *csound, int enabled)
PUBLIC void csoundSetExternalMidiOpenCallback (void *csound, void(*midiOpenCallback)(void *csound))
PUBLIC void csoundSetExternalMidiReadCallback (void *csound, int(*readMidiCallback)(void *csound, unsigned char *midiData, int size))
PUBLIC void csoundSetExternalMidiWriteCallback (void *csound, int(*writeMidiCallback)(void *csound, unsigned char *midiData))
PUBLIC void csoundSetFLTKThreadLocking (void *csound, int isLocking)
PUBLIC void csoundSetHostData (void *csound, void *hostData)
PUBLIC void csoundSetInputValueCallback (void *csound, void(*inputValueCalback)(void *csound, char *channelName, MYFLT *value))
PUBLIC void csoundSetIsGraphable (void *csound, int isGraphable)
PUBLIC void csoundSetKillGraphCallback (void *csound, void(*killGraphCallback)(void *csound, WINDAT *windat))
PUBLIC void csoundSetMakeGraphCallback (void *csound, void(*makeGraphCallback)(void *csound, WINDAT *windat, char *name))
PUBLIC void csoundSetMessageCallback (void *csound, void(*csoundMessageCallback)(void *csound, const char *format, va_list valist))
PUBLIC void csoundSetMessageLevel (void *csound, int messageLevel)
PUBLIC void csoundSetOutputValueCallback (void *csound, void(*outputValueCalback)(void *csound, char *channelName, MYFLT value))
PUBLIC void csoundSetPlayopenCallback (void *csound, void(*playopen__)(int nchanls, int dsize, float sr, int scale))
PUBLIC void csoundSetRecopenCallback (void *csound, void(*recopen_)(int nchanls, int dsize, float sr, int scale))
PUBLIC void csoundSetRtcloseCallback (void *csound, void(*rtclose__)(void))
PUBLIC void csoundSetRtplayCallback (void *csound, void(*rtplay__)(char *outBuf, int nbytes))
PUBLIC void csoundSetRtrecordCallback (void *csound, int(*rtrecord__)(char *inBuf, int nbytes))
PUBLIC void csoundSetScoreOffsetSeconds (void *csound, MYFLT offset)
PUBLIC void csoundSetScorePending (void *csound, int pending)
PUBLIC void csoundSetThrowMessageCallback (void *csound, void(*throwMessageCallback)(void *csound, const char *format, va_list valist))
PUBLIC void csoundSetYieldCallback (void *csound, int(*yieldCallback)(void *csound))
PUBLIC void csoundThrowMessage (void *csound, const char *format,...)
PUBLIC void csoundThrowMessageV (void *csound, const char *format, va_list args)


Generated by  Doxygen 1.6.0   Back to index