Play a sound once using Java Audio Synthesis System (JASS)
<p>Does anyone know how to play a sound file just one time using JASS? I can play sound using <code>SourcePlayer</code> but this is a thread and it plays over and over again. </p>

<p>I am using the code below:</p>

<pre><code>SourcePlayer player;
LoopBuffer loopbuffer;
Mixer mixer;
String wavfile = "sounds/ur.wav";

public void start(int speed) {
    float srate = 44100.f;
    int bufferSize = 128*4;
    int bufferSizeJavaSound = 8*1024;

    loopbuffer = new LoopBuffer(srate, bufferSize, wavfile);

    mixer = new Mixer(bufferSize, 1);
    mixer.setGain(0,1);

    player = new SourcePlayer(bufferSize, bufferSizeJavaSound, srate);
    try {
        player.addSource(mixer);
        mixer.addSource(loopbuffer);           
    } catch(SinkIsFullException e) { }

    float val = (float)(.95 + speed/20.);

    loopbuffer.setSpeed((float)val);

    player.start();
}
</code></pre>

<p>Thanks in advance</p>
