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


Java Control.Type方法代碼示例

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


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

示例1: 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

示例2: 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

示例3: isControlSupported

import javax.sound.sampled.Control; //導入方法依賴的package包/類
public final boolean isControlSupported(Control.Type controlType) {
    // protect against a NullPointerException
    if (controlType == null) {
        return false;
    }

    for (int i = 0; i < controls.length; i++) {
        if (controlType == controls[i].getType()) {
            return true;
        }
    }

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

示例4: getControl

import javax.sound.sampled.Control; //導入方法依賴的package包/類
public final Control getControl(Control.Type controlType) {
    // protect against a NullPointerException
    if (controlType != null) {

        for (int i = 0; i < controls.length; i++) {
            if (controlType == controls[i].getType()) {
                return controls[i];
            }
        }
    }

    throw new IllegalArgumentException("Unsupported control type: " + controlType);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:14,代碼來源:AbstractLine.java

示例5: isControlSupported

import javax.sound.sampled.Control; //導入方法依賴的package包/類
@Override
public final boolean isControlSupported(Control.Type controlType) {
    // protect against a NullPointerException
    if (controlType == null) {
        return false;
    }

    for (int i = 0; i < controls.length; i++) {
        if (controlType == controls[i].getType()) {
            return true;
        }
    }

    return false;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:16,代碼來源:AbstractLine.java

示例6: getControl

import javax.sound.sampled.Control; //導入方法依賴的package包/類
@Override
public final Control getControl(Control.Type controlType) {
    // protect against a NullPointerException
    if (controlType != null) {

        for (int i = 0; i < controls.length; i++) {
            if (controlType == controls[i].getType()) {
                return controls[i];
            }
        }
    }

    throw new IllegalArgumentException("Unsupported control type: " + controlType);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:15,代碼來源:AbstractLine.java

示例7: main

import javax.sound.sampled.Control; //導入方法依賴的package包/類
public static void main(String args[]) throws Exception {
    System.out.println();
    System.out.println();
    System.out.println("4629190: CompoundControl: getMemberControls() and toString() throw NullPointerException");

    String firstControlTypeName = "first_Control_Type_Name";
    String secondControlTypeName = "second_Control_Type_Name";
    String thirdControlTypeName = "third_Control_Type_Name";

    Control.Type firstControlType = new TestControlType(firstControlTypeName);
    Control.Type secondControlType = new TestControlType(secondControlTypeName);
    Control.Type thirdControlType = new TestControlType(thirdControlTypeName);

    Control firstControl = new TestControl(firstControlType);
    Control secondControl = new TestControl(secondControlType);
    Control thirdControl = new TestControl(thirdControlType);

    String testCompoundControlTypeName = "CompoundControl_Type_Name";
    CompoundControl.Type testCompoundControlType
        = new TestCompoundControlType(testCompoundControlTypeName);

    Control[] setControls = { firstControl, secondControl, thirdControl };
    CompoundControl testedCompoundControl
        = new TestCompoundControl(testCompoundControlType, setControls);

    // this may throw exception if bug applies
    Control[] producedControls = testedCompoundControl.getMemberControls();
    System.out.println("Got "+producedControls.length+" member controls.");

    // this may throw exception if bug applies
    String producedString = testedCompoundControl.toString();
    System.out.println("toString() returned: "+producedString);

    System.out.println("Test passed.");
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:36,代碼來源:ToString.java

示例8: isControlSupported

import javax.sound.sampled.Control; //導入方法依賴的package包/類
public boolean isControlSupported(Control.Type controlType) {

        // protect against a NullPointerException
        if (controlType == null) {
            return false;
        }

        for (int i = 0; i < controls.length; i++) {
            if (controlType == controls[i].getType()) {
                return true;
            }
        }

        return false;
    }
 
開發者ID:openjdk,項目名稱:jdk7-jdk,代碼行數:16,代碼來源:AbstractLine.java

示例9: getControl

import javax.sound.sampled.Control; //導入方法依賴的package包/類
public Control getControl(Control.Type controlType) {

        // protect against a NullPointerException
        if (controlType != null) {

            for (int i = 0; i < controls.length; i++) {
                if (controlType == controls[i].getType()) {
                    return controls[i];
                }
            }
        }

        throw new IllegalArgumentException("Unsupported control type: " + controlType);
    }
 
開發者ID:openjdk,項目名稱:jdk7-jdk,代碼行數:15,代碼來源:AbstractLine.java

示例10: printControls

import javax.sound.sampled.Control; //導入方法依賴的package包/類
/** @invisible
 * 
 * Prints the available controls and their ranges to the console. Not all
 * lines 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 for this line.");
  }
}
 
開發者ID:d2fn,項目名稱:passage,代碼行數:40,代碼來源:Controller.java

示例11: rawplay

import javax.sound.sampled.Control; //導入方法依賴的package包/類
private void rawplay(AudioFormat trgFormat, AudioInputStream ain, float volume)
		throws IOException, LineUnavailableException {
	byte[] data = new byte[8192];
	try {
		clip = getLine(ain, trgFormat);
		if (clip == null) {
			return;
		}
		Control.Type vol1 = FloatControl.Type.VOLUME, vol2 = FloatControl.Type.MASTER_GAIN;
		FloatControl c = (FloatControl) clip.getControl(FloatControl.Type.MASTER_GAIN);
		float min = c.getMinimum();
		float v = volume * (c.getMaximum() - min) / 100f + min;
		if (this.clip.isControlSupported(vol1)) {
			FloatControl volumeControl = (FloatControl) this.clip.getControl(vol1);
			volumeControl.setValue(v);
		} else if (this.clip.isControlSupported(vol2)) {
			FloatControl gainControl = (FloatControl) this.clip.getControl(vol2);
			gainControl.setValue(v);
		}
		clip.start();
		int nBytesRead = 0;
		while (isRunning && (nBytesRead != -1)) {
			nBytesRead = ain.read(data, 0, data.length);
			if (nBytesRead != -1) {
				clip.write(data, 0, nBytesRead);
			}
		}
	} finally {
		clip.drain();
		clip.stop();
		clip.close();
		ain.close();
	}
}
 
開發者ID:cping,項目名稱:RipplePower,代碼行數:35,代碼來源:LWaveSound.java

示例12: TestControl

import javax.sound.sampled.Control; //導入方法依賴的package包/類
TestControl(Control.Type type) {
    super(type);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:4,代碼來源:ToString.java

示例13: getControl

import javax.sound.sampled.Control; //導入方法依賴的package包/類
public Control getControl(Control.Type control) {
    return null;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:4,代碼來源:LineInfoNPE.java

示例14: isControlSupported

import javax.sound.sampled.Control; //導入方法依賴的package包/類
public boolean isControlSupported(Control.Type control) {
    return false;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:4,代碼來源:LineInfoNPE.java

示例15: getControl

import javax.sound.sampled.Control; //導入方法依賴的package包/類
@Override public Control getControl (Control.Type control)
{
  return dataLine.getControl(control);
}
 
開發者ID:playn,項目名稱:playn,代碼行數:5,代碼來源:BigClip.java


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