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

Instances of this class hold the data resulting from compressing a sound. Each carries a reference to the codec class that created it, so that it can reconstruct a sound similar to the original in response to the message asSound.

In order to facilitate integration with existing sounds, a CompressedSoundData instance can masquerade as a sound by caching a copy of its original sound and delegating the essential sound-playing protocol to that cached copy. It should probably be made a subclass of AbstractSound to complete the illusion.

instance methods
  accessing
  channels
channels:
codecName
codecName:
firstSample
firstSample:
gain
gain:
loopEnd
loopEnd:
loopLength
loopLength:
perceivedPitch
perceivedPitch:
samplingRate
samplingRate:
soundClassName
soundClassName:

  as yet unclassified
  compressWith:
compressWith:atRate:
withEToySound:samplingRate:

  asSound
  asSound
doControl
mixSampleCount:into:startingAt:leftVol:rightVol:
reset
samples
samplesRemaining

class methods
  no messages
 

instance methods
  accessing top  
 

channels

Answer an array of ByteArrays containing the compressed sound data for each channel.


 

channels:


 

codecName

Answer the name of the sound codec used to compress this sound. Typically, this is the name of a class that can be used to decode the sound, but it is possible that the codec has not yet been implemented or is not filed into this image.


 

codecName:


 

firstSample

Answer the firstSample of the original sound.


 

firstSample:


 

gain

Answer the gain of the original sound.


 

gain:


 

loopEnd

Answer index of the last sample of the loop, or nil if the original sound was not looped.


 

loopEnd:


 

loopLength

Answer length of the loop, or nil if the original sound was not looped.


 

loopLength:


 

perceivedPitch

Answer the perceived pitch of the original sound. By convention, unpitched sounds (like drum hits) are given an arbitrary pitch of 100.0.


 

perceivedPitch:


 

samplingRate

Answer the samplingRate of the original sound.


 

samplingRate:


 

soundClassName

Answer the class name of the uncompressed sound.


 

soundClassName:


  as yet unclassified top  
 

compressWith:


 

compressWith:atRate:


 

withEToySound:samplingRate:


  asSound top  
 

asSound

Answer the result of decompressing the receiver.


 

doControl


 

mixSampleCount:into:startingAt:leftVol:rightVol:


 

reset

This message is the cue to start behaving like a real sound in order to be played.
We do this by caching a decompressed version of this sound.
See also samplesRemaining.


 

samples


 

samplesRemaining

This message is the cue that the cached sound may no longer be needed.
We know it is done playing when samplesRemaining=0.


class methods
  no messages top