📄 auralattributesretained.java
字号:
*/ void setDecayFilter(float decayFilter) { this.decayFilter = decayFilter; this.aaDirty = true; notifyUsers(); } /** * Retrieve Revereration Decay Filter * @return reverb delay Filter */ float getDecayFilter() { return this.decayFilter; } /** * Set Reverb Diffusion * @param diffusion ratio between min and max device diffusion settings */ void setDiffusion(float diffusion) { this.diffusion = diffusion; this.aaDirty = true; notifyUsers(); } /** * Retrieve Revereration Decay Diffusion * @return reverb diffusion */ float getDiffusion() { return this.diffusion; } /** * Set Reverb Density * @param density ratio between min and max device density settings */ void setDensity(float density) { this.density = density; this.aaDirty = true; notifyUsers(); } /** * Retrieve Revereration Density * @return reverb density */ float getDensity() { return this.density; } /** * Set Revereration Bounds * @param reverbVolume bounds used to approximate reverb time. */ synchronized void setReverbBounds(Bounds reverbVolume) { this.reverbBounds = reverbVolume; this.aaDirty = true; notifyUsers(); } /** * Retrieve Revereration Delay Bounds volume * @return reverb bounds volume that defines the Reverberation space and * indirectly the delay */ Bounds getReverbBounds() { return this.reverbBounds; } /** * Set Reverberation Order of Reflections * @param reverbOrder number of times reflections added to reverb signal */ void setReverbOrder(int reverbOrder) { this.reverbOrder = reverbOrder; this.aaDirty = true; notifyUsers(); } /** * Retrieve Reverberation Order of Reflections * @return reverb order number of times reflections added to reverb signal */ int getReverbOrder() { return this.reverbOrder; } /** * Set Distance Filter (based on distances and frequency cutoff) * @param attenuation array of pairs defining distance frequency cutoff */ synchronized void setDistanceFilter(Point2f[] attenuation) { if (attenuation == null) { this.filterType = NO_FILTERING; return; } int attenuationLength = attenuation.length; if (attenuationLength == 0) { this.filterType = NO_FILTERING; return; } this.filterType = LOW_PASS; // Reallocate every time unless size of new array equal old array if ( distance == null || (distance != null && (distance.length != attenuationLength) ) ) { this.distance = new float[attenuationLength]; this.frequencyCutoff = new float[attenuationLength]; } for (int i = 0; i< attenuationLength; i++) { this.distance[i] = attenuation[i].x; this.frequencyCutoff[i] = attenuation[i].y; } this.aaDirty = true; notifyUsers(); } /** * Set Distance Filter (based on distances and frequency cutoff) using * separate arrays * @param distance array containing distance values * @param filter array containing low-pass frequency cutoff values */ synchronized void setDistanceFilter(float[] distance, float[] filter) { if (distance == null || filter == null) { this.filterType = NO_FILTERING; return; } int distanceLength = distance.length; int filterLength = filter.length; if (distanceLength == 0 || filterLength == 0) { this.filterType = NO_FILTERING; return; } // Reallocate every time unless size of new array equal old array if ( this.distance == null || ( this.distance != null && (this.distance.length != filterLength) ) ) { this.distance = new float[distanceLength]; this.frequencyCutoff = new float[distanceLength]; } this.filterType = LOW_PASS; // Copy the distance array into nodes field System.arraycopy(distance, 0, this.distance, 0, distanceLength); // Copy the filter array an array of same length as the distance array if (distanceLength <= filterLength) { System.arraycopy(filter, 0, this.frequencyCutoff,0, distanceLength); } else { System.arraycopy(filter, 0, this.frequencyCutoff, 0, filterLength); // Extend filter array to length of distance array by // replicate last filter values. for (int i=filterLength; i< distanceLength; i++) { this.frequencyCutoff[i] = filter[filterLength - 1]; } } if (debugFlag) { debugPrint("AAR setDistanceFilter(D,F)"); for (int jj=0;jj<distanceLength;jj++) { debugPrint(" from distance, freq = " + distance[jj] + ", " + filter[jj]); debugPrint(" into distance, freq = " + this.distance[jj] + ", " + this.frequencyCutoff[jj]); } } this.aaDirty = true; notifyUsers(); } /** * Retrieve Distance Filter array length * @return attenuation array length */ int getDistanceFilterLength() { if (distance == null) return 0; else return this.distance.length; } /** * Retrieve Distance Filter (distances and frequency cutoff) * @return attenaution pairs of distance and frequency cutoff filter */ void getDistanceFilter(Point2f[] attenuation) { // Write into existing param array already allocated if (attenuation == null) return; if (this.distance == null || this.frequencyCutoff == null) return; // The two filter attenuation arrays length should be the same // We can assume that distance and filter lengths are the same // and are non-zero. int distanceLength = this.distance.length; // check that attenuation array large enough to contain // auralAttribute arrays if (distanceLength > attenuation.length) distanceLength = attenuation.length; for (int i=0; i< distanceLength; i++) { attenuation[i].x = this.distance[i]; if (filterType == NO_FILTERING) attenuation[i].y = Sound.NO_FILTER; else if (filterType == LOW_PASS) attenuation[i].y = this.frequencyCutoff[i]; if (debugFlag) debugPrint("AAR: getDistF: " + attenuation[i].x + ", " + attenuation[i].y); } } /** * Retrieve Distance Filter as arrays distances and frequency cutoff array * @param distance array of float values * @param frequencyCutoff array of float cutoff filter values in Hertz */ void getDistanceFilter(float[] distance, float[] filter) { // Write into existing param arrays already allocated if (distance == null || filter == null) return; if (this.distance == null || this.frequencyCutoff == null) return; int distanceLength = this.distance.length; // check that distance parameter large enough to contain auralAttribute // distance array // We can assume that distance and filter lengths are the same // and are non-zero. if (distance.length < distanceLength) // parameter array not large enough to hold all this.distance data distanceLength = distance.length; System.arraycopy(this.distance, 0, distance, 0, distanceLength); if (debugFlag) debugPrint("AAR getDistanceFilter(D,F) " + this.distance[0]); int filterLength = this.frequencyCutoff.length; if (filter.length < filterLength) // parameter array not large enough to hold all this.filter data filterLength = filter.length; if (filterType == NO_FILTERING) { for (int i=0; i< filterLength; i++) filter[i] = Sound.NO_FILTER; } if (filterType == LOW_PASS) { System.arraycopy(this.frequencyCutoff, 0, filter, 0, filterLength); } if (debugFlag) debugPrint(", " + this.frequencyCutoff[0]); } /** * Set Frequency Scale Factor * @param frequencyScaleFactor factor applied to sound's base frequency */ void setFrequencyScaleFactor(float frequencyScaleFactor) { this.frequencyScaleFactor = frequencyScaleFactor; this.aaDirty = true; notifyUsers(); } /** * Retrieve Frequency Scale Factor * @return frequency scale factor applied to sound's base frequency */ float getFrequencyScaleFactor() { return this.frequencyScaleFactor; } /** * Set Velocity ScaleFactor used in calculating Doppler Effect * @param velocityScaleFactor applied to velocity of sound in relation to listener */ void setVelocityScaleFactor(float velocityScaleFactor) { this.velocityScaleFactor = velocityScaleFactor; this.aaDirty = true; notifyUsers(); } /** * Retrieve Velocity ScaleFactor used in calculating Doppler Effect * @return velocity scale factor */ float getVelocityScaleFactor() { return this.velocityScaleFactor; } synchronized void reset(AuralAttributesRetained aa) { int i; this.attributeGain = aa.attributeGain; this.rolloff = aa.rolloff; this.reflectionCoefficient = aa.reflectionCoefficient; this.reverbCoefficient = aa.reverbCoefficient; this.reflectionDelay = aa.reflectionDelay; this.reverbDelay = aa.reverbDelay; this.reverbBounds = aa.reverbBounds; this.reverbOrder = aa.reverbOrder; this.decayTime = aa.decayTime; this.decayFilter = aa.decayFilter; this.diffusion = aa.diffusion; this.density = aa.density; this.frequencyScaleFactor = aa.frequencyScaleFactor; this.velocityScaleFactor = aa.velocityScaleFactor; if (aa.distance != null) { this.distance = new float[aa.distance.length]; if (debugFlag) debugPrint("reset aa; aa.distance.length = " + this.distance.length); System.arraycopy(aa.distance, 0, this.distance, 0, this.distance.length); } else if (debugFlag) debugPrint("reset aa; aa.distance = null"); if (aa.frequencyCutoff != null) { this.frequencyCutoff = new float[aa.frequencyCutoff.length]; if (debugFlag) debugPrint("reset aa; aa.frequencyCutoff.length = " + this.frequencyCutoff.length); System.arraycopy(aa.frequencyCutoff, 0, this.frequencyCutoff, 0, this.frequencyCutoff.length); } else if (debugFlag) debugPrint("reset aa; aa.frequencyCutoff = null"); // XXXX: (Enhancement) Why are these dirtyFlag cleared rather than aa->this this.aaDirty = false; aa.aaDirty = false; } void update(AuralAttributesRetained aa) { this.reset(aa); } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -