From 7a2e20caac9db6f789a7b3fab344b9758af45335 Mon Sep 17 00:00:00 2001 From: Harvey Harrison Date: Sun, 19 Apr 2015 21:02:06 -0700 Subject: j3dcore: flatten the directory structure a bit Signed-off-by: Harvey Harrison --- src/javax/media/j3d/AudioDevice.java | 271 +++++++++++++++++++++++++++++++++++ 1 file changed, 271 insertions(+) create mode 100644 src/javax/media/j3d/AudioDevice.java (limited to 'src/javax/media/j3d/AudioDevice.java') diff --git a/src/javax/media/j3d/AudioDevice.java b/src/javax/media/j3d/AudioDevice.java new file mode 100644 index 0000000..1aab9fc --- /dev/null +++ b/src/javax/media/j3d/AudioDevice.java @@ -0,0 +1,271 @@ +/* + * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + * + */ + +package javax.media.j3d; + + +/** + * The AudioDevice Class defines and encapsulates the + * audio device's basic information and characteristics. + *

+ * A Java3D application running on a particular machine could have one of + * several options available to it for playing the audio image created by the + * sound renderer. Perhaps the machine Java3D is executing on has more than + * one sound card (e.g., one that is a Wave Table Synthesis card and the other + * with accelerated sound spatialization hardware). Furthermore, suppose there + * are Java3D audio device drivers that execute Java3D audio methods on each of + * these specific cards. In such a case the application would have at least two + * audio device drivers through which the audio could be produced. For such a + * case the Java3D application must choose the audio device driver with which + * sound rendering is to be performed. Once this audio device is chosen, the + * application can additionally select the type of audio playback type the + * rendered sound image is to be output on. The playback device (headphones or + * speaker(s)) is physically connected to the port the selected device driver + * outputs to. + *

+ * AudioDevice Interface + *

+ *

+ *

+ * Instantiating and Registering a New Device + *

+ *

+ *

+ * General Rules for calling AudioDevice methods: + * It is illegal for an application to call any non-query AudioDevice method + * if the AudioDevice is created then explicitly assigned to a + * PhysicalEnvironment using PhysicalEnvironment.setAudioDevice(); + * When either PhysicalEnvironment.setAudioDevice() is called - including + * when implicitly called by SimpleUniverse.getViewer().createAudioDevice() + * - the Core creates a SoundScheduler thread which makes calls to + * the AudioDevice. + *

+ * If an application creates it's own instance of an AudioDevice and + * initializes it directly, rather than using PhysicalEnvironment. + * setAudioDevice(), that application may make any AudioDevice3D methods calls + * without fear of the Java 3D Core also trying to control the AudioDevice. + * Under this condition it is safe to call AudioDevice non-query methods. + */ + +public interface AudioDevice { + + /** ************* + * + * Constants + * + ****************/ + /** + * Audio Playback Types + * + * Types of audio output device Java3D sound is played over: + * Headphones, MONO_SPEAKER, STEREO_SPEAKERS + */ + /** + * Choosing Headphones as the audio playback type + * specifies that the audio playback will be through stereo headphones. + */ + public static final int HEADPHONES = 0; + + /** + * Choosing a + * single near-field monoaural speaker + * as the audio playback type + * specifies that the audio playback will be through a single speaker + * some supplied distance away from the listener. + */ + public static final int MONO_SPEAKER = 1; + + /** + * Choosing a + * two near-field stereo speakers + * as the audio playback type + * specifies that the audio playback will be through stereo speakers + * some supplied distance away from, and at some given angle to + * the listener. + */ + public static final int STEREO_SPEAKERS = 2; + + /** + * Initialize the audio device. + * Exactly what occurs during initialization is implementation dependent. + * This method provides explicit control by the user over when this + * initialization occurs. + * Initialization must be initiated before any other AudioDevice + * methods are called. + * @return true if initialization was successful without errors + */ + public abstract boolean initialize(); + + /** + * Code to close the device and release resources. + * @return true if close of device was successful without errors + */ + public abstract boolean close(); + + /** + * Set Type of Audio Playback physical transducer(s) sound is output to. + * Valid types are HEADPHONES, MONO_SPEAKER, STEREO_SPEAKERS + * @param type audio playback type + */ + public abstract void setAudioPlaybackType(int type); + + /** + * Get Type of Audio Playback Output Device. + * @return audio playback type + */ + public abstract int getAudioPlaybackType(); + + /** + * Set Distance from interaural mid-point between Ears to a Speaker. + * @param distance from interaural midpoint between the ears to closest speaker + */ + public abstract void setCenterEarToSpeaker(float distance); + + /** + * Get Distance from interaural mid-point between Ears to a Speaker. + * @return distance from interaural midpoint between the ears to closest speaker + */ + public abstract float getCenterEarToSpeaker(); + + /** + * Set Angle Offset (in radians) To Speaker. + * @param angle in radians from head Z axis and vector from center ear to speaker + */ + public abstract void setAngleOffsetToSpeaker(float angle); + + /** + * Get Angle Offset (in radians) To Speaker. + * @return angle in radians from head Z axis and vector from center ear to speaker + */ + public abstract float getAngleOffsetToSpeaker(); + + /** + * Query total number of channels available for sound rendering + * for this audio device. This returns the maximum number of channels + * available for Java3D sound rendering for all sound sources. + * @return total number of channels that can be used for this audio device + */ + public abstract int getTotalChannels(); + + /** + * Query number of channels currently available for use. + * During rendering, when sound nodes are playing, this method returns the + * number of channels still available to Java3D for rendering additional + * sound nodes. + * @return total number of channels current available + */ + public abstract int getChannelsAvailable(); + + /** + * Query number of channels that are used, or would be used to render + * a particular sound node. This method returns the number of channels + * needed to render a particular Sound node. The return value is the same + * no matter if the Sound is currently active and enabled (being played) or + * is inactive. + * @return number of channels a particular Sound node is using or would used + * if enabled and activated (rendered). + */ + public abstract int getChannelsUsedForSound(Sound node); +} -- cgit v1.2.3