Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

SoundManagerMsg.h

Go to the documentation of this file.
00001 //-*-c++-*-
00002 #ifndef INCLUDED_SoundManagerMsg_h
00003 #define INCLUDED_SoundManagerMsg_h
00004 
00005 class RCRegion;
00006 
00007 //! A small header that preceeds data sent by SoundManager between processes
00008 struct SoundManagerMsg {
00009 private:
00010   friend class SoundManager;
00011 
00012   //! the type to use when referring to Sounds
00013   typedef unsigned short Snd_ID;
00014 
00015   //! Denotes what type of message this is
00016   enum MsgType {
00017     add, //!< indicates a new sound to be played
00018     del, //!< indicates the sound with #id should be stopped
00019     wakeup, //!< indicates that it's time to start sending sounds to the system
00020     unknown //!< initial value for #type until one of the others is assigned
00021   } type; //!< indicates how this message should be processed
00022   
00023   //! The id of the sound this is in reference to
00024   Snd_ID id;
00025 
00026   //! The RCRegion to free, if it's a deletion
00027   RCRegion * region;
00028   
00029   //! The serial number of the sound this is in reference to, see SoundManager::sn
00030   unsigned int sn;
00031   
00032   //! constructor
00033   SoundManagerMsg() : type(unknown), id(static_cast<Snd_ID>(-1)), region(NULL), sn(-1U) {}
00034 
00035   //! virtual destructor
00036   /*! doesn't do anything, but don't remove it, otherwise this would no longer be a virtual base class */
00037   virtual ~SoundManagerMsg() {}
00038 
00039   //! Accessor for the id number, set by SoundManager
00040   Snd_ID getID() const { return id; }
00041 
00042   //! Sets up the header as an add message
00043   void setAdd(Snd_ID sndid, unsigned int sndsn) {
00044     type=add;
00045     id=sndid;
00046     sn=sndsn;
00047   }
00048 
00049   //! Sets up the header as an erase message
00050   void setDelete(RCRegion* rcregion) {
00051     type=del;
00052     region=rcregion;
00053   }
00054   
00055   //! Sets up the header as a wakeup message
00056   void setWakeup() {
00057     type=wakeup;
00058   }
00059 
00060   SoundManagerMsg(const SoundManagerMsg&); //!< don't call
00061   SoundManagerMsg operator=(const SoundManagerMsg&); //!< don't call
00062 };
00063 
00064 /*! @file
00065  * @brief Defines SoundManagerMsg, a small header used by SoundManager for sending messages between processes
00066  * @author ejt (Creator)
00067  */
00068 
00069 #endif // INCLUDED_SoundManagerMsg_h

Tekkotsu v5.1CVS
Generated Mon May 9 04:58:51 2016 by Doxygen 1.6.3