Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

LWEnvelope.cpp

Go to the documentation of this file.
00001 
00002 /*
00003     TEDDY - General graphics application library
00004     Copyright (C) 1999-2002  Timo Suoranta
00005     tksuoran@cc.helsinki.fi
00006 
00007     This library is free software; you can redistribute it and/or
00008     modify it under the terms of the GNU Lesser General Public
00009     License as published by the Free Software Foundation; either
00010     version 2.1 of the License, or (at your option) any later version.
00011 
00012     This library is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015     Lesser General Public License for more details.
00016 
00017     You should have received a copy of the GNU Lesser General Public
00018     License along with this library; if not, write to the Free Software
00019     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020 
00021     $Id: LWEnvelope.cpp,v 1.4 2002/01/11 14:34:59 tksuoran Exp $
00022 */
00023 
00024 
00025 #include "Teddy/TeddyConfig.h"
00026 #if defined( TEDDY_INCLUDE_LW_SCENE )
00027 
00028 
00029 #include "Teddy/Imports/LWEnvelope.h"
00030 #include "Teddy/Imports/LWEnvelopeKey.h"
00031 #include "Teddy/Imports/LWFile.h"
00032 #include "Teddy/SysSupport/StdIO.h"
00033 
00034 
00035 namespace Teddy   {
00036 namespace Imports {
00037 
00038 
00040 LWEnvelope::LWEnvelope( LWFile *f ){
00041     this->f  = f;
00042     last_key = NULL;
00043 }
00044 
00045 
00046 void LWEnvelope::processEnvelope(){
00047     envelope_type   = f->read_ID4();
00048     envelope_length = f->read_U2();
00049     f->pushDomain( envelope_length );
00050     switch( envelope_type ){
00051         case ID_PRE:  readPreBehaviour_U2(); break;
00052         case ID_POST: readPostBehaviour_U2(); break;
00053         case ID_KEY:  readKeyframe_F4_F4(); break;
00054         case ID_SPAN: readInterpolation_ID4_d(); break;
00055         case ID_CHAN: readChannel_S0_U2_d(); break;
00056         case ID_NAME: readName_S0(); break;
00057         default: break;
00058     }
00059     f->popDomain( true );
00060 }
00061 
00062 
00072 void LWEnvelope::readPreBehaviour_U2(){
00073     pre_behaviour = f->read_U2();
00074 }
00075 
00076 
00085 void LWEnvelope::readPostBehaviour_U2(){
00086     post_behaviour = f->read_U2();
00087 }
00088 
00089 
00090 void LWEnvelope::readKeyframe_F4_F4(){
00091     F4 keyframe_time  = f->read_F4();
00092     F4 keyframe_value = f->read_F4();
00093     LWEnvelopeKey *key = last_key = new LWEnvelopeKey( keyframe_time, keyframe_value );
00094     keys.push_back( key );
00095 }
00096 
00097 
00109 void LWEnvelope::readInterpolation_ID4_d(){
00110     if( last_key == NULL ){
00111         printf( "Envelope key missing for interval interpolation\n" );
00112         return;
00113     }
00114     //  FIX
00115 }
00116 
00117 
00128 void LWEnvelope::readChannel_S0_U2_d(){
00129     std::string server_name = f->read_S0();
00130     U2          flags       = f->read_U2();
00131 
00132     if( (flags & 1) == 1 ){
00133         //  Channel filter plugin disabled
00134         return;
00135     }
00136 
00137     while( f->domainLeft() > 0 ){
00138         //  FIX send bytes to plugin server
00139     }
00140 }
00141 
00142 
00152 void LWEnvelope::readName_S0(){
00153     name = f->read_S0();
00154 }
00155 
00156 
00157 };  //  namespace Imports
00158 };  //  namespace Teddy
00159 
00160 
00161 #endif  //  TEDDY_INCLUDE_LW_SCENE