本文整理汇总了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();
}