/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* This class provides an interface to the Headspace Audio engine through
* the Java Sound API.
*
* This class emulates systems with multiple audio channels, mixing
* multiple streams for the workstation's single-channel device.
*
* @see AudioData
* @see AudioDataStream
* @see AudioStream
* @see AudioStreamSequence
* @see ContinuousAudioDataStream
* @author David Rivas
* @author Kara Kytle
* @author Jan Borgersen
* @author Florian Bomers
*/
public final class AudioDevice {
/** Hashtable of audio clips / input streams. */
/** Are we currently playing audio? */
private boolean playing = false;
/** Handle to the JS audio mixer. */
/**
* The default audio player. This audio player is initialized
* automatically.
*/
/**
* Create an AudioDevice instance.
*/
private AudioDevice() {
clipStreams = new Hashtable();
}
// if ALAW or ULAW, we must convert....
// could not convert
return;
}
return;
}
datapusher.start();
}
try {
} catch( IOException e ) {
throw new InvalidMidiDataException( e.getMessage() );
}
// fix for bug 4302884: Audio device is not released when AudioClip stops
}
/**
* Open an audio channel.
*/
if(DEBUG) {
}
// is this already playing? if so, then just return
return;
}
}
if( in instanceof AudioStream ) {
// it's a midi file
try {
} catch (Exception e) {
return;
}
// it's sampled audio
try {
} catch (Exception e) {
return;
}
}
} else if (in instanceof AudioDataStream ) {
if (in instanceof ContinuousAudioDataStream) {
try {
} catch (Exception e) {
return;
}
}
else {
try {
} catch (Exception e) {
return;
}
}
} else {
try {
try {
} catch(IOException ioe) {
return;
}
} catch( UnsupportedAudioFileException e ) {
try {
try {
} catch(IOException ioe1) {
return;
}
} catch( InvalidMidiDataException e1 ) {
// $$jb:08.01.99: adding this section to make some of our other
// legacy classes work.....
// not MIDI either, special case handling for all others
8000, 8, 1, 1, 8000, true );
try {
} catch (UnsupportedAudioFileException es) {
return;
} catch (LineUnavailableException es2) {
return;
}
} catch( MidiUnavailableException e2 ) {
// could not open sequence
return;
}
} catch( LineUnavailableException e ) {
return;
}
}
// don't forget adjust for a new stream.
notify();
}
/**
* Close an audio channel.
*/
if(DEBUG) {
}
//info.sequencer.close();
}
}
}
notify();
}
/**
* Open the device (done automatically)
*/
public synchronized void open() {
// $$jb: 06.24.99: This is done on a per-stream
// basis using the new JS API now.
}
/**
* Close the device (done automatically)
*/
public synchronized void close() {
// $$jb: 06.24.99: This is done on a per-stream
// basis using the new JS API now.
}
/**
* Play open audio stream(s)
*/
public void play() {
// $$jb: 06.24.99: Holdover from old architechture ...
// basis using the JavaSound API.
if (DEBUG) {
}
}
/**
* Close streams
*/
public synchronized void closeStreams() {
}
}
if (DEBUG) {
}
// Empty the hash table.
clipStreams = new Hashtable();
}
/**
* Number of channels currently open.
*/
public int openChannels() {
}
/**
* Make the debug info print out.
*/
void setVerbose(boolean v) {
DEBUG = v;
}
// INFO CLASS
this.datapusher = datapusher;
}
}
}
}
}