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
/* Example 4 - Using Threads
* Author: Steven Yi <stevenyi@gmail.com>
* 2013.10.28
*
* In this example, we use the Csound thread functions to run Csound in
* a separate thread. This is a common scenario where you will run
* Csound in one thread, and doing other things in another thread
* (i.e. have a GUI main thread, maybe a worker thread for heavy
* computations, etc.).
*
* The Python example used the CsoundPerformanceThread which is a
* C++ class that uses the same C functions used in this example.
* To note, Csound offers thread functions so that the the developer
* won't have to worry about what thread library is used (i.e. pthreads).
* Using Csound's thread functions helps make your code more portable
* between platforms.
*/
extern crate csound;
use *;
use thread;
use ;
/* Defining our Csound ORC code within a multiline String */
static orc: &str = "sr=44100
ksmps=32
nchnls=2
0dbfs=1
instr 1
aout vco2 0.5, 440
outs aout, aout
endin";
/*Defining our Csound SCO code */
static sco: &str = "i1 0 10";