⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sound.java

📁 JAVA3D矩陈的相关类
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
        if (isLiveOrCompiled())            if (!this.getCapability(ALLOW_IS_READY_READ))		throw new CapabilityNotSetException(J3dI18N.getString("Sound22"));	        return ((SoundRetained)this.retained).isReady(view);    }    /**     * Retrieves sound's play status.  If this sound is audibly playing on any     * initialized audio device, this method returns true.     * @return flag denoting if sound is playing (potentially audible) or not     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     */    public boolean isPlaying()  {        if (isLiveOrCompiled())            if (!this.getCapability(ALLOW_IS_PLAYING_READ))		throw new CapabilityNotSetException(J3dI18N.getString("Sound18"));          return ((SoundRetained)this.retained).isPlaying();    }    /**     * Retrieves sound's play status.  If this sound is audibly playing on the     * audio device associated with the given view, this method returns     * true.     * @param view the view on which to query the isPlaying status.     * @return flag denoting if sound is playing (potentially audible) 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 isPlaying(View view) {        if (isLiveOrCompiled())            if (!this.getCapability(ALLOW_IS_PLAYING_READ))		throw new CapabilityNotSetException(J3dI18N.getString("Sound18"));          return ((SoundRetained)this.retained).isPlaying(view);    }    /**     * Retrieves sound's silent status.  If this sound is silently playing on     * any initialized audio device, this method returns true.     * @return flag denoting if sound is silently playing (enabled but not active)     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     */    public boolean isPlayingSilently()  {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_IS_PLAYING_READ))		throw new CapabilityNotSetException(J3dI18N.getString("Sound18"));	        return ((SoundRetained)this.retained).isPlayingSilently();    }    /**     * Retrieves sound's silent status.  If this sound is silently playing on     * the audio device associated with the given view, this method returns     * true.     * The isPlayingSilently state is affected by enable, mute,  and continuous     * states as well as active status of sound.     * @param view the view on which to query the isPlayingSilently status.     * @return flag denoting if sound is silently playing (enabled but not active)     * @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 isPlayingSilently(View view) {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_IS_PLAYING_READ))		throw new CapabilityNotSetException(J3dI18N.getString("Sound18"));	        return ((SoundRetained)this.retained).isPlayingSilently(view);    }    /**       * Retrieves number of channels that are being used to render this sound     * on the audio device associated with the Virtual Universe's primary view.     * @return number of channels used by sound; returns 0 if not playing     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     */      public int getNumberOfChannelsUsed()  {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_CHANNELS_USED_READ))		throw new CapabilityNotSetException(J3dI18N.getString("Sound20"));	        return ((SoundRetained)this.retained).getNumberOfChannelsUsed();    }    /**     * Retrieves number of channels that are being used to render this sound     * on the audio device associated with given view.     * @param view the view on which to query the number of channels used.     * @return number of channels used by sound; returns 0 if not playing     * @exception CapabilityNotSetException if appropriate capability is     * @since Java 3D 1.3     * not set and this object is part of live or compiled scene graph     */    public int getNumberOfChannelsUsed(View view) {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_CHANNELS_USED_READ))		throw new CapabilityNotSetException(J3dI18N.getString("Sound20"));	        return ((SoundRetained)this.retained).getNumberOfChannelsUsed(view);    }    /**     * Set mute state flag.  If the sound is playing it will be set to     * play silently     * @param state flag     * @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 void setMute(boolean state) {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_MUTE_WRITE))		throw new CapabilityNotSetException(J3dI18N.getString("Sound23"));	        ((SoundRetained)this.retained).setMute(state);    }    /**     * Retrieves sound Mute state.     * A return value of true does not imply that the sound has      * been started playing or is still playing silently.     * @return mute state flag     * @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 getMute() {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_MUTE_READ))		throw new CapabilityNotSetException(J3dI18N.getString("Sound24"));	        return ((SoundRetained)this.retained).getMute();    }    /**     * Pauses or resumes (paused) playing sound.     * @param state pause flag     * @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 void setPause(boolean state) {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_PAUSE_WRITE))		throw new CapabilityNotSetException(J3dI18N.getString("Sound25"));	        ((SoundRetained)this.retained).setPause(state);    }    /**     * Retrieves the value of the Pause state flag.     * A return value of true does not imply that the sound was      * started playing and then paused.     * @return pause state     * @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 getPause() {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_PAUSE_READ))		throw new CapabilityNotSetException(J3dI18N.getString("Sound26"));	        return ((SoundRetained)this.retained).getPause();    }    /**     * Sets Sample Rate.     * Changes (scales) the playback rate of a sound independent of     * Doppler rate changes - applied to ALL sound types.     * Affects device sample rate playback and thus affects both pitch and speed     * @param scaleFactor %%% describe this.     * @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 void setRateScaleFactor(float scaleFactor) {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_RATE_SCALE_FACTOR_WRITE))		throw new CapabilityNotSetException(J3dI18N.getString("Sound27"));	        ((SoundRetained)this.retained).setRateScaleFactor(scaleFactor);    }    /**     * Retrieves Sample Rate.     * @return sample rate scale factor     * @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 float getRateScaleFactor() {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_RATE_SCALE_FACTOR_READ))		throw new CapabilityNotSetException(J3dI18N.getString("Sound28"));	        return ((SoundRetained)this.retained).getRateScaleFactor();    }   /**     * Copies all Sound information from     * <code>originalNode</code> into     * the current node.  This method is called from the     * <code>cloneNode</code> method which is, in turn, called by the     * <code>cloneTree</code> method.<P>      *     * @param originalNode the original node to duplicate.     * @param forceDuplicate when set to <code>true</code>, causes the     *  <code>duplicateOnCloneTree</code> flag to be ignored.  When     *  <code>false</code>, the value of each node's     *  <code>duplicateOnCloneTree</code> variable determines whether     *  NodeComponent data is duplicated or copied.     *     * @exception RestrictedAccessException if this object is part of a live     *  or compiled scenegraph.     *     * @see Node#duplicateNode     * @see Node#cloneTree     * @see NodeComponent#setDuplicateOnCloneTree     */    void duplicateAttributes(Node originalNode, boolean forceDuplicate) {	super.duplicateAttributes(originalNode, forceDuplicate);        SoundRetained orgRetained = (SoundRetained)originalNode.retained;        SoundRetained thisRetained = (SoundRetained)this.retained;	thisRetained.setSoundData((MediaContainer) getNodeComponent(					   orgRetained.getSoundData(),					   forceDuplicate,					   originalNode.nodeHashtable));	thisRetained.setInitialGain(orgRetained.getInitialGain());	thisRetained.setLoop(orgRetained.getLoop());	thisRetained.setReleaseEnable(orgRetained.getReleaseEnable());	thisRetained.setContinuousEnable(orgRetained.getContinuousEnable());	thisRetained.setSchedulingBounds(orgRetained.getSchedulingBounds());	thisRetained.setPriority(orgRetained.getPriority());	thisRetained.setEnable(orgRetained.getEnable());	// updateNodeReferences will set the following correctly	thisRetained.setSchedulingBoundingLeaf(orgRetained.getSchedulingBoundingLeaf());    }    /**     * Callback used to allow a node to check if any scene graph objects     * referenced     * by that node have been duplicated via a call to <code>cloneTree</code>.     * This method is called by <code>cloneTree</code> after all nodes in     * the sub-graph have been duplicated. The cloned Leaf node's method     * will be called and the Leaf node can then look up any object references     * by using the <code>getNewObjectReference</code> method found in the     * <code>NodeReferenceTable</code> object.  If a match is found, a     * reference to the corresponding object in the newly cloned sub-graph     * is returned.  If no corresponding reference is found, either a     * DanglingReferenceException is thrown or a reference to the original     * object is returned depending on the value of the     * <code>allowDanglingReferences</code> parameter passed in the     * <code>cloneTree</code> call.     * <p>     * NOTE: Applications should <i>not</i> call this method directly.     * It should only be called by the cloneTree method.     *     * @param referenceTable a NodeReferenceTableObject that contains the     *  <code>getNewObjectReference</code> method needed to search for     *  new object instances.     * @see NodeReferenceTable     * @see Node#cloneTree     * @see DanglingReferenceException     */    public void updateNodeReferences(NodeReferenceTable referenceTable) {	super.updateNodeReferences(referenceTable);	SoundRetained rt = (SoundRetained) retained;        BoundingLeaf bl = rt.getSchedulingBoundingLeaf();        if (bl != null) {            Object o = referenceTable.getNewObjectReference(bl);            rt.setSchedulingBoundingLeaf((BoundingLeaf)o);        }        MediaContainer sd = rt.getSoundData();        if (sd != null) {            rt.setSoundData(sd);        }    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -