aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: 064526741109f23a81ce25c8453ca3e1019eb506 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85

   

csound-curl : simple HTTP GET and POST requests from Csound

Overview

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.

Requirements

  • Cmake >= 2.8.12
  • Csound with development headers >= 6.14.0
  • libCURL >= 7.26.0

Installation

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.

Examples

Some examples are provided in the examples directory.

Opcode reference

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.

ires, Sres curlget Surl

Perform a GET request at init time.

  • ires : HTTP response code
  • Sres : response body

  • Surl : URL to request

ires, Sres curlpost Surl, SpostData

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

kdone, kres, Sres curlgetk Surl

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

kdone, kres, Sres curlpostk Surl, SpostData

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

Sencoded curlurlencode Sinput

URL encode a string at init time.

  • Sinput : the string to be encoded

  • Sencoded : the encoded string

Sencoded curlurlencodek Sinput, ktrigger

URL encode a string at k-rate upon receipt of a trigger.

  • Sinput : the string to be encoded
  • ktrigger : encode the string when this is set to 1

  • Sencoded : the encoded string