本文整理汇总了Java中javazoom.jl.player.advanced.PlaybackEvent类的典型用法代码示例。如果您正苦于以下问题:Java PlaybackEvent类的具体用法?Java PlaybackEvent怎么用?Java PlaybackEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PlaybackEvent类属于javazoom.jl.player.advanced包,在下文中一共展示了PlaybackEvent类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: close
import javazoom.jl.player.advanced.PlaybackEvent; //导入依赖的package包/类
protected void close() {
this.playing = false;
if (this.listener != null)
{
this.listener.playbackFinished(createEvent(PlaybackEvent.STOPPED));
}
if (this.source != null) {
AL10.alSourceStop(this.source);
AL10.alDeleteSources(this.source);
this.source = null;
}
if (this.buffer != null) {
AL10.alDeleteBuffers(this.buffer);
this.buffer = null;
}
}
示例2: play
import javazoom.jl.player.advanced.PlaybackEvent; //导入依赖的package包/类
public void play() throws UnsupportedAudioFileException, IOException {
AudioInputStream in = (AudioInputStream) this.stream;
final AudioFormat outFormat = getOutFormat(in.getFormat());
this.source = BufferUtils.createIntBuffer(1);
AL10.alGenSources(this.source);
if (alError()) {
close();
return;
}
AL10.alSourcei(this.source.get(0), AL10.AL_LOOPING, AL10.AL_FALSE);
AL10.alSourcef(this.source.get(0), AL10.AL_PITCH, 1.0f);
AL10.alSourcef(this.source.get(0), AL10.AL_GAIN, this.volume * Minecraft.getMinecraft().gameSettings.getSoundLevel(SoundCategory.RECORDS));
if (alError()) {
close();
return;
}
this.playing = true;
if (this.listener != null)
{
this.listener.playbackStarted(createEvent(PlaybackEvent.STARTED));
}
stream(AudioSystem.getAudioInputStream(outFormat, in));
if (this.playing) {
while (AL10.alGetSourcei(this.source.get(0), AL10.AL_SOURCE_STATE) == AL10.AL_PLAYING) {
try {
Thread.sleep(1);
} catch (InterruptedException e) {}
}
}
close();
}
示例3: playbackFinished
import javazoom.jl.player.advanced.PlaybackEvent; //导入依赖的package包/类
@Override
public void playbackFinished(PlaybackEvent event) {
thread.interrupt();
if( looped ){
play( file, looped );
}else{
stopped = true;
}
}
示例4: addPlaybackStartedListener
import javazoom.jl.player.advanced.PlaybackEvent; //导入依赖的package包/类
public void addPlaybackStartedListener(Consumer<PlaybackEvent> listener) {
playbackStartedListeners.add(listener);
}
示例5: addPlaybackFinishedListener
import javazoom.jl.player.advanced.PlaybackEvent; //导入依赖的package包/类
public void addPlaybackFinishedListener(Consumer<PlaybackEvent> listener) {
playbackFinishedListeners.add(listener);
}
示例6: playbackStarted
import javazoom.jl.player.advanced.PlaybackEvent; //导入依赖的package包/类
@Override
public void playbackStarted(PlaybackEvent event) {
playbackStartedListeners.forEach(l -> l.accept(event));
}
示例7: playbackFinished
import javazoom.jl.player.advanced.PlaybackEvent; //导入依赖的package包/类
@Override
public void playbackFinished(PlaybackEvent event) {
playbackFinishedListeners.forEach(l -> l.accept(event));
}
示例8: addPlaybackFinishedListener
import javazoom.jl.player.advanced.PlaybackEvent; //导入依赖的package包/类
@Override
public void addPlaybackFinishedListener(Consumer<PlaybackEvent> playbackListener) {
this.playbackListener.addPlaybackFinishedListener(playbackListener);
}
示例9: playbackStarted
import javazoom.jl.player.advanced.PlaybackEvent; //导入依赖的package包/类
@Override
public void playbackStarted(PlaybackEvent evt) {
}
示例10: playbackStopped
import javazoom.jl.player.advanced.PlaybackEvent; //导入依赖的package包/类
@Override
public void playbackStopped(PlaybackEvent evt) {
}
示例11: playbackCompleted
import javazoom.jl.player.advanced.PlaybackEvent; //导入依赖的package包/类
@Override
public void playbackCompleted(PlaybackEvent evt) {
fireOnSongCompletedEvent();
}
示例12: addPlaybackFinishedListener
import javazoom.jl.player.advanced.PlaybackEvent; //导入依赖的package包/类
/**
* @param playbackListener The playback listener to register.
*/
void addPlaybackFinishedListener(Consumer<PlaybackEvent> playbackListener);