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


Java Control類代碼示例

本文整理匯總了Java中javax.sound.sampled.Control的典型用法代碼示例。如果您正苦於以下問題:Java Control類的具體用法?Java Control怎麽用?Java Control使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Control類屬於javax.sound.sampled包,在下文中一共展示了Control類的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: implOpen

import javax.sound.sampled.Control; //導入依賴的package包/類
void implOpen() throws LineUnavailableException {
    if (Printer.trace) Printer.trace(">> PortMixerPort: implOpen().");
    long newID = ((PortMixer) mixer).getID();
    if ((id == 0) || (newID != id) || (controls.length == 0)) {
        id = newID;
        Vector vector = new Vector();
        synchronized (vector) {
            nGetControls(id, portIndex, vector);
            controls = new Control[vector.size()];
            for (int i = 0; i < controls.length; i++) {
                controls[i] = (Control) vector.elementAt(i);
            }
        }
    } else {
        enableControls(controls, true);
    }
    if (Printer.trace) Printer.trace("<< PortMixerPort: implOpen() succeeded");
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:19,代碼來源:PortMixer.java

示例2: AbstractMixer

import javax.sound.sampled.Control; //導入依賴的package包/類
/**
 * Constructs a new AbstractMixer.
 * @param mixer the mixer with which this line is associated
 * @param controls set of supported controls
 */
protected AbstractMixer(Mixer.Info mixerInfo,
                        Control[] controls,
                        Line.Info[] sourceLineInfo,
                        Line.Info[] targetLineInfo) {

    // Line.Info, AbstractMixer, Control[]
    super(new Line.Info(Mixer.class), null, controls);

    // setup the line part
    this.mixer = this;
    if (controls == null) {
        controls = new Control[0];
    }

    // setup the mixer part
    this.mixerInfo = mixerInfo;
    this.sourceLineInfo = sourceLineInfo;
    this.targetLineInfo = targetLineInfo;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:25,代碼來源:AbstractMixer.java

示例3: implOpen

import javax.sound.sampled.Control; //導入依賴的package包/類
void implOpen() throws LineUnavailableException {
    if (Printer.trace) Printer.trace(">> PortMixerPort: implOpen().");
    long newID = ((PortMixer) mixer).getID();
    if ((id == 0) || (newID != id) || (controls.length == 0)) {
        id = newID;
        Vector<Control> vector = new Vector<>();
        synchronized (vector) {
            nGetControls(id, portIndex, vector);
            controls = new Control[vector.size()];
            for (int i = 0; i < controls.length; i++) {
                controls[i] = vector.elementAt(i);
            }
        }
    } else {
        enableControls(controls, true);
    }
    if (Printer.trace) Printer.trace("<< PortMixerPort: implOpen() succeeded");
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:19,代碼來源:PortMixer.java

示例4: AbstractMixer

import javax.sound.sampled.Control; //導入依賴的package包/類
/**
 * Constructs a new AbstractMixer.
 * @param mixerInfo the mixer with which this line is associated
 * @param controls set of supported controls
 */
protected AbstractMixer(Mixer.Info mixerInfo,
                        Control[] controls,
                        Line.Info[] sourceLineInfo,
                        Line.Info[] targetLineInfo) {

    // Line.Info, AbstractMixer, Control[]
    super(new Line.Info(Mixer.class), null, controls);

    // setup the line part
    this.mixer = this;
    if (controls == null) {
        controls = new Control[0];
    }

    // setup the mixer part
    this.mixerInfo = mixerInfo;
    this.sourceLineInfo = sourceLineInfo;
    this.targetLineInfo = targetLineInfo;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:25,代碼來源:AbstractMixer.java

示例5: AbstractDataLine

import javax.sound.sampled.Control; //導入依賴的package包/類
/**
 * Constructs a new AbstractLine.
 */
protected AbstractDataLine(DataLine.Info info, AbstractMixer mixer, Control[] controls, AudioFormat format, int bufferSize) {

    super(info, mixer, controls);

    // record the default values
    if (format != null) {
        defaultFormat = format;
    } else {
        // default CD-quality
        defaultFormat = new AudioFormat(44100.0f, 16, 2, true, Platform.isBigEndian());
    }
    if (bufferSize > 0) {
        defaultBufferSize = bufferSize;
    } else {
        // 0.5 seconds buffer
        defaultBufferSize = ((int) (defaultFormat.getFrameRate() / 2)) * defaultFormat.getFrameSize();
    }

    // set the initial values to the defaults
    this.format = defaultFormat;
    this.bufferSize = defaultBufferSize;
}
 
開發者ID:campolake,項目名稱:openjdk9,代碼行數:26,代碼來源:AbstractDataLine.java

示例6: toString

import javax.sound.sampled.Control; //導入依賴的package包/類
@Override
public final String toString()
{
	if (contents==null)
	{
		final StringBuilder contentBuilder=new StringBuilder();

		for (int loop=0; loop<indent; loop++)
			contentBuilder.append('\t');
		contentBuilder.append(subject.getLineInfo().toString());

		for (final Control control : subject.getControls())
		{
			contentBuilder.append(System.getProperty("line.separator"));
			contentBuilder.append(new ControlDescription(control, indent+1).toString());
		}

		contents=contentBuilder.toString();
	}
	return contents;
}
 
開發者ID:rarcher,項目名稱:Couch-Potato-Server,代碼行數:22,代碼來源:LineDescription.java

示例7: toString

import javax.sound.sampled.Control; //導入依賴的package包/類
@Override
public final String toString()
{
	if (contents==null)
	{
		final StringBuilder contentBuilder=new StringBuilder();

		for (int loop=0; loop<indent; loop++)
			contentBuilder.append('\t');
		contentBuilder.append(subject.toString());

		if (subject instanceof CompoundControl)
		{
			for (final Control member : ((CompoundControl)subject).getMemberControls())
			{
				contentBuilder.append(System.getProperty("line.separator"));
				contentBuilder.append(new ControlDescription(member, indent+1).toString());
			}
		}

		contents=contentBuilder.toString();
	}
	return contents;
}
 
開發者ID:rarcher,項目名稱:Couch-Potato-Server,代碼行數:25,代碼來源:ControlDescription.java

示例8: printControls

import javax.sound.sampled.Control; //導入依賴的package包/類
/** @invisible
 * 
 * Prints the available controls and their ranges to the console. Not all
 * Controllers have all of the controls available on them so this is a way to find
 * out what is available.
 * 
 */
public void printControls()
{
  if (controls.length > 0)
  {
    System.out.println("Available controls are:");
    for (int i = 0; i < controls.length; i++)
    {
      Control.Type type = controls[i].getType();
      System.out.print("  " + type.toString());
      if (type == VOLUME || type == GAIN || type == BALANCE || type == PAN)
      {
        FloatControl fc = (FloatControl) controls[i];
        String shiftSupported = "does";
        if (fc.getUpdatePeriod() == -1)
        {
          shiftSupported = "doesn't";
        }
        System.out.println(", which has a range of " + fc.getMaximum() + " to "
            + fc.getMinimum() + " and " + shiftSupported
            + " support shifting.");
      }
      else
      {
        System.out.println("");
      }
    }
  }
  else
  {
    System.out.println("There are no controls available.");
  }
}
 
開發者ID:JacobRoth,項目名稱:romanov,代碼行數:40,代碼來源:Controller.java

示例9: getControl

import javax.sound.sampled.Control; //導入依賴的package包/類
@Deprecated
public Control getControl(Control.Type type)
{
  for(int i = 0; i < controls.length; i++)
  {
    if ( controls[i].getType().equals(type) )
    {
      return controls[i];
    }
  }
  return null;
}
 
開發者ID:JacobRoth,項目名稱:romanov,代碼行數:13,代碼來源:Controller.java

示例10: enableControls

import javax.sound.sampled.Control; //導入依賴的package包/類
private void enableControls(Control[] controls, boolean enable) {
    for (int i = 0; i < controls.length; i++) {
        if (controls[i] instanceof BoolCtrl) {
            ((BoolCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof FloatCtrl) {
            ((FloatCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof CompoundControl) {
            enableControls(((CompoundControl) controls[i]).getMemberControls(), enable);
        }
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:14,代碼來源:PortMixer.java

示例11: AbstractLine

import javax.sound.sampled.Control; //導入依賴的package包/類
/**
 * Constructs a new AbstractLine.
 * @param mixer the mixer with which this line is associated
 * @param controls set of supported controls
 */
protected AbstractLine(Line.Info info, AbstractMixer mixer, Control[] controls) {

    if (controls == null) {
        controls = new Control[0];
    }

    this.info = info;
    this.mixer = mixer;
    this.controls = controls;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:16,代碼來源:AbstractLine.java

示例12: getControls

import javax.sound.sampled.Control; //導入依賴的package包/類
/**
 * Obtains the set of controls supported by the
 * line.  If no controls are supported, returns an
 * array of length 0.
 * @return control set
 */
public final Control[] getControls() {
    Control[] returnedArray = new Control[controls.length];

    for (int i = 0; i < controls.length; i++) {
        returnedArray[i] = controls[i];
    }

    return returnedArray;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:16,代碼來源:AbstractLine.java


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