Changeset 10771 for code/branches/cpp11_v2/src/orxonox
- Timestamp:
- Nov 7, 2015, 5:24:58 PM (9 years ago)
- Location:
- code/branches/cpp11_v2/src/orxonox/sound
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v2/src/orxonox/sound/AmbientSound.cc
r10765 r10771 92 92 { 93 93 const std::string& path = "ambient/" + mood + '/' + this->ambientSource_; 94 s hared_ptr<ResourceInfo> fileInfo = Resource::getInfo(path);94 std::shared_ptr<ResourceInfo> fileInfo = Resource::getInfo(path); 95 95 if (fileInfo != nullptr) 96 96 { -
code/branches/cpp11_v2/src/orxonox/sound/BaseSound.h
r9667 r10771 33 33 34 34 #include <string> 35 #include < boost/shared_ptr.hpp>35 #include <memory> 36 36 #include <OgreDataStream.h> 37 37 #include "core/object/Listable.h" … … 107 107 ALuint audioSource_; 108 108 bool bPooling_; 109 s hared_ptr<SoundBuffer> soundBuffer_;109 std::shared_ptr<SoundBuffer> soundBuffer_; 110 110 std::string source_; 111 111 float volume_; -
code/branches/cpp11_v2/src/orxonox/sound/SoundBuffer.cc
r10769 r10771 39 39 namespace orxonox 40 40 { 41 SoundBuffer::SoundBuffer(const std::string& filename, std::list<s hared_ptr<SoundBuffer>>::iterator poolIterator)41 SoundBuffer::SoundBuffer(const std::string& filename, std::list<std::shared_ptr<SoundBuffer>>::iterator poolIterator) 42 42 : filename_(filename) 43 43 , audioBuffer_(AL_NONE) … … 48 48 49 49 // Get resource info 50 s hared_ptr<ResourceInfo> fileInfo = Resource::getInfo(filename);50 std::shared_ptr<ResourceInfo> fileInfo = Resource::getInfo(filename); 51 51 if (fileInfo == nullptr) 52 52 { … … 83 83 } 84 84 85 void SoundBuffer::loadStandard(const s hared_ptr<ResourceInfo>& fileInfo, DataStreamPtr dataStream)85 void SoundBuffer::loadStandard(const std::shared_ptr<ResourceInfo>& fileInfo, DataStreamPtr dataStream) 86 86 { 87 87 // Read everything into a temporary buffer … … 127 127 } 128 128 129 void SoundBuffer::loadOgg(const s hared_ptr<ResourceInfo>& fileInfo, DataStreamPtr dataStream)129 void SoundBuffer::loadOgg(const std::shared_ptr<ResourceInfo>& fileInfo, DataStreamPtr dataStream) 130 130 { 131 131 char inbuffer[256*1024]; -
code/branches/cpp11_v2/src/orxonox/sound/SoundBuffer.h
r10769 r10771 33 33 34 34 #include <list> 35 #include < boost/shared_ptr.hpp>35 #include <memory> 36 36 #include "core/Resource.h" 37 37 … … 45 45 { 46 46 friend class SoundManager; 47 #if !defined(_MSC_VER) || _MSC_VER >= 150048 // Make sure nobody deletes an instance (using strong pointers)49 template <class T>50 friend void boost::checked_delete(T*);51 #endif52 47 53 48 public: 54 #if defined(_MSC_VER) && _MSC_VER < 150055 49 ~SoundBuffer(); 56 #endif57 50 inline ALuint getBuffer() 58 51 { return this->audioBuffer_; } … … 64 57 65 58 private: 66 SoundBuffer(const std::string& filename, std::list<shared_ptr<SoundBuffer>>::iterator poolIterator); 67 #if !defined(_MSC_VER) || _MSC_VER >= 1500 68 ~SoundBuffer(); 69 #endif 70 void loadStandard(const shared_ptr<ResourceInfo>& fileInfo, DataStreamPtr dataStream); 71 void loadOgg(const shared_ptr<ResourceInfo>& fileInfo, DataStreamPtr dataStream); 59 SoundBuffer(const std::string& filename, std::list<std::shared_ptr<SoundBuffer>>::iterator poolIterator); 60 void loadStandard(const std::shared_ptr<ResourceInfo>& fileInfo, DataStreamPtr dataStream); 61 void loadOgg(const std::shared_ptr<ResourceInfo>& fileInfo, DataStreamPtr dataStream); 72 62 73 63 std::string filename_; 74 64 ALuint audioBuffer_; 75 std::list<s hared_ptr<SoundBuffer>>::iterator poolIterator_;65 std::list<std::shared_ptr<SoundBuffer>>::iterator poolIterator_; 76 66 }; 77 67 } -
code/branches/cpp11_v2/src/orxonox/sound/SoundManager.cc
r10769 r10771 505 505 } 506 506 507 s hared_ptr<SoundBuffer> SoundManager::getSoundBuffer(const std::string& filename)508 { 509 s hared_ptr<SoundBuffer> buffer;507 std::shared_ptr<SoundBuffer> SoundManager::getSoundBuffer(const std::string& filename) 508 { 509 std::shared_ptr<SoundBuffer> buffer; 510 510 // Check active or pooled buffers 511 511 SoundBufferMap::const_iterator it = this->soundBuffers_.find(filename); … … 538 538 } 539 539 540 void SoundManager::releaseSoundBuffer(const s hared_ptr<SoundBuffer>& buffer, bool bPoolBuffer)540 void SoundManager::releaseSoundBuffer(const std::shared_ptr<SoundBuffer>& buffer, bool bPoolBuffer) 541 541 { 542 542 // Check if others are still using the buffer … … 551 551 while (this->effectsPoolSize_ + it->second->getSize() > this->maxEffectsPoolSize_s && !this->effectsPool_.empty()) 552 552 { 553 s hared_ptr<SoundBuffer> bufferDel = this->effectsPool_.back();553 std::shared_ptr<SoundBuffer> bufferDel = this->effectsPool_.back(); 554 554 this->effectsPoolSize_ -= bufferDel->getSize(); 555 555 bufferDel->poolIterator_ = this->effectsPool_.end(); -
code/branches/cpp11_v2/src/orxonox/sound/SoundManager.h
r10769 r10771 36 36 #include <map> 37 37 #include <string> 38 #include < boost/shared_ptr.hpp>38 #include <memory> 39 39 40 40 #include "util/Singleton.h" … … 96 96 // tolua_end 97 97 98 s hared_ptr<SoundBuffer> getSoundBuffer(const std::string& filename);99 void releaseSoundBuffer(const s hared_ptr<SoundBuffer>& buffer, bool bPoolBuffer);98 std::shared_ptr<SoundBuffer> getSoundBuffer(const std::string& filename); 99 void releaseSoundBuffer(const std::shared_ptr<SoundBuffer>& buffer, bool bPoolBuffer); 100 100 101 101 ALuint getSoundSource(BaseSound* object); … … 139 139 static const unsigned int maxEffectsPoolSize_s = 40 * 1024 * 1024; 140 140 unsigned int effectsPoolSize_; 141 typedef std::list<s hared_ptr<SoundBuffer>> EffectsPoolList;141 typedef std::list<std::shared_ptr<SoundBuffer>> EffectsPoolList; 142 142 EffectsPoolList effectsPool_; 143 typedef std::map<std::string, s hared_ptr<SoundBuffer>> SoundBufferMap;143 typedef std::map<std::string, std::shared_ptr<SoundBuffer>> SoundBufferMap; 144 144 SoundBufferMap soundBuffers_; 145 145
Note: See TracChangeset
for help on using the changeset viewer.