home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Java 1.2 How-To
/
JavaHowTo.iso
/
3rdParty
/
Gamelication
/
com
/
next
/
gt
/
RCS
/
AudioManager.java,v
< prev
next >
Wrap
Text File
|
1998-04-20
|
2KB
|
115 lines
head 1.2;
access;
symbols;
locks
jgh8962:1.2; strict;
comment @# @;
1.2
date 98.04.15.15.35.12; author mds1274; state Exp;
branches;
next 1.1;
1.1
date 98.04.14.00.56.35; author jgh8962; state Exp;
branches;
next ;
desc
@@
1.2
log
@*** empty log message ***
@
text
@/**
* AudioManager.java
* @@author Jeremy Hutchins, idea from: Bhagvan Kommadi
*/
package com.next.gt;
import sun.audio.*;
import java.io.*;
/**
* Plays a audio files (.au format)
*/
public class AudioManager extends java.applet.Applet
implements Runnable
{
private Thread _kicker = null;
private int _naptime = 5;
private boolean _keepRunning = true;
public void run()
{
while (_keepRunning)
{
try
{
_kicker.sleep(_naptime);
}
catch (InterruptedException e) {};
}
}
public void start()
{
_kicker = new Thread(this);
_kicker.start();
}
/**
* Open the audiostream and
* play the audiofile by the AudioPlayer
*/
public void play(String fileName)
{
AudioStream as;
try
{
as = new AudioStream(new FileInputStream(fileName));
AudioPlayer.player.start(as);
}
catch (IOException e) {
System.err.println("Can't open audio stream");
}
}
/**
* resume playing the sound
*/
public void resumeplay(String fileName)
{
AudioPlayer.player.resume();
}
/**
* suspend the player
*/
public void stopplay( )
{
AudioPlayer.player.suspend();
}
}
@
1.1
log
@Initial revision
@
text
@d5 3
@