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


Java BooleanControl类代码示例

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


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

示例1: setMute

import javax.sound.sampled.BooleanControl; //导入依赖的package包/类
public void setMute(boolean mute) {
	// Set mute value.
	this.mute = mute;

	if (outputLine == null) {
		return;
	}
	else if (outputLine.isControlSupported(BooleanControl.Type.MUTE)) {
		BooleanControl muteControl = (BooleanControl) outputLine.getControl(BooleanControl.Type.MUTE);
		muteControl.setValue(mute);

		//if (!mute)
		//	setGain(oldGain);
	}

}
 
开发者ID:mars-sim,项目名称:mars-sim,代码行数:17,代码来源:OGGSoundClip.java

示例2: testEnumControl

import javax.sound.sampled.BooleanControl; //导入依赖的package包/类
public void testEnumControl() {

        BooleanControl control = new MyControl(BooleanControl.Type.MUTE, true,
                "ON", "OFF");
        assertTrue(control.getValue());
        control.setValue(false);
        assertFalse(control.getValue());
        assertEquals("ON", control.getStateLabel(true));
        assertEquals("OFF", control.getStateLabel(false));
        assertEquals("Mute Control with current value: OFF", control
                .toString());

        control = new MyControl(BooleanControl.Type.APPLY_REVERB, false);
        assertFalse(control.getValue());
        control.setValue(true);
        assertTrue(control.getValue());
        assertEquals("true", control.getStateLabel(true));
        assertEquals("false", control.getStateLabel(false));
        assertEquals("Apply Reverb Control with current value: true", control
                .toString());
    }
 
开发者ID:shannah,项目名称:cn1,代码行数:22,代码来源:BooleanControlTest.java

示例3: getValue

import javax.sound.sampled.BooleanControl; //导入依赖的package包/类
private boolean getValue(BooleanControl.Type type)
{
  boolean v = false;
  if (hasControl(type))
  {
    BooleanControl c = (BooleanControl) getControl(type);
    v = c.getValue();
  }
  else
  {
    Minim.error(type.toString() + " is not supported.");
  }
  return v;
}
 
开发者ID:JacobRoth,项目名称:romanov,代码行数:15,代码来源:Controller.java

示例4: setValue

import javax.sound.sampled.BooleanControl; //导入依赖的package包/类
private void setValue(BooleanControl.Type type, boolean v)
{
  if (hasControl(type))
  {
    BooleanControl c = (BooleanControl) getControl(type);
    c.setValue(v);
  }
  else
  {
    Minim.error(type.toString() + " is not supported.");
  }
}
 
开发者ID:JacobRoth,项目名称:romanov,代码行数:13,代码来源:Controller.java

示例5: createType

import javax.sound.sampled.BooleanControl; //导入依赖的package包/类
private static BooleanControl.Type createType(String name) {
    if (name.equals("Mute")) {
        return BooleanControl.Type.MUTE;
    }
    else if (name.equals("Select")) {
        // $$fb add as new static type?
        //return BooleanControl.Type.SELECT;
    }
    return new BCT(name);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:PortMixer.java

示例6: setMute

import javax.sound.sampled.BooleanControl; //导入依赖的package包/类
@Override
public void setMute(boolean mute) {
	
	BooleanControl control = (BooleanControl)this.controls.get("Mute");
	boolean oldVal = control.getValue();
	control.setValue(mute);
	this.trigger(AudioEvent.Type.MUTE_CHANGED, oldVal, mute);
}
 
开发者ID:RalleYTN,项目名称:SimpleAudio,代码行数:9,代码来源:AbstractAudio.java

示例7: setMute

import javax.sound.sampled.BooleanControl; //导入依赖的package包/类
/**
 * Mute or unmute the current playback.
 * @param mute the mute status
 */
public void setMute(boolean mute) {
	BooleanControl bc = (BooleanControl)sdl.getControl(BooleanControl.Type.MUTE);
	if (bc != null) {
		bc.setValue(mute);
	}
}
 
开发者ID:akarnokd,项目名称:open-ig,代码行数:11,代码来源:AudioThread.java

示例8: BooleanControlAdapter

import javax.sound.sampled.BooleanControl; //导入依赖的package包/类
BooleanControlAdapter(final BooleanControl underlying)
{
	if (underlying==null)
		throw new NullPointerException("Given boolean control is null.");
	if (!BooleanControl.Type.MUTE.equals(underlying.getType()))
		throw new IllegalArgumentException("Given boolean control is not a mute control.");
	this.underlying=underlying;
}
 
开发者ID:rarcher,项目名称:Couch-Potato-Server,代码行数:9,代码来源:BooleanControlAdapter.java

示例9: LineControlGroup

import javax.sound.sampled.BooleanControl; //导入依赖的package包/类
public LineControlGroup(final Line underlying) throws LineUnavailableException, Exception
{
	if (!underlying.isOpen())
		underlying.open();

	final FloatControl volumeInput=(FloatControl)new ControlLocator(FloatControl.Type.VOLUME).find(underlying);
	if (volumeInput==null)
		throw new Exception("Could not find volume control for line \""+underlying.getLineInfo().toString()+"\".");
	volume=new FloatControlAdapter(volumeInput);

	final StringBuilder log=new StringBuilder();
	if (logger.isDebugEnabled())
	{
		log.append("Instantiated for line \"");
		log.append(underlying.getLineInfo().toString());
		log.append("\". ");
	}

	final BooleanControl muteInput=(BooleanControl)new ControlLocator(BooleanControl.Type.MUTE).find(underlying);
	if (muteInput==null)
	{
		mute=null;
		if (logger.isDebugEnabled())
			log.append("Found volume control but no mute control.");
	}
	else
	{
		mute=new BooleanControlAdapter(muteInput);
		if (logger.isDebugEnabled())
			log.append("Found volume and mute controls.");
	}
	logger.debug(log.toString());
}
 
开发者ID:rarcher,项目名称:Couch-Potato-Server,代码行数:34,代码来源:LineControlGroup.java

示例10: setup

import javax.sound.sampled.BooleanControl; //导入依赖的package包/类
@Before
public void setup()
{
	mockControl=Mockito.mock(BooleanControl.class);
	Mockito.when(mockControl.getType()).thenReturn(BooleanControl.Type.MUTE);

	testee=new BooleanControlAdapter(mockControl);
}
 
开发者ID:rarcher,项目名称:Couch-Potato-Server,代码行数:9,代码来源:BooleanControlAdapterTest.java

示例11: setMuted

import javax.sound.sampled.BooleanControl; //导入依赖的package包/类
/**
 * Sets this audio player to muted.
 * @param flag true to mute the audio
 */
public void setMuted(boolean flag) {
	if (this.line != null) {
		if (this.line.isControlSupported(BooleanControl.Type.MUTE)) {
			BooleanControl control = (BooleanControl)this.line.getControl(BooleanControl.Type.MUTE);
			control.setValue(flag);
		}
	}
}
 
开发者ID:wnbittle,项目名称:praisenter,代码行数:13,代码来源:XugglerAudioPlayerThread.java

示例12: isMuted

import javax.sound.sampled.BooleanControl; //导入依赖的package包/类
/**
 * Returns true if the audio player is muted.
 * <p>
 * It's possible that JavaSound doesn't support the mute control.  In this
 * case false will always be returned.
 * @return boolean
 */
public boolean isMuted() {
	if (this.line != null) {
		if (this.line.isControlSupported(BooleanControl.Type.MUTE)) {
			BooleanControl control = (BooleanControl)this.line.getControl(BooleanControl.Type.MUTE);
			return control.getValue();
		}
	}
	// otherwise return false
	return false;
}
 
开发者ID:wnbittle,项目名称:praisenter,代码行数:18,代码来源:XugglerAudioPlayerThread.java

示例13: setMicrophoneInput

import javax.sound.sampled.BooleanControl; //导入依赖的package包/类
public void setMicrophoneInput() {
    TreePath path = findByName(new TreePath(root), new String[]{"MICROPHONE", "Select"});

    if (path == null) {
        path = findByName(new TreePath(root), new String[]{"Capture source", "Capture", "Mute"});
    }

    if (path != null) {
        if (path.getLastPathComponent() instanceof JavaMixer.ControlNode) {
            BooleanControl bControl = (BooleanControl) (((JavaMixer.ControlNode) path.getLastPathComponent()).getControl());
            bControl.setValue(true);
        }
    }
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:15,代码来源:JavaMixer.java

示例14: setMuteForMicrophoneOutput

import javax.sound.sampled.BooleanControl; //导入依赖的package包/类
public void setMuteForMicrophoneOutput() {
    TreePath path = findByName(new TreePath(root), new String[]{"SPEAKER", "Microfone", "Mute"});

    if (path == null) {
        path = findByName(new TreePath(root), new String[]{"MIC target", "mic", "Mute"});
    }

    if (path != null) {
        if (path.getLastPathComponent() instanceof JavaMixer.ControlNode) {
            BooleanControl bControl = (BooleanControl) (((JavaMixer.ControlNode) path.getLastPathComponent()).getControl());
            bControl.setValue(true);
        }
    }
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:15,代码来源:JavaMixer.java

示例15: ControlNode

import javax.sound.sampled.BooleanControl; //导入依赖的package包/类
public ControlNode(Control control) {
    super(control.getType(), true);
    this.control = control;
    if (control instanceof BooleanControl) {
        component = createControlComponent((BooleanControl) control);
    } else if (control instanceof EnumControl) {
        component = createControlComponent((EnumControl) control);
    } else if (control instanceof FloatControl) {
        component = createControlComponent((FloatControl) control);
    } else {
        component = null;
    }
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:14,代码来源:JavaMixer.java


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