src/ISound.cpp

Go to the documentation of this file.
00001 /* Crown and Cutlass
00002  * Sound Base Object Code
00003  */
00004 
00005 #include <cstdlib>
00006 #include "Log.h"
00007 #include "SoundSystem.h"
00008 #include "OpenALSource.h"
00009 #include "ISound.h"
00010 
00011 ISound::ISound() {
00012   m_source = NULL;
00013   m_locked = false;
00014 }
00015 
00016 ISound::~ISound() {
00017   // Don't delete the source, the sound system does that
00018   m_source = NULL;
00019 }
00020 
00021 OpenALSource* ISound::GetSource() {
00022   return m_source;
00023 }
00024 
00025 void ISound::Prepare() {
00026   if (m_source == NULL) {
00027     m_source = SoundSystem::s_soundSystem->AquireSource();
00028     InitializeSource();
00029   }
00030 }
00031 
00032 void ISound::RevokeSource() {
00033   if (m_source != NULL) {
00034     Log::s_log->Message("Source revoked");
00035     alSourceStop(m_source->GetSource());
00036     m_source = NULL;
00037   } else {
00038     Log::s_log->Message("NULL source revoked");
00039   }
00040 }
00041 
00042 void ISound::SetLocked(bool lock) {
00043   m_locked = lock;
00044 }

Generated on Mon Jan 8 22:34:12 2007 for CrownandCutlass by  doxygen 1.4.7