File: jitlib_networking.schelp

package info (click to toggle)
supercollider 1%3A3.6.6~repack-2-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 23,792 kB
  • ctags: 25,269
  • sloc: cpp: 177,129; lisp: 63,421; ansic: 11,297; python: 1,787; perl: 766; yacc: 311; sh: 286; lex: 181; ruby: 173; makefile: 168; xml: 13
file content (97 lines) | stat: -rw-r--r-- 3,076 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
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
title:: jitlib_networking
summary:: networked programming
categories:: Libraries>JITLib>Tutorials
related:: Overviews/JITLib

emphasis::please note any problems, I'll try to add solutions here.::

section::1) using ProxySpace with more than one client, with separate bus spaces

note::
if only one client is using a remote server, only step (a) and step (d) are relevant. The clientID argument can be left out then.
::

subsection::before you start

remember to synchronize your system clocks. This can be done by:
definitionList::
## in OS X || SystemPreferences>Date&Time: set emphasis::"Set Date & Time automatically":: to true.
## in linux || set the ntp clock
::
a local time server is better than the apple time server. if you cannot sync the time, you can set the server latency to code::nil::. This will break the pattern's functionality though.

subsection::a) boot the (remote) server and create a local model

(you cannot directly boot a remote server instance)

code::
s = Server("serverName", NetAddr(hostname, port), clientID);
::
definitionList::
## serverName || can be any name
## hostname || is an ip address, or if you have a name resolution, a network name
## port || the port on which the server is listening. default is 57110
## clientID || for each client (each sc-lang) emphasis::a different integer number has to be given::
::
see link::Classes/Server::

subsection::b) from each client, initialize the default node and set notify to true:

code::
s.boot; // this will initialize the tree and start notification

// if needed, a server window can be created:
s.makeWindow;
::

subsection::c) preallocate a range of busses in each client.

If there is conflicts, increase the number of busses in the server options before booting:

code::
s.options.numAudioBusChannels = 1024;	//optional
::

code::
(
var numberOfParticipants, n;
numberOfParticipants = 4;


n = s.options.numAudioBusChannels / numberOfParticipants;
n = n.floor.asInteger * s.clientID;
s.audioBusAllocator.alloc(n);


n = s.options.numControlBusChannels / numberOfParticipants;
n = n.floor.asInteger * s.clientID;
s.controlBusAllocator.alloc(n);
)
::

subsection::d) now create a ProxySpace from the server:

code::
p = ProxySpace.push(s);
::

section::2) using ProxySpace with more than one client, with a partly shared bus space

step a, b like in link::#1)_using_proxyspace_with_more_than_one_client,_with_separate_bus_spaces#(1)::, skip (d)

subsection::c) before allocating a number of busses for each client, create shared busses:

code::
p = ProxySpace.push(s);
~shared1.ar(2);
~shared2.ar(2);
~sharedkr.kr(1); // or other names.
::

then do (c) like in link::#1)_using_proxyspace_with_more_than_one_client,_with_separate_bus_spaces#(1)::, just take care that the shared busses are taking number space already, so the easiest is to increase the numberOfParticipants by one, so no overrun happens.

section::3) writing a chat

see example in link::Classes/Client:: in the strong::JITLibExtensions:: quark.

see also link::Classes/Public:: in the strong::JITLibExtensions:: quark.