Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/csound/univorc.csd
blob: b646f8f5a6b7f3cc7a6cc3c88d23332ce5e98636 (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
<CsoundSynthesizer>
<CsOptions>
-+rtaudio=alsa -odac -m0 -d -b2048 -B4096
</CsOptions>
<CsInstruments>
sr=22050
ksmps=100
nchnls=2

/**************************************************************************
 General Soundfile Player - Used by Memorize Activity
**************************************************************************/

instr 108
/* soundfile play control
  p4 : filename
  p5 : unique instance ID
  p6 : output gain (0-1)
  p7 : offset in seconds

  channels:
  sfplay.<ID>.on  - instance control channel (1:on 0: off)
  sfplay.<ID>.gain - soundfile play gain (0-1)
  sfplay.<ID>.flen  - holds the channel length
*/
S1 strget p4
inst = p5
ich = 1
iln = 10
ioffset = p8

Slen  sprintf "sfplay.%d.flen", p5  ; file length channel
chnset iln, Slen

Splay sprintf "sfplay.%d.on", inst  ; instance control channel
Sname sprintf "sfplay.%d.fname", inst  ; filename channel
Sgain sprintf "sfplay.%d.gain", inst ; gain channel
chnset S1, Sname
chnset 1,  Splay
chnset p6, Sgain
event_i "i",109,0,iln,inst,ich,ioffset
turnoff
endin


instr 109
/* soundfile player
  This is the actual soundfile player.
  It never gets called directly
*/
ich = p5
inst= p4
ioffset = p6
Splay sprintf "sfplay.%d.on", inst  ; instance control channel
Sname sprintf "sfplay.%d.fname", inst  ; filename channel
Sgain sprintf "sfplay.%d.gain", inst ; gain channel
kon chnget Splay
kg1 chnget Sgain
S1  chnget Sname
if kon == 0 then
printf "sfplay:%d OFF\n", 1, inst
turnoff
endif
if ich = 1 then
a1 oggplay S1, ioffset
a2 = a1
else
a1,a2 oggplay S1, ioffset
endif
     outs a1*kg1, a2*kg1
printf_i "sfplay:%d\n", 1, inst
endin

</CsInstruments>
<CsScore>
f0 600000

</CsScore>
</CsoundSynthesizer>