📄 sound.java
字号:
/** * Retrieves description/data associated with this sound source. * @return 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 MediaContainer getSoundData() { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_SOUND_DATA_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Sound1")); return ((SoundRetained)this.retained).getSoundData(); } /** * Set the overall gain scale factor applied to data associated with this * source to increase or decrease its overall amplitude. * @param amplitude (gain) scale factor * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void setInitialGain(float amplitude) { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_INITIAL_GAIN_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Sound2")); ((SoundRetained)this.retained).setInitialGain(amplitude); } /** * Get the overall gain applied to the sound data associated with source. * @return overall gain scale factor applied to sound source data. * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public float getInitialGain() { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_INITIAL_GAIN_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Sound3")); return ((SoundRetained)this.retained).getInitialGain(); } /** * Sets a sound's loop count. * @param loopCount number of times sound is looped during play * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void setLoop(int loopCount) { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_LOOP_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Sound4")); ((SoundRetained)this.retained).setLoop(loopCount); } /** * Retrieves loop count for this sound * @return loop count * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public int getLoop() { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_LOOP_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Sound5")); return ((SoundRetained)this.retained).getLoop(); } /** * Enables or disables the release flag for the sound associated with * this sound. * @param state release flag * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void setReleaseEnable(boolean state) { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_RELEASE_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Sound6")); ((SoundRetained)this.retained).setReleaseEnable(state); } /** * Retrieves the release flag for sound associated with sound. * @return sound's release flag * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public boolean getReleaseEnable() { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_RELEASE_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Sound7")); return ((SoundRetained)this.retained).getReleaseEnable(); } /** * Enables or disables continuous play flag. * @param state denotes if deactivated sound silently continues playing * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void setContinuousEnable(boolean state) { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_CONT_PLAY_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Sound8")); ((SoundRetained)this.retained).setContinuousEnable(state); } /** * Retrieves sound's continuous play flag. * @return flag denoting if deactivated sound silently continues playing * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public boolean getContinuousEnable() { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_CONT_PLAY_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Sound9")); return ((SoundRetained)this.retained).getContinuousEnable(); } /** * Enable or disable sound. * @param state enable (on/off) flag denotes if active sound is heard * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void setEnable(boolean state) { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_ENABLE_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Sound10")); if (this instanceof BackgroundSound) ((SoundRetained)this.retained).setEnable(state); else // instanceof PointSound or ConeSound ((PointSoundRetained)this.retained).setEnable(state); } /** * Retrieves sound's enabled flag. * @return sound enabled flag * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public boolean getEnable() { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_ENABLE_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Sound21")); return ((SoundRetained)this.retained).getEnable(); } /** * Set the Sound's scheduling region to the specified bounds. * This is used when the scheduling bounding leaf is set to null. * @param region the bounds that contains the Sound's new scheduling * region. * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void setSchedulingBounds(Bounds region) { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_SCHEDULING_BOUNDS_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Sound11")); ((SoundRetained)this.retained).setSchedulingBounds(region); } /** * Retrieves the Sound node's scheduling bounds. * @return this Sound's scheduling bounds information * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public Bounds getSchedulingBounds() { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_SCHEDULING_BOUNDS_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Sound12")); return ((SoundRetained)this.retained).getSchedulingBounds(); } /** * Set the Sound's scheduling region to the specified bounding leaf. * When set to a value other than null, this overrides the scheduling * bounds object. * @param region the bounding leaf node used to specify the Sound * node's new scheduling region. * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void setSchedulingBoundingLeaf(BoundingLeaf region) { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_SCHEDULING_BOUNDS_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Sound11")); ((SoundRetained)this.retained).setSchedulingBoundingLeaf(region); } /** * Retrieves the Sound node's scheduling bounding leaf. * @return this Sound's scheduling bounding leaf information * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public BoundingLeaf getSchedulingBoundingLeaf() { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_SCHEDULING_BOUNDS_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Sound12")); return ((SoundRetained)this.retained).getSchedulingBoundingLeaf(); } /** * Set sound's priority value. * @param priority value used to order sound's importance for playback. * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void setPriority(float priority) { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_PRIORITY_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Sound15")); ((SoundRetained)this.retained).setPriority(priority); } /** * Retrieves sound's priority value. * @return sound priority value * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public float getPriority() { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_PRIORITY_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Sound16")); return ((SoundRetained)this.retained).getPriority(); } /** * Get the Sound's duration * @return this Sound's duration in milliseconds including repeated * loops * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public long getDuration() { if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_DURATION_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Sound17")); return ((SoundRetained)this.retained).getDuration(); } /** * Retrieves sound's 'ready' status. If this sound is fully * prepared to begin playing (audibly or silently) on all * initialized audio devices, this method returns true. * @return flag denoting if sound is immediate playable or not * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public boolean isReady() { if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_IS_READY_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Sound22")); return ((SoundRetained)this.retained).isReady(); } /** * Retrieves sound's 'ready' status. If this sound is fully * prepared to begin playing (audibly or silently) on the audio * device associated with this view, this method returns true. * @param view the view on which to query the ready status. * @return flag denoting if sound is immediate playable or not * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * @since Java 3D 1.3 */ public boolean isReady(View view) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -