Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

OpenALScene.h

Go to the documentation of this file.
00001 /*
00002  * OpenALScene.h

00003  *
00004  * The scene for sounds.

00005  *
00006  * Version: $Id: OpenALScene_h-source.html,v 1.1 2001/02/01 12:25:09 coockie Exp $

00007  */
00008 
00009 #ifndef __OPENALSCENE_H
00010 #define __OPENALSCENE_H
00011 
00012 #include "SoundDefines.h"
00013 #include "SND_IScene.h"
00014 #include "SND_SoundObject.h"
00015 #include "SND_SoundListener.h"
00016 #include <map>
00017 #include "StdString.h"
00018 
00019 typedef struct Objectlistdata {
00020         int                     id;
00021         int                     buffer;
00022 } Objectlistdata;
00023 
00024 typedef struct Activelistdata {
00025         int                     id;
00026         int                     buffer;
00027         double          timestamp;
00028 } Activelistdata;
00029 
00030 class OpenALScene : public SND_IScene
00031 {
00032 public:
00033         OpenALScene();
00034         ~OpenALScene();
00035 
00036         void                            proceed(double curtime,double deltatime);
00037 
00038         bool                            init();
00039         void                            exit();
00040         void                            addObject(SND_SoundObject* object);
00041         void                            removeObject(SND_SoundObject* object);
00042 
00043         void                            setAudio(bool audio) {m_audio = audio;}
00044         virtual void            SetListenerPosition(const MT_Point3& pos);
00045 
00046         bool                            isAudio()               {return m_audio;}
00047         SND_SoundListener*      getListener()   {return &m_listener;}
00048         unsigned int*           getSources()    {return &m_source[0];}
00049         unsigned int*           getBuffers()    {return &m_buffer[0];}
00050 
00051 private:
00052         std::map<CCString, int>                                 m_samples;
00053         std::map<SND_SoundObject*, Objectlistdata>      m_soundobjects;
00054         std::map<SND_SoundObject*, Activelistdata>      m_activeobjects;
00055 
00056         int                                     getId();
00057         int                                     loadSample(const CCString& pSample);
00058         void                            ShowPlaystate();                                /* method is used for debugging only */
00059         int                                     CheckActiveList(unsigned int* openalsources);
00060         void                            UpdateListener();
00061         void                            BuildActiveList(double curtime);
00062         void                            UpdateActiveObects();
00063 
00064         bool                            m_audio;
00065         SND_SoundListener       m_listener;
00066         int                                     m_idlist;
00067         unsigned int            m_buffer[NUM_BUFFERS];
00068         unsigned int            m_source[NUM_SOURCES];
00069         bool                            m_bufferList[NUM_BUFFERS];
00070         bool                            m_activeList[NUM_SOURCES];
00071 };
00072 
00073 #endif //__OPENALSCENE_H

Generated at Thu Feb 1 13:03:08 2001 for Ketsji Game Engine by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000