On 1/20/2012 6:42 AM, Héctor Martínez wrote:
> I have downloaded and compiled osgAudio. Now I want to integrate it in my
> own OSG-based program. So, how can I just open an audio file and play it? I
> mean the simplest way, no need for complicated features right now. Something
> like:
> open("myAudio.wav");
> playAudio();

  See examples/openal-lowlevel/simple.cpp.

    osgAudio::AudioEnvironment::instance()->init();
    osg::ref_ptr<Source> bgsound = new Source;
    bgsound->stop();
    osg::ref_ptr<Sample> sample = new Sample("myAudio.wav");
    bgsound->setSound(sample.get());
    bgsound->setGain(0.6f);      // Lower gain (volume)
    bgsound->setLooping();
    bgsound->setAmbient();      // Make sound ambient (i.e. not attenuated)
    bgsound->play();          // Start playing


-- 
Chris 'Xenon' Hanson, omo sanza lettere. [email protected] 
http://www.alphapixel.com/
  Digital Imaging. OpenGL. Scene Graphs. GIS. GPS. Training. Consulting. 
Contracting.
    "There is no Truth. There is only Perception. To Perceive is to Exist." - 
Xen
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to