📄 sound.java
字号:
*/ public static final int ALLOW_CONT_PLAY_WRITE = CapabilityBits.SOUND_ALLOW_CONT_PLAY_WRITE; /** * Specifies that this node allows access to its object's sound on * information. */ public static final int ALLOW_ENABLE_READ = CapabilityBits.SOUND_ALLOW_ENABLE_READ; /** * Specifies that this node allows writing to its object's sound on * information. */ public static final int ALLOW_ENABLE_WRITE = CapabilityBits.SOUND_ALLOW_ENABLE_WRITE; /** * Specifies that this node allows read access to its scheduling bounds * information. */ public static final int ALLOW_SCHEDULING_BOUNDS_READ = CapabilityBits.SOUND_ALLOW_SCHEDULING_BOUNDS_READ; /** * Specifies that this node allows write access to its scheduling bounds * information. */ public static final int ALLOW_SCHEDULING_BOUNDS_WRITE = CapabilityBits.SOUND_ALLOW_SCHEDULING_BOUNDS_WRITE; /** * Specifies that this node allows read access to its priority order * value. */ public static final int ALLOW_PRIORITY_READ = CapabilityBits.SOUND_ALLOW_PRIORITY_READ; /** * Specifies that this node allows write access to its priority order * value. */ public static final int ALLOW_PRIORITY_WRITE = CapabilityBits.SOUND_ALLOW_PRIORITY_WRITE; /** * Specifies that this node allows access to its object's sound duration * information. */ public static final int ALLOW_DURATION_READ = CapabilityBits.SOUND_ALLOW_DURATION_READ; /** * Specifies that this node allows access to its object's sound status * denoting if it is ready to be played 'immediately'. */ public static final int ALLOW_IS_READY_READ = CapabilityBits.SOUND_ALLOW_IS_READY_READ; /** * Specifies that this node allows access to its object's sound audibly * playing or playing silently status. */ public static final int ALLOW_IS_PLAYING_READ = CapabilityBits.SOUND_ALLOW_IS_PLAYING_READ; /** * Specifies that this node allows access to its number of channels * used by this sound. */ public static final int ALLOW_CHANNELS_USED_READ = CapabilityBits.SOUND_ALLOW_CHANNELS_USED_READ; /** * Specifies that this node allows access to its object's mute flag * information. * * @since Java 3D 1.3 */ public static final int ALLOW_MUTE_READ = CapabilityBits.SOUND_ALLOW_MUTE_READ; /** * Specifies that this node allows writing to its object's mute flag * information. * * @since Java 3D 1.3 */ public static final int ALLOW_MUTE_WRITE = CapabilityBits.SOUND_ALLOW_MUTE_WRITE; /** * Specifies that this node allows access to its object's pause flag * information. * * @since Java 3D 1.3 */ public static final int ALLOW_PAUSE_READ = CapabilityBits.SOUND_ALLOW_PAUSE_READ; /** * Specifies that this node allows writing to its object's pause flag * information. * * @since Java 3D 1.3 */ public static final int ALLOW_PAUSE_WRITE = CapabilityBits.SOUND_ALLOW_PAUSE_WRITE; /** * Specifies that this node allows access to its object's sample rate scale * factor information. * * @since Java 3D 1.3 */ public static final int ALLOW_RATE_SCALE_FACTOR_READ = CapabilityBits.SOUND_ALLOW_RATE_SCALE_FACTOR_READ; /** * Specifies that this node allows writing to its object's sample rate scale * factor information. * * @since Java 3D 1.3 */ public static final int ALLOW_RATE_SCALE_FACTOR_WRITE = CapabilityBits.SOUND_ALLOW_RATE_SCALE_FACTOR_WRITE; /** * Denotes that there is no filter value associated with object's distance * or angular attenuation array. */ public static final float NO_FILTER = -1.0f; /** * Denotes that the sound's duration could not be calculated. * A fall back for getDuration of a non-cached sound. */ public static final int DURATION_UNKNOWN = -1; /** * When used as a loop count sound will loop an infinite number of time * until explicitly stopped (setEnabled(false)). */ public static final int INFINITE_LOOPS = -1; // Array for setting default read capabilities private static final int[] readCapabilities = { ALLOW_CHANNELS_USED_READ, ALLOW_CONT_PLAY_READ, ALLOW_DURATION_READ, ALLOW_ENABLE_READ, ALLOW_INITIAL_GAIN_READ, ALLOW_IS_PLAYING_READ, ALLOW_IS_READY_READ, ALLOW_LOOP_READ, ALLOW_MUTE_READ, ALLOW_PAUSE_READ, ALLOW_PRIORITY_READ, ALLOW_RATE_SCALE_FACTOR_READ, ALLOW_RELEASE_READ, ALLOW_SCHEDULING_BOUNDS_READ, ALLOW_SOUND_DATA_READ }; /** * Constructs and initializes a new Sound node using default * parameters. The following defaults values are used: * <ul> * sound data: null<br> * initial gain: 1.0<br> * loop: 0<br> * release flag: false<br> * continuous flag: false<br> * enable flag: false<br> * scheduling bounds : null<br> * scheduling bounding leaf : null<br> * priority: 1.0<br> * rate scale factor: 1.0<br> * mute state: false<br> * pause state: false<br> * </ul> */ public Sound() { // set default read capabilities setDefaultReadCapabilities(readCapabilities); } /** * Constructs and initializes a new Sound node object using the provided * data and gain parameter values, and defaults for all other fields. This * constructor implicitly loads the sound data associated with this node if * the implementation uses sound caching. * @param soundData description of JMF source data used by this sound source * @param initialGain overall amplitude scale factor applied to sound source */ public Sound(MediaContainer soundData, float initialGain) { // set default read capabilities setDefaultReadCapabilities(readCapabilities); ((SoundRetained)this.retained).setSoundData(soundData); ((SoundRetained)this.retained).setInitialGain(initialGain); } /** * Constructs and initializes a new Sound node using provided parameter * values. * @param soundData description of JMF source data used by this sound source * @param initialGain overall amplitude scale factor applied to sound source * @param loopCount number of times sound is looped when played * @param release flag specifying whether the sound is to be played * to end when stopped * @param continuous flag specifying whether the sound silently plays * when disabled * @param enable flag specifying whether the sound is enabled * @param region scheduling bounds * @param priority defines playback priority if too many sounds started */ public Sound(MediaContainer soundData, float initialGain, int loopCount, boolean release, boolean continuous, boolean enable, Bounds region, float priority ) { // set default read capabilities setDefaultReadCapabilities(readCapabilities); ((SoundRetained)this.retained).setSoundData(soundData); ((SoundRetained)this.retained).setInitialGain(initialGain); ((SoundRetained)this.retained).setLoop(loopCount); ((SoundRetained)this.retained).setReleaseEnable(release); ((SoundRetained)this.retained).setContinuousEnable(continuous); ((SoundRetained)this.retained).setEnable(enable); ((SoundRetained)this.retained).setSchedulingBounds(region); ((SoundRetained)this.retained).setPriority(priority); } /** * Constructs and initializes a new Sound node using provided parameter * values. * @param soundData description of JMF source data used by this sound source * @param initialGain overall amplitude scale factor applied to sound source * @param loopCount number of times sound is looped when played * @param release flag specifying whether the sound is to be played * to end when stopped * @param continuous flag specifying whether the sound silently plays * when disabled * @param enable flag specifying whether the sound is enabled * @param region scheduling bounds * @param priority defines playback priority if too many sounds started * @param rateFactor defines playback sample rate scale factor * @since Java 3D 1.3 */ public Sound(MediaContainer soundData, float initialGain, int loopCount, boolean release, boolean continuous, boolean enable, Bounds region, float priority, float rateFactor ) { // set default read capabilities setDefaultReadCapabilities(readCapabilities); ((SoundRetained)this.retained).setSoundData(soundData); ((SoundRetained)this.retained).setInitialGain(initialGain); ((SoundRetained)this.retained).setLoop(loopCount); ((SoundRetained)this.retained).setReleaseEnable(release); ((SoundRetained)this.retained).setContinuousEnable(continuous); ((SoundRetained)this.retained).setEnable(enable); ((SoundRetained)this.retained).setSchedulingBounds(region); ((SoundRetained)this.retained).setPriority(priority); ((SoundRetained)this.retained).setRateScaleFactor(rateFactor); } /** * Sets fields that define the sound source data of this node. * @param soundData description of JMF source data used by this sound source * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void setSoundData(MediaContainer soundData) { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_SOUND_DATA_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Sound0")); if (this instanceof BackgroundSound) ((SoundRetained)this.retained).setSoundData(soundData); else // instanceof PointSound or ConeSound ((PointSoundRetained)this.retained).setSoundData(soundData); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -