File: EventStream.schelp

package info (click to toggle)
supercollider 1%3A3.13.0%2Brepack-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 80,296 kB
  • sloc: cpp: 476,363; lisp: 84,680; ansic: 77,685; sh: 25,509; python: 7,909; makefile: 3,440; perl: 1,964; javascript: 974; xml: 826; java: 677; yacc: 314; lex: 175; objc: 152; ruby: 136
file content (22 lines) | stat: -rw-r--r-- 855 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
title:: Event Stream
categories:: Streams-Patterns-Events
related:: Classes/Stream, Classes/Event
summary:: A Stream that returns Events when called

An event stream is a normal link::Classes/Stream:: that returns events when called. (see class link::Classes/Event::). Usually, an event stream requires an event to be passed in, often the default event is used:

code::
t = Pbind(\x, Pseq([1, 2, 3])).asStream; // Pbind, e.g. creates a stream
t.next(Event.default);
t.next(Event.default);
::

An event stream cannot be played directly with a clock, as it returns events and not time values. Therefore, an link::Classes/EventStreamPlayer:: is used, which replaces the event by according time value.

A link::Classes/Pevent:: can be used to wrap a stream in an event:

code::
t = Pevent(Pbind(\x, Pseq([1,2,3])), Event.default).asStream;
t.next;
t.next;
::