View Javadoc

1   // Copyright 2001, FreeHEP.
2   package org.freehep.graphicsio.swf;
3   
4   import java.io.IOException;
5   
6   /**
7    * SWF SoundEnvelope.
8    * 
9    * @author Mark Donszelmann
10   * @author Charles Loomis
11   * @version $Id: SoundEnvelope.java 8584 2006-08-10 23:06:37Z duns $
12   */
13  public class SoundEnvelope {
14  
15      private long pos44;
16  
17      private int leftLevel, rightLevel;
18  
19      public SoundEnvelope(long pos44, int leftLevel, int rightLevel) {
20          this.pos44 = pos44;
21          this.leftLevel = leftLevel;
22          this.rightLevel = rightLevel;
23      }
24  
25      public SoundEnvelope(SWFInputStream input) throws IOException {
26          pos44 = input.readUnsignedInt();
27          leftLevel = input.readUnsignedShort();
28          rightLevel = input.readUnsignedShort();
29      }
30  
31      public void write(SWFOutputStream swf) throws IOException {
32          swf.writeUnsignedInt(pos44);
33          swf.writeUnsignedShort(leftLevel);
34          swf.writeUnsignedShort(rightLevel);
35      }
36  
37      public String toString() {
38          return "SoundEnvelope pos44: " + pos44 + ", level(L,R): " + leftLevel
39                  + ", " + rightLevel;
40      }
41  }