Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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       
Note: See TracChangeset for help on using the changeset viewer.