/** * Creates the retained mode AuralAttributesRetained object that this * component object will point to. */ @Override void createRetained() { this.retained = new AuralAttributesRetained(); this.retained.setSource(this); }
/** * Set a set of aural attributes for this Soundscape * @param attributes aural attributes to be set */ void setAuralAttributes(AuralAttributes attributes) { if (this.source.isLive()) { if (this.attributes != null) { this.attributes.clearLive(refCount); } if (attributes != null) { ((AuralAttributesRetained)attributes.retained).setLive(inBackgroundGroup, refCount); } } if (this.attributes != null) { this.attributes.removeUser(this); } if (attributes != null) { this.attributes = (AuralAttributesRetained)attributes.retained; this.attributes.addUser(this); } else { this.attributes = null; } // copy all fields out of attributes and put into our copy of attributes this.isDirty |= ATTRIBUTES_CHANGED; dispatchMessage(ATTRIBUTES_CHANGED, attributes); if (source != null && source.isLive()) { notifySceneGraphChanged(false); } }
AuralAttributesRetained rt = (AuralAttributesRetained) retained; rt.setAttributeGain(aural.getAttributeGain()); rt.setRolloff(aural.getRolloff()); rt.setReflectionCoefficient(aural.getReflectionCoefficient()); rt.setReverbDelay(aural.getReverbDelay()); rt.setReverbOrder(aural.getReverbOrder()); rt.setReverbBounds(aural.getReverbBounds()); rt.setFrequencyScaleFactor(aural.getFrequencyScaleFactor()); rt.setVelocityScaleFactor(aural.getVelocityScaleFactor()); int len = aural.getDistanceFilterLength(); float distance[] = new float[len]; float frequencyCutoff[] = new float[len]; aural.getDistanceFilter(distance, frequencyCutoff); rt.setDistanceFilter(distance, frequencyCutoff);
int arraySize = attribs.getDistanceFilterLength(); if ((attribs.filterType == AuralAttributesRetained.NO_FILTERING) || for (int i=0; i< arraySize; i++) attenuation[i] = new Point2f(); attribs.getDistanceFilter(attenuation); double[] distance = new double[arraySize]; float[] cutoff = new float[arraySize];
/** * Retrieve Distance Filter as a single array containing distances * and frequency cutoff. The distance filter is copied into * the specified array. * The array must be large enough to hold all of the points. * The individual array elements must be allocated by the caller. * @param attenuation array of pairs of distance and frequency cutoff values * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void getDistanceFilter(Point2f[] attenuation) { if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_DISTANCE_FILTER_READ)) throw new CapabilityNotSetException(J3dI18N.getString("AuralAttributes12")); ((AuralAttributesRetained)this.retained).getDistanceFilter(attenuation); }
/** * This clearLive routine first calls the superclass's method, then * it removes itself to the list of lights */ @Override void clearLive(SetLiveState s) { super.clearLive(s); if (s.switchTargets != null && s.switchTargets[0] != null) { s.switchTargets[0].addNode(this, Targets.SND_TARGETS); } if (attributes != null) { attributes.clearLive(s.refCount); } if (s.transformTargets != null && s.transformTargets[0] != null) { s.transformTargets[0].addNode(this, Targets.SND_TARGETS); s.notifyThreads |= J3dThread.UPDATE_TRANSFORM; } // If its view Scoped, then add this list // to be sent to Sound Structure if ((s.viewScopedNodeList != null) && (s.viewLists != null)) { s.viewScopedNodeList.add(this); s.scopedNodesViewList.add(s.viewLists.get(0)); } else { s.nodeList.add(this); } s.notifyThreads |= (J3dThread.UPDATE_SOUND | J3dThread.SOUND_SCHEDULER); }
/** * Retrieve Attribute Gain (amplitude). * @return gain amplitude scale factor * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public float getAttributeGain() { if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_ATTRIBUTE_GAIN_READ)) throw new CapabilityNotSetException(J3dI18N.getString("AuralAttributes1")); return ((AuralAttributesRetained)this.retained).getAttributeGain(); }
/** * Retrieve Decay Time. * @return reverb decay time * @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 getDecayTime() { if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_DECAY_TIME_READ)) throw new CapabilityNotSetException(J3dI18N.getString("AuralAttributes29")); return ((AuralAttributesRetained)this.retained).getDecayTime(); }
/** * Retrieve Diffusion. * @return reverb diffusion ratio * @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 getDiffusion() { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_DIFFUSION_READ)) throw new CapabilityNotSetException(J3dI18N.getString("AuralAttributes33")); return ((AuralAttributesRetained)this.retained).getDiffusion(); }
/** * Retrieve Decay Filter. * @return reverb decay filter cutoff frequency * @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 getDecayFilter() { if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_DECAY_FILTER_READ)) throw new CapabilityNotSetException(J3dI18N.getString("AuralAttributes31")); return ((AuralAttributesRetained)this.retained).getDecayFilter(); }
/** * Retrieve Density. * @return reverb density * @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 getDensity() { if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_DENSITY_READ)) throw new CapabilityNotSetException(J3dI18N.getString("AuralAttributes35")); return ((AuralAttributesRetained)this.retained).getDensity(); }
(findClosestAAttribs(nIntersected)).clone();
/** * Retrieve Distance Filter in separate distance and frequency cutoff arrays. * The arrays must be large enough to hold all of the distance * and frequency cutoff values. * @param distance array * @param frequencyCutoff cutoff array * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void getDistanceFilter(float[] distance, float[] frequencyCutoff) { if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_DISTANCE_FILTER_READ)) throw new CapabilityNotSetException(J3dI18N.getString("AuralAttributes12")); ((AuralAttributesRetained)this.retained).getDistanceFilter( distance, frequencyCutoff); }