com.softsynth.jsyn
Class SynthSampleAIFF

java.lang.Object
  extended by java.util.Observable
      extended by com.softsynth.jsyn.SynthObject
          extended by com.softsynth.jsyn.SynthChannelData
              extended by com.softsynth.jsyn.SynthSample
                  extended by com.softsynth.jsyn.SynthSampleAIFF
All Implemented Interfaces:
ChunkHandler

public class SynthSampleAIFF
extends SynthSample
implements ChunkHandler

SynthSample that can load itself from a standard AIFF format file stream.

Author:
(C) 1997 Phil Burk, SoftSynth.com, All Rights Reserved
See Also:
ParseIFF, SynthSampleWAV

Field Summary
 
Fields inherited from class com.softsynth.jsyn.SynthSample
AIFF, byteData, UNRECOGNIZED, WAV
 
Fields inherited from class com.softsynth.jsyn.SynthChannelData
cuePoints
 
Constructor Summary
SynthSampleAIFF()
           
SynthSampleAIFF(java.io.InputStream stream)
           
SynthSampleAIFF(SynthContext synthContext)
           
SynthSampleAIFF(SynthContext synthContext, java.io.InputStream stream)
          Create a sample by loading it from an AIFF file..
 
Method Summary
 void handleChunk(ParseIFF parser, int ckID, int ckSize)
          Called by parse() method to handle chunks in an AIFF specific manner.
 void handleForm(ParseIFF parser, int ckID, int ckSize, int type)
          Called by parse() method to handle FORM chunks in an AIFF specific manner.
 short[] loadShorts(java.io.InputStream stream, boolean ifLoadData)
          Load the sample data from the given stream and return it in an array of shorts.
 
Methods inherited from class com.softsynth.jsyn.SynthSample
allocate, clear, clear, dump, getBaseFrequency, getChannelsPerFrame, getFileSize, getFileType, getNumBytesRead, getOffset, getSampleRate, load, load, read, read, setBaseFrequency, setHighAmplitude, setHighFrequency, setLowAmplitude, setLowFrequency, setSampleRate, write, write
 
Methods inherited from class com.softsynth.jsyn.SynthChannelData
findCuePoint, findCuePosition, getMaxFrames, getNumFrames, getReleaseBegin, getReleaseEnd, getReleaseSize, getSustainBegin, getSustainEnd, getSustainSize, insertSortedCue, setNumFrames, setReleaseLoop, setSustainLoop
 
Methods inherited from class com.softsynth.jsyn.SynthObject
delete, deleteAll, enableDeletionByGarbageCollector, enableTracking, getPeer, getSynthContext, isTrackingEnabled, toString, track
 
Methods inherited from class java.util.Observable
addObserver, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SynthSampleAIFF

public SynthSampleAIFF(SynthContext synthContext,
                       java.io.InputStream stream)
                throws SynthException,
                       java.io.IOException
Create a sample by loading it from an AIFF file..

Parameters:
stream - A stream that may come from a file or in memory byte array.
Throws:
SynthException - If parsing fails, or there is insufficient memory.
java.io.IOException - If parsing fails, or IO error occurs.

SynthSampleAIFF

public SynthSampleAIFF(SynthContext synthContext)

SynthSampleAIFF

public SynthSampleAIFF(java.io.InputStream stream)
                throws SynthException,
                       java.io.IOException
Throws:
SynthException
java.io.IOException

SynthSampleAIFF

public SynthSampleAIFF()
Method Detail

loadShorts

public short[] loadShorts(java.io.InputStream stream,
                          boolean ifLoadData)
                   throws SynthException,
                          java.io.IOException
Load the sample data from the given stream and return it in an array of shorts.

Overrides:
loadShorts in class SynthSample
Parameters:
stream - May be any stream from a file, a URL, a byte array, etc.
ifLoadData - If true, sample data will be loaded into memory.
Throws:
SynthException - If parsing fails, or there is insufficient memory.
java.io.IOException - If parsing fails, or IO error occurs.

handleForm

public void handleForm(ParseIFF parser,
                       int ckID,
                       int ckSize,
                       int type)
                throws java.io.IOException
Called by parse() method to handle FORM chunks in an AIFF specific manner.

Specified by:
handleForm in interface ChunkHandler
Parameters:
ckID - four byte chunk ID such as 'data'
ckSize - size of chunk in bytes
type - a 4 byte identifier such as AIFF_ID that identifies the FORM type.
Throws:
java.io.IOException - If parsing fails, or IO error occurs.

handleChunk

public void handleChunk(ParseIFF parser,
                        int ckID,
                        int ckSize)
                 throws java.io.IOException
Called by parse() method to handle chunks in an AIFF specific manner.

Specified by:
handleChunk in interface ChunkHandler
Parameters:
ckID - four byte chunk ID such as 'data'
ckSize - size of chunk in bytes
Throws:
java.io.IOException - If parsing fails, or IO error occurs.