本文整理匯總了Java中java.applet.Applet.newAudioClip方法的典型用法代碼示例。如果您正苦於以下問題:Java Applet.newAudioClip方法的具體用法?Java Applet.newAudioClip怎麽用?Java Applet.newAudioClip使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.applet.Applet
的用法示例。
在下文中一共展示了Applet.newAudioClip方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: playApplet
import java.applet.Applet; //導入方法依賴的package包/類
private static void playApplet(String filename) {
URL url = null;
try {
File file = new File(filename);
if (file.canRead())
url = file.toURI().toURL();
} catch (MalformedURLException e) {
throw new IllegalArgumentException("could not play '" + filename + "'", e);
}
// URL url = StdAudio.class.getResource(filename);
if (url == null) {
throw new IllegalArgumentException("could not play '" + filename + "'");
}
AudioClip clip = Applet.newAudioClip(url);
clip.play();
}
示例2: reproducirSonidoJuego
import java.applet.Applet; //導入方法依賴的package包/類
public void reproducirSonidoJuego(){
URL url = getClass().getResource("juego.mid");
clipJuego = Applet.newAudioClip(url);
clipJuego.loop();
}
示例3: getAudio
import java.applet.Applet; //導入方法依賴的package包/類
public static AudioClip getAudio(int index) {
if (audios[index] == null) {
URL url = null;
ClassLoader classLoader = FileHelper.class.getClassLoader();
url = classLoader.getResource("music/" + index + ".wav");
audios[index] = Applet.newAudioClip(url);
}
return audios[index];
}
示例4: playAudio
import java.applet.Applet; //導入方法依賴的package包/類
public void playAudio(int tempo, boolean flag) throws UnsupportedAudioFileException, LineUnavailableException, IOException, InterruptedException{
Clip clip = AudioSystem.getClip();
URL url = getClass().getResource("/audio/smb_die.wav");
URL urlToHot = this.getClass().getResource("/audio/smb_die.wav");
System.out.println(urlToHot);
this.audio = Applet.newAudioClip(url);
if(flag) audio.loop();
else audio.stop();
}
示例5: createAudioClipFactory
import java.applet.Applet; //導入方法依賴的package包/類
protected AudioClipFactory createAudioClipFactory() {
return new AudioClipFactory() {
public AudioClip getAudioClip(URL url) {
return Applet.newAudioClip(url);
}
};
}
示例6: Sound
import java.applet.Applet; //導入方法依賴的package包/類
private Sound(String name) {
try {
clip = Applet.newAudioClip( Sound.class
.getResource( name ) ); //tries to load the audio clip from the name you gave above.
} catch ( Throwable e ) {
e.printStackTrace( ); // else it will throw an error
}
}
示例7: doLoadSounds
import java.applet.Applet; //導入方法依賴的package包/類
/**
* Method description
*
* @see
*/
final private void doLoadSounds() {
switch (this.bytGprogramType) {
case Constants.bytS_STATE_PROGRAM_LOCAL_APPLICATION:
this.objGapplicationClipAA = new ExtendedClip[Constants.bytS_FILES_SOUNDS_NUMBER][Constants.bytS_ENGINE_SOUNDS_BUFFERING];
for (byte bytLsoundFileIndex = 0; bytLsoundFileIndex < Constants.bytS_FILES_SOUNDS_NUMBER; ++bytLsoundFileIndex) {
for (byte bytLbufferingIndex = 0; bytLbufferingIndex < Constants.bytS_ENGINE_SOUNDS_BUFFERING; ++bytLbufferingIndex) {
this.objGapplicationClipAA[bytLsoundFileIndex][bytLbufferingIndex] = new ExtendedClip(this, bytLsoundFileIndex);
}
}
break;
case Constants.bytS_STATE_PROGRAM_LOCAL_APPLET:
case Constants.bytS_STATE_PROGRAM_WEB_APPLET:
this.objGappletAudioClipA = new AudioClip[Constants.bytS_FILES_SOUNDS_NUMBER];
for (byte bytLsoundFileIndex = 0; bytLsoundFileIndex < Constants.bytS_FILES_SOUNDS_NUMBER; ++bytLsoundFileIndex) {
try {
this.objGappletAudioClipA[bytLsoundFileIndex] =
Applet.newAudioClip(new URL(Strings.doConcat( this.strS_CODE_BASE,
Constants.strS_FILE_NAME_A[Constants.intS_FILE_FOLDER_SOUNDS],
this.chrGpathSeparator,
Constants.strS_FILE_SOUND_NAME_A[bytLsoundFileIndex])));
} catch (final Throwable objPthrowable) {
Tools.err("Error while initializing sound");
this.objGappletAudioClipA[bytLsoundFileIndex] = null;
}
}
break;
}
}
示例8: EfectosSonido
import java.applet.Applet; //導入方法依賴的package包/類
public EfectosSonido(){
URL url = getClass().getResource("laser.WAV");
clipShoot = Applet.newAudioClip(url);
url = getClass().getResource("explosion.wav");
clipExplosion = Applet.newAudioClip(url);
url = getClass().getResource("Beep.WAV");
clipClick = Applet.newAudioClip(url);
}
示例9: reproducirSonidoMenu
import java.applet.Applet; //導入方法依賴的package包/類
public void reproducirSonidoMenu(){
URL url = getClass().getResource("menu.mid");
clipMenu = Applet.newAudioClip(url);
clipMenu.loop();
}
示例10: pararSonidoMenu
import java.applet.Applet; //導入方法依賴的package包/類
public void pararSonidoMenu(){
URL url = getClass().getResource("menu.mid");
clipMenu = Applet.newAudioClip(url);
clipMenu.stop();
}
示例11: pararSonidoJuego
import java.applet.Applet; //導入方法依賴的package包/類
public void pararSonidoJuego(){
URL url = getClass().getResource("juego.mid");
clipJuego = Applet.newAudioClip(url);
clipJuego.stop();
}
示例12: reproducirSonidoAcelerar
import java.applet.Applet; //導入方法依賴的package包/類
public void reproducirSonidoAcelerar(){
URL url = getClass().getResource("Acelerar.wav");
clipAcelerar = Applet.newAudioClip(url);
clipAcelerar.play();
}
示例13: pararSonidoAcelerar
import java.applet.Applet; //導入方法依賴的package包/類
public void pararSonidoAcelerar(){
URL url = getClass().getResource("Acelerar.wav");
clipAcelerar = Applet.newAudioClip(url);
clipAcelerar.stop();
}
示例14: reproducirSonidoTomarEnergia
import java.applet.Applet; //導入方法依賴的package包/類
public void reproducirSonidoTomarEnergia(){
URL url = getClass().getResource("EnergyTake.wav");
clipEnergy = Applet.newAudioClip(url);
clipEnergy.play();
}
示例15: pararSonidoTomarEnergia
import java.applet.Applet; //導入方法依賴的package包/類
public void pararSonidoTomarEnergia(){
URL url = getClass().getResource("EnergyTake.wav");
clipEnergy = Applet.newAudioClip(url);
clipEnergy.stop();
}