Debian Codegraph @

src/Examples/FLOSS Manual Examples/08 Other Communication/08A01_OSC_send_recv_int.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 -m 128
4 </CsOptions>
5 <CsInstruments>
6
7 sr = 44100
8 ksmps = 32
9 nchnls = 2
10 0dbfs = 1
11
12 giPortHandle OSCinit 47120
13
14 instr Send
15 kSendTrigger = 1
16 kSendValue = 17
17 OSCsend kSendTrigger, "", 47120, "/exmp_1/int", "i", kSendValue
18 endin
19
20 instr Receive
21 kReceiveValue init 0
22 kGotIt OSClisten giPortHandle, "/exmp_1/int", "i", kReceiveValue
23 if kGotIt == 1 then
24 printf "Message Received for '%s' at time %f: kReceiveValue = %d\n",
25 1, "/exmp_1/int", times:k(), kReceiveValue
26 endif
27 endin
28
29 </CsInstruments>
30 <CsScore>
31 i "Receive" 0 3 ;start listening process first
32 i "Send" 1 1 ;then after one second send message
33 </CsScore>
34 </CsoundSynthesizer>
35 ;example by joachim heintz