Class SoundbankResource
java.lang.Object
javax.sound.midi.SoundbankResource
- Direct Known Subclasses:
Instrument
A
SoundbankResource represents any audio resource stored in a
Soundbank. Common soundbank resources include:
- Instruments. An instrument may be specified in a variety of ways.
However, all soundbanks have some mechanism for defining instruments. In
doing so, they may reference other resources stored in the soundbank.
Each instrument has a
Patchwhich specifies the MIDI program and bank by which it may be referenced in MIDI messages. Instrument information may be stored inInstrumentobjects. - Audio samples. A sample typically is a sampled audio waveform which
contains a short sound recording whose duration is a fraction of a
second, or at most a few seconds. These audio samples may be used by a
Synthesizerto synthesize sound in response to MIDI commands, or extracted for use by an application. (The terminology reflects musicians' use of the word "sample" to refer collectively to a series of contiguous audio samples or frames, rather than to a single, instantaneous sample.) The data class for an audio sample will be an object that encapsulates the audio sample data itself and information about how to interpret it (the format of the audio data), such as anAudioInputStream. - Embedded sequences. A sound bank may contain built-in song data stored
in a data object such as a
Sequence.
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
ConstructorsModifierConstructorDescriptionprotectedSoundbankResource(Soundbank soundBank, String name, Class<?> dataClass) Constructs a newSoundbankResourcefrom the given sound bank and wavetable index. -
Method Summary
Modifier and TypeMethodDescriptionabstract ObjectgetData()Obtains the sampled audio that is stored in thisSoundbankResource.Class<?> Obtains the class used by this sample to represent its data.getName()Obtains the name of the resource.Obtains the sound bank that contains thisSoundbankResource.Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitModifier and TypeMethodDescriptionprotected Objectclone()Answers a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.booleanCompares the argument to the receiver, and answers true if they represent the same object using a class specific comparison.protected voidfinalize()Deprecated, for removal: This API element is subject to removal in a future version.May cause performance issues, deadlocks and hangs.getClass()Answers the unique instance of java.lang.Class which represents the class of the receiver.inthashCode()Answers an integer hash code for the receiver.final voidnotify()Causes one thread which iswaiting on the receiver to be made ready to run.final voidCauses all threads which arewaiting on the receiver to be made ready to run.toString()Answers a string containing a concise, human-readable description of the receiver.final voidwait()Causes the thread which sent this message to be made not ready to run pending some change in the receiver (as indicated bynotifyornotifyAll).final voidwait(long time) Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated bynotifyornotifyAll) or the expiration of the timeout.final voidwait(long time, int frac) Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated bynotifyornotifyAll) or the expiration of the timeout.
-
Constructor Details
-
SoundbankResource
Constructs a newSoundbankResourcefrom the given sound bank and wavetable index. (Setting theSoundbankResource'sname, sampled audio data, and instruments is a subclass responsibility.)- Parameters:
soundBank- the sound bank containing thisSoundbankResourcename- the name of the sampledataClass- the class used to represent the sample's data- See Also:
-
-
Method Details
-
getSoundbank
Obtains the sound bank that contains thisSoundbankResource.- Returns:
- the sound bank in which this
SoundbankResourceis stored
-
getName
Obtains the name of the resource. This should generally be a string descriptive of the resource.- Returns:
- the instrument's name
-
getDataClass
Obtains the class used by this sample to represent its data. The object returned bygetDatawill be of this class. If thisSoundbankResourceobject does not support direct access to its data, returnsnull.- Returns:
- the class used to represent the sample's data, or null if the data is not accessible
-
getData
Obtains the sampled audio that is stored in thisSoundbankResource. The type of object returned depends on the implementation of the concrete class, and may be queried usinggetDataClass.- Returns:
- an object containing the sampled audio data
- See Also:
-