Java Reference
In-Depth Information
Figure 8. Second code segment and result for SoundTest.java
1.
// Selection of distanceFilter models
2.
JRadioButton fModel1 = new JRadioButton("No filter");
3.
JRadioButton fModel2 = new JRadioButton("Model 1");
4.
JRadioButton fModel3 = new JRadioButton("Model 2");
5.
6.
fModel1.addActionListener(new ActionListener() {
7.
public void actionPerformed(ActionEvent e) {
8.
aAttributes.setDistanceFilter(distanceFilter1);
9.
tg.setTransform(t3d);
10.
if(!sound.getEnable()) { sound.setEnable(true); sound.setDistanceGain(distanceGain); }}};
11.
12. fModel2.addActionListener(new ActionListener() {
13.
public void actionPerformed(ActionEvent e) {
14.
aAttributes.setDistanceFilter(distanceFilter2);
15.
tg.setTransform(t3d);
16.
if(!sound.getEnable()) { sound.setEnable(true); sound.setDistanceGain(distanceGain); }}};
17.
18. fModel3.addActionListener(new ActionListener() {
19.
public void actionPerformed(ActionEvent e) {
20.
aAttributes.setDistanceFilter(distanceFilter3);
21.
tg.setTransform(t3d);
22.
if(!sound.getEnable()) { sound.setEnable(true); sound.setDistanceGain(distanceGain); }}};
turn a sound source on or off, set its gain, release style, continuous playback style, loop-
ing, priority, and scheduling bounds. In addition, by creating a SoundScape object with
appropriate AuralAttributes, an special acoustical environment can be simulated.


Search WWH ::

Custom Search