Class: SmartAudioPort

Environment: Siren
Superclass: Siren.PortAudioPort
Category: MusicIO-Sound
Instance variables: inChannels callbackBlock useProcess ioProcess
ioSemaphore inClient outClients inBuffer outBuffer
counter

SmartPortAudioPort is a more advanced IO port for PortAudio; it uses a Smalltalk process that sleeps on a semaphore that is signalled by the PortAudio callback. this allows one to synthesize sound interactively or to record into Siren sounds. The methods nextInBuffer and nextInBuffer are used to copy buffers or call synthesis clients.

Instance Variables:
inChannels # of input channels
ioSemaphore semaphore sent from the low-level driver
inClient sample index> the sound being recorded into
outClients Integer)> my playing sounds and their sample indices
ioProcess my IO thread
inBuffer sample buffer handed to PortAudio
outBuffer sample buffer handed to PortAudio

play/record

callback
Handle a callback from PortAudio; this is sent an an external callback

doIO
Handle a callback from PortAudio; this is sent an an external callback through the class

nextInBuffer
Get the next input buffer for the clients from the interface.

nextOutBuffer
Get the next output buffer from the clients and sum it into my buffer for playing.

play: aSound
Play the argument on the receiver over the DACs.

record: aSound
Record into the argument via the receiver.

start: duration
Start the receiver's IO loop for the given duration.

accessing

inChannels

inChannels: aValue

outClients

setInputDevice
Set the port to use the default input device

open/close

close
Close the receiver sound port

open
Open the receiver sound port

initialize/release

initialize
Answer an initialized version of the receiver.

MetaClass: SmartAudioPort class

examples

testPlay
Test playing a sound through the call-back interface

testRecord
SmartAudioPort testRecord

callbacks

callback
Forward the callback to an instance

instance creation

new
Answer a new instance, or the singleton