EVALUATION
Don't see the test.
###@###.### 2004-07-01
java.applet.AppletAudioClip which is used in the test is a simple wrapper for
com.sun.media.sound.JavaSoundAudioClip, here is rewritten test which use this
class directly and demostrate the problem.
--- Bug.java ---
import java.applet.*;
import java.net.*;
import com.sun.media.sound.JavaSoundAudioClip;
public class Bug{
public static void main(String[] args) {
try {
JavaSoundAudioClip ac = new JavaSoundAudioClip(Bug.class.getResource("yes.au").openStream());
ac.play();
} catch (Exception e3) {
System.err.println("Failed to construct the AudioClip: " + e3);
}
}
}
--- end of Bug.java ---
Thus this is java sound's problem, not applet's one.
###@###.### 2004-09-17
This might be either java sound or io problem, reassigning to javasound for further investigation.
###@###.### 2004-09-17
###@###.### 2005-2-10 01:15:36 GMT
The simplified testcase differs from the incidents on the
JavaMedia forum. It works on 1.4.2 because of a bug that
does not terminate the JVM when the program ends, see CR
4735740. If delay is added to the testcase it works on 1.5.0.
Most of the incidents on the forum indicate short audio clips
are not played while the program / applet continues. A boundary
condition exists in PLATFORM_API_WinOS_DirectSound.cpp in
src/windows/native/com/sun/media/sound/engine/ that is
frequently hit on very small files. Silence is played
instead of the audio clip.
###@###.### 2005-2-18 03:12:32 GMT
Trying to verify the fix on 1.5.0_02 B07 and B08 but the following code will not play the complete clip and the JVM will exit while playing it.
AudioClip ac = Applet.newAudioClip(Bug.class.getResource("spacemusic.au");
//The following play() will not play the whole audio clip unless Thread.sleep(delay) is introduced after it.
ac.play();
//And JVM will exit before loop() method to complete the audio clip unless Thread.sleep(delay) after it.
ac.loop();
###@###.### 2005-2-28 22:36:44 GMT
As mentioned above, simplified testcase differs from the incidents
on the JavaMedia forum. It ONLY works on 1.4.2 because of a bug
that does not terminate the JVM when the program ends, see CR
4735740.
AudioClip.play() is asynchronous; it starts playing audio, it
returns as soon as the clip is started, it does not delay the
current thread to the end of the clip.
Since the fix fo CR 4735740 is in 1.5.0, the delay is needed
in the testcase following ac.play().
###@###.### 2005-3-01 01:09:18 GMT
Users may run into problem when they cannot query the length of the audio clip at runtime, hence, do not know how long the delay is needed for the sleep.
###@###.### 2005-03-01 18:26:56 GMT
AudioClip is not intended for the type of program that needs
to know how long the clip is in order to wait for it. If it
is absolutely necessary to wait for a clip to complete, the
addLineListener function can be used to associate an event
listener that can be executed when the clip completes playing.
The intent of AudioClip is to allow a programmer to trigger
a sound when an event occurs without having to manage play
of the clip. For instance in a game when an object collides
with a wall the programmer may want to start a collision
sound, change the object's trajectory, possibly indicate
damage to the object or the wall and go back to the main
loop of the game. In another case, say to simulate a car
alarm, the programmer may want to trigger a looping clip
until an event occurs that would clear the alarm; at that
time the programmer would invoke stop() on the clip.
an.
###@###.### 2005-03-01 19:11:35 GMT
|