Veda/MediaTimePattern.h

Go to the documentation of this file.
00001 /*! \file 
00002     \author victorien ferry & www.m4nkind.com
00003     \brief This file applies the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1 , read file COPYING.
00004 */
00005 #ifndef COM_M4NKIND_MediaTimePattern_H
00006 #define COM_M4NKIND_MediaTimePattern_H
00007 
00008 #include "VirtualMedia.h"
00009 #include "VirtualMachine.h"
00010 
00011 #include "PackFloat.h"
00012 #include "PackList_TimeBlockTrack.h"
00013 #include "PackLong.h"
00014 #include "PackObjectReference.h"
00015 #include "PackFloatByte_Limits.h"
00016 /*!
00017     \class  MediaTimePattern
00018     \ingroup BaseObjectInheritedDocGroup BaseObjectInherited_Veda
00019     \brief  The class Defining a media pattern as a list of tracks of other media to mix.
00020             Each track is a suit of VirtualMedia reference to play. 
00021             a MediaTimePattern can call other ones recursively.
00022 */
00023 class MediaTimePattern : public VirtualMedia
00024 {
00025 /*==================================================================
00026                                 PUBLIC
00027 ==================================================================*/
00028 public:
00029     /*!
00030         \brief  Constructor. There should only be members initialisation there.
00031     */
00032     MediaTimePattern(void);
00033 
00034     /*!
00035         \brief  Class Inheritance Descriptors. Also forces a destructor. See BASEOBJECT_DECLARE_... in .cpp
00036     */
00037     BASEOBJECT_DEFINE_CLASS(MediaTimePattern);
00038 
00039     /*!
00040         \brief   Process a media at a given date, (compute,draw, 
00041                 or do anything) using a machine. You must process the media on machine this->GetMachine().
00042                 Note there are no play/pause or speed concept here, by default, a date is passed.
00043 
00044         \param  _frameDate a date, in second, which defines the effect cinematic.
00045         \param  _pViewPort the viewport to render. Can't be 0L.
00046     */
00047     virtual void ProcessMedia( double _frameDate,VirtualMachine::InternalViewPort *_pViewPort );
00048 
00049     /*!
00050         \brief   If the media had to generate real time sounds, 
00051                 ProcessSoundInterupt will be called by a machine. There is a default 
00052                 behaviour for this method, which does nothing. the float buffer 
00053                 accumulate the whole machine sound.
00054         \param  _SoundBufferToAddYourSignal description of the buffer to fill.
00055     */
00056     virtual void ProcessSoundInterupt( VirtualMachine::SoundBufferToAddYourSignal &_SoundBufferToAddYourSignal );
00057 
00058 
00059     /*!
00060         \brief   Nested class that describes something to play in a MediaTimePattern.
00061                 It is used as the element of the script list, each reference another script: 
00062     */
00063     class PartToPlay : public PackList_TimeBlockTrack::TimeBlockTrackElement
00064     {
00065     public:
00066         //! the reference to the subscript to play:
00067         PackObjectReference mSer_ReferenceToPlay;
00068         //! an offset applyed to the part time, in 100Hz units:
00069         PackFloat_FixedPoint mSer_TimeOffset;
00070         //! the speed<<4
00071         PackFloat_FixedPoint mSer_TimeSpeed;
00072         //! general shade value [0,1] used for volume or transparency
00073         PackFloatByte_Limits mSer_ShadeAtStart;
00074         //! general shade value [0,1] used for volume or transparency
00075         PackFloatByte_Limits mSer_ShadeAtEnd;
00076         //! \brief constructor . It registers the
00077         PartToPlay(void) : PackList_TimeBlockTrack::TimeBlockTrackElement()
00078             ,mSer_TimeSpeed(PackFloat::m_0p0625) // 1/16
00079         {
00080             REGISTER_MEMBER_REFERENCE(mSer_ReferenceToPlay ,"MediaToPlay", VirtualMedia::m_Description );
00081             REGISTER_MEMBER( mSer_TimeOffset,"Offset");
00082             REGISTER_MEMBER_PACKFLOAT( mSer_TimeSpeed,"Speed",1.0f);
00083             REGISTER_MEMBER_PACKFLOATBYTE_0_1(mSer_ShadeAtStart,/*"ShadeStart" TODO*/0L,1.0f);
00084             REGISTER_MEMBER_PACKFLOATBYTE_0_1(mSer_ShadeAtEnd,/*"ShadeAtEnd"TODO*/0L,1.0f);
00085         };
00086     };
00087 
00088     /*!
00089         \brief  static method passed to the list to create new elements.
00090         \return a new PartToPlay object.
00091     */
00092     static PackList_TimeBlockTrack::TimeBlockTrackElement *NewPartToPlay(){ return new PartToPlay(); };
00093 
00094     /*!
00095         \brief  static method passed to mSer_TrackList to create new elements.
00096         \return a new Track object.
00097     */
00098     static BaseType *NewTrack();
00099 
00100 #ifdef _ENGINE_EDITABLE_
00101     /*!
00102         \brief  Draw the preview.
00103 
00104         \param  _frameDate a date, in second, which defines the effect cinematic.
00105         \param  _pPreviewViewPort the viewport to render. Can't be 0L.
00106         \param  _pPreviewConfiguration Preview Configuration object. Never 0L. Do not keep a pointer to it.
00107     */
00108     virtual void ProcessPreview(double _frameDate,VirtualMachine::InternalViewPort *_pPreviewViewPort,const PreviewConfiguration *_pPreviewConfiguration);
00109 #endif  
00110 #ifdef _ENGINE_EDITABLE_
00111     /*!
00112         \brief  Draw a shceme of the tracks and parts in a special rectangle for preview.
00113 
00114         \param  _frameDate a date, in second, which defines the effect cinematic.
00115         \param  _pPreviewViewPort the viewport to render. Can't be 0L.
00116         \param  _pPreviewConfiguration Preview Configuration object. Never 0L. Do not keep a pointer to it.
00117     */
00118     virtual void ProcessPreview_DrawTracks(double _frameDate,VirtualMachine::InternalViewPort *_pPreviewViewPort,const PreviewConfiguration *_pPreviewConfiguration);
00119 #endif  
00120 #ifdef _ENGINE_EDITABLE_
00121     /*!
00122         \brief  Preview Tool: Create a preview Square 3D Object.
00123     */
00124     virtual void ProcessPreview_CreateSquare(VirtualMachine::InternalObject3DBuffer **_ppVertexAndPolygonBufferOut);
00125 #endif  
00126     /*
00127         \class  ReferenceMember
00128         \brief  Note: THIS WAS EXPERIMENTAL !!!
00129                 Inner base class that stands for special data members to a BaseObject,
00130                 cf:  BaseObject::ReferenceMembers
00131     */
00132     /*
00133     class MediaTimePattern_ReferenceMembers : public ReferenceMembers
00134     { public:
00135     
00136         MediaTimePattern_ReferenceMembers(){};
00137         ReferenceMembers    **m_pTrackList_ReferenceMembers;
00138     };*/
00139     /*
00140         \brief  THIS WAS EXPERIMENTAL !!! cf: BaseObject::CreateNewReferenceMembers()   
00141         \return new members by reference, or empty adress.
00142     *//*
00143     virtual ReferenceMembers    *CreateNewReferenceMembers();
00144     */
00145 
00146 /*==================================================================
00147                                 PROTECTED
00148 ==================================================================*/
00149 protected:
00150     //! the track list on the pattern. 
00151     PackList        mSer_TrackList;
00152     /*!
00153         \brief  Method that really build the object using the serializable parameters.
00154                 Close() should close everything opened by Create().
00155         \return false if creation failed.
00156     */
00157     virtual bool CreateInternal(void);
00158 #ifdef _ENGINE_EDITABLE_
00159     /*!
00160         \brief  that closes everything. Still, the object exist and can be rebuild the same using Create()
00161     */
00162     virtual void CloseInternal(void);
00163 #endif
00164 
00165 #ifdef _ENGINE_EDITABLE_
00166     //! object created for preview.
00167     VirtualMachine::InternalObject3DBuffer  *m_pPreviewSquareObject;
00168 #endif
00169 
00170 
00171 };
00172 #endif

      /\/\        4         N         k         !         N         D
                      _______  _ __ ___  _____            ___ _ _  ____
     ___________  __//___   /________  |/    / ___________\_______/    \
    /   _   _   \/   _     /    _   /      _/_/____/    _       __     /
   /    /   /       /     /    /    \      \/     /    /    \   \     /
  \\___/___/___/    ¯    _____/_____/       ______\___/_____/\________\\
               \________/_ ___ __ l____\      /elD!  
                 http://www.m4nkind.com \____/