created project for sound API sound
authorAnton Epple <toni.epple@eppleton.de>
Tue, 28 May 2013 08:16:32 +0200
branchsound
changeset 1087cc01dacf0e2
parent 107 8b55cc88621f
child 109 0b12d1c32314
created project for sound API
sound/src/main/java/net/java/html/sound/api/AudioClip.java
     1.1 --- a/sound/src/main/java/net/java/html/sound/api/AudioClip.java	Mon May 27 16:59:48 2013 +0200
     1.2 +++ b/sound/src/main/java/net/java/html/sound/api/AudioClip.java	Tue May 28 08:16:32 2013 +0200
     1.3 @@ -37,10 +37,10 @@
     1.4          audioEnvironment = loader.iterator().next();
     1.5      }
     1.6  
     1.7 -    public static AudioClip create(String src){
     1.8 +    public static AudioClip create(String src) {
     1.9          return new AudioClip(src);
    1.10      }
    1.11 -    
    1.12 +
    1.13      public void play() {
    1.14          Object nativeClip = audioEnvironment.play(this, cached);
    1.15          cache(nativeClip);
    1.16 @@ -55,13 +55,13 @@
    1.17          Object nativeClip = audioEnvironment.stop(this, cached);
    1.18          cache(nativeClip);
    1.19      }
    1.20 -    
    1.21 +
    1.22      public void setVolume(int volume) {
    1.23          Object nativeClip = audioEnvironment.setVolume(this, volume, cached);
    1.24          cache(nativeClip);
    1.25      }
    1.26 -    
    1.27 -    public void playFrom(int seconds){
    1.28 +
    1.29 +    public void playFrom(int seconds) {
    1.30          Object nativeClip = audioEnvironment.playFrom(this, seconds, cached);
    1.31          cache(nativeClip);
    1.32      }
    1.33 @@ -82,7 +82,7 @@
    1.34      @Override
    1.35      public int hashCode() {
    1.36          int hash = 5;
    1.37 -        hash = 59 * hash + (this.src != null ? this.src.hashCode() : 0);
    1.38 +        hash = 59 * hash + (this.src != null ? this.src.hashCode() : 0) ^ (cached==null? 1231 : 1237);
    1.39          return hash;
    1.40      }
    1.41  
    1.42 @@ -98,6 +98,9 @@
    1.43          if ((this.src == null) ? (other.src != null) : !this.src.equals(other.src)) {
    1.44              return false;
    1.45          }
    1.46 +        if ((this.cached == null) != (other.cached == null)) {
    1.47 +            return false;
    1.48 +        }
    1.49          return true;
    1.50      }
    1.51  }
    1.52 \ No newline at end of file