Squeak Class Documentation category index | class index  
 
SoundPlayer
  category: Sound-Synthesis
  superclass: Object
  subclasses:

No comment. Sorry.

instance methods
  no messages
 

class methods
  accessing
  bufferMSecs
reverbState
samplingRate
setVolumeLeft:volumeRight:
soundVolume
stereo

  initialization
  initialize
useShortBuffer

  player process
  isReverbOn
oldStylePlayLoop
playLoop
playerProcess
startPlayerProcessBufferSize:rate:stereo:
startPlayerProcessBufferSize:rate:stereo:sound:
startReverb
stopPlayerProcess
stopReverb

  playing
  canStartPlayer
isPlaying:
pauseSound:
playSound:
resumePlaying:
resumePlaying:quickStart:
stopPlayingAll
waitUntilDonePlaying:

  primitive test
  boinkPitch:dur:loudness:waveTable:pan:
boinkScale
playTestSample:pan:
sineTable:

  private
  isAllSilence:size:
primSoundAvailableBytes
primSoundGetVolume
primSoundInsertSamples:from:samplesOfLeadTime:
primSoundPlaySamples:from:startingAt:
primSoundSetVolumeLeft:volumeRight:
primSoundStartBufferSize:rate:stereo:
primSoundStartBufferSize:rate:stereo:semaIndex:
primSoundStop
startPlayingImmediately:

  snapshotting
  shutDown
startUp
startUpWithSound:

instance methods
  no messages top  

class methods
  accessing top  
 

bufferMSecs


 

reverbState


 

samplingRate


 

setVolumeLeft:volumeRight:

Set sound pass in float 0.0-1.0 for left and right channel, with possible 2.0 or higher to overdrive sound channel


 

soundVolume

Return sound as array of doubles left then right channel, range is 0.0 to 1.0 but may be overdriven


 

stereo


  initialization top  
 

initialize

SoundPlayer initialize; shutDown; startUp


 

useShortBuffer

Experimental support for real-time MIDI input. This only works on platforms whose hardware allows very short buffer sizes. It has been tested on a Macintosh Powerbook G3.


  player process top  
 

isReverbOn


 

oldStylePlayLoop

This version of the play loop is used if the VM does not yet support sound primitives that signal a semaphore when a sound buffer becomes available.


 

playLoop

The sound player process loop.


 

playerProcess


 

startPlayerProcessBufferSize:rate:stereo:

Start the sound player process. Terminate the old process, if any.


 

startPlayerProcessBufferSize:rate:stereo:sound:

Start the sound player process. Terminate the old process, if any.


 

startReverb

Start a delay-line style reverb with the given tap delays and gains. Tap delays are given in samples and should be prime integers; the following comment gives an expression that generates primes.


 

stopPlayerProcess

Stop the sound player process.


 

stopReverb


  playing top  
 

canStartPlayer

Some platforms do no support simultaneous record and play. If this is one of those platforms, return false if there is a running SoundRecorder.


 

isPlaying:


 

pauseSound:

Stop playing the given sound. Playing can be resumed from this point later.


 

playSound:

Reset and start playing the given sound from its beginning.


 

resumePlaying:

Start playing the given sound without resetting it; it will resume playing from where it last stopped.


 

resumePlaying:quickStart:

Start playing the given sound without resetting it; it will resume playing from where it last stopped. If quickStart is true, then try to start playing the given sound immediately.


 

stopPlayingAll

Stop playing all sounds.


 

waitUntilDonePlaying:

Wait until the given sound is no longer playing.


  primitive test top  
 

boinkPitch:dur:loudness:waveTable:pan:

Play a decaying note on the given stream using the given wave table. Used for testing only.


 

boinkScale

Tests the sound output primitives by playing a scale.


 

playTestSample:pan:

Append the given sample in the range [-32767..32767] to the output buffer, playing the output buffer when it is full. Used for testing only.


 

sineTable:

Compute a sine table of the given size. Used for testing only.


  private top  
 

isAllSilence:size:

return true if the buffer is all silence after reverb has ended


 

primSoundAvailableBytes

Return the number of bytes of available space in the sound output buffer.


 

primSoundGetVolume

Return sound as array of doubles left then right channel, range is 0.0 to 1.0 but may be overdriven


 

primSoundInsertSamples:from:samplesOfLeadTime:

Mix the given number of sample frames from the given sound buffer into the queue of samples that has already been submitted to the sound driver. This primitive is used to start a sound playing with minimum latency, even if large sound output buffers are being used to ensure smooth sound output. Returns the number of samples consumed, or zero if the primitive is not implemented or fails.


 

primSoundPlaySamples:from:startingAt:

Copy count bytes into the current sound output buffer from the given sample buffer starting at the given index.


 

primSoundSetVolumeLeft:volumeRight:

Set sound pass in float 0.0-1.0 for left and right channel, with possible 2.0 or higher to overdrive sound channel


 

primSoundStartBufferSize:rate:stereo:

Start double-buffered sound output with the given buffer size and sampling rate. This version has been superceded by primitive 171 (primSoundStartBufferSize:rate:stereo:semaIndex:).


 

primSoundStartBufferSize:rate:stereo:semaIndex:

Start double-buffered sound output with the given buffer size and sampling rate. If the given semaphore index is > 0, it is taken to be the index of a Semaphore in the external objects array to be signalled when the sound driver is ready to accept another buffer of samples.


 

primSoundStop

Stop double-buffered sound output. Must not raise an error because it is used inside error handling and at system shutdown


 

startPlayingImmediately:

Private! Start playing the given sound as soon as possible by mixing it into the sound output buffers of the underlying sound driver.


  snapshotting top  
 

shutDown

Stop player process, for example before snapshotting.


 

startUp

Start up the player process.


 

startUpWithSound:

Start up the player process.