csound-curl provides opcodes to perform basic HTTP GET and POST requests at init time and k-rate. SSL hosts are supported. It can be used with the csound-json plugin opcodes in order to effectively communicate with web services and such.
- Cmake >= 2.8.12
- Csound with development headers >= 6.14.0
- libCURL >= 7.26.0
Create a build directory at the top of the source tree, execute cmake .., make and optionally make install as root. If the latter is not used/possible then the resulting library can be used with the --opcode-lib flag in Csound.
eg:
mkdir build && cd build
cmake ..
make && sudo make install
Cmake should find Csound and any other required libraries using the modules in the cmake/Modules directory and installation should be as simple as above.
Some examples are provided in the examples directory.
Due to possible delays incurred by network processes, the init-time opcodes may interrupt any current activity in Csound. For example, audio may be subject to dropouts. As a result it may be ideal only to use the init time opcodes at performance initialisation, and use the k-rate opcodes if requests are required during performance.
Perform a GET request at init time.
- ires : HTTP response code
-
Sres : response body
-
Surl : URL to request
Perform a POST request at init time.
- ires : HTTP response code
-
Sres : response body
-
Surl : URL to request
- SpostData : data to post, should be URL encoded if required
Perform a GET request at k-rate.
- kdone : trigger to specify if the request has completed (1 if so, 0 at all other times)
- kres : HTTP response code
-
Sres : response body
-
Surl : URL to request
Perform a POST request at k-rate.
- kdone : trigger to specify if the request has completed (1 if so, 0 at all other times)
- kres : HTTP response code
-
Sres : response body
-
Surl : URL to request
- SpostData : data to post, should be URL encoded if required
URL encode a string at init time.
URL encode a string at k-rate upon receipt of a trigger.