00001 /** 00002 * @file Platform/Aperios1.3.2/SoundDataSender.h 00003 * This file contains a sender for sound data. 00004 */ 00005 #ifndef __SOUNDDATASENDER_H__ 00006 #define __SOUNDDATASENDER_H__ 00007 00008 #ifndef __ProcessFramework_h__ 00009 #error Never include this file directly. Include ProcessFramework.h instead. 00010 #endif 00011 00012 #include "Platform/ProcessFramework.h" 00013 #include "Representations/Sound/SoundData.h" 00014 #include <OPENR/OPENRAPI.h> 00015 00016 /** 00017 * This class implements a sender for sound data. 00018 */ 00019 class SoundDataSender : public SenderBase<SoundData> 00020 { 00021 private: 00022 MemoryRegionID memID[2]; /**< The memory regions of the two package instances. */ 00023 OSoundVectorData* soundVec[2]; /**< Pointers to the data in the packages. */ 00024 RCRegion* package[2]; /**< The two instances of the packages. */ 00025 int index; /**< The index of the next package. */ 00026 00027 /** 00028 * The function fills a package with data. 00029 * @param i The index of the package (0 or 1). 00030 */ 00031 void prepare(int i); 00032 00033 protected: 00034 /** 00035 * The function prepares a package. 00036 */ 00037 virtual void preparePackage(); 00038 00039 /** 00040 * The functions sets a package for a receiver. 00041 * @param receiver The receive the package will be sent to. 00042 */ 00043 virtual void setPackage(const ObserverID& receiver); 00044 00045 /** 00046 * The function frees the package. 00047 */ 00048 virtual void freePackage(); 00049 00050 public: 00051 /** 00052 * The constructor. 00053 * @param process The process this sender is associated with. 00054 * @param blocking Decides whether this sender blocks the execution of the next frame 00055 * until all connected receivers have requested a new package. 00056 */ 00057 SoundDataSender(PlatformProcess* process,bool blocking); 00058 00059 /** 00060 * Destructor. 00061 */ 00062 ~SoundDataSender(); 00063 }; 00064 00065 /** 00066 * The macro declares a sender for sound data. 00067 * It must be used inside a declaration of a process, after the macro DEBUGGING. 00068 */ 00069 #define SENDER_SOUNDDATA \ 00070 SoundDataSender theSoundDataSender 00071 00072 /** 00073 * The macro instantiates a sender for sound data. 00074 * @param blocking Decides whether this sender blocks the execution of the next frame 00075 * until all connected receivers have requested a new package. 00076 */ 00077 #define INIT_SENDER_SOUNDDATA(blocking) \ 00078 theSoundDataSender(this,blocking) 00079 00080 #endif 00081 00082 /* 00083 * Change log : 00084 * 00085 * $Log: SoundDataSender.h,v $ 00086 * Revision 1.1.1.1 2004/05/22 17:23:40 cvsadm 00087 * created new repository GT2004_WM 00088 * 00089 * Revision 1.1 2003/10/07 10:06:59 cvsadm 00090 * Created GT2004 (M.J.) 00091 * 00092 * Revision 1.2 2003/09/26 15:30:28 juengel 00093 * Renamed DataTypes to representations. 00094 * 00095 * Revision 1.1.1.1 2003/07/02 09:40:24 cvsadm 00096 * created new repository for the competitions in Padova from the 00097 * tamara CVS (Tuesday 2:00 pm) 00098 * 00099 * removed unused solutions 00100 * 00101 * Revision 1.2 2002/12/02 11:00:13 dueffert 00102 * doxygen docu corrected 00103 * 00104 * Revision 1.1 2002/11/28 14:22:01 hebbel 00105 * added SoundDataSender 00106 * 00107 * Revision 1.1 2002/07/13 10:54:58 roefer 00108 * New command and sound sender 00109 * 00110 * 00111 * 00112 */