当前位置: 首页>>代码示例>>Java>>正文


Java SoundSystem类代码示例

本文整理汇总了Java中paulscode.sound.SoundSystem的典型用法代码示例。如果您正苦于以下问题:Java SoundSystem类的具体用法?Java SoundSystem怎么用?Java SoundSystem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SoundSystem类属于paulscode.sound包,在下文中一共展示了SoundSystem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setMuted

import paulscode.sound.SoundSystem; //导入依赖的package包/类
public void setMuted(final boolean flag) {
	// If not loaded return
	if (!this.loaded || this.sndSystem == null)
		return;

	final SoundSystem ss = getSoundSystem();

	// OpenEye: Looks like the command thread is dead or not initialized.
	try {
		if (flag) {
			ss.setMasterVolume(MUTE_VOLUME);
		} else {
			final GameSettings options = Minecraft.getMinecraft().gameSettings;
			ss.setMasterVolume(options.getSoundLevel(SoundCategory.MASTER));
		}
	} catch (final Throwable t) {
		// Silent - at some point the thread will come back and can be
		// issued a mute.
		;
	}
}
 
开发者ID:OreCruncher,项目名称:DynamicSurroundings,代码行数:22,代码来源:SoundManagerReplacement.java

示例2: init

import paulscode.sound.SoundSystem; //导入依赖的package包/类
public static void init() {
    SoundSystemConfig.setLogger(new NoLogger());
    try {
        addLibrary(LibraryJavaSound.class);
        setCodec("ogg", CodecJOrbis.class);
    } catch (SoundSystemException e) {
        e.printStackTrace();
    }
    soundSystem = new SoundSystem();

    //Quellen für jeden Sound
    register("buttonclick", "sounds/buttonclick.ogg", "buttonclick.ogg");
    register("sword_attack", "sounds/sword_attack.ogg", "sword_attack.ogg");
    register("hit", "sounds/hit.ogg", "hit.ogg");
    register("cross", "sounds/cross.ogg", "cross.ogg");
    register("death", "sounds/death.ogg", "death.ogg");
    register("victory", "sounds/victory.ogg", "victory.ogg");
}
 
开发者ID:Slaergh,项目名称:Super-Kajetan,代码行数:19,代码来源:SoundUtil.java

示例3: playSound

import paulscode.sound.SoundSystem; //导入依赖的package包/类
@Nullable
public String playSound(@Nonnull final BasicSound<?> sound) {
	if (!canFitSound()) {
		if (ModOptions.enableDebugLogging)
			DSurround.log().debug("> NO ROOM: [%s]", sound.toString());
		return null;
	}

	final SoundManager manager = getManager();
	
	if (!StringUtils.isEmpty(sound.getId()))
		manager.stopSound(sound);

	manager.playSound(sound);

	if (ModOptions.enableDebugLogging) {
		if (StringUtils.isEmpty(sound.getId())) {
			DSurround.log().debug("> NOT QUEUED: [%s]", sound.toString());
		} else {
			final StringBuilder builder = new StringBuilder();
			builder.append("> QUEUED: [").append(sound.toString()).append(']');
			if (DSurround.log().testTrace(ModOptions.Trace.TRUE_SOUND_VOLUME)) {
				final SoundSystem ss = manager.sndSystem;
				// Force a flush of all commands so we can get
				// the actual volume and pitch used within the
				// sound library.
				ss.CommandQueue(null);
				final float v = ss.getVolume(sound.getId());
				final float p = ss.getPitch(sound.getId());
				builder.append("; v: ").append(v).append(", p: ").append(p);
			}
			DSurround.log().debug(builder.toString());
		}
	}

	return sound.getId();
}
 
开发者ID:OreCruncher,项目名称:DynamicSurroundings,代码行数:38,代码来源:SoundEngine.java

示例4: initialize

import paulscode.sound.SoundSystem; //导入依赖的package包/类
private void initialize() {
    try {
        soundManager = (SoundManager) ReflectionHelper.findField(net.minecraft.client.audio.SoundHandler.class, SOUND_MANAGER_MAPPING).get(Minecraft.getMinecraft().getSoundHandler());
        soundSystem = (SoundSystem) ReflectionHelper.findField(SoundManager.class, SOUND_SYSTEM_MAPPING).get(soundManager);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:dmillerw,项目名称:EventMod,代码行数:9,代码来源:SoundHandler.java

示例5: getSoundSystem

import paulscode.sound.SoundSystem; //导入依赖的package包/类
private SoundSystem getSoundSystem() {
    if (!loaded) {
        initialize();
        loaded = true;
    }
    return soundSystem;
}
 
开发者ID:dmillerw,项目名称:EventMod,代码行数:8,代码来源:SoundHandler.java

示例6: loadBackgroundAudio

import paulscode.sound.SoundSystem; //导入依赖的package包/类
public static Audio loadBackgroundAudio(SoundSystem system, String path, String name){
    if(loadBackgroundMusic(system, path, name)){
        return new Audio(system, name);
    }

    Debug.error("Failed to load audio: '" + path + "' - '" + name + "'");

    return new Audio(system, "");
}
 
开发者ID:CryoGenesis,项目名称:GGU,代码行数:10,代码来源:AudioLoader.java

示例7: loadAudio

import paulscode.sound.SoundSystem; //导入依赖的package包/类
public static Audio loadAudio(SoundSystem system, String path, String name){
    if(loadSoundEffect(system, path, name)){
       return new Audio(system, name);
    }

    Debug.error("Failed to load audio: '" + path + "' - '" + name + "'");

    return new Audio(system, "");
}
 
开发者ID:CryoGenesis,项目名称:GGU,代码行数:10,代码来源:AudioLoader.java

示例8: GitHubNotifier

import paulscode.sound.SoundSystem; //导入依赖的package包/类
public GitHubNotifier(final SoundSystem ss) {
	super("GitHubNotifier");
	
	client = new GitHubClient();
	
	this.ss = ss;
	
	try {
		GraphicsEnvironment.getLocalGraphicsEnvironment().registerFont(Font.createFont(Font.TRUETYPE_FONT, getClass().getResourceAsStream("/octicons.ttf")).deriveFont(20f));
		loadRemindMe();
		DIR.mkdirs();
		
		addWindowListener(new WindowAdapter() {
			@Override
			public void windowClosing(WindowEvent e) {
				ss.cleanup();
			}
		});
		setDefaultCloseOperation(EXIT_ON_CLOSE);
		setResizable(false);
		init();
		setLocationRelativeTo(null);
		setVisible(true);
	} catch (Exception e1) {
		e1.printStackTrace();
	}
}
 
开发者ID:Dakror,项目名称:GitHubNotifier,代码行数:28,代码来源:GitHubNotifier.java

示例9: main

import paulscode.sound.SoundSystem; //导入依赖的package包/类
public static void main(String[] args) {
	try {
		UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
		SoundSystemConfig.addLibrary(LibraryJavaSound.class);
		SoundSystemConfig.setCodec("wav", CodecWav.class);
		SoundSystem ss = new SoundSystem(LibraryJavaSound.class);
		new GitHubNotifier(ss);
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:Dakror,项目名称:GitHubNotifier,代码行数:12,代码来源:GitHubNotifier.java

示例10: Sound

import paulscode.sound.SoundSystem; //导入依赖的package包/类
/**
 * @param soundFile
 * @param soundSystem
 */
public Sound(SoundSystem soundSystem, String soundFile, String soundName) throws Exception {        
    this.soundSystem = soundSystem;
    this.sourceName = soundName;
    this.soundFile = soundFile;
    
    this.soundSystem.newSource(true, this.sourceName, soundFile, false, 0, 0, 0, 
            SoundSystemConfig.ATTENUATION_ROLLOFF, SoundSystemConfig.getDefaultRolloff());                
}
 
开发者ID:tonysparks,项目名称:seventh,代码行数:13,代码来源:Sound.java

示例11: SoundBuffer

import paulscode.sound.SoundSystem; //导入依赖的package包/类
/**
 * 
 */
public SoundBuffer(SoundSystem soundSystem, String soundFile, Random random) throws Exception {
    this.soundSystem = soundSystem;
    this.soundFile = soundFile;
    this.random = random;
    this.soundSystem.loadSound(new File(soundFile).toURI().toURL(), soundFile);
}
 
开发者ID:tonysparks,项目名称:seventh,代码行数:10,代码来源:SoundBuffer.java

示例12: setMixer

import paulscode.sound.SoundSystem; //导入依赖的package包/类
/**
* Sets the current mixer.  If this method is not called, the
* "Java Sound Audio Engine" mixer will be used by default.
* @param m New mixer.
*/
   public static void setMixer( Mixer m ) throws SoundSystemException
   {
       mixer( SET, m );
       SoundSystemException e = SoundSystem.getLastException();
       SoundSystem.setException( null );
       if( e != null )
           throw e;
   }
 
开发者ID:kovertopz,项目名称:Paulscode-SoundSystem,代码行数:14,代码来源:LibraryJavaSound.java

示例13: getSoundSystem

import paulscode.sound.SoundSystem; //导入依赖的package包/类
private SoundSystem getSoundSystem() {
	return this.sndSystem;
}
 
开发者ID:OreCruncher,项目名称:DynamicSurroundings,代码行数:4,代码来源:SoundManagerReplacement.java

示例14: updateAllSounds

import paulscode.sound.SoundSystem; //导入依赖的package包/类
@Override
public void updateAllSounds() {

	final SoundSystem sndSystem = getSoundSystem();

	++this.playTime;

	for (final ITickableSound itickablesound : this.tickableSounds) {
		itickablesound.update();

		if (itickablesound.isDonePlaying()) {
			this.stopSound(itickablesound);
		} else {
			final String s = this.invPlayingSounds.get(itickablesound);
			synchronized (SoundSystemConfig.THREAD_SYNC) {
				sndSystem.setVolume(s, this.getClampedVolume(itickablesound));
				sndSystem.setPitch(s, this.getClampedPitch(itickablesound));
				sndSystem.setPosition(s, itickablesound.getXPosF(), itickablesound.getYPosF(),
						itickablesound.getZPosF());
			}
		}
	}

	final Iterator<Entry<String, ISound>> iterator = this.playingSounds.entrySet().iterator();

	while (iterator.hasNext()) {

		final Entry<String, ISound> entry = iterator.next();
		final String s1 = entry.getKey();

		if (!sndSystem.playing(s1)) {
			final ISound isound = entry.getValue();
			final int j = isound.getRepeatDelay();
			final int minThresholdDelay = isound instanceof BasicSound ? 0 : 1;

			// Repeatable sound could have a delay of 0, meaning
			// don't delay a requeue.
			if (isound.canRepeat() && j >= minThresholdDelay) {
				this.playDelayedSound(isound, j);
			} else {
				this.setState(isound, SoundState.DONE);
			}

			iterator.remove();
			sndSystem.removeSource(s1);
			this.playingSoundsStopTime.remove(s1);

			try {
				this.categorySounds.remove(isound.getCategory(), s1);
			} catch (RuntimeException var8) {
				;
			}

			if (isound instanceof ITickableSound) {
				this.tickableSounds.remove(isound);
			}
		}
	}

	final Iterator<Entry<ISound, Integer>> iterator1 = this.delayedSounds.entrySet().iterator();

	while (iterator1.hasNext()) {
		final Entry<ISound, Integer> entry1 = iterator1.next();

		if (this.playTime >= entry1.getValue().intValue()) {
			final ISound isound1 = entry1.getKey();

			if (isound1 instanceof ITickableSound) {
				((ITickableSound) isound1).update();
			}

			this.playSound(isound1);
			iterator1.remove();
		}
	}
}
 
开发者ID:OreCruncher,项目名称:DynamicSurroundings,代码行数:77,代码来源:SoundManagerReplacement.java

示例15: getSoundSystem

import paulscode.sound.SoundSystem; //导入依赖的package包/类
public static SoundSystem getSoundSystem() {
        return getSoundManager().sndSystem;
//        return ObfuscationReflectionHelper.getPrivateValue(SoundManager.class, getSoundManager(), "sndSystem", "field_148620_e");
    }
 
开发者ID:Cazzar,项目名称:CazzarCoreLib,代码行数:5,代码来源:SoundSystemHelper.java


注:本文中的paulscode.sound.SoundSystem类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。