public class AlarmSound
extends java.util.TimerTask
The class emits a sound every TIME_INTERVAL seconds
if the table contains alarms not seen by the user.
The sound depends on the highest priority of the alarms
not seen i.e. every priority has its own specific sound.
It is possible to inhibit the sound for a given period of
time, INHIBIT_TIME.
After INHIBIT_TIME seconds, the sounds will be
re-enabled.
In case of error playing a sound, objects of this class do nothing because we do not want to trigger a failure in the application neither to present a dialog to the operator. Apart of that, if the audio system is in use by another application then it might happen that it is not possible to reserve a new line and play the sound.;
Note:
after testing in tf-ohg I have found that the STE sound environment
is quite problematic. for example in my account there were 4 mixers
but I have tried another one that add only one and in that case it was
not possible to find a line to play the sound.
With my account, even with 4 mixers available the process was able
to play the sound but not in the speakers.
To limit the risk that the sound is played in the wrong device or
that the line obtained by default is not available because locked
by another application and so n, I decided to play the sound
in all available devices with the risk to play it twice.
| Constructor and Description |
|---|
AlarmSound(AlarmTableModel model)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
addSoundListener(AlarmSoundListener listener)
Add or remove a listener
|
void |
close()
Close the timer.
|
int |
getSoundLevel()
Return the inhibit sound level
|
void |
inhibit(int level)
Set the level of the alarm to which a sound has to be played.
|
void |
run()
The task to emit the sound.
|
public AlarmSound(AlarmTableModel model)
model - The table modelpublic void inhibit(int level)
level - The new level of the sound to play;
level must be in the same range of soundLevel.AlarmSound#soundLevel}public int getSoundLevel()
AlarmSound#soundLevel}public void close()
public void run()
run in interface java.lang.Runnablerun in class java.util.TimerTaskpublic void addSoundListener(AlarmSoundListener listener)
listener - If not null add the listener;
otherwise remove the listener