org.deken.game.sound.audio
Class FilteredAudioStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
org.deken.game.sound.audio.FilteredAudioStream
- All Implemented Interfaces:
- java.io.Closeable
public class FilteredAudioStream
- extends java.io.FilterInputStream
Title: FilteredSoundStream
Description: This class is a FilterInputStream that applies a SoundFilter
to the underlying input stream.
Copyright: Copyright (c) 2006
- Version:
- 1.0
- Author:
- Gary Deken
- See Also:
SoundFilter
Fields inherited from class java.io.FilterInputStream |
in |
Constructor Summary |
FilteredAudioStream(java.io.InputStream inputStream,
StreamAudioFilter soundFilter)
Creates a new FilteredSoundStream object with the specified InputStream
and SoundFilter. |
Method Summary |
static int |
convertSecondsToSampleRate(javax.sound.sampled.AudioFormat format,
float seconds)
Converts seconds into sample rates. |
int |
read(byte[] samples,
int offset,
int length)
Overrides the FilterInputStream method to apply this filter whenever bytes
are read. |
void |
setFrameSize(javax.sound.sampled.AudioFormat audioFormat)
|
Methods inherited from class java.io.FilterInputStream |
available, close, mark, markSupported, read, read, reset, skip |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FilteredAudioStream
public FilteredAudioStream(java.io.InputStream inputStream,
StreamAudioFilter soundFilter)
- Creates a new FilteredSoundStream object with the specified InputStream
and SoundFilter.
- Parameters:
inputStream
- AudioInputStreamsoundFilter
- SoundFilter
convertSecondsToSampleRate
public static int convertSecondsToSampleRate(javax.sound.sampled.AudioFormat format,
float seconds)
- Converts seconds into sample rates. Thus for one second for an AudioFormat
with a Sample rate of 10000 will return 10000. This method is helpful,
giving you the Sample Rate of an AudioFormat if it is unknown.
- Parameters:
format
- AudioFormatseconds
- float
- Returns:
- int
setFrameSize
public void setFrameSize(javax.sound.sampled.AudioFormat audioFormat)
read
public int read(byte[] samples,
int offset,
int length)
throws java.io.IOException
- Overrides the FilterInputStream method to apply this filter whenever bytes
are read.
- Overrides:
read
in class java.io.FilterInputStream
- Parameters:
samples
- byte[]offset
- intlength
- int
- Returns:
- int
- Throws:
java.io.IOException