maandree / cnt

Coop Network Tetris, a university project.
maandree.github.com/cnt
4 stars 1 forks source link

Bell #29

Open maandree opened 12 years ago

maandree commented 12 years ago

Audible bell (opt-out) and visual bell (opt-out) should be triggered at least one round before the local players turn.

maandree commented 12 years ago

Here is a code basis for a audible bell.

import javax.sound.sampled.*;
import java.io.*;

public class Sound
{   public static void Audio()
    {   try
        {
            final Clip clip = AudioSystem.getClip();
            final File file = new File("bell.wav");
            final AudioInputStream ais = AudioSystem.getAudioInputStream(file);
            clip.open(ais);
            clip.start();
        } 
        catch (final Exception err)
        {   System.err.println(err.getMessage());
}   }   }

http://docs.oracle.com/javase/6/docs/api/index.html?javax/sound/midi/spi/package-summary.html http://docs.oracle.com/javase/6/docs/api/javax/sound/sampled/Clip.html http://docs.oracle.com/javase/6/docs/api/javax/sound/sampled/SourceDataLine.html http://docs.oracle.com/javase/6/docs/api/javax/sound/sampled/FloatControl.html http://docs.oracle.com/javase/6/docs/api/javax/sound/sampled/FloatControl.Type.html