File: append.liq

package info (click to toggle)
liquidsoap 2.4.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 12,844 kB
  • sloc: ml: 74,136; javascript: 27,320; ansic: 505; sh: 139; xml: 114; lisp: 96; makefile: 26
file content (30 lines) | stat: -rw-r--r-- 520 bytes parent folder | download
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
music = chop(every=1., metadata=[("source", "s1")], sine(amplitude=0.1, 440.))

def next(_) =
  sine(amplitude=0.1, duration=.5, 880.)
end

s = append(music, next)

count_s1 = ref(0)
count_s2 = ref(0)

s.on_track(
  synchronous=true,
  fun (m) ->
    begin
      s = m["source"]
      if
        s == "s1"
      then
        ref.incr(count_s1)
      else
        test.equal(m["source"], "")
        ref.incr(count_s2)
      end

      if count_s1() > 2 and count_s2() > 2 then test.pass() end
    end
)

output.dummy(s)