當前位置: 首頁>>代碼示例>>Java>>正文


Java Applet.newAudioClip方法代碼示例

本文整理匯總了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();
}
 
開發者ID:Scoutdrago3,項目名稱:MusicToGraph,代碼行數:19,代碼來源:StdAudio.java

示例2: reproducirSonidoJuego

import java.applet.Applet; //導入方法依賴的package包/類
public void reproducirSonidoJuego(){
    URL url = getClass().getResource("juego.mid");
    clipJuego = Applet.newAudioClip(url);
    clipJuego.loop();
}
 
開發者ID:Uminks,項目名稱:Star-Ride--RiverRaid,代碼行數:6,代碼來源:EfectosSonido.java

示例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];
}
 
開發者ID:zhangjikai,項目名稱:LinkGame,代碼行數:10,代碼來源:EffectSound.java

示例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();
    
}
 
開發者ID:knowrafa,項目名稱:lembredio,代碼行數:11,代碼來源:Audio.java

示例5: createAudioClipFactory

import java.applet.Applet; //導入方法依賴的package包/類
protected AudioClipFactory createAudioClipFactory() {
  return new AudioClipFactory() {
    public AudioClip getAudioClip(URL url) {
      return Applet.newAudioClip(url);
    }
  };
}
 
開發者ID:ajmath,項目名稱:VASSAL-src,代碼行數:8,代碼來源:SoundConfigurer.java

示例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
  }
}
 
開發者ID:BrianGaucher,項目名稱:Camasia,代碼行數:9,代碼來源:Sound.java

示例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;
	}
}
 
開發者ID:jugglemaster,項目名稱:JuggleMasterPro,代碼行數:35,代碼來源:JuggleMasterPro.java

示例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);
}
 
開發者ID:Uminks,項目名稱:Star-Ride--RiverRaid,代碼行數:9,代碼來源:EfectosSonido.java

示例9: reproducirSonidoMenu

import java.applet.Applet; //導入方法依賴的package包/類
public void reproducirSonidoMenu(){
    URL url = getClass().getResource("menu.mid");
    clipMenu = Applet.newAudioClip(url);  
    clipMenu.loop();
}
 
開發者ID:Uminks,項目名稱:Star-Ride--RiverRaid,代碼行數:6,代碼來源:EfectosSonido.java

示例10: pararSonidoMenu

import java.applet.Applet; //導入方法依賴的package包/類
public void pararSonidoMenu(){
    URL url = getClass().getResource("menu.mid");
    clipMenu = Applet.newAudioClip(url);
    clipMenu.stop();
}
 
開發者ID:Uminks,項目名稱:Star-Ride--RiverRaid,代碼行數:6,代碼來源:EfectosSonido.java

示例11: pararSonidoJuego

import java.applet.Applet; //導入方法依賴的package包/類
public void pararSonidoJuego(){
    URL url = getClass().getResource("juego.mid");
    clipJuego = Applet.newAudioClip(url);
    clipJuego.stop();
}
 
開發者ID:Uminks,項目名稱:Star-Ride--RiverRaid,代碼行數:6,代碼來源:EfectosSonido.java

示例12: reproducirSonidoAcelerar

import java.applet.Applet; //導入方法依賴的package包/類
public void reproducirSonidoAcelerar(){
    URL url = getClass().getResource("Acelerar.wav");
    clipAcelerar = Applet.newAudioClip(url);
    clipAcelerar.play();
}
 
開發者ID:Uminks,項目名稱:Star-Ride--RiverRaid,代碼行數:6,代碼來源:EfectosSonido.java

示例13: pararSonidoAcelerar

import java.applet.Applet; //導入方法依賴的package包/類
public void pararSonidoAcelerar(){
    URL url = getClass().getResource("Acelerar.wav");
    clipAcelerar = Applet.newAudioClip(url);
    clipAcelerar.stop();
}
 
開發者ID:Uminks,項目名稱:Star-Ride--RiverRaid,代碼行數:6,代碼來源:EfectosSonido.java

示例14: reproducirSonidoTomarEnergia

import java.applet.Applet; //導入方法依賴的package包/類
public void reproducirSonidoTomarEnergia(){
    URL url = getClass().getResource("EnergyTake.wav");
    clipEnergy = Applet.newAudioClip(url);
    clipEnergy.play();
}
 
開發者ID:Uminks,項目名稱:Star-Ride--RiverRaid,代碼行數:6,代碼來源:EfectosSonido.java

示例15: pararSonidoTomarEnergia

import java.applet.Applet; //導入方法依賴的package包/類
public void pararSonidoTomarEnergia(){
    URL url = getClass().getResource("EnergyTake.wav");
    clipEnergy = Applet.newAudioClip(url);
    clipEnergy.stop();
}
 
開發者ID:Uminks,項目名稱:Star-Ride--RiverRaid,代碼行數:6,代碼來源:EfectosSonido.java


注:本文中的java.applet.Applet.newAudioClip方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。