Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 419


Ignore:
Timestamp:
Dec 5, 2007, 7:28:46 PM (16 years ago)
Author:
nicolape
Message:

We now have a nice backgroundsound playing

Location:
code/branches/FICN/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • code/branches/FICN/src/audio/AudioManager.cc

    r389 r419  
    55        AudioManager::AudioManager()
    66        {
     7                alutInit(NULL, 0);
     8
     9                bgSound.open("ambient3");
     10                bgSound.display();
    711               
     12                if(!bgSound.playback())
     13                {
     14        std::cout << "Ogg refused to play.";
     15                }
    816        }
    917               
    1018        AudioManager::~AudioManager()
    1119        {
    12                
     20                bgSound.release();
     21                alutExit();
     22        }
     23       
     24        void AudioManager::update()
     25        {
     26                bgSound.update();
     27    if(!bgSound.playing())
     28    {
     29        if(!bgSound.playback())
     30            std::cout << "Ogg abruptly stopped.";
     31        else
     32            std::cout << "Ogg stream was interrupted.\n";
     33    }
    1334        }
    1435       
  • code/branches/FICN/src/audio/AudioManager.h

    r409 r419  
    66#include "AudioBuffer.h"
    77#include "AudioSource.h"
     8#include "AudioStream.h"
    89
    910namespace audio
     
    1213        {
    1314        public:
     15
    1416                // Init audio
    1517                AudioManager();
     18
    1619                // Kill audio and set buffers, sources and memory free
    1720                ~AudioManager();
     21
    1822                // Set listener position
    1923                void setPos(std::vector<float> newPosition);
     24
    2025                // Set listener speed
    2126                void setSpeed(std::vector<float> newSpeed);
     27
    2228                // Set listener orientation (first is direction
    2329                // the listener looks at, the second is the direction
    2430                // upwards the listener)
    2531                void setOri(std::vector<float> at, std::vector<float> up);
     32
    2633                // Parses given xml string
    2734                void loadParams();
     35
     36                // Update
     37                void update();
     38
    2839        private:
    2940
     41                // Backgroundsound
     42    AudioStream bgSound;
    3043       
    3144                // Vector containing all audio files
  • code/branches/FICN/src/audio/AudioStream.cc

    r411 r419  
    44namespace audio
    55{
    6         void AudioStream::open(string path)
     6        void AudioStream::open(std::string path)
    77        {
    88            int result;
     
    6161        void AudioStream::display()
    6262        {
    63             cout
     63            std::cout
    6464                << "version         " << vorbisInfo->version         << "\n"
    6565                << "channels        " << vorbisInfo->channels        << "\n"
     
    7373               
    7474            for(int i = 0; i < vorbisComment->comments; i++)
    75                 cout << "   " << vorbisComment->user_comments[i] << "\n";
    76                
    77             cout << endl;
     75                std::cout << "   " << vorbisComment->user_comments[i] << "\n";
     76               
     77            std::cout << std::endl;
    7878        }
    7979       
     
    212212                    return std::string("Invalid Vorbis header.");
    213213                case OV_EFAULT:
    214                     return string("Internal logic fault (bug or heap/stack corruption.");
     214                    return std::string("Internal logic fault (bug or heap/stack corruption.");
    215215                default:
    216216                    return std::string("Unknown Ogg error.");
     
    218218        }
    219219}
     220
  • code/branches/FICN/src/audio/CMakeLists.txt

    r411 r419  
    66        AudioBuffer.cc
    77        AudioSource.cc
    8 
     8        AudioStream.cc
    99)
    1010SET(INC_FILES
     
    1212        AudioBuffer.h
    1313        AudioSource.h
     14        AudioStream.h
    1415)
    1516
  • code/branches/FICN/src/orxonox/orxonox.cc

    r389 r419  
    5656SpaceshipSteering* steering;
    5757
     58audio::AudioManager* auMan;
    5859
    5960// some tests to see if enet works without includsion
     
    113114    bool frameStarted(const FrameEvent& evt)
    114115    {
     116   
     117        auMan->update();
     118   
    115119      mKeyboard->capture();
    116120      mMouse->capture();
     
    281285      void createScene(void)
    282286      {
    283                 audio::AudioManager* auMan = new audio::AudioManager();
     287                                auMan = new audio::AudioManager();
    284288
    285289
Note: See TracChangeset for help on using the changeset viewer.