|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectauditory.sampled.BufferedSound
public class BufferedSound
An in-memory representation of sampled auditory content. Because this is a complete in-memory representation it often uses a lot of memory. One could, alternatively, keep part of the content in-memory and store the remainder in a file (e.g., using a ring buffer). An individual BufferedSound can only be manipulated by one thread at a time. This should not be a problem in practice since, most often, a BufferedSound will be manipulated first and then rendered. Note: For simplicity, all BufferedSound objects use signed PCM with a 16bit sample size, and a big-endian byte order (i.e., network byte order)
Constructor Summary | |
---|---|
BufferedSound(float sampleRate)
Explicit Value Constructor |
Method Summary | |
---|---|
void |
addChannel(double[] signal)
Add a channel to this BufferedSound One channel corresponds to "mono", two channels corresponds to "stereo", etc... |
void |
append(BufferedSound other)
Append a BufferedSound to this BufferedSound Note: If the BufferedSound to append does not match this BufferedSound then nothing is done |
javax.sound.sampled.AudioFormat |
getAudioFormat()
Get the AudioFormat for this BufferedSound |
int |
getMicrosecondLength()
Get the length of this BufferedSound in microseconds |
int |
getMillisecondLength()
Get the length of this BufferedSound in milliseconds |
int |
getNumberOfChannels()
Get the number of channels |
int |
getNumberOfSamples()
Get the number of samples (per channel) in this BufferedSound |
float |
getSampleRate()
Get the sampling rate for this BufferedSound |
java.util.Iterator<double[]> |
getSignals()
Get the signals Note: It is dangerous to provide access to the signal data since it could be modified in inappropriate ways |
boolean |
matches(BufferedSound other)
Compares this BufferedSound object to another |
void |
render(javax.sound.sampled.Clip clip)
Render this BufferedSound on the given Clip |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BufferedSound(float sampleRate)
sampleRate
- The sampling rate (in Hz)Method Detail |
---|
public void addChannel(double[] signal)
public void append(BufferedSound other)
other
- The BufferedSound to appendpublic javax.sound.sampled.AudioFormat getAudioFormat()
getAudioFormat
in interface Content
public java.util.Iterator<double[]> getSignals()
public int getMicrosecondLength()
public int getMillisecondLength()
public int getNumberOfChannels()
public int getNumberOfSamples()
public float getSampleRate()
public boolean matches(BufferedSound other)
other
- The BufferedSound to compare to
public void render(javax.sound.sampled.Clip clip) throws javax.sound.sampled.LineUnavailableException
render
in interface Content
clip
- The Clip to use
javax.sound.sampled.LineUnavailableException
|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |