HtmlSound(com.allen_sauer.gwt.voices.client.Sound sound) { this.sound = sound; sound.addEventHandler( new SoundHandler() { @Override public void onSoundLoadStateChange(SoundLoadStateChangeEvent event) {} @Override public void onPlaybackComplete(PlaybackCompleteEvent event) { playing = false; } }); }
/** * Event constructor. * * @param source the sound object */ public SoundLoadStateChangeEvent(Object source) { super(source); Sound sound = (Sound) source; loadState = sound.getLoadState(); }
@Override public void setVolume(float volume) { Asserts.checkArgument(0f <= volume && volume <= 1f, "Must ensure 0f <= volume <= 1f"); sound.setVolume((int) (volume * 100)); }
@Override public void setLooping(boolean looping) { sound.setLooping(looping); }
@Override public void stop() { sound.stop(); playing = false; }
@Override public boolean play() { playing = true; return sound.play(); }