-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmy_first_plugin.cmajor
58 lines (39 loc) · 1.42 KB
/
my_first_plugin.cmajor
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
/*
Most simple graph with oscillator and gain nodes.
*/
// Every CMajor patch needs one main graph...this is where everything comes together
graph my_first_plugin [[ main ]]
{
// Create an output stream to your sound card
output stream float out;
// This is one way you can define parameters that can be connected to a custom UI
input osc.frequencyIn [[ min: 20.0, max: 20000.0, init: 300.0 ]];
input gain.volume [[ min: -84.0, max: 6.0, init: -12.0 ]];
// A node is a simple audio processor.
// If we wanted, we could create our own custom node using Processor
node osc = std::oscillators::Sine (float);
node gain = std::levels::SmoothedGain (float);
// Connect the nodes together
connection osc.out -> gain.in;
connection gain.out -> out;
}
/*
Note: In the example above, I've created each input, node, and connection explicitly...
I think this is a good way to start when you're learning, because it makes it clear what's going on.
However, you can also simplify these using braces...for example:
input
{
osc.frequencyIn [[ name: "Frequency", min: 20.0, max: 20000.0 ]];
gain.volume [[ name: "Gain", min: -84.0, max: 6.0 ]];
}
node
{
osc = std::oscillators::Sine (float, 300.0);
gain = std::levels::SmoothedGain (float, 0.5);
}
connection
{
osc.out -> gain.in;
gain.out -> out;
}
*/