- All Known Implementing Classes:
- AiffAudioOutputStream, AuAudioOutputStream, HeaderlessAudioOutputStream, TAudioOutputStream, WaveAudioOutputStream
public interface AudioOutputStream
Represents a one-time writing of audio data to a destination (file or output stream).
This interface is the lowest abstraction level of writing audio data.
Implementations of this interface should, when write() is called, never
do buffering and they should never do format conversions. However,
this interface is intended to abstract the file format (how the
headers and data chunks look like) and the way of writing to the
destination object. (implementation note [non-normative]: the last
should be done by using TDataOutputStream implementing classes).
One reasoning behind this interface was to allow direct, unbuffered
writing of recorded data.
In JS API 0.90, there was no obvious way for this.
Data have had to be recorded to a buffer, then written to a file
from that buffer.
This gave problems with long recordings, where the main
memory of the machine is not big enough to hold all data. There are
two ways so solve this:
a) Having a special AudioInputStream that fetches its data from a
TargetDataLine. This way, the loop inside the AudioFileWriters reads
directely from the recording line via the special AudioInputStream.
This is the solution Sun adopted for JS 1.0.
b) The other way is to expose a direct interface to the writing of the
audio file with no loop inside it. This is to enable the application
programmer to write the main loop itself, possibly doing some
additional processing inside it. This is the more flexible way.
The drawback is that it requires a new architecture for writing files.
This interface is the central part of a proposal for the second
solution.
The idea is now to use the new structure inside the old one to gain
experience with it before proposing to make it a public interface
(public in the sense that it is part of the javax.sound.sampled
package).