Board index FlightGear Development

Hear no sound from the four openal tests.

FlightGear is opensource, so you can be the developer. In the need for help on anything? We are here to help you.
Forum rules
Core development is discussed on the official FlightGear-Devel development mailing list.

Bugs can be reported in the bug tracker.

Hear no sound from the four openal tests.

Postby Yukosu » Mon Nov 04, 2013 2:30 am

I tried to compile and run the four openal test projects(simgear/sound/openal_test1.cxx openal_test2.cxx openal_test3.cxx openal_test4.cxx), and heard no sound, but the sound system is working well in flightgear.

openal_test2.cxx:
Code: Select all
#include <stdio.h>
#ifdef _WIN32
#include <windows.h>
#define sleep(x) Sleep(x*1000)
#else
#include <unistd.h>
#endif

#include <simgear/debug/logstream.hxx>
#include <simgear/misc/sg_path.hxx>

#include "soundmgr_openal.hxx"
#include "sample_group.hxx"
#include "sample_openal.hxx"


int main( int argc, char *argv[] ) {
    SGSampleGroup *sgr;
    SGSoundMgr *smgr;

    smgr = new SGSoundMgr;

    smgr->bind();
    smgr->init();
    sgr = smgr->find("default", true);
    smgr->set_volume(0.9);
    smgr->activate();

    SGPath srcDir(SRC_DIR);

    SGSoundSample *sample1 = new SGSoundSample("jet.wav", srcDir);
    sample1->set_volume(1.0);
    sample1->set_pitch(1.0);
    sample1->play_looped();
    sgr->add(sample1, "sound1");
    smgr->update(1.0);
    printf("playing sample1\n");
    sleep(1);

    SGSoundSample *sample2 = new SGSoundSample("jet.wav", srcDir);
    sample2->set_volume(0.5);
    sample2->set_pitch(0.4);
    sample2->play_looped();
    sgr->add(sample2, "sound2");
    smgr->update(1.0);                // debugging shows it stucks here
    printf("playing sample2\n"); 
    sleep(1);

//  ...

    smgr->unbind();
    sleep(2);
    delete smgr;
}
   


Dunno what the problem is. Has anyone ever tried these tests?
I'm quite a newbie and hope someone could help. Thanks in advance.
Yukosu
 
Posts: 2
Joined: Sun Nov 03, 2013 8:42 am

Re: Hear no sound from the four openal tests.

Postby adrian » Mon Nov 04, 2013 6:39 am

From a quick look at the source: where did you define SRC_DIR?
adrian
 
Posts: 362
Joined: Wed Sep 15, 2010 3:15 pm

Re: Hear no sound from the four openal tests.

Postby Yukosu » Mon Nov 04, 2013 6:49 am

adrian wrote in Mon Nov 04, 2013 6:39 am:From a quick look at the source: where did you define SRC_DIR?

Oh, maybe I missed a #define at the beginning. Anyway the project has no compiling errors.
Yukosu
 
Posts: 2
Joined: Sun Nov 03, 2013 8:42 am


Return to Development

Who is online

Users browsing this forum: No registered users and 8 guests