Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/anotherbigidea/flash/sound/SoundStreamHead.java


1   /****************************************************************
2    * Copyright (c) 2001, David N. Main, All rights reserved.
3    * 
4    * Redistribution and use in source and binary forms, with or
5    * without modification, are permitted provided that the 
6    * following conditions are met:
7    *
8    * 1. Redistributions of source code must retain the above 
9    * copyright notice, this list of conditions and the following 
10   * disclaimer. 
11   * 
12   * 2. Redistributions in binary form must reproduce the above 
13   * copyright notice, this list of conditions and the following 
14   * disclaimer in the documentation and/or other materials 
15   * provided with the distribution.
16   * 
17   * 3. The name of the author may not be used to endorse or 
18   * promote products derived from this software without specific 
19   * prior written permission. 
20   * 
21   * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY 
22   * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
23   * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 
24   * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
25   * AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
26   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
27   * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
28   * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
29   * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
30   * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 
31   * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 
32   * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33   ****************************************************************/
34  package com.anotherbigidea.flash.sound;
35  
36  import java.io.*;
37  import java.util.*;
38  import com.anotherbigidea.io.*;
39  import com.anotherbigidea.flash.*;
40  import com.anotherbigidea.flash.structs.*;
41  import com.anotherbigidea.flash.interfaces.*;
42  import com.anotherbigidea.flash.writers.*;
43  
44  /**
45   * Sound Stream Header Information
46   */
47  public class SoundStreamHead
48  {
49      public int     playbackFrequency;
50      public boolean playback16bit;
51      public boolean playbackStereo;                
52      public int     streamFormat;
53      public int     streamFrequency;
54      public boolean stream16bit;
55      public boolean streamStereo;
56      public int     averageSampleCount;
57      
58      public SoundStreamHead( int playbackFrequency, boolean playback16bit, boolean playbackStereo,
59                              int streamFormat, int streamFrequency, boolean stream16bit, boolean streamStereo,
60                              int averageSampleCount )
61      {
62          this.playbackFrequency  = playbackFrequency;  
63          this.playback16bit      = playback16bit;      
64          this.playbackStereo     = playbackStereo;                
65          this.streamFormat       = streamFormat;       
66          this.streamFrequency    = streamFrequency;    
67          this.stream16bit        = stream16bit;        
68          this.streamStereo       = streamStereo;       
69          this.averageSampleCount = averageSampleCount; 
70      }
71      
72      /**
73       * Playback and streaming parameters are assumed to be the same
74       */
75      public SoundStreamHead( int frequency, boolean is16bit, boolean isStereo,
76                              int streamFormat, int averageSampleCount )
77      {
78          this.playbackFrequency  = frequency;  
79          this.playback16bit      = is16bit;      
80          this.playbackStereo     = isStereo;                
81          this.streamFormat       = streamFormat;       
82          this.streamFrequency    = frequency;    
83          this.stream16bit        = is16bit;        
84          this.streamStereo       = isStereo;       
85          this.averageSampleCount = averageSampleCount; 
86      }
87      
88      public void write( SWFSpriteTagTypes swfTags ) throws IOException 
89      {
90          swfTags.tagSoundStreamHead2( playbackFrequency, playback16bit, playbackStereo,
91                                       streamFormat, streamFrequency, stream16bit, streamStereo,
92                                       averageSampleCount );
93      }
94  }