本文整理汇总了Java中javax.sound.sampled.DataLine.Info类的典型用法代码示例。如果您正苦于以下问题:Java Info类的具体用法?Java Info怎么用?Java Info使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Info类属于javax.sound.sampled.DataLine包,在下文中一共展示了Info类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: playSync
import javax.sound.sampled.DataLine.Info; //导入依赖的package包/类
public void playSync(String filePath) {
final File file = new File(filePath);
try (final AudioInputStream in = getAudioInputStream(file)) {
final AudioFormat outFormat = getOutFormat(in.getFormat());
final Info info = new Info(SourceDataLine.class, outFormat);
try (final SourceDataLine line = (SourceDataLine) AudioSystem.getLine(info)) {
if (line != null) {
line.open(outFormat);
line.start();
stream(getAudioInputStream(outFormat, in), line);
line.drain();
line.stop();
}
}
}
catch (Exception e) {
throw new IllegalStateException(e);
}
}
示例2: play
import javax.sound.sampled.DataLine.Info; //导入依赖的package包/类
public void play(InputStream inputStream) {
stopAll();
try (final AudioInputStream in = getAudioInputStream(inputStream)) {
final AudioFormat outFormat = getOutFormat(in.getFormat());
final Info info = new Info(SourceDataLine.class, outFormat);
try (final SourceDataLine line = (SourceDataLine) AudioSystem.getLine(info)) {
if (line != null) {
lines.add(line);
line.open(outFormat);
line.start();
stream(getAudioInputStream(outFormat, in), line);
line.drain();
line.stop();
}
}
} catch (UnsupportedAudioFileException
| LineUnavailableException
| IOException exception) {
throw new IllegalStateException(exception);
}
}
示例3: create
import javax.sound.sampled.DataLine.Info; //导入依赖的package包/类
@ObfuscatedName("w")
@ObfuscatedSignature(
signature = "(II)V",
garbageValue = "-629465154"
)
@Export("create")
protected void create(int var1) throws LineUnavailableException {
try {
Info var2 = new Info(SourceDataLine.class, this.audioFormat, var1 << (ContextMenuRow.highMemory?2:1));
this.source = (SourceDataLine)AudioSystem.getLine(var2);
this.source.open();
this.source.start();
this.size = var1;
} catch (LineUnavailableException var5) {
int var4 = (var1 >>> 1 & 1431655765) + (var1 & 1431655765);
var4 = (var4 >>> 2 & 858993459) + (var4 & 858993459);
var4 = (var4 >>> 4) + var4 & 252645135;
var4 += var4 >>> 8;
var4 += var4 >>> 16;
int var3 = var4 & 255;
if(var3 != 1) {
this.create(class173.nextPowerOfTwo(var1));
} else {
this.source = null;
throw var5;
}
}
}
示例4: AudioPlayer
import javax.sound.sampled.DataLine.Info; //导入依赖的package包/类
public AudioPlayer(File audioFile, ResourceBundle messages) throws IOException {
this.messages = messages;
try (AudioInputStream in = AudioSystem.getAudioInputStream(audioFile.toURI().toURL())) {
this.audioFile = audioFile;
outFormat = getOutFormat(in.getFormat());
Info info = new Info(SourceDataLine.class, outFormat);
line = (SourceDataLine) AudioSystem.getLine(info);
line.open(outFormat);
} catch (UnsupportedAudioFileException | LineUnavailableException e) {
throw new IOException(e);
}
}
示例5: play
import javax.sound.sampled.DataLine.Info; //导入依赖的package包/类
public void play(String filePath) {
final File file = new File(filePath);
try (final AudioInputStream in = getAudioInputStream(file)) {
final AudioFormat outFormat = getOutFormat(in.getFormat());
final Info info = new Info(SourceDataLine.class, outFormat);
try (final SourceDataLine line =
(SourceDataLine) AudioSystem.getLine(info)) {
if (line != null) {
line.open(outFormat);
line.start();
AudioInputStream inputMystream = AudioSystem.getAudioInputStream(outFormat, in);
stream(inputMystream, line);
line.drain();
line.stop();
}
}
} catch (UnsupportedAudioFileException
| LineUnavailableException
| IOException e) {
throw new IllegalStateException(e);
}
}
示例6: JavaSoundInDevice
import javax.sound.sampled.DataLine.Info; //导入依赖的package包/类
public JavaSoundInDevice(Mixer mixer, AudioFormat af, Info info,int bufferSizeInFrames) {
super(mixer, af, info,bufferSizeInFrames);
framesRead = 0;
doFlush = true;
}
示例7: JavaSoundOutDevice
import javax.sound.sampled.DataLine.Info; //导入依赖的package包/类
public JavaSoundOutDevice(Mixer mixer, AudioFormat af, Info info,int bufferSizeInFrames) {
super(mixer, af, info, bufferSizeInFrames);
}