Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2966 for code/branches


Ignore:
Timestamp:
May 11, 2009, 2:30:54 PM (16 years ago)
Author:
erwin
Message:

moved files, modified to support multiple contexts

Location:
code/branches/sound/src
Files:
1 added
1 deleted
3 edited
5 copied

Legend:

Unmodified
Added
Removed
  • code/branches/sound/src/orxonox/CMakeLists.txt

    r2950 r2966  
    3131ADD_SUBDIRECTORY(overlays)
    3232ADD_SUBDIRECTORY(tools)
     33ADD_SUBDIRECTORY(sound)
    3334GET_ALL_HEADER_FILES(ORXONOX_HDR_FILES)
    3435SET(ORXONOX_FILES ${ORXONOX_SRC_FILES} ${ORXONOX_HDR_FILES})
     
    5152  ${CEGUILUA_LIBRARY}
    5253  ${Boost_SYSTEM_LIBRARY}
     54  ${OPENAL_LIBRARY}
     55  ${ALUT_LIBRARY}
     56  #${VORBISFILE_LIBRARY}
     57  #${VORBIS_LIBRARY}
     58  #${OGG_LIBRARY}
    5359  ogreceguirenderer_orxonox
    5460  tinyxml++_orxonox
     
    5864  core
    5965  network
    60   sound
    6166)
    6267
  • code/branches/sound/src/orxonox/objects/Level.cc

    r2955 r2966  
    5757        if (this->xmlfilename_.length() >= Core::getMediaPathString().length())
    5858            this->xmlfilename_ = this->xmlfilename_.substr(Core::getMediaPathString().length());
     59           
     60        this->sndmgr_ = new SoundManager();
    5961    }
    6062
     
    6870            if (this->xmlfile_)
    6971                Loader::unload(this->xmlfile_);
     72           
     73            if(this->ambientsound_ != NULL)
     74                delete this->ambientsound_;
     75           
     76            delete this->sndmgr_;
    7077        }
    7178    }
     
    158165            {
    159166                this->ambientsound_ = new SoundBase();
    160                 this->sndmgr_.addSound(this->ambientsound_);
     167                this->sndmgr_->addSound(this->ambientsound_);
    161168            }
    162169
  • code/branches/sound/src/orxonox/objects/Level.h

    r2950 r2966  
    7373            XMLFile*               xmlfile_;
    7474            std::list<BaseObject*> objects_;
    75             SoundManager           sndmgr_;
     75            SoundManager*          sndmgr_;
    7676            SoundBase*             ambientsound_;
    7777    };
  • code/branches/sound/src/orxonox/sound/CMakeLists.txt

    • Property svn:mergeinfo set to (toggle deleted branches)
      /code/branches/buildsystem/src/sound/CMakeLists.txt1874-2276,​2278-2400
      /code/branches/buildsystem2/src/sound/CMakeLists.txt2506-2658
      /code/branches/buildsystem3/src/sound/CMakeLists.txt2662-2708
      /code/branches/ceguilua/src/sound/CMakeLists.txt1802-1808
      /code/branches/core3/src/sound/CMakeLists.txt1572-1739
      /code/branches/gcc43/src/sound/CMakeLists.txt1580
      /code/branches/gui/src/sound/CMakeLists.txt1635-1723
      /code/branches/input/src/sound/CMakeLists.txt1629-1636
      /code/branches/lodfinal/src/sound/CMakeLists.txt2372-2411
      /code/branches/miniprojects/src/sound/CMakeLists.txt2754-2824
      /code/branches/network/src/sound/CMakeLists.txt2356
      /code/branches/network64/src/sound/CMakeLists.txt2210-2355
      /code/branches/objecthierarchy/src/sound/CMakeLists.txt1911-2085,​2100,​2110-2169
      /code/branches/objecthierarchy2/src/sound/CMakeLists.txt2171-2479
      /code/branches/overlay/src/sound/CMakeLists.txt2117-2385
      /code/branches/physics/src/sound/CMakeLists.txt1912-2055,​2107-2439
      /code/branches/physics_merge/src/sound/CMakeLists.txt2436-2457
      /code/branches/pickups/src/sound/CMakeLists.txt1926-2086,​2127
      /code/branches/pickups2/src/sound/CMakeLists.txt2107-2497
      /code/branches/presentation/src/sound/CMakeLists.txt2369-2652,​2654-2660
      /code/branches/questsystem/src/sound/CMakeLists.txt1894-2088
      /code/branches/questsystem2/src/sound/CMakeLists.txt2107-2259
      /code/branches/script_trigger/src/sound/CMakeLists.txt1295-1953,​1955
      /code/branches/weapon/src/sound/CMakeLists.txt1925-2094
      /code/branches/weapon2/src/sound/CMakeLists.txt2107-2488
    r2963 r2966  
    1  #
    2  #             ORXONOX - the hottest 3D action shooter ever to exist
    3  #                             > www.orxonox.net <
    4  #
    5  #        This program is free software; you can redistribute it and/or
    6  #         modify it under the terms of the GNU General Public License
    7  #        as published by the Free Software Foundation; either version 2
    8  #            of the License, or (at your option) any later version.
    9  #
    10  #       This program is distributed in the hope that it will be useful,
    11  #        but WITHOUT ANY WARRANTY; without even the implied warranty of
    12  #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    13  #                 GNU General Public License for more details.
    14  #
    15  #   You should have received a copy of the GNU General Public License along
    16  #      with this program; if not, write to the Free Software Foundation,
    17  #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    18  #
    19 
    20 SET_SOURCE_FILES(SOUND_FILES
     1ADD_SOURCE_FILES(ORXONOX_SRC_FILES
    212    SoundManager.h
    223    SoundBase.h
     
    256    SoundBase.cc
    267)
    27 GENERATE_SOURCE_GROUPS(${SOUND_FILES})
    288
    29 
    30 ADD_LIBRARY(sound SHARED ${SOUND_FILES})
    31 TARGET_LINK_LIBRARIES(sound
    32   ${OPENAL_LIBRARY}
    33   ${ALUT_LIBRARY}
    34   #${VORBISFILE_LIBRARY}
    35   #${VORBIS_LIBRARY}
    36   #${OGG_LIBRARY}
    37   core
    38   util
    39 )
    40 
    41 ORXONOX_INSTALL(sound)
  • code/branches/sound/src/orxonox/sound/SoundBase.cc

    • Property svn:mergeinfo set to (toggle deleted branches)
      /code/branches/buildsystem/src/sound/SoundBase.cc1874-2276,​2278-2400
      /code/branches/buildsystem2/src/sound/SoundBase.cc2506-2658
      /code/branches/buildsystem3/src/sound/SoundBase.cc2662-2708
      /code/branches/ceguilua/src/sound/SoundBase.cc1802-1808
      /code/branches/core3/src/sound/SoundBase.cc1572-1739
      /code/branches/gcc43/src/sound/SoundBase.cc1580
      /code/branches/gui/src/sound/SoundBase.cc1635-1723
      /code/branches/input/src/sound/SoundBase.cc1629-1636
      /code/branches/lodfinal/src/sound/SoundBase.cc2372-2411
      /code/branches/miniprojects/src/sound/SoundBase.cc2754-2824
      /code/branches/network/src/sound/SoundBase.cc2356
      /code/branches/network64/src/sound/SoundBase.cc2210-2355
      /code/branches/objecthierarchy/src/sound/SoundBase.cc1911-2085,​2100,​2110-2169
      /code/branches/objecthierarchy2/src/sound/SoundBase.cc2171-2479
      /code/branches/overlay/src/sound/SoundBase.cc2117-2385
      /code/branches/physics/src/sound/SoundBase.cc1912-2055,​2107-2439
      /code/branches/physics_merge/src/sound/SoundBase.cc2436-2457
      /code/branches/pickups/src/sound/SoundBase.cc1926-2086,​2127
      /code/branches/pickups2/src/sound/SoundBase.cc2107-2497
      /code/branches/presentation/src/sound/SoundBase.cc2369-2652,​2654-2660
      /code/branches/questsystem/src/sound/SoundBase.cc1894-2088
      /code/branches/questsystem2/src/sound/SoundBase.cc2107-2259
      /code/branches/script_trigger/src/sound/SoundBase.cc1295-1953,​1955
      /code/branches/weapon/src/sound/SoundBase.cc1925-2094
      /code/branches/weapon2/src/sound/SoundBase.cc2107-2488
    r2963 r2966  
    4040        this->entity_ = NULL;
    4141    }
     42
    4243    SoundBase::SoundBase(WorldEntity* entity)
    4344    {
     
    4546        this->buffer_ = 0;
    4647        this->entity_ = entity;
     48    }
     49
     50    SoundBase::~SoundBase()
     51    {
     52        alSourcei(this->source_, AL_BUFFER, 0);
     53        alDeleteSources(1, &this->source_);
     54        alDeleteBuffers(1, &this->buffer_);
    4755    }
    4856
  • code/branches/sound/src/orxonox/sound/SoundBase.h

    • Property svn:mergeinfo set to (toggle deleted branches)
      /code/branches/buildsystem/src/sound/SoundBase.h1874-2276,​2278-2400
      /code/branches/buildsystem2/src/sound/SoundBase.h2506-2658
      /code/branches/buildsystem3/src/sound/SoundBase.h2662-2708
      /code/branches/ceguilua/src/sound/SoundBase.h1802-1808
      /code/branches/core3/src/sound/SoundBase.h1572-1739
      /code/branches/gcc43/src/sound/SoundBase.h1580
      /code/branches/gui/src/sound/SoundBase.h1635-1723
      /code/branches/input/src/sound/SoundBase.h1629-1636
      /code/branches/lodfinal/src/sound/SoundBase.h2372-2411
      /code/branches/miniprojects/src/sound/SoundBase.h2754-2824
      /code/branches/network/src/sound/SoundBase.h2356
      /code/branches/network64/src/sound/SoundBase.h2210-2355
      /code/branches/objecthierarchy/src/sound/SoundBase.h1911-2085,​2100,​2110-2169
      /code/branches/objecthierarchy2/src/sound/SoundBase.h2171-2479
      /code/branches/overlay/src/sound/SoundBase.h2117-2385
      /code/branches/physics/src/sound/SoundBase.h1912-2055,​2107-2439
      /code/branches/physics_merge/src/sound/SoundBase.h2436-2457
      /code/branches/pickups/src/sound/SoundBase.h1926-2086,​2127
      /code/branches/pickups2/src/sound/SoundBase.h2107-2497
      /code/branches/presentation/src/sound/SoundBase.h2369-2652,​2654-2660
      /code/branches/questsystem/src/sound/SoundBase.h1894-2088
      /code/branches/questsystem2/src/sound/SoundBase.h2107-2259
      /code/branches/script_trigger/src/sound/SoundBase.h1295-1953,​1955
      /code/branches/weapon/src/sound/SoundBase.h1925-2094
      /code/branches/weapon2/src/sound/SoundBase.h2107-2488
    r2963 r2966  
    4242     *
    4343     */
    44     class SoundBase
     44    class _OrxonoxExport SoundBase
    4545    {
    4646    public:
    4747        SoundBase();
    4848        SoundBase(WorldEntity* entity);
     49        ~SoundBase();
    4950
    5051        void attachToEntity(WorldEntity* entity);
  • code/branches/sound/src/orxonox/sound/SoundManager.cc

    • Property svn:mergeinfo set to (toggle deleted branches)
      /code/branches/buildsystem/src/sound/SoundManager.cc1874-2276,​2278-2400
      /code/branches/buildsystem2/src/sound/SoundManager.cc2506-2658
      /code/branches/buildsystem3/src/sound/SoundManager.cc2662-2708
      /code/branches/ceguilua/src/sound/SoundManager.cc1802-1808
      /code/branches/core3/src/sound/SoundManager.cc1572-1739
      /code/branches/gcc43/src/sound/SoundManager.cc1580
      /code/branches/gui/src/sound/SoundManager.cc1635-1723
      /code/branches/input/src/sound/SoundManager.cc1629-1636
      /code/branches/lodfinal/src/sound/SoundManager.cc2372-2411
      /code/branches/miniprojects/src/sound/SoundManager.cc2754-2824
      /code/branches/network/src/sound/SoundManager.cc2356
      /code/branches/network64/src/sound/SoundManager.cc2210-2355
      /code/branches/objecthierarchy/src/sound/SoundManager.cc1911-2085,​2100,​2110-2169
      /code/branches/objecthierarchy2/src/sound/SoundManager.cc2171-2479
      /code/branches/overlay/src/sound/SoundManager.cc2117-2385
      /code/branches/physics/src/sound/SoundManager.cc1912-2055,​2107-2439
      /code/branches/physics_merge/src/sound/SoundManager.cc2436-2457
      /code/branches/pickups/src/sound/SoundManager.cc1926-2086,​2127
      /code/branches/pickups2/src/sound/SoundManager.cc2107-2497
      /code/branches/presentation/src/sound/SoundManager.cc2369-2652,​2654-2660
      /code/branches/questsystem/src/sound/SoundManager.cc1894-2088
      /code/branches/questsystem2/src/sound/SoundManager.cc2107-2259
      /code/branches/script_trigger/src/sound/SoundManager.cc1295-1953,​1955
      /code/branches/weapon/src/sound/SoundManager.cc1925-2094
      /code/branches/weapon2/src/sound/SoundManager.cc2107-2488
    r2963 r2966  
    3737namespace orxonox
    3838{
     39    ALCdevice* SoundManager::device_s = NULL;
     40
    3941    /**
    4042     * Default constructor
     
    4244    SoundManager::SoundManager()
    4345    {
    44         if(!alutInit(NULL,NULL)) {
     46        if(!alutInitWithoutContext(NULL,NULL))
     47        {
    4548            COUT(2) << "OpenAL ALUT: " << alutGetErrorString(alutGetError()) << std::endl;
    4649        }
     50        else
     51        {
     52            COUT(4) << "OpenAL ALUT version:" << alutGetMajorVersion() << "." << alutGetMinorVersion() << std::endl;
     53            COUT(4) << "OpenAL ALUT supported MIME types:" << alutGetMIMETypes(ALUT_LOADER_BUFFER) << std::endl;
     54            if(SoundManager::device_s == NULL)
     55            {
     56                COUT(3) << "OpenAL: open sound device..." << std::endl;
     57                SoundManager::device_s = alcOpenDevice(NULL);
     58            }
    4759
    48         COUT(4) << "OpenAL ALUT version:" << alutGetMajorVersion() << "." << alutGetMinorVersion() << std::endl;
    49         COUT(4) << "OpenAL ALUT supported MIME types:" << alutGetMIMETypes(ALUT_LOADER_BUFFER) << std::endl;
     60            if(SoundManager::device_s == NULL)
     61            {
     62                COUT(2) << "OpenAL: Could not open sound device" << std::endl;
     63            }
     64            else
     65            {
     66                this->context_ = alcCreateContext(SoundManager::device_s, NULL);
     67                if(this->context_ == NULL)
     68                {
     69                    COUT(2) << "OpenAL: Could not create sound context";
     70                }
     71                else
     72                {
     73                    alcMakeContextCurrent(this->context_);
     74                }
     75            }
     76        }
     77    }
     78
     79    SoundManager::~SoundManager()
     80    {
     81        alcDestroyContext(this->context_);
     82        alcCloseDevice(SoundManager::device_s);
     83        alutExit();
    5084    }
    5185
     
    72106                pos = i;
    73107        }
    74        
     108
    75109        delete (*pos);
    76110        this->soundlist_.erase(pos);
     
    110144            (*i)->update();
    111145    }
    112 
    113 
     146}
  • code/branches/sound/src/orxonox/sound/SoundManager.h

    • Property svn:mergeinfo set to (toggle deleted branches)
      /code/branches/buildsystem/src/sound/SoundManager.h1874-2276,​2278-2400
      /code/branches/buildsystem2/src/sound/SoundManager.h2506-2658
      /code/branches/buildsystem3/src/sound/SoundManager.h2662-2708
      /code/branches/ceguilua/src/sound/SoundManager.h1802-1808
      /code/branches/core3/src/sound/SoundManager.h1572-1739
      /code/branches/gcc43/src/sound/SoundManager.h1580
      /code/branches/gui/src/sound/SoundManager.h1635-1723
      /code/branches/input/src/sound/SoundManager.h1629-1636
      /code/branches/lodfinal/src/sound/SoundManager.h2372-2411
      /code/branches/miniprojects/src/sound/SoundManager.h2754-2824
      /code/branches/network/src/sound/SoundManager.h2356
      /code/branches/network64/src/sound/SoundManager.h2210-2355
      /code/branches/objecthierarchy/src/sound/SoundManager.h1911-2085,​2100,​2110-2169
      /code/branches/objecthierarchy2/src/sound/SoundManager.h2171-2479
      /code/branches/overlay/src/sound/SoundManager.h2117-2385
      /code/branches/physics/src/sound/SoundManager.h1912-2055,​2107-2439
      /code/branches/physics_merge/src/sound/SoundManager.h2436-2457
      /code/branches/pickups/src/sound/SoundManager.h1926-2086,​2127
      /code/branches/pickups2/src/sound/SoundManager.h2107-2497
      /code/branches/presentation/src/sound/SoundManager.h2369-2652,​2654-2660
      /code/branches/questsystem/src/sound/SoundManager.h1894-2088
      /code/branches/questsystem2/src/sound/SoundManager.h2107-2259
      /code/branches/script_trigger/src/sound/SoundManager.h1295-1953,​1955
      /code/branches/weapon/src/sound/SoundManager.h1925-2094
      /code/branches/weapon2/src/sound/SoundManager.h2107-2488
    r2963 r2966  
    4343     *
    4444     */
    45     class SoundManager : public Tickable
     45    class _OrxonoxExport SoundManager : public Tickable
    4646    {
    4747    public:
    4848        SoundManager();
     49        ~SoundManager();
    4950        void addSound(SoundBase* sound);
    5051        void removeSound(SoundBase* sound);
     
    5354
    5455    private:
     56        static ALCdevice* device_s;
     57        ALCcontext* context_;
    5558        std::list<SoundBase*> soundlist_;
    5659
Note: See TracChangeset for help on using the changeset viewer.