Hi Laurens,

thank you for your reply. I still have the same problem. I can't figure out
why this is happening. With SDL it was working fine (without delays and cuts
in the audio). The strange thing is that if the video finishes and starts
again, the audio doesn't sound with cuts (until it goes to pause again).
On the other hand, I don't get this problem when playing audio files instead
of video files.

If anyone can give an idea about the problem, you are welcome.

Best regards

-----Original Message-----
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Laurens
Voerman
Sent: martes, 24 de enero de 2012 16:49
To: OpenSceneGraph Users
Subject: Re: [osg-users] Play audio files

Hi Héctor,

I have no solution, our software just calls pause() from osg::ImageStream,
and has the same stuttering on restart.

Laurens.

On 1/24/2012 10:32 AM, Héctor Martínez wrote:
> Thank you Mattias and Laurens. I am testing the code you (Laurens) 
> have attached and it is working, but the audio is not synchronized and 
> if I pause the audio and then I play again, it seems that it plays 
> some kind of buffered audio and then the audio begins to sound with cuts.
> I am trying to find the reason of this behavior, but I write it here 
> in case you now the solution.
>
> Best regards.
>
> -----Original Message-----
> From: osg-users-boun...@lists.openscenegraph.org
> [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of 
> Laurens Voerman
> Sent: lunes, 23 de enero de 2012 15:12
> To: OpenSceneGraph Users
> Subject: Re: [osg-users] Play audio files
>
> Hi All,
>
> I have ffmpeg movie audio working with osgAudio, but have been to busy 
> to clean up the code, create an example and submit  for inclusion in 
> the osgAudio library. To avoid duplicate work I attach my current code "as
is".
> Currently this is working part of our program, running both on linux
> (AMD64) and win7 (x64) . It compiles and runs on Win32 x86 but is 
> probably never tested.
>
> attached is a zipfile with "AudioSink.h"
>
> example should be a variation on osgMovie, but should be in the 
> osgAudio library, because osgAudio depends on osg.
>
> Laurens.
>
> Quick cut and paste from our program to show how to use this 'audioSink':
>
> // includes:
> #define OV_EXCLUDE_STATIC_CALLBACKS
> #include<osgAudio/SoundManager.h>
> #include<osgAudio/SoundRoot.h>
>
> #include "AudioSink.h"
> //init
>           osgAudio::SoundManager::instance()->init( 16 );
>
> osgAudio::SoundManager::instance()->getEnvironment()->setDistanceModel
> (osgAu
> dio::InverseDistance);
>
> osgAudio::SoundManager::instance()->getEnvironment()->setDopplerFactor
> (1);
>
>       if (!noAudio) {
>           _sceneRootGroup->addChild(new osgAudio::SoundRoot);
>       }
> // play movie audio
>                   osg::ImageStream::AudioStreams&  audioStreams =
> ffstream->getAudioStreams();
>                   if (_playAudio&&  (!audioStreams.empty())&&
> audioStreams[0].valid())
>                   {
>                       osg::AudioStream* audioStream =
audioStreams[0].get();
>                       osg::notify(osg::NOTICE)<<"AudioStream read 
> ["<<audioStream->getName()<<"]"<<std::endl;
>                           osgRCAudio::AudioSink *sink;
>                           try {
>                               sink = new osgAudio::AudioSink(audioStream);
>                           }
>                           catch (...)
>                           {
>                               osg::notify(osg::WARN)<<  "new AudioSink 
> failed"<<  std::endl;
>                           }
>                           audioStream->setAudioSink(sink);
>                   }
> // cleanup
>       osgAudio::SoundManager *sndMgr = osgAudio::SoundManager::instance();
>       if (sndMgr->initialized()) sndMgr->shutdown();
>
>       if (osg::Referenced::getDeleteHandler())
>       {
>
> osg::Referenced::getDeleteHandler()->setNumFramesToRetainObjects(0);
>           osg::Referenced::getDeleteHandler()->flushAll();
>       }
>
>
> On 1/23/2012 11:22 AM, Mattias Helsing wrote:
>> Hello Héctor
>>
>> You need to extend osg::AudioSink with the osgAudio code that you 
>> have working. Have a look at the osgmovie exemple. It (optionally) 
>> implements the osg::AudioSink interface using SDL. You need to do it 
>> using osgAudio (or whatever sound backend you prefer).
>>
>> cheers
>> Mattias
>>
>> 2012/1/23 Héctor Martínez<hector.marti...@sensetrix.com>:
>>> Hi,
>>>
>>>
>>> Now, the following question: is there a straight way to connect the 
>>> audio from a video to osgAudio? I am using the ffmpeg plugin to read 
>>> the videos and I get audioStreams as it is done in the osgmovie example.
>>>
>>> Thank you in advance.
>> _______________________________________________
>> osg-users mailing list
>> osg-users@lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.
>> org
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.
> org
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to