1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package inc.che.common.audio;
20
21
22
23 import java.io.File;
24 import java.io.FileInputStream;
25 import java.io.IOException;
26 import java.io.InputStream;
27
28 import org.apache.log4j.Logger;
29
30 import sun.audio.AudioData;
31 import sun.audio.AudioDataStream;
32 import sun.audio.AudioStream;
33
34 /***
35 * <b>@todo</b>
36 * @version $Id: AudioPlayer.java,v 1.1 2005/03/06 12:56:48 stevemcmee Exp $
37 * @author <address> Steve McMee <Steve@users.sourceforge.net> </address>
38 */
39
40 public final class AudioPlayer {
41
42 /*** CVS ID of this file */
43 public static final String CVS_ID =
44 "$Id: AudioPlayer.java,v 1.1 2005/03/06 12:56:48 stevemcmee Exp $";
45
46 /***
47 * logger instance for this class
48 */
49
50 private static Logger log = Logger.getLogger(AudioPlayer.class);
51
52 /***
53 * forbidden Constructor
54 */
55 private AudioPlayer() {
56 }
57
58 public static void play(File audioFile) throws IOException {
59 play(new FileInputStream(audioFile));
60 }
61
62 public static void play(InputStream is) throws IOException {
63 AudioData data = new AudioStream(is).getData();
64 AudioDataStream audiostream = new AudioDataStream(data);
65 sun.audio.AudioPlayer.player.start(audiostream);
66 }
67
68 }