Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2854 in orxonox.OLD for orxonox/branches/sound/src/sound_test.cc


Ignore:
Timestamp:
Nov 14, 2004, 4:44:31 PM (20 years ago)
Author:
simon
Message:

/branches/sound: finally a running version. To test, you can switch the parameters in the test class sound_test. A .ogg file named music.ogg from the directory . is played. The test class is really ugly, I know.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/sound/src/sound_test.cc

    r2838 r2854  
    1414*/
    1515
    16 
    1716#include "sound_test.h"
    18 #include "SDL.h"
    19 #include "SDL_mixer.h"
    2017
    2118using namespace std;
    2219
    23 SoundControl* test;
     20SoundControl* sound = NULL;
     21int counter = 0;
     22int through = 0;
    2423
    25 SoundTest::SoundTest () {
    26   test = SoundControl::getInstance();
     24SoundTest::SoundTest() {
     25  sound = SoundControl::getInstance();
    2726}
    2827
    2928
    30 SoundTest::~SoundTest () {
    31  
     29SoundTest::~SoundTest() {
     30  sound->deleteInstance();
    3231}
    3332
    3433
    35 void main (void) {
     34int main(void) {
     35  SoundTest();
    3636  SDL_Surface *screen;
    37   SDL_Init(SDL_INIT_VIDEO);
     37  SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO);
    3838  screen = SDL_SetVideoMode(320, 240, 0, 0);
    39   SoundControl* sound = new SoundControl;
    40   sound.SoundControl();
    41   sound->playOgg(music.ogg);
    42   sound.~SoundControl();
     39  sound->playOgg("music.ogg");
     40  while(!through) {
     41    SDL_Delay(100);
     42    if(counter >= 1000) {
     43        through = 1;
     44    }
     45    counter++;
     46  }
     47  SDL_Quit();
    4348}
Note: See TracChangeset for help on using the changeset viewer.