File: main.cpp

package info (click to toggle)
zynaddsubfx 3.0.6-7.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 65,848 kB
  • sloc: cpp: 124,436; ansic: 39,936; objc: 2,496; makefile: 1,369; python: 567; sh: 566; ruby: 178; javascript: 50
file content (46 lines) | stat: -rw-r--r-- 1,130 bytes parent folder | download | duplicates (6)
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
#include "Synth.h"
#include "Echo.h"
#include <stdio.h>
#include <rtosc/rtosc.h>
#include <rtosc/ports.h>

int main()
{
    Synth synth;
    synth.oscil.freq = 10.0;

    synth.effects[2].eff = new Echo();


    char buffer[100];
    rtosc::RtData d;
    d.loc = NULL;
    d.loc_size = 0;
    d.obj = &synth;
    //simple event
    rtosc_message(buffer,100,"volume","f", 0.37);
    Synth::ports.dispatch(buffer, d);

    //simple nested event
    rtosc_message(buffer,100,"oscil/freq","f", 1002.3);
    Synth::ports.dispatch(buffer, d);

    //received event
    rtosc_message(buffer,100,"effect2/echo/time", "f", 8.0);
    Synth::ports.dispatch(buffer, d);

    //discarded event
    rtosc_message(buffer,100,"effect2/lfo/freq", "f", 2.0);
    Synth::ports.dispatch(buffer, d);

    //discarded event
    rtosc_message(buffer,100,"effect0/lfo/freq", "f", 2.0);
    Synth::ports.dispatch(buffer, d);


    printf("synth.oscil.freq            = %f\n", synth.oscil.freq);
    printf("synth.volume                = %f\n", synth.volume);
    printf("synth.effects[2].echo->time = %f\n", synth.effects[2].echo->time);

    return 0;
}