SyslogMedia.java
2.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
package com.sitech.ismp.ice.syslogd;
import java.net.*;
import java.util.*;
import java.applet.*;
import sun.audio.*; //import the sun.audio package
import java.io.*;
/*
* This class will need to be changed for every new
* environment that the syslogd package is used in.
* Specifically, the audio currently depends on an
* available Applet, which is provided by the SyslogD
* application in this instance.
*/
public class
SyslogMedia
{
public static final String RCS_ID = "$Id: SyslogMedia.java,v 1.1.1.1 1998/02/22 05:47:54 time Exp $";
public static final String RCS_REV = "$Revision: 1.1.1.1 $";
public static final String RCS_NAME = "$Name: $";
static public final String sunAudioAPIName = "SunAudio";
static public final String jmfAudioAPIName = "JMFAudio";
static private Hashtable audioCache;
static
{
SyslogMedia.audioCache = new Hashtable();
}
static public void
loadAudioClip( String apiName, String audioPath )
{
if ( apiName.equalsIgnoreCase( SyslogMedia.sunAudioAPIName ) )
{
SyslogMedia.loadSunAudioClip( audioPath );
}
else
{
System.err.println
( "ERROR loading, unknown audio API '" + apiName + "'" );
}
}
static public void
playAudioClip( String apiName, String audioPath )
{
if ( apiName.equalsIgnoreCase( SyslogMedia.sunAudioAPIName ) )
{
SyslogMedia.playSunAudioClip( audioPath );
}
else
{
System.err.println
( "ERROR playing, unknown audio API '" + apiName + "'" );
}
}
static public void
loadSunAudioClip( String audioPath )
{
//** add this into your application code as appropriate
File audioFile = new File( audioPath );
if ( ! audioFile.exists() )
{
System.err.println
( "ERROR could not load audio clip '"
+ audioPath + "', it does not exist." );
}
else
{
SyslogMedia.audioCache.put( audioPath, audioFile );
}
}
static public void
playSunAudioClip( String audioPath )
{
/*File audioFile = (File)
SyslogMedia.audioCache.get( audioPath );
if ( audioFile != null )
{
InputStream in = null;
AudioStream audioClip = null;
try {
in = new FileInputStream( audioFile );
audioClip = new AudioStream( in );
AudioPlayer.player.start( audioClip );
}
catch ( IOException ex )
{
System.err.println
( "ERROR playing audioClip '" + audioPath
+ "':\n\t" + ex.getMessage() );
}
}*/
}
}