KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openlaszlo > iv > flash > api > sound > Sound


1 /*
2  * $Id: Sound.java,v 1.2 2002/02/15 23:44:28 skavish Exp $
3  *
4  * ===========================================================================
5  *
6  */

7
8 package org.openlaszlo.iv.flash.api.sound;
9
10 import org.openlaszlo.iv.flash.api.*;
11 import org.openlaszlo.iv.flash.parser.*;
12 import org.openlaszlo.iv.flash.util.*;
13 import java.io.PrintStream JavaDoc;
14
15 /**
16  * Sound base class
17  *
18  * @author James Taylor
19  *
20  */

21
22 public abstract class Sound extends FlashDef
23 {
24     public static final int COMPRESS_NONE = 0;
25     public static final int COMPRESS_ADPCM = 1;
26     public static final int COMPRESS_MP3 = 2;
27
28     public static final String JavaDoc [] compressions = { "None", "ADPCM", "MP3" };
29
30     public static final int RATE_5_5 = 0;
31     public static final int RATE_11 = 1;
32     public static final int RATE_22 = 2;
33     public static final int RATE_44 = 3;
34
35     public static final int [] rates = { 5500, 11025, 22050, 44100 };
36
37     public int compressFormat;
38     public int rate;
39     public boolean isSample16bit;
40     public boolean isStereo;
41     public int sampleCount;
42
43     public int getTag()
44     {
45         return Tag.DEFINESOUND;
46     }
47
48     public void printContent( PrintStream JavaDoc out, String JavaDoc indent )
49     {
50         out.println( indent+"Sound: id="+getID()+", name='"+getName()+"'" );
51     }
52
53     public boolean isConstant()
54     {
55         return true;
56     }
57
58     /**
59      * Return data size
60      */

61     public abstract int getSize();
62
63     protected FlashItem copyInto( FlashItem item, ScriptCopier copier )
64     {
65         super.copyInto( item, copier );
66
67         ( (Sound) item ).compressFormat = compressFormat;
68         ( (Sound) item ).rate = rate;
69         ( (Sound) item ).isSample16bit = isSample16bit;
70         ( (Sound) item ).isStereo = isStereo;
71         ( (Sound) item ).sampleCount = sampleCount;
72
73         return item;
74     }
75
76     public abstract void write( FlashOutput fob );
77 }
78
Popular Tags