added sender funcs

This commit is contained in:
Mustafa 2014-03-12 16:15:46 -07:00
parent 6f26f0a709
commit 60ad93a46c

View file

@ -27,24 +27,36 @@ Example:
} }
@section{Sending commands to the server} @section{Communicating with the SuperCollider server (scsynth)}
Most functions that send messages to the server do so by accepting a file descriptor type as the first argument. Most functions that send messages to the server do so by accepting a socket type as the first argument.
This function is passed to with-udp-sc3 or with-tcp-sc3, which call the function on a socket of a specific type. This function is passed to with-udp-sc3 or with-tcp-sc3, which call the function on a socket of a specific type.
Assumes the scsynth is running using udp at port 57110.
@defproc[(with-udp-sc3 [func procedure?]) any/c]{
@defproc[(with-udp-sc3 [func procedure?]) b]{ func should be a function that takes a socket (reset is an example of such a function).
func should be a function that takes a file descriptor (reset is an example of such a function).
with-udp-sc3 opens a udp socket, calls func on that socket, closes the socket, and returns the return value of func. with-udp-sc3 opens a udp socket, calls func on that socket, closes the socket, and returns the return value of func.
}
Example: Example:
@racketblock[ @racketblock[
(with-udp-sc3 reset) (with-udp-sc3 reset)
] ]
}
@defproc[(with-tcp-sc3 [func procedure?]) any/c]{
Same as with-udp-sc3 but uses the tcp protocol.
}
@defproc[(play [fd (or udp:socket? tcp:socket?)] [ugen ugen?]) any/c]{
The same as audition but without the socket creation step. (audition uses play)
Using the given socket, plays sound generated by the ugen. This creates a synthdef,
sends it to the server using the name "anonymous" and group 1, and creates a new synth.
Example:
@racketblock[ @racketblock[
(define (play-ugen ugen) (define (play-ugen ugen)
(with-udp-sc3 (lambda (fd) (with-udp-sc3 (lambda (fd)
@ -52,10 +64,17 @@ Example:
] ]
} }
@defproc[(send [fd (or udp:socket? tcp:socket?)] [message message?]) ()]{
Sends an OSC message to the server using the socket fd.
}
@defproc[(async [fd (or udp:socket? tcp:socket?)] [message message?]) ()]{
Sends an OSC message to the server using the socket fd and waits (blocks) for a /done message fro mteh server.
}
@section{Reporting Bugs} @section{Reporting Bugs}
For Heaven's sake, report lots of bugs! For Heaven's sake, report lots of bugs!