本文整理匯總了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");
}
示例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;
}
示例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");
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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.");
}
}
示例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;
}
示例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);
}
}
}
示例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;
}
示例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;
}