Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3055 for code/branches/sound2


Ignore:
Timestamp:
May 25, 2009, 1:53:13 PM (16 years ago)
Author:
erwin
Message:

added mainmenu ambient sound

Location:
code/branches/sound2/src/orxonox
Files:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • code/branches/sound2/src/orxonox/CameraManager.h

    r3013 r3055  
    5656
    5757            static CameraManager& getInstance() { assert(singletonRef_s); return *singletonRef_s; }
     58            static CameraManager* getInstancePtr() { return singletonRef_s; }
    5859
    5960            void useCamera(Ogre::Camera* camera);
  • code/branches/sound2/src/orxonox/OrxonoxPrereqs.h

    r3013 r3055  
    253253    //sound
    254254    class SoundBase;
    255     class SoundManger;
     255    class SoundManager;
     256    class SoundMainMenu;
    256257}
    257258
  • code/branches/sound2/src/orxonox/gamestates/GSMainMenu.cc

    r2957 r3055  
    4040#include "objects/Scene.h"
    4141#include "GraphicsManager.h"
     42#include "sound/SoundMainMenu.h"
    4243
    4344namespace orxonox
     
    7980
    8081        InputManager::getInstance().requestEnterState("mainMenu");
     82
     83        this->ambient_ = new SoundMainMenu();
     84        this->ambient_->play(true);
    8185    }
    8286
    8387    void GSMainMenu::deactivate()
    8488    {
     89        delete this->ambient_;
     90
    8591        InputManager::getInstance().requestLeaveState("mainMenu");
    8692        InputManager::getInstance().requestDestroyState("mainMenu");
  • code/branches/sound2/src/orxonox/gamestates/GSMainMenu.h

    r2896 r3055  
    5555        // console commands
    5656        ConsoleCommand* ccStartGame_;
     57
     58        // ambient sound for the main menu
     59        SoundMainMenu* ambient_;
    5760    };
    5861}
  • code/branches/sound2/src/orxonox/sound/CMakeLists.txt

    r3013 r3055  
    22    SoundManager.h
    33    SoundBase.h
     4    SoundMainMenu.h
    45
    56    SoundManager.cc
    67    SoundBase.cc
     8    SoundMainMenu.cc
    79)
    810
  • code/branches/sound2/src/orxonox/sound/SoundBase.cc

    r3013 r3055  
    148148            if(filename.find("ogg", 0) != std::string::npos)
    149149            {
     150                COUT(2) << "Sound: Trying fallback ogg loader" << std::endl;
    150151                this->buffer_ = loadOggFile(filename);
    151152            }
    152153
    153             if(this->buffer_ == AL_NONE)
     154            if(this->buffer_ == AL_NONE)
     155            {
     156                COUT(2) << "Sound: fallback ogg loader failed: " << alutGetErrorString(alutGetError()) << std::endl;
    154157                return false;
     158            }
    155159        }
    156160
     
    158162        alSourcei(this->source_, AL_BUFFER, this->buffer_);
    159163        if(alGetError() != AL_NO_ERROR) {
    160             COUT(2) << "Sound: OpenAL: Error loading sample file" << std::endl;
     164            COUT(2) << "Sound: OpenAL: Error loading sample file: " << filename << std::endl;
    161165            return false;
    162166        }
     
    172176    ALuint SoundBase::loadOggFile(std::string filename)
    173177    {
    174         COUT(2) << "Sound: Trying fallback ogg loader";
    175 
    176178        char inbuffer[4096];
    177179        std::vector<char> outbuffer;
     
    207209            }
    208210        }
    209        
     211
    210212        ov_clear(&vf);
    211213
  • code/branches/sound2/src/orxonox/sound/SoundBase.h

    r3013 r3055  
    3232#include <string>
    3333
     34#include "OrxonoxPrereqs.h"
     35
    3436namespace orxonox
    3537{
    36     class SoundManager;
    37     class WorldEntity;
    38 
    3938    /**
    4039     * The SoudBase class is the base class for all sound file loader classes.
  • code/branches/sound2/src/orxonox/sound/SoundManager.cc

    r3013 r3055  
    5252        else
    5353        {
    54             COUT(4) << "Sound: OpenAL ALUT version:" << alutGetMajorVersion() << "." << alutGetMinorVersion() << std::endl;
    55             COUT(4) << "Sound: OpenAL ALUT supported MIME types:" << alutGetMIMETypes(ALUT_LOADER_BUFFER) << std::endl;
     54            COUT(4) << "Sound: OpenAL ALUT version: " << alutGetMajorVersion() << "." << alutGetMinorVersion() << std::endl;
     55            COUT(4) << "Sound: OpenAL ALUT supported MIME types: " << alutGetMIMETypes(ALUT_LOADER_BUFFER) << std::endl;
    5656            if(SoundManager::device_s == NULL)
    5757            {
     
    7777                {
    7878                    if(alcMakeContextCurrent(this->context_) == AL_TRUE)
    79                         COUT(3) << "Sound: OpenAL: Context " << this->context_ << "loaded" << std::endl;
     79                        COUT(3) << "Sound: OpenAL: Context " << this->context_ << " loaded" << std::endl;
    8080                }
    8181            }
     
    124124    void SoundManager::tick(float dt)
    125125    {
     126        if (!CameraManager::getInstancePtr())
     127            return;
     128
    126129        // update listener position
    127130        Camera* camera = CameraManager::getInstance().getActiveCamera();
  • code/branches/sound2/src/orxonox/sound/SoundManager.h

    r3013 r3055  
    3131#include <AL/alc.h>
    3232
    33 #include <orxonox/objects/Tickable.h>
     33#include "OrxonoxPrereqs.h"
     34#include "orxonox/objects/Tickable.h"
    3435
    3536namespace orxonox
    3637{
    37     class SoundBase;
    38 
    3938    /**
    4039     * The SoundManager class manages the OpenAL device, context and listener
Note: See TracChangeset for help on using the changeset viewer.