本文整理汇总了Java中javax.sound.sampled.Line.Info方法的典型用法代码示例。如果您正苦于以下问题:Java Line.Info方法的具体用法?Java Line.Info怎么用?Java Line.Info使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.sound.sampled.Line
的用法示例。
在下文中一共展示了Line.Info方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AbstractMixer
import javax.sound.sampled.Line; //导入方法依赖的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;
}
示例2: isLineSupported
import javax.sound.sampled.Line; //导入方法依赖的package包/类
@Override
public final boolean isLineSupported(Line.Info info) {
int i;
for (i = 0; i < sourceLineInfo.length; i++) {
if (info.matches(sourceLineInfo[i])) {
return true;
}
}
for (i = 0; i < targetLineInfo.length; i++) {
if (info.matches(targetLineInfo[i])) {
return true;
}
}
return false;
}
示例3: getMaxLines
import javax.sound.sampled.Line; //导入方法依赖的package包/类
@Override
public int getMaxLines(Line.Info info) {
Line.Info fullInfo = getLineInfo(info);
// if it's not supported at all, return 0.
if (fullInfo == null) {
return 0;
}
if (fullInfo instanceof DataLine.Info) {
// DirectAudioDevices should mix !
return getMaxSimulLines();
}
return 0;
}
示例4: getLineInfo
import javax.sound.sampled.Line; //导入方法依赖的package包/类
/**
* Returns the first complete Line.Info object it finds that
* matches the one specified, or null if no matching Line.Info
* object is found.
*/
final Line.Info getLineInfo(Line.Info info) {
if (info == null) {
return null;
}
// $$kk: 05.31.99: need to change this so that
// the format and buffer size get set in the
// returned info object for data lines??
for (int i = 0; i < sourceLineInfo.length; i++) {
if (info.matches(sourceLineInfo[i])) {
return sourceLineInfo[i];
}
}
for (int i = 0; i < targetLineInfo.length; i++) {
if (info.matches(targetLineInfo[i])) {
return targetLineInfo[i];
}
}
return null;
}
示例5: getLine
import javax.sound.sampled.Line; //导入方法依赖的package包/类
@Override
public Line getLine(Line.Info info) throws LineUnavailableException {
Line.Info fullInfo = getLineInfo(info);
if ((fullInfo != null) && (fullInfo instanceof Port.Info)) {
for (int i = 0; i < portInfos.length; i++) {
if (fullInfo.equals(portInfos[i])) {
return getPort(i);
}
}
}
throw new IllegalArgumentException("Line unsupported: " + info);
}
示例6: getMaxLines
import javax.sound.sampled.Line; //导入方法依赖的package包/类
public int getMaxLines(Line.Info info) {
Line.Info fullInfo = getLineInfo(info);
// if it's not supported at all, return 0.
if (fullInfo == null) {
return 0;
}
if (fullInfo instanceof Port.Info) {
//return AudioSystem.NOT_SPECIFIED; // if several instances of PortMixerPort
return 1;
}
return 0;
}
示例7: isTargetLine
import javax.sound.sampled.Line; //导入方法依赖的package包/类
/**
* Determines whether this is a target line for this mixer.
* Right now this just checks whether it's supported, but should
* check whether it actually belongs to this mixer....
*/
final boolean isTargetLine(Line.Info info) {
for (int i = 0; i < targetLineInfo.length; i++) {
if (info.matches(targetLineInfo[i])) {
return true;
}
}
return false;
}
示例8: getMaxLines
import javax.sound.sampled.Line; //导入方法依赖的package包/类
public int getMaxLines(Line.Info info) {
if (info.getLineClass() == SourceDataLine.class)
return AudioSystem.NOT_SPECIFIED;
if (info.getLineClass() == Clip.class)
return AudioSystem.NOT_SPECIFIED;
return 0;
}
示例9: getLine
import javax.sound.sampled.Line; //导入方法依赖的package包/类
public Line getLine(Line.Info info) throws LineUnavailableException {
Line.Info fullInfo = getLineInfo(info);
if ((fullInfo != null) && (fullInfo instanceof Port.Info)) {
for (int i = 0; i < portInfos.length; i++) {
if (fullInfo.equals(portInfos[i])) {
return getPort(i);
}
}
}
throw new IllegalArgumentException("Line unsupported: " + info);
}
示例10: getLine
import javax.sound.sampled.Line; //导入方法依赖的package包/类
@Override
public Line getLine(Line.Info info) throws LineUnavailableException {
if (!isLineSupported(info))
throw new IllegalArgumentException("Line unsupported: " + info);
if ((info.getLineClass() == SourceDataLine.class)) {
return new SoftMixingSourceDataLine(this, (DataLine.Info) info);
}
if ((info.getLineClass() == Clip.class)) {
return new SoftMixingClip(this, (DataLine.Info) info);
}
throw new IllegalArgumentException("Line unsupported: " + info);
}
示例11: checkLines
import javax.sound.sampled.Line; //导入方法依赖的package包/类
public static void checkLines(Mixer mixer, Line.Info[] infos) {
for (int i = 0; i<infos.length; i++) {
try {
System.out.println(" Line "+infos[i]+" (max. "+mixer.getMaxLines(infos[i])+" simultaneously): ");
if (infos[i] instanceof DataLine.Info) {
DataLine.Info info = (DataLine.Info) infos[i];
int thisTestedFormats = testedFormats;
int thisFailed = failed;
AudioFormat[] formats = info.getFormats();
for (int f = 0; f < formats.length; f++) {
if (formats[f].getEncoding().equals(AudioFormat.Encoding.PCM_SIGNED)
|| formats[f].getEncoding().equals(AudioFormat.Encoding.PCM_UNSIGNED)) {
try {
if (formats[f].getSampleSizeInBits() > 16) {
// if a bit size larger than 16 is available, also 16-bit must be there
checkFormat(formats, getOtherBits(formats[f], 16));
} else
if (formats[f].getSampleSizeInBits() > 8) {
// if a bit size larger than 8 is available, also 8-bit must be there
checkFormat(formats, getOtherBits(formats[f], 8));
}
if (formats[f].getChannels() > 2) {
// if more than 2 channels, also 2 channels must be there
checkFormat(formats, getOtherChannels(formats[f], 2));
} else
if (formats[f].getChannels() > 1) {
// if more than 1 channel, also 1 channel must be there
checkFormat(formats, getOtherChannels(formats[f], 1));
}
} catch (Exception e1) {
out(" Unexpected exception when getting a format: "+e1);
}
}
}
if (testedFormats - thisTestedFormats == 0) {
out(" -->could not test any formats");
} else if (failed - thisFailed == 0) {
out(" -->"+(testedFormats - thisTestedFormats)+" formats tested OK");
}
} else {
out(" --> not a DataLine");
}
} catch (Exception e) {
out(" Unexpected exception when getting a line: "+e);
}
}
}
示例12: getSourceLineInfo
import javax.sound.sampled.Line; //导入方法依赖的package包/类
public javax.sound.sampled.Line.Info[] getSourceLineInfo() {
Line.Info[] localArray = new Line.Info[sourceLineInfo.length];
System.arraycopy(sourceLineInfo, 0, localArray, 0,
sourceLineInfo.length);
return localArray;
}
示例13: getLineInfo
import javax.sound.sampled.Line; //导入方法依赖的package包/类
public final Line.Info getLineInfo() {
return info;
}
示例14: getLineInfo
import javax.sound.sampled.Line; //导入方法依赖的package包/类
@Override
public javax.sound.sampled.Line.Info getLineInfo() {
return new Line.Info(Mixer.class);
}
示例15: getLineInfo
import javax.sound.sampled.Line; //导入方法依赖的package包/类
public javax.sound.sampled.Line.Info getLineInfo() {
return new Line.Info(Mixer.class);
}