This is the create Sound function :-
openalpp::Sample *sample = new openalpp::Sample(file.c_str());
osg::ref_ptr<osgAL::SoundState> sound_state = new
osgAL::SoundState("Fountain Sound");
sound_state->setSample(sample);
sound_state->setGain(0.9f);
sound_state->setPitch(1);
sound_state->allocateSource(15, false);
sound_state->setPlay(true);
sound_state->setLooping(true);
sound_state->setReferenceDistance(70);
sound_state->setRolloffFactor(4);
sound_state->apply();
osgAL::SoundManager::instance()->addSoundState(sound_state.get());
sound->setSoundState(sound_state.get());
But still it isnt working :( .. Any idea why ?
On Dec 29, 2007 1:11 AM, Anders Backman <[EMAIL PROTECTED]> wrote:
> If you are using a looping soundsource you should allocate a soundsource
> (Hardware soundsource).
>
> So before calling setPlay(true);
> call soundState::allocateSource( priority );
>
> where priority is an integer indicating the prority of the sound you want
> to play (a higher priority will increase the chance of actually succeeding
> getting a hw soundsource if all of them are in use).
>
> /Anders
>
>
> On Dec 28, 2007 8:20 PM, maruti borker <[EMAIL PROTECTED]> wrote:
>
> >
> > I was going through the examples of osgal-0.6.1 ...
> > In the example "osgal" two sounds have been added ... and one of them is
> > added to the glider .
> > They had used createSound() function ... which they have included in
> > the example.
> >
> > I wanted to do the same in my program , I copied the createsound
> > function and then wrote the following code :-
> >
> > osg::ref_ptr<osgAL::SoundNode> sound_node = createSound("
> > wateresplash.wav");
> > findNodeVisitor findNode("fountain");
> > root->accept(findNode);
> > std::vector<osg::Node*>nodeList=findNode.getNodeList();
> > if(nodeList.size()!=0)
> > (nodeList[0]->asGroup())->addChild(sound_node.get());
> > std::cout<<nodeList.size()<<std::endl;
> >
> > But it is giving a runtime error :-
> >
> > terminate called after throwing an instance of 'std::runtime_error'
> > what(): SoundState::apply(): No sound source allocated.
> > Aborted
> >
> > This error wasnt coming in the example code :( ...
> >
> > Does anyone have an idea about this ?
> > --
> > ----------------------------------------------
> > Maruti Borker
> > IIIT Hyderabad
> > Website:-
> > http://students.iiit.ac.in/~maruti<http://students.iiit.ac.in/%7Emaruti>
> > Blog:- http://marutiborker.wordpress.com
> > _______________________________________________
> > osg-users mailing list
> > [email protected]
> >
> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >
> >
>
>
> --
>
>
> ________________________________________________________________
> Anders Backman Email: [EMAIL PROTECTED]
> HPC2N/VRlab Phone: +46 (0)90-786 9936
> Umea university Cellular: +46 (0)70-392 64 67
> S-901 87 UMEA SWEDEN Fax: +46 90-786 6126
>
> http://www.cs.umu.se/~andersb<http://www.cs.umu.se/%7Eandersb>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
--
----------------------------------------------
Maruti Borker
IIIT Hyderabad
Website:- http://students.iiit.ac.in/~maruti
Blog:- http://marutiborker.wordpress.com
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org