📄 audioengine3d.java
字号:
*/ public void setPosition(int index, Point3d position) { Sample sample = (Sample)getSample(index); if (sample != null) sample.setPosition(position); return; } /* Set elliptical distance attenuation arrays applied to sample amplitude. * @param index device specific reference number to device driver sample * @param frontDistance defines an array of distance along the position axis * thru which ellipses pass * @param frontAttenuationScaleFactor gain scale factors * @param backDistance defines an array of distance along the negative axis * thru which ellipses pass * @param backAttenuationScaleFactor gain scale factors */ public void setDistanceGain(int index, double[] frontDistance, float[] frontAttenuationScaleFactor, double[] backDistance, float[] backAttenuationScaleFactor) { Sample sample = (Sample)getSample(index); if (sample != null) sample.setDistanceGain(frontDistance, frontAttenuationScaleFactor, backDistance, backAttenuationScaleFactor); return; } /** * Set direction vector of sample. * @param index device specific reference number to device driver sample * @param direction vector in virtual world coordinate. */ public void setDirection(int index, Vector3d direction) { Sample sample = (Sample)getSample(index); if (sample != null) sample.setDirection(direction); return; } /** * Set angular attenuation arrays affecting angular amplitude attenuation * and angular distance filtering. * @param index device specific reference number to device driver sample * @param filterType denotes type of filtering (on no filtering) applied * to sample. * @param angle array containing angular distances from sound axis * @param attenuationScaleFactor array containing gain scale factor * @param filterCutoff array containing filter cutoff frequencies. * The filter values for each tuples can be set to Sound.NO_FILTER. */ public void setAngularAttenuation(int index, int filterType, double[] angle, float[] attenuationScaleFactor, float[] filterCutoff) { Sample sample = (Sample)getSample(index); if (sample != null) sample.setAngularAttenuation(filterType, angle, attenuationScaleFactor, filterCutoff); return; } /** * Set rolloff value for current aural attribute applied to all samples. * @param rolloff scale factor applied to standard speed of sound. */ public void setRolloff(float rolloff) { attribs.rolloff = rolloff; return; } /** * Set reverberation surface reflection coefficient value for current aural * attribute applied to all samples. * @param coefficient applied to amplitude of reverbation added at each * iteration of reverb processing. */ public void setReflectionCoefficient(float coefficient) { attribs.reflectionCoefficient = coefficient; return; } /** * Set reverberation delay time for current aural attribute applied to * all samples. * @param reverbDelay amount of time in millisecond between each * iteration of reverb processing. */ public void setReverbDelay(float reverbDelay) { attribs.reverbDelay = reverbDelay; return; } /** * Set reverberation order for current aural attribute applied to all * samples. * @param reverbOrder number of times reverb process loop is iterated. */ public void setReverbOrder(int reverbOrder) { attribs.reverbOrder = reverbOrder; return; } /** * Set distance filter for current aural attribute applied to all samples. * @param filterType denotes type of filtering (on no filtering) applied * to all sample based on distance between listener and sound. * @param dist is an attenuation array of distance and low-pass filter values. */ public void setDistanceFilter(int filterType, double[] dist, float[] filterCutoff) { attribs.setDistanceFilter(filterType, dist, filterCutoff); return; } /** * Set frequency scale factor for current aural attribute applied to all * samples. * @param scaleFactor frequency scale factor applied to samples normal * playback rate. */ public void setFrequencyScaleFactor(float scaleFactor) { attribs.frequencyScaleFactor = scaleFactor; return; } /** * Set velocity scale factor for current aural attribute applied to all * samples when Doppler is calculated. * @param scaleFactor scale factor applied to postional samples' * listener-to-soundSource velocity. * playback rate. */ public void setVelocityScaleFactor(float scaleFactor) { attribs.velocityScaleFactor = scaleFactor; return; } /** * Get number of channels used by a particular sample on the audio device. * @param index device specific reference number to device driver sample * @return number of channels currently being used by this sample. */ public int getNumberOfChannelsUsed(int index) { // This method must be overridden by device specific implementation Sample sample = (Sample)getSample(index); if (sample != null) return (sample.getNumberOfChannelsUsed()); else return 0; } /** * Get number of channels that would be used by a particular sample on * the audio device given the mute flag passed in as a parameter. * @param index device specific reference number to device driver sample * @param muteFlag denotes the mute state to assume while executing this * query. This mute value does not have to match the current mute state * of the sample. * @return number of channels that would be used by this sample if it * were playing. */ public int getNumberOfChannelsUsed(int index, boolean muteFlag) { // This method must be overridden by device specific implementation Sample sample = (Sample)getSample(index); if (sample != null) return (sample.getNumberOfChannelsUsed()); else return 0; } /** * Get length of time a sample would play if allowed to play to completion. * @param index device specific reference number to device driver sample * @return length of sample in milliseconds */ public long getSampleDuration(int index) { Sample sample = (Sample)getSample(index); if (sample != null) return (sample.getDuration()); else return 0L; } /** * Get time this sample begun playing on the audio device. * @param index device specific reference number to device driver sample * @return system clock time sample started */ public long getStartTime(int index) { Sample sample = (Sample)getSample(index); if (sample != null) return (sample.getStartTime()); else return 0L; } /** * Get reference to the array list of samples * @return reference to samples list * @deprecated unsafe to get reference to samples list with this method. * It's better to directly reference samples list within a synchronized * block which also contains calls to .getSample(index). */ protected ArrayList getSampleList() { return (samples); } public int getSampleListSize() { return (samples.size()); } /** * Get specific sample from indexed sample list * Checks for valid index before attempting to get sample from list. * @param index device specific reference number to device driver sample * @return reference to sample; returns null if index out of range. * * @since Java 3D 1.2.1 */ public Sample getSample(int index) { synchronized(samples) { if ((index >= 0) && (index < samples.size())) { Sample sample = (Sample)samples.get(index); return (sample); } else return null; } } /* * Get reference to current aural attribute parameters associated with * this audio device. * @return reference to current aural attribute parameters */ public AuralParameters getAuralParameters() { return (attribs); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -