JavaTM 2 Platform
Standard Ed. 5.0

javax.sound.midi
Class SoundbankResource

java.lang.Object
  extended by javax.sound.midi.SoundbankResource
Direct Known Subclasses:
Instrument

public abstract class SoundbankResource
extends Object

A SoundbankResource represents any audio resource stored in a Soundbank. Common soundbank resources include:

Synthesizers that use wavetable synthesis or related techniques play back the audio in a sample when synthesizing notes, often when emulating the real-world instrument that was originally recorded. However, there is not necessarily a one-to-one correspondence between the Instruments and samples in a Soundbank. A single Instrument can use multiple SoundbankResources (typically for notes of dissimilar pitch or brightness). Also, more than one Instrument can use the same sample.


Constructor Summary
protected SoundbankResource(Soundbank soundBank, String name, Class<?> dataClass)
          Constructs a new SoundbankResource from the given sound bank and wavetable index.
 
Method Summary
abstract  Object getData()
          Obtains the sampled audio that is stored in this SoundbankResource.
 Class<?> getDataClass()
          Obtains the class used by this sample to represent its data.
 String getName()
          Obtains the name of the resource.
 Soundbank getSoundbank()
          Obtains the sound bank that contains this SoundbankResource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SoundbankResource

protected SoundbankResource(Soundbank soundBank,
                            String name,
                            Class<?> dataClass)
Constructs a new SoundbankResource from the given sound bank and wavetable index. (Setting the SoundbankResource's name, sampled audio data, and instruments is a subclass responsibility.)

Parameters:
soundBank - the sound bank containing this SoundbankResource
name - the name of the sample
dataClass - the class used to represent the sample's data
See Also:
getSoundbank(), getName(), getDataClass(), getData()
Method Detail

getSoundbank

public Soundbank getSoundbank()
Obtains the sound bank that contains this SoundbankResource.

Returns:
the sound bank in which this SoundbankResource is stored

getName

public String getName()
Obtains the name of the resource. This should generally be a string descriptive of the resource.

Returns:
the instrument's name

getDataClass

public Class<?> getDataClass()
Obtains the class used by this sample to represent its data. The object returned by getData will be of this class. If this SoundbankResource object does not support direct access to its data, returns null.

Returns:
the class used to represent the sample's data, or null if the data is not accessible

getData

public abstract Object getData()
Obtains the sampled audio that is stored in this SoundbankResource. The type of object returned depends on the implementation of the concrete class, and may be queried using getDataClass.

Returns:
an object containing the sampled audio data
See Also:
getDataClass()

JavaTM 2 Platform
Standard Ed. 5.0

Submit a bug or feature
For further API reference and developer documentation, see Java 2 SDK SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.

Copyright 2004 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.