Java Reference
In-Depth Information
Figure 7. First code segment for SoundTest.java
24.
aAttributes.setCapability(AuralAttributes.ALLOW_ATTRIBUTE_GAIN_WRITE);
25.
aAttributes.setCapability(AuralAttributes.ALLOW_FREQUENCY_SCALE_FACTOR_WRITE);
26.
aAttributes.setCapability(AuralAttributes.ALLOW_REFLECTION_COEFFICIENT_WRITE);
27.
aAttributes.setCapability(AuralAttributes.ALLOW_REVERB_DELAY_WRITE);
28.
aAttributes.setCapability(AuralAttributes.ALLOW_REVERB_ORDER_WRITE);
29.
aAttributes.setCapability(AuralAttributes.ALLOW_ROLLOFF_WRITE);
30.
aAttributes.setCapability(AuralAttributes.ALLOW_VELOCITY_SCALE_FACTOR_WRITE);
31.
aAttributes.setDistanceFilter(distanceFilter);
32.
sound.setCapability(Sound.ALLOW_ENABLE_WRITE);
33. sound.setCapability(Sound.ALLOW_ENABLE_READ);
34. sound.setCapability(PointSound.ALLOW_DISTANCE_GAIN_WRITE);
35. sound.setSchedulingBounds(sBounds);
36. sound.setSoundData(data);
37. sound.setInitialGain(2.0f);
38. sound.setLoop(Sound.INFINITE_LOOPS);
39. sScape.setCapability(Soundscape.ALLOW_ATTRIBUTES_WRITE);
40. sScape.setCapability(Soundscape.ALLOW_APPLICATION_BOUNDS_WRITE);
41. sScape.setAuralAttributes(aAttributes);
42. sScape.setApplicationBounds(sScapeBounds);
43.
44. protected void decode(ParamSlider paramSlider, int idx) {
45.
float value = paramSlider.getValue();
46.
try switch(idx) {
47.
case 0: aAttributes.setAttributeGain(value); break;
48.
case 1: aAttributes.setFrequencyScaleFactor(value); break;
49.
case 2: aAttributes.setReflectionCoefficient(value); break;
50.
case 3: aAttributes.setReverbDelay(value); break;
51.
case 4: aAttributes.setReverbOrder((int)value); break;
52.
case 5: aAttributes.setRolloff(value); System.out.println(value); break;
53.
case 6: aAttributes.setVelocityScaleFactor(value); break;
54.
case 7: v3f.set(0.0f, 0.0f, -value); t3d.setTranslation(v3f); tg.setTransform(t3d); break;
55.
default: };
56.
catch (NumberFormatException e){}
57.
sScape.setApplicationBounds(sScapeBounds);
58. }
summary
In this chapter, we have outlined how 3D sound sources and aural characteristics can be
integrated into the virtual world built using Java 3D. Three types of sources, Background-
Sound, PointSound and ConeSound, are supported, and this become audible if the activation
radius intersects with the scheduling bounds of the sound. Controls are also available to
Search WWH ::




Custom Search