rtaudio/stream
src/rtaudio/stream.tur
defn
stream-open
(stream-open [a :int out-device :int out-chans :int in-device :int in-chans :int format :cstr sample-rate :int buf-frames :int callback :int] :ptr<void>)
configure and open an audio stream.
Parameters
| a | audio handle (ok-val from audio-new) | |
| out-device | output device index (-1 to disable output) | |
| out-chans | number of output channels (0 to disable output) | |
| in-device | input device index (-1 to disable input) | |
| in-chans | number of input channels (0 to disable input) | |
| format | sample format keyword: ":int16", ":int32", ":float32", ":float64" | |
| sample-rate | desired sample rate in Hz (e.g. 44100, 48000) | |
| buf-frames | buffer size in frames (e.g. 256, 512) | |
| callback | audio callback function pointer as :int (cast to rtaudio_cb_t) |
Returns
(ok 0) on success; (err 0) on failure.
Example
(let [r (stream-open a 0 2 -1 0 ":float32" 44100 512 my-cb)]
(if (ok? r) (stream-start a) (println "stream-open failed")))
Since: RA0
defn
stream-start
(stream-start [a :int] :ptr<void>)
begin audio processing on an open stream.
Parameters
| a | audio handle (ok-val from audio-new) |
Returns
(ok 0) on success; (err 0) on failure.
Example
(stream-start a)
Since: RA0
defn
stream-stop
(stream-stop [a :int] :void)
stop audio processing without closing the stream.
Parameters
| a | audio handle (ok-val from audio-new) |
Returns
void
Example
(stream-stop a)
Since: RA0
defn
stream-close
(stream-close [a :int] :void)
close the audio stream and release its resources.
Parameters
| a | audio handle (ok-val from audio-new) |
Returns
void
Example
(stream-close a)
Since: RA0
defn
stream-latency
(stream-latency [a :int] :int)
return the stream latency in frames.
Parameters
| a | audio handle (ok-val from audio-new) |
Returns
Latency in frames as :int.
Example
(println (stream-latency a))
Since: RA0
defn
stream-sample-rate
(stream-sample-rate [a :int] :int)
return the stream sample rate in Hz.
Parameters
| a | audio handle (ok-val from audio-new) |
Returns
Sample rate as :int (e.g. 44100).
Example
(println (stream-sample-rate a))
Since: RA0
Internal definitions
__ok-- create an ok result wrapping integer value v.__err-- create an err result wrapping integer error value e.