本文整理汇总了Java中javax.sound.midi.MetaEventListener类的典型用法代码示例。如果您正苦于以下问题:Java MetaEventListener类的具体用法?Java MetaEventListener怎么用?Java MetaEventListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MetaEventListener类属于javax.sound.midi包,在下文中一共展示了MetaEventListener类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: MidiAudio
import javax.sound.midi.MetaEventListener; //导入依赖的package包/类
MidiAudio(InputStream data) throws MidiUnavailableException {
getSequencer();
setSequence(data);
sequencer.addMetaEventListener(new MetaEventListener() {
public void meta(MetaMessage msg) {
if (msg.getType() == 47) {
try {
sequencer.setSequence(sequence);
} catch (InvalidMidiDataException e) {
ErrorHandler.alert(e);
}
sequencer.setTickPosition(0);
if (loop) { // End of track
sequencer.start();
}
}
}
});
AudioFormat base = new AudioFormat(44100, 16, 2, true, false);
format = new AudioFileFormat(new Type("MIDI", "mid"), base, (int) (base.getFrameRate() * (sequence.getMicrosecondLength() / 1000000 + 4))).getFormat();
}
示例2: addMetaEventListener
import javax.sound.midi.MetaEventListener; //导入依赖的package包/类
@Override
public boolean addMetaEventListener(MetaEventListener listener) {
synchronized(metaEventListeners) {
if (! metaEventListeners.contains(listener)) {
metaEventListeners.add(listener);
}
return true;
}
}
示例3: removeMetaEventListener
import javax.sound.midi.MetaEventListener; //导入依赖的package包/类
@Override
public void removeMetaEventListener(MetaEventListener listener) {
synchronized(metaEventListeners) {
int index = metaEventListeners.indexOf(listener);
if (index >= 0) {
metaEventListeners.remove(index);
}
}
}
示例4: initSequencer
import javax.sound.midi.MetaEventListener; //导入依赖的package包/类
private void initSequencer()
{
// Close the sequencer and synthesizer
getSequencer().addMetaEventListener(new MetaEventListener() {
public void meta(MetaMessage event)
{
if (event.getType() == 47)
{
close();
}
}
});
}
示例5: addMetaEventListener
import javax.sound.midi.MetaEventListener; //导入依赖的package包/类
public boolean addMetaEventListener(MetaEventListener listener)
{
// TODO Auto-generated method stub
return false;
}
示例6: removeMetaEventListener
import javax.sound.midi.MetaEventListener; //导入依赖的package包/类
public void removeMetaEventListener(MetaEventListener listener)
{
// TODO Auto-generated method stub
}
示例7: addMetaEventListener
import javax.sound.midi.MetaEventListener; //导入依赖的package包/类
public boolean addMetaEventListener(MetaEventListener listener) {
// TODO Auto-generated method stub
return false;
}
示例8: removeMetaEventListener
import javax.sound.midi.MetaEventListener; //导入依赖的package包/类
public void removeMetaEventListener(MetaEventListener listener) {
// TODO Auto-generated method stub
}