Csound Csound-dev Csound-tekno Search About

Re: [Csnd-dev] OENTRY character for single opcode argument of any type

Date2016-12-20 11:06
FromNate Whetsell
SubjectRe: [Csnd-dev] OENTRY character for single opcode argument of any type
> Can you supply us with an introductory paragraph for the news?

Here’s the introduction from csound-api’s README.md with some minor changes:

The [csound-api](https://github.com/nwhetsell/csound-api) package is a [Node.js Addon](https://nodejs.org/api/addons.html) for using Csound through its C [API](https://csound.github.io/docs/api/index.html). The functions in this package try to match the functions in Csound’s API as closely as possible, and this package adds a [`PerformAsync`](https://github.com/nwhetsell/csound-api#PerformAsync) function that runs Csound in a background thread. If you `require` this package using

```javascript
const csound = require('csound-api');
```

then you can use Csound’s API as, for example,

```javascript
function messageCallback(attributes, string) {
  console.log(string);
}
const Csound = csound.Create();
csound.SetMessageCallback(Csound, messageCallback);
csound.Message(Csound, 'hello, world');
```

The equivalent in C would be something like

```c
void messageCallback(CSOUND *Csound, int attributes, const char *format, va_list argumentList) {
  vprintf(format, argumentList);
}
CSOUND *Csound = csoundCreate(NULL);
csoundSetMessageCallback(Csound, messageCallback);
csoundMessage(Csound, "hello, world");