Example #1
0
  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();
 }
Example #3
0
 @Override
 public void setVolume(float volume) {
   Asserts.checkArgument(0f <= volume && volume <= 1f, "Must ensure 0f <= volume <= 1f");
   sound.setVolume((int) (volume * 100));
 }
Example #4
0
 @Override
 public void setLooping(boolean looping) {
   sound.setLooping(looping);
 }
Example #5
0
 @Override
 public void stop() {
   sound.stop();
   playing = false;
 }
Example #6
0
 @Override
 public boolean play() {
   playing = true;
   return sound.play();
 }