本文整理汇总了Java中sun.audio.AudioData类的典型用法代码示例。如果您正苦于以下问题:Java AudioData类的具体用法?Java AudioData怎么用?Java AudioData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AudioData类属于sun.audio包,在下文中一共展示了AudioData类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: continuousStart
import sun.audio.AudioData; //导入依赖的package包/类
public void continuousStart() {
// Create AudioData source.
AudioData data = null;
try {
data = as.getData(); //@Legend: getData()不支持mid格式!
} catch(IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// Create ContinuousAudioDataStream.
cas = new ContinuousAudioDataStream(data);
// Play audio.
AudioPlayer.player.start(cas);
}
示例2: play
import sun.audio.AudioData; //导入依赖的package包/类
public synchronized void play() {
stop();
byte[] data = new byte[samples.length + 24];
writeSunAudioHeader(data, sampleRate, samples.length);
System.arraycopy(samples, 0, data, 24, samples.length);
AudioData audioData = new AudioData(data);
audioStream = new AudioDataStream(audioData);
AudioPlayer.player.start(audioStream);
}
示例3: loop
import sun.audio.AudioData; //导入依赖的package包/类
public synchronized void loop() {
stop();
byte[] data = new byte[samples.length + 24];
writeSunAudioHeader(data, sampleRate, samples.length);
System.arraycopy(samples, 0, data, 24, samples.length);
AudioData audioData = new AudioData(data);
AudioDataStream audioStream = new ContinuousAudioDataStream(audioData);
AudioPlayer.player.start(audioStream);
}