01: /*
02: * $Id: Sound.java,v 1.2 2002/02/15 23:44:28 skavish Exp $
03: *
04: * ===========================================================================
05: *
06: */
07:
08: package org.openlaszlo.iv.flash.api.sound;
09:
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;
14:
15: /**
16: * Sound base class
17: *
18: * @author James Taylor
19: *
20: */
21:
22: public abstract class Sound extends FlashDef {
23: public static final int COMPRESS_NONE = 0;
24: public static final int COMPRESS_ADPCM = 1;
25: public static final int COMPRESS_MP3 = 2;
26:
27: public static final String[] compressions = { "None", "ADPCM",
28: "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: return Tag.DEFINESOUND;
45: }
46:
47: public void printContent(PrintStream out, String indent) {
48: out.println(indent + "Sound: id=" + getID() + ", name='"
49: + getName() + "'");
50: }
51:
52: public boolean isConstant() {
53: return true;
54: }
55:
56: /**
57: * Return data size
58: */
59: public abstract int getSize();
60:
61: protected FlashItem copyInto(FlashItem item, ScriptCopier copier) {
62: super .copyInto(item, copier);
63:
64: ((Sound) item).compressFormat = compressFormat;
65: ((Sound) item).rate = rate;
66: ((Sound) item).isSample16bit = isSample16bit;
67: ((Sound) item).isStereo = isStereo;
68: ((Sound) item).sampleCount = sampleCount;
69:
70: return item;
71: }
72:
73: public abstract void write(FlashOutput fob);
74: }
|