Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 334


Ignore:
Timestamp:
Nov 28, 2007, 5:42:23 PM (17 years ago)
Author:
nicolape
Message:

Sound is now working in Orxonox! Added a test background sound that plays when starting the game

Location:
code/branches/audio
Files:
3 added
7 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • code/branches/audio/CMakeLists.txt

    r330 r334  
    4949FIND_PACKAGE(ENet)
    5050FIND_PACKAGE(Boost)
    51 #FIND_PACKAGE(OpenAL)
     51FIND_PACKAGE(OpenAL)
    5252
    5353#Sets the search paths for the linking
    54 LINK_DIRECTORIES(${OGRE_LIB_DIR} ${OIS_LIB_DIR} ${CEGUI_LIB_DIR} ${CEGUI_OGRE_LIB_DIR} ${ENet_LIBRARY} ${Boost_LIBRARY_DIRS} core objects loader network weapon classHierarchy audio)
     54LINK_DIRECTORIES(${OGRE_LIB_DIR} ${OIS_LIB_DIR} ${CEGUI_LIB_DIR} ${CEGUI_OGRE_LIB_DIR} ${ENet_LIBRARY} ${OPENAL_LIB_DIR} ${Boost_LIBRARY_DIRS} core objects loader network weapon classHierarchy audio openal alut)
    5555#Sets the search path for include files
    5656INCLUDE_DIRECTORIES(${OGRE_INCLUDE_DIR} ${OIS_INCLUDE_DIR} ${CEGUI_INCLUDE_DIR} ${CEGUI_OGRE_INCLUDE_DIR} ${ENet_INCLUDE_DIR} ${Boost_INCLUDE_DIRS})
  • code/branches/audio/src/audio/Ambient.cc

    r330 r334  
    3232                 ListenerOri[5]=0;
    3333
     34
     35        // Initialize OpenAL and clear the error bit.
     36
     37        alutInit(NULL, 0);
     38        alGetError();
     39
     40        // Load the wav data.
     41
     42        if(LoadALData() == AL_FALSE)
     43        {
     44            printf("Error loading sound data.");
     45               
     46        }
     47
     48        SetListenerValues();
     49
     50        // Setup an exit procedure.
     51
     52        //atexit(KillALData);
     53
    3454                std::cout << "Play sone ambient background sound";
    3555        }
     
    4262        ALsizei freq;
    4363        ALboolean loop;
     64
    4465
    4566        alGenBuffers(1, &Buffer);
     
    6788                return AL_TRUE;
    6889
     90
    6991        return AL_FALSE;
    7092}       
     93
     94void Ambient::SetListenerValues()
     95{
     96        alListenerfv(AL_POSITION,    ListenerPos);
     97        alListenerfv(AL_VELOCITY,    ListenerVel);
     98        alListenerfv(AL_ORIENTATION, ListenerOri);
     99}
     100
     101void Ambient::KillALData()
     102{
     103        alDeleteBuffers(1, &Buffer);
     104        alDeleteSources(1, &Source);
     105        alutExit();
     106}
     107
     108void Ambient::play()
     109{
     110        alSourcePlay(Source);
     111
     112}
     113
     114
    71115       
    72116       
  • code/branches/audio/src/audio/Ambient.h

    r330 r334  
    1414        public:
    1515                Ambient();
     16                void play();
    1617        private:
    1718                ALboolean LoadALData();
    18 
     19                void SetListenerValues();
     20                void KillALData();
    1921
    2022                ALuint Buffer;
  • code/branches/audio/src/audio/CMakeLists.txt

    r327 r334  
    44SET(INC_FILES Ambient.h)
    55
    6 INCLUDE_DIRECTORIES(..)
    76
    87ADD_LIBRARY(audio ${SRC_FILES} ${INC_FILES})
    98
    10 TARGET_LINK_LIBRARIES(../openal/lib)
     9TARGET_LINK_LIBRARIES(audio alut)
     10TARGET_LINK_LIBRARIES(audio openal)
     11
     12
  • code/branches/audio/src/orxonox/CMakeLists.txt

    r327 r334  
    66ADD_EXECUTABLE(../../bin/main ${SRC_FILES} ${INC_FILES})
    77
    8 TARGET_LINK_LIBRARIES(../../bin/main ${OGRE_LIBRARIES} ${OIS_LIBRARIES} loader audio)
     8TARGET_LINK_LIBRARIES(../../bin/main ${OGRE_LIBRARIES} ${OIS_LIBRARIES} ${OPENAL_LIBRARIES} loader audio)
    99
    1010INCLUDE_DIRECTORIES(..)
  • code/branches/audio/src/orxonox/orxonox.cc

    r327 r334  
    192192      {
    193193                                audio::Ambient* bgsound = new audio::Ambient();
     194                                bgsound->play();
    194195                                       
    195196        string levelFile = "sp_level_moonstation.oxw";
Note: See TracChangeset for help on using the changeset viewer.