Page principale   Liste des namespaces   Hiérarchie des classes   Liste par ordre alphabétique   Liste des composants   Liste des fichiers   Membres des namespaces   Composants   Déclarations  

Référence de la classe ExManagerSound

#include <ExManagerSound.h>

Graphe d'héritage de la classe ExManagerSound

ExManagerObject< ExCSound > ExManager

Membres publics

void Init (void)
void Reset (void)
ExCAction InputCommand (ExCCommand Command)
ExCAction InputAction (ExCAction Action)
void DisplayAviableInput (void)
bool LoadSound (std::string)
bool RemoveSound (std::string)
void PlaySound (std::string)
void StopSound (std::string)
int GetSound (std::string)

Membres publics statiques

ExManagerSound * CreateSingleton (void)

Membres privés

 ExManagerSound (void)
 ~ExManagerSound (void)

Attributs Privés

bool m_initok
ALCcontext * context
ALCdevice * device
ALuint buffer_index
ALuint buffer [MAX_BUFFER]
ALint error
ALboolean loop
ALuint source_index
ALuint source_available
ALuint source [64]

Attributs Privés Statiques

bool m_flag = false
ExManagerSound * m_instance = NULL

Documentation des contructeurs et destructeurs

ExManagerSound void    [private]
 

Définition à la ligne 43 du fichier ExManagerSound.cpp.

Références buffer_index, m_initok, source_available, et source_index.

00044 {
00045   buffer_index = 0;
00046   source_index = 0;
00047   source_available = 0;
00048   m_initok=false;
00049 }

~ExManagerSound void    [private]
 

Définition à la ligne 51 du fichier ExManagerSound.cpp.

Références context.

00052 {
00053         alcDestroyContext (context);
00054 }


Documentation des méthodes

ExManagerSound * CreateSingleton void    [static]
 

Définition à la ligne 29 du fichier ExManagerSound.cpp.

Références CreateSingleton(), Guard, m_flag, et m_instance.

Référencé par CreateSingleton(), et main().

00029                                                    {
00030 Guard(ExManagerSound* ExManagerSound::CreateSingleton(void))
00031         if(!m_flag)
00032         {
00033                 m_flag = true; // We are creating the error log now, so set flag to true
00034                 m_instance = new ExManagerSound; // Create the error log
00035         }else
00036         {
00037                 std::cout<<"Error singleton already created"<<std::endl;
00038         }
00039         return m_instance; 
00040 UnGuard
00041 }

void DisplayAviableInput void   
 

Définition à la ligne 99 du fichier ExManagerSound.cpp.

Références ExManager::Consol, DisplayAviableInput(), Guard, et m_initok.

Référencé par DisplayAviableInput(), et InitManager().

00099                                               {
00100 Guard (void ExManagerSound::DisplayAviableInput (void))
00101         if(!m_initok)return;
00102         *Consol<<"****************************************"<<std::endl;
00103         *Consol<<"* Soundsystem init success             *"<<std::endl;
00104         *Consol<<"****************************************"<<std::endl;
00105         *Consol<<"Company        : "<<alGetString (AL_VENDOR)<<std::endl;
00106         *Consol<<"Version        : "<<alGetString (AL_VERSION)<<std::endl;
00107         *Consol<<"Renderer       : "<<alGetString (AL_RENDERER)<<std::endl;
00108         *Consol<<"Extensions     : "<<alGetString (AL_EXTENSIONS)<<std::endl;
00109         *Consol<<"****************************************"<<std::endl;
00110 UnGuard
00111 }

int GetSound std::string   
 

Définition à la ligne 223 du fichier ExManagerSound.cpp.

Références GetSound(), et Guard.

Référencé par GetSound().

00223                                             {
00224 Guard (ExCSound* ExManagerSound::GetSound (std::string file))
00225         return -1;
00226 UnGuard
00227 }

void Init void    [virtual]
 

Redéfinie à partir de ExManagerObject< ExCSound >.

Définition à la ligne 56 du fichier ExManagerSound.cpp.

Références buffer, ExManager::Consol, context, device, error, Guard, ExManagerObject::Init(), m_initok, MAX_BUFFER, MAX_SOURCE, source, et source_available.

Référencé par InitManager().

00057 {
00058 Guard (void ExManagerSound::init (void))
00059         ExManagerObject<ExCSound>::Init();      
00060         device = alcOpenDevice(NULL);
00061         if(device == NULL)
00062         {
00063                 *Consol <<"ExManagerSound:: alcOpenDevice error "<<std::endl;
00064                 return ;
00065         }
00066         context=alcCreateContext(device,NULL);
00067         alcMakeContextCurrent(context);
00068         //Generate buffers
00069         alGenBuffers(MAX_BUFFER,buffer);
00070         if ((error = alGetError()) != AL_NO_ERROR)
00071         {
00072                 *Consol<<"ExManagerSound:: alGenBuffers error:"<<error<<std::endl;
00073                 return ;
00074         }
00075         //Generate sources
00076         for(int i = 0; i < MAX_SOURCE ; i++)
00077         {
00078                 alGenSources(1 , &source[i]);
00079                 if ((error = alGetError()) != AL_NO_ERROR)
00080                 {
00081                         *Consol<<"ExManagerSound:: alGenSources error:"<<error<<std::endl;
00082                         return ;
00083                 }
00084         else source_available++;
00085         }
00086         m_initok=true;
00087 
00088         //LoadSound("idiot.wav");
00089 UnGuard
00090 }       

ExCAction InputAction ExCAction    Action [virtual]
 

Redéfinie à partir de ExManager.

Définition à la ligne 242 du fichier ExManagerSound.cpp.

Références ExManager::Consol, Guard, InputAction(), ExManagerObject< ExCSound >::List(), LoadSound(), ExCAction::m_Action, ExCAction::m_NextAction, ExCAction::m_Param, PlaySound(), RemoveSound(), et StopSound().

Référencé par InputAction(), et ExManagerCommand::ProcesExCAction().

00243 {
00244 Guard(ExCAction ExManagerSound::InputAction(ExCAction Action))
00245         switch(Action.m_Action)
00246         {
00247         case LIST_SOUND:List(); break;
00248         case REMOVE_SOUND:RemoveSound(Action.m_Param);break;
00249         case PLAY_SOUND:PlaySound(Action.m_Param);break;
00250         case STOP_SOUND:StopSound(Action.m_Param);break;
00251         case ADD_SOUND:LoadSound(Action.m_Param);break;
00252         case SET_REPEATS_SOUND: //ManagerSound->SetRepeats(Action.m_Param);break;
00253     case GET_REPEATS_SOUND:     //ManagerSound->GetRepeats(Action.m_Param);break;
00254         
00255         default:
00256                 *Consol<<"Can not file action in SOUND_ACTION_MAP"<<std::endl;
00257                 break;
00258         }       
00259 
00260         if(Action.m_NextAction){return *Action.m_NextAction;}
00261         else{return NOTHING;}
00262 UnGuard
00263 }

ExCAction InputCommand ExCCommand    Command [virtual]
 

Redéfinie à partir de ExManager.

Définition à la ligne 235 du fichier ExManagerSound.cpp.

Références Guard, et InputCommand().

Référencé par InputCommand().

00236 {
00237 Guard(ExCAction ExManagerSound::InputCommand(ExCCommand Command))
00238         return NOTHING;
00239 UnGuard
00240 }

bool LoadSound std::string   
 

Définition à la ligne 113 du fichier ExManagerSound.cpp.

Références ExManagerObject< ExCSound >::Add(), buffer, buffer_index, ExManager::Consol, data, error, Guard, LoadSound(), loop, ExManagerObject< ExCSound >::m_ItMap, ExManagerObject< ExCSound >::m_Map, ExCSound::SetIdent(), ExCObject::SetName(), source, et source_index.

Référencé par InputAction(), ExManagerCommand::InputAction(), ExManagerCommand::LoadSetOfFile(), et LoadSound().

00113                                               {
00114 Guard (bool ExManagerSound::LoadSound(std::string file))
00115   //We check if the file already exist
00116         //For wav file
00117         ALsizei     size,freq;
00118         ALenum      format;
00119         ALvoid      *data;
00120          bool found = false;
00121 
00122         for(m_ItMap=m_Map->begin();m_ItMap!=m_Map->end();m_ItMap++)
00123         {
00124                 if(m_ItMap->second.GetName()==file)
00125                 {
00126                         found = true;
00127                         break;
00128                 }
00129         }
00130         if(found)
00131         {
00132                 *Consol << " ***************************************" << std::endl;
00133                 *Consol << " ** File " << file.c_str() << " already load" << std::endl;
00134                 return -1;
00135         }
00136   
00137   // Load the wav file
00138         //std::string bufferload("../Data/sound/");
00139         //bufferload+=file;
00140         //alutLoadWAVFile((ALbyte*)bufferload.c_str(),&format,&data,&size,&freq,&loop);
00141         alutLoadWAVFile((ALbyte*)file.c_str(),&format,&data,&size,&freq,&loop);
00142   *Consol << " ***************************************" << std::endl;
00143   *Consol << " ** Loading " << file.c_str() << std::endl;
00144   *Consol << " - Format " << format << std::endl;
00145   *Consol << " - Data " << data << std::endl;
00146   *Consol << " - Size " << size << std::endl;
00147   *Consol << " - Freq " << freq << std::endl;
00148   if(loop) *Consol << " - Loop ON";
00149   else *Consol << " - Loop OFF";
00150 
00151         if ((error = alGetError()) != AL_NO_ERROR)
00152         {
00153                 *Consol<<"ExManagerSound:: LoadWavFile error:"<<error<<std::endl;
00154                 return -1;
00155         }
00156   // Copy wav file into the buffer
00157         alBufferData(buffer[buffer_index],format,data,size,freq);
00158         if ((error = alGetError()) != AL_NO_ERROR)
00159         {
00160                 *Consol<<"ExManagerSound:: alBufferData error:"<<error<<std::endl;
00161                 return -1;
00162         }
00163         else
00164         {
00165                 ExCSound Sound;
00166                 Sound.SetName(file.c_str());
00167                 Sound.SetIdent(buffer_index);
00168                 Add(Sound);
00169                 *Consol << " - ident " << buffer_index << std::endl;
00170         }
00171 
00172   // Unload the wav file
00173         alutUnloadWAV(format,data,size,freq);
00174         if ((error = alGetError()) != AL_NO_ERROR)
00175         {
00176                 *Consol<<"ExManagerSound:: alutUnloadWAV error:"<<error<<std::endl;
00177                 return -1;
00178         }
00179 
00180         // Generate source for this wav file
00181         alSourcei(source[source_index],AL_BUFFER,buffer[buffer_index]);
00182         if ((error = alGetError()) != AL_NO_ERROR)
00183         {
00184                 *Consol<<"ExManagerSound:: alSourcei error:"<<error<<std::endl;
00185                 return -1;
00186         }
00187   
00188         source_index++;
00189         buffer_index++;
00190 
00191         *Consol << " ----> " << file.c_str() << " load ok :-)"  << std::endl;
00192   
00193 
00194 
00195   return true;
00196         
00197 UnGuard
00198 }

void PlaySound std::string   
 

Définition à la ligne 200 du fichier ExManagerSound.cpp.

Références ExManager::Consol, error, Guard, ExManagerObject< ExCSound >::m_ItMap, ExManagerObject< ExCSound >::m_Map, PlaySound(), et source.

Référencé par InputAction(), et PlaySound().

00200                                               {
00201 Guard (void ExManagerSound::PlaySound (std::string file))
00202         for(m_ItMap=m_Map->begin();m_ItMap!=m_Map->end();m_ItMap++)
00203         {
00204                 if(m_ItMap->second.GetName()==file)
00205                 {
00206                         alSourcePlay(source[m_ItMap->second.GetIdent()]);
00207                         *Consol<<"Play sound :"<<file<<" ident:"<<m_ItMap->second.GetIdent()<<std::endl;
00208                         if ((error = alGetError()) != AL_NO_ERROR)
00209                         {
00210                                 *Consol<<"ExManagerSound:: alSourcePlay error:"<<error<<std::endl;
00211                         }
00212                         return;
00213                 }
00214         }
00215 UnGuard
00216 }

bool RemoveSound std::string   
 

Définition à la ligne 229 du fichier ExManagerSound.cpp.

Références Guard, et RemoveSound().

Référencé par InputAction(), et RemoveSound().

00229                                                 {
00230 Guard (bool ExManagerSound::RemoveSound (std::string file))
00231         return true;
00232 UnGuard
00233 }

void Reset void    [virtual]
 

Redéfinie à partir de ExManagerObject< ExCSound >.

Définition à la ligne 92 du fichier ExManagerSound.cpp.

Références Guard, ExManagerObject::Reset(), et Reset().

Référencé par ExManagerCommand::ProcesExCAction(), et Reset().

00093 {
00094 Guard (void ExManagerSound::Reset (void))
00095         ExManagerObject<ExCSound>::Reset();
00096 UnGuard
00097 }

void StopSound std::string   
 

Définition à la ligne 218 du fichier ExManagerSound.cpp.

Références Guard, et StopSound().

Référencé par InputAction(), et StopSound().

00218                                               {
00219 Guard (void ExManagerSound::StopSound (std::string file))
00220 UnGuard
00221 }


Documentation des données imbriquées

ALuint buffer[MAX_BUFFER] [private]
 

Définition à la ligne 82 du fichier ExManagerSound.h.

Référencé par Init(), et LoadSound().

ALuint buffer_index [private]
 

Définition à la ligne 81 du fichier ExManagerSound.h.

Référencé par ExManagerSound(), et LoadSound().

ALCcontext* context [private]
 

Définition à la ligne 77 du fichier ExManagerSound.h.

Référencé par Init(), et ~ExManagerSound().

ALCdevice* device [private]
 

Définition à la ligne 78 du fichier ExManagerSound.h.

Référencé par Init().

ALint error [private]
 

Définition à la ligne 83 du fichier ExManagerSound.h.

Référencé par Init(), LoadSound(), et PlaySound().

ALboolean loop [private]
 

Définition à la ligne 86 du fichier ExManagerSound.h.

Référencé par LoadSound().

bool m_flag = false [static, private]
 

Définition à la ligne 26 du fichier ExManagerSound.cpp.

Référencé par CreateSingleton().

bool m_initok [private]
 

Définition à la ligne 76 du fichier ExManagerSound.h.

Référencé par DisplayAviableInput(), ExManagerSound(), et Init().

ExManagerSound * m_instance = NULL [static, private]
 

Définition à la ligne 27 du fichier ExManagerSound.cpp.

Référencé par CreateSingleton().

ALuint source[64] [private]
 

Définition à la ligne 89 du fichier ExManagerSound.h.

Référencé par Init(), LoadSound(), et PlaySound().

ALuint source_available [private]
 

Définition à la ligne 88 du fichier ExManagerSound.h.

Référencé par ExManagerSound(), et Init().

ALuint source_index [private]
 

Définition à la ligne 87 du fichier ExManagerSound.h.

Référencé par ExManagerSound(), et LoadSound().


La documentation associée à cette classe a été générée à partir des fichiers suivants :
Généré le Tue Dec 10 18:18:47 2002 pour ExNihilo par doxygen1.3-rc1