|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttapeutils.Sample
This class provides the representation of a sampled sound.
Constructor Summary | |
---|---|
Sample(javax.sound.sampled.AudioInputStream input,
boolean invert,
int channel)
Construct the sample from a file. |
Method Summary | |
---|---|
void |
endModification()
End a modification. |
javax.sound.sampled.AudioFormat |
getAudioFormat()
Get the audio format for this sample. |
int |
getBytesPerSample()
Get the number of bytes per sample. |
int |
getRange()
Get the possible range of values for this sample. |
double |
getRateMultiplier()
Get the sample rate multiplier. |
double |
getSamplesPerSecond()
Return the number of samples per second. |
int |
getSampleValue(int index)
Get the sample value at the given position. |
int |
numSamples()
Get the number of samples. |
void |
play(int index,
boolean newThread)
Play the sample. |
int |
redo()
Redo a modification. |
void |
run()
Play the sample. |
void |
save(java.io.OutputStream out)
Save the sample data to the given output stream. |
void |
setChannel(int channel)
Set the selected channel. |
void |
setInvert(boolean invert)
Set the inversion. |
void |
setSampleValue(int index,
int value)
Set the sample value at the given position. |
void |
startModification(int index,
int length)
Start a modification. |
void |
stopPlaying()
Stop playing the sample. |
int |
undo()
Undo a modification. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Sample(javax.sound.sampled.AudioInputStream input, boolean invert, int channel) throws java.io.IOException
A particular channel must be selected.
The data within the sample can be inverted.
input
- The audio input stream.invert
- Indicates whether to invert values.channel
- The selected channel.
java.io.IOException
- An error occurred reading the stream.Method Detail |
public int getSampleValue(int index)
index
- The index of the sample.
public void setSampleValue(int index, int value)
index
- The index of the sample.value
- The value of the sample.public int numSamples()
public int getBytesPerSample()
public int getRange()
public javax.sound.sampled.AudioFormat getAudioFormat()
public double getRateMultiplier()
This is used to restore wavelength information back to the default sample rate.
public double getSamplesPerSecond()
public void save(java.io.OutputStream out) throws java.io.IOException
out
- THe output stream.
java.io.IOException
public void play(int index, boolean newThread) throws javax.sound.sampled.LineUnavailableException
index
- The starting index.newThread
- Indicates whether to start playing on a new thread.
javax.sound.sampled.LineUnavailableException
public void run()
run
in interface java.lang.Runnable
public void stopPlaying()
public void startModification(int index, int length)
index
- length
- public void endModification()
public int undo()
public int redo()
public void setChannel(int channel)
channel
- The new value.public void setInvert(boolean invert)
invert
- The new value.
|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |