本文整理汇总了Java中javax.sound.sampled.Mixer.Info类的典型用法代码示例。如果您正苦于以下问题:Java Info类的具体用法?Java Info怎么用?Java Info使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Info类属于javax.sound.sampled.Mixer包,在下文中一共展示了Info类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMixer
import javax.sound.sampled.Mixer.Info; //导入依赖的package包/类
public Mixer getMixer(Info info) {
if (!(info == null || info == SoftMixingMixer.info)) {
throw new IllegalArgumentException("Mixer " + info.toString()
+ " not supported by this provider.");
}
synchronized (mutex) {
if (lockthread != null)
if (Thread.currentThread() == lockthread)
throw new IllegalArgumentException("Mixer "
+ info.toString()
+ " not supported by this provider.");
if (globalmixer == null)
globalmixer = new SoftMixingMixer();
return globalmixer;
}
}
示例2: getMixer
import javax.sound.sampled.Mixer.Info; //导入依赖的package包/类
@Override
public Mixer getMixer(Info info) {
if (!(info == null || info == SoftMixingMixer.info)) {
throw new IllegalArgumentException("Mixer " + info.toString()
+ " not supported by this provider.");
}
synchronized (mutex) {
if (lockthread != null)
if (Thread.currentThread() == lockthread)
throw new IllegalArgumentException("Mixer "
+ info.toString()
+ " not supported by this provider.");
if (globalmixer == null)
globalmixer = new SoftMixingMixer();
return globalmixer;
}
}
示例3: main
import javax.sound.sampled.Mixer.Info; //导入依赖的package包/类
public static void main(String[] args) throws InterruptedException {
for (AudioFileFormat.Type fileFormat : AudioSystem.getAudioFileTypes()) {
System.out.print(fileFormat + ", ");
}
System.out.println();
System.out.println();
for (Info info : AudioSystem.getMixerInfo()) {
System.out.println(info);
}
System.out.println();
Mixer mixer = AudioSystem.getMixer(null);
int maxLines = mixer.getMaxLines(mixer.getLineInfo());
System.out.println("maxlines=" + maxLines);
Thread.sleep(100);
play("freesoundproject_22740__FranciscoPadilla__37_Click_Finger.wav");
play("freesoundproject_28917__junggle__btn107.mp3");
Thread.sleep(1000);
System.out.println("Done");
}
示例4: getMixerInfo
import javax.sound.sampled.Mixer.Info; //导入依赖的package包/类
public static Vector<Mixer.Info> getMixerInfo(
final boolean supportsPlayback, final boolean supportsRecording) {
final Vector<Mixer.Info> infos = new Vector<Mixer.Info>();
final Mixer.Info[] mixers = AudioSystem.getMixerInfo();
for (final Info mixerinfo : mixers) {
if (supportsRecording
&& AudioSystem.getMixer(mixerinfo).getTargetLineInfo().length != 0) {
// Mixer capable of recording audio if target LineWavelet length != 0
infos.add(mixerinfo);
} else if (supportsPlayback
&& AudioSystem.getMixer(mixerinfo).getSourceLineInfo().length != 0) {
// Mixer capable of audio play back if source LineWavelet length != 0
infos.add(mixerinfo);
}
}
return infos;
}
示例5: initMixer
import javax.sound.sampled.Mixer.Info; //导入依赖的package包/类
private void initMixer() {
Info selected;
Info[] mixerInfo = AudioSystem.getMixerInfo();
if (mixerInfo == null || mixerInfo.length == 0) {
theMixer = null;
lineAvailable = false;
System.out.println("No sound mixer is available!");
return;
}
String mixer = preferredMixer.getValue();
selected = mixerInfo[0];
for (Info i : mixerInfo) {
if (i.getName().equalsIgnoreCase(mixer)) {
selected = i;
break;
}
}
theMixer = AudioSystem.getMixer(selected);
// for (Line l : theMixer.getSourceLines()) {
// l.close();
// }
lineAvailable = true;
}
示例6: GetMixerCapabilities
import javax.sound.sampled.Mixer.Info; //导入依赖的package包/类
public AudioFormat[] GetMixerCapabilities(int MixerIndex) {
Info[] mixerinfo = AudioSystem.getMixerInfo();
// select the Mixer to record from
Mixer mixer = AudioSystem.getMixer(mixerinfo[MixerIndex]);
Line.Info[] Infos = mixer.getTargetLineInfo();
for (int i = 0; i < Infos.length; i++) {
if (Infos[i] instanceof DataLine.Info) {
DataLine.Info dataLineInfo = (DataLine.Info) Infos[i];
// these are the available formats of the selected mixer
AudioFormat[] supportedFormats = dataLineInfo.getFormats();
return supportedFormats;
}
}
return null;
}
示例7: getModel
import javax.sound.sampled.Mixer.Info; //导入依赖的package包/类
public String getModel() {
StringBuilder result = new StringBuilder(MODEL_1);
for (ProtocolDecoder decoder : decoders.getAllDecoders()) {
result.append("<item>");
result.append(decoder.getInfo().getName());
result.append("</item>");
}
result.append(MODEL_2);
result.append("<item>");
result.append(getSourceName());
result.append("</item>");
for (Info source : audioSampler.getSourceList()) {
result.append("<item>");
result.append(source.getName());
result.append("</item>");
}
result.append(MODEL_3);
return result.toString();
}
示例8: setSourceName
import javax.sound.sampled.Mixer.Info; //导入依赖的package包/类
/**
* Specify audio source. This can be specified in two ways, either the
* source number or by the name of the source. Even if the number is
* specified, the source name is stored and used.
*
* @param name source name or source number
*/
public void setSourceName(String name) {
Info sources[] = m_PulsePlayer.getSourceList();
if ((name.length() == 1) &&
(name.charAt(0) >= '0') &&
(name.charAt(0) <= '9')) {
m_PulsePlayer.setSource(Integer.parseInt(name));
} else {
for (int i = 0; i < sources.length; i++) {
if (sources[i].getName().replaceAll("\\s+", " ").equalsIgnoreCase(name)) {
m_PulsePlayer.setSource(i);
}
}
}
m_SourceName = sources[m_PulsePlayer.getSource()].getName();
if (m_PulsePlayer.isOpen()) {
m_PulsePlayer.closeLine();
m_PulsePlayer.openLine();
}
}
示例9: getMixer
import javax.sound.sampled.Mixer.Info; //导入依赖的package包/类
@Override
public Mixer getMixer(Info info) {
if( TGMixer.MIXER_INFO.equals(info) ) {
return new TGMixer();
}
return null;
}
示例10: getMixer
import javax.sound.sampled.Mixer.Info; //导入依赖的package包/类
@Override
public Mixer getMixer(Info info)
{
if (info.equals(mixer.getMixerInfo()))
return mixer;
throw new
IllegalArgumentException("This provider cannot handle a mixer or type: "
+ info.getName());
}
示例11: getMixer
import javax.sound.sampled.Mixer.Info; //导入依赖的package包/类
@Override
public Mixer getMixer(Info info)
{
if (info.equals(mixer.getMixerInfo()))
return mixer;
throw new
IllegalArgumentException("This provider cannot handle a mixer or type: "
+ info.getName());
}
示例12: main
import javax.sound.sampled.Mixer.Info; //导入依赖的package包/类
public static void main(String[] args) throws InterruptedException {
for (AudioFileFormat.Type fileFormat : AudioSystem.getAudioFileTypes()) {
System.out.print(fileFormat + ", ");
}
System.out.println();
System.out.println();
for (Info info : AudioSystem.getMixerInfo()) {
System.out.println(info);
}
System.out.println();
Mixer mixer = AudioSystem.getMixer(null);
int maxLines = mixer.getMaxLines(mixer.getLineInfo());
System.out.println("maxlines=" + maxLines);
Thread.sleep(100);
play("35631__reinsamba__crystal_glass.wav");
play("9874__vixuxx__crow.au");
play("9874__vixuxx__crow.aiff");
play("Bird_Black_Ready1.wav");
play("Bird_Black_Clicked1.mp3");
play("ambient_construction.mp3");
play("28917__junggle__btn107.mp3");
play("forty-two.mp3");
Thread.sleep(1000);
System.out.println("Done");
}
示例13: getSelections
import javax.sound.sampled.Mixer.Info; //导入依赖的package包/类
@Override
public LinkedHashMap<? extends String, String> getSelections() {
Info[] mixerInfo = AudioSystem.getMixerInfo();
LinkedHashMap<String, String> out = new LinkedHashMap<>();
for (Info i : mixerInfo) {
out.put(i.getName(), i.getName());
}
return out;
}
示例14: isMixerSupported
import javax.sound.sampled.Mixer.Info; //导入依赖的package包/类
public boolean isMixerSupported(Mixer.Info info) {
Mixer.Info[] devices = getMixerInfo();
for (Info element : devices) {
if (info.equals(element)) {
return true;
}
}
return false;
}
示例15: getMenu
import javax.sound.sampled.Mixer.Info; //导入依赖的package包/类
@Override
public JMenu getMenu() {
final JMenu retVal = new JMenu();
if(getWavDisplay().isPlaying()) {
retVal.add(new StopAction(getEditor(), this));
} else {
retVal.add(new PlayAction(getEditor(), this));
final JCheckBoxMenuItem loopItem = new JCheckBoxMenuItem(new ToggleLoop(getWavDisplay()));
retVal.add(loopItem);
// output device selection
final JMenu mixerMenu = new JMenu("Output Device");
final Info[] mixers = AudioSystem.getMixerInfo();
for(Info mixerInfo:mixers) {
// if we have no source lines, we can't use this device
if(AudioSystem.getMixer(mixerInfo).getSourceLineInfo().length == 0) continue;
final SelectMixerAction mixerAct = new SelectMixerAction(getWavDisplay(), mixerInfo);
mixerAct.putValue(SelectMixerAction.SELECTED_KEY,
getWavDisplay().getMixerInfo() == mixerInfo);
mixerMenu.add(new JCheckBoxMenuItem(mixerAct));
}
retVal.add(mixerMenu);
}
retVal.addSeparator();
retVal.add(new ResetAction(getEditor(), this));
retVal.add(new ZoomAction(getEditor(), this));
retVal.add(new ZoomAction(getEditor(), this, false));
retVal.addSeparator();
retVal.add(new SaveAction(getEditor(), this));
retVal.add(new GenerateAction(getEditor(), this));
for(SpeechAnalysisTier tier:pluginTiers) {
tier.addMenuItems(retVal, false);
}
return retVal;
}