root/OpenSceneGraph/trunk/examples/osgmovie/osgmovie.cpp @ 10188

Revision 10188, 22.6 kB (checked in by robert, 6 years ago)

Re-ordered SDL class to try and avoid OSX issues with _main.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1/* OpenSceneGraph example, osgmovie.
2*
3*  Permission is hereby granted, free of charge, to any person obtaining a copy
4*  of this software and associated documentation files (the "Software"), to deal
5*  in the Software without restriction, including without limitation the rights
6*  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7*  copies of the Software, and to permit persons to whom the Software is
8*  furnished to do so, subject to the following conditions:
9*
10*  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
11*  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
12*  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
13*  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
14*  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
15*  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
16*  THE SOFTWARE.
17*/
18
19#include <osgViewer/Viewer>
20#include <osgViewer/ViewerEventHandlers>
21
22#include <osgDB/ReadFile>
23
24#include <osg/Geode>
25#include <osg/Geometry>
26#include <osg/StateSet>
27#include <osg/Material>
28#include <osg/Texture2D>
29#include <osg/TextureRectangle>
30#include <osg/TextureCubeMap>
31#include <osg/TexMat>
32#include <osg/CullFace>
33#include <osg/ImageStream>
34#include <osg/io_utils>
35
36#include <osgGA/TrackballManipulator>
37#include <osgGA/StateSetManipulator>
38#include <osgGA/EventVisitor>
39
40#include <iostream>
41
42class MovieEventHandler : public osgGA::GUIEventHandler
43{
44public:
45
46    MovieEventHandler():_playToggle(true),_trackMouse(false) {}
47
48    void setMouseTracking(bool track) { _trackMouse = track; }
49    bool getMouseTracking() const { return _trackMouse; }
50
51    void set(osg::Node* node);
52
53    virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa, osg::Object*, osg::NodeVisitor* nv);
54
55    virtual void getUsage(osg::ApplicationUsage& usage) const;
56
57    typedef std::vector< osg::observer_ptr<osg::ImageStream> > ImageStreamList;
58
59protected:
60
61    virtual ~MovieEventHandler() {}
62
63    class FindImageStreamsVisitor : public osg::NodeVisitor
64    {
65    public:
66        FindImageStreamsVisitor(ImageStreamList& imageStreamList):
67            _imageStreamList(imageStreamList) {}
68
69        virtual void apply(osg::Geode& geode)
70        {
71            apply(geode.getStateSet());
72
73            for(unsigned int i=0;i<geode.getNumDrawables();++i)
74            {
75                apply(geode.getDrawable(i)->getStateSet());
76            }
77
78            traverse(geode);
79        }
80
81        virtual void apply(osg::Node& node)
82        {
83            apply(node.getStateSet());
84            traverse(node);
85        }
86
87        inline void apply(osg::StateSet* stateset)
88        {
89            if (!stateset) return;
90
91            osg::StateAttribute* attr = stateset->getTextureAttribute(0,osg::StateAttribute::TEXTURE);
92            if (attr)
93            {
94                osg::Texture2D* texture2D = dynamic_cast<osg::Texture2D*>(attr);
95                if (texture2D) apply(dynamic_cast<osg::ImageStream*>(texture2D->getImage()));
96
97                osg::TextureRectangle* textureRec = dynamic_cast<osg::TextureRectangle*>(attr);
98                if (textureRec) apply(dynamic_cast<osg::ImageStream*>(textureRec->getImage()));
99            }
100        }
101
102        inline void apply(osg::ImageStream* imagestream)
103        {
104            if (imagestream)
105            {
106                _imageStreamList.push_back(imagestream);
107            }
108        }
109
110        ImageStreamList& _imageStreamList;
111
112    protected:
113
114        FindImageStreamsVisitor& operator = (const FindImageStreamsVisitor&) { return *this; }
115
116    };
117
118
119    bool            _playToggle;
120    bool            _trackMouse;
121    ImageStreamList _imageStreamList;
122
123};
124
125
126
127void MovieEventHandler::set(osg::Node* node)
128{
129    _imageStreamList.clear();
130    if (node)
131    {
132        FindImageStreamsVisitor fisv(_imageStreamList);
133        node->accept(fisv);
134    }
135}
136
137
138bool MovieEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa, osg::Object*, osg::NodeVisitor* nv)
139{
140    switch(ea.getEventType())
141    {
142        case(osgGA::GUIEventAdapter::MOVE):
143        case(osgGA::GUIEventAdapter::PUSH):
144        case(osgGA::GUIEventAdapter::RELEASE):
145        {
146            if (_trackMouse)
147            {
148                osgViewer::View* view = dynamic_cast<osgViewer::View*>(&aa);
149                osgUtil::LineSegmentIntersector::Intersections intersections;
150                bool foundIntersection = view==0 ? false :
151                    (nv==0 ? view->computeIntersections(ea.getX(), ea.getY(), intersections) :
152                             view->computeIntersections(ea.getX(), ea.getY(), nv->getNodePath(), intersections));
153
154                if (foundIntersection)
155                {
156
157                    // use the nearest intersection
158                    const osgUtil::LineSegmentIntersector::Intersection& intersection = *(intersections.begin());
159                    osg::Drawable* drawable = intersection.drawable.get();
160                    osg::Geometry* geometry = drawable ? drawable->asGeometry() : 0;
161                    osg::Vec3Array* vertices = geometry ? dynamic_cast<osg::Vec3Array*>(geometry->getVertexArray()) : 0;
162                    if (vertices)
163                    {
164                        // get the vertex indices.
165                        const osgUtil::LineSegmentIntersector::Intersection::IndexList& indices = intersection.indexList;
166                        const osgUtil::LineSegmentIntersector::Intersection::RatioList& ratios = intersection.ratioList;
167
168                        if (indices.size()==3 && ratios.size()==3)
169                        {
170                            unsigned int i1 = indices[0];
171                            unsigned int i2 = indices[1];
172                            unsigned int i3 = indices[2];
173
174                            float r1 = ratios[0];
175                            float r2 = ratios[1];
176                            float r3 = ratios[2];
177
178                            osg::Array* texcoords = (geometry->getNumTexCoordArrays()>0) ? geometry->getTexCoordArray(0) : 0;
179                            osg::Vec2Array* texcoords_Vec2Array = dynamic_cast<osg::Vec2Array*>(texcoords);
180                            if (texcoords_Vec2Array)
181                            {
182                                // we have tex coord array so now we can compute the final tex coord at the point of intersection.
183                                osg::Vec2 tc1 = (*texcoords_Vec2Array)[i1];
184                                osg::Vec2 tc2 = (*texcoords_Vec2Array)[i2];
185                                osg::Vec2 tc3 = (*texcoords_Vec2Array)[i3];
186                                osg::Vec2 tc = tc1*r1 + tc2*r2 + tc3*r3;
187
188                                osg::notify(osg::NOTICE)<<"We hit tex coords "<<tc<<std::endl;
189
190                            }
191                        }
192                        else
193                        {
194                            osg::notify(osg::NOTICE)<<"Intersection has insufficient indices to work with";
195                        }
196
197                    }
198                }
199                else
200                {
201                    osg::notify(osg::NOTICE)<<"No intersection"<<std::endl;
202                }
203            }
204            break;
205        }
206        case(osgGA::GUIEventAdapter::KEYDOWN):
207        {
208            if (ea.getKey()=='p')
209            {
210                for(ImageStreamList::iterator itr=_imageStreamList.begin();
211                    itr!=_imageStreamList.end();
212                    ++itr)
213                {
214                    _playToggle = !_playToggle;
215                    if ( _playToggle )
216                    {
217                        // playing, so pause
218                        std::cout<<"Play"<<std::endl;
219                        (*itr)->play();
220                    }
221                    else
222                    {
223                        // playing, so pause
224                        std::cout<<"Pause"<<std::endl;
225                        (*itr)->pause();
226                    }
227                }
228                return true;
229            }
230            else if (ea.getKey()=='r')
231            {
232                for(ImageStreamList::iterator itr=_imageStreamList.begin();
233                    itr!=_imageStreamList.end();
234                    ++itr)
235                {
236                    std::cout<<"Restart"<<std::endl;
237                    (*itr)->rewind();
238                    (*itr)->play();
239                }
240                return true;
241            }
242            else if (ea.getKey()=='L')
243            {
244                for(ImageStreamList::iterator itr=_imageStreamList.begin();
245                    itr!=_imageStreamList.end();
246                    ++itr)
247                {
248                    if ( (*itr)->getLoopingMode() == osg::ImageStream::LOOPING)
249                    {
250                        std::cout<<"Toggle Looping Off"<<std::endl;
251                        (*itr)->setLoopingMode( osg::ImageStream::NO_LOOPING );
252                    }
253                    else
254                    {
255                        std::cout<<"Toggle Looping On"<<std::endl;
256                        (*itr)->setLoopingMode( osg::ImageStream::LOOPING );
257                    }
258                }
259                return true;
260            }
261            return false;
262        }
263
264        default:
265            return false;
266    }
267    return false;
268}
269
270void MovieEventHandler::getUsage(osg::ApplicationUsage& usage) const
271{
272    usage.addKeyboardMouseBinding("p","Play/Pause movie");
273    usage.addKeyboardMouseBinding("r","Restart movie");
274    usage.addKeyboardMouseBinding("l","Toggle looping of movie");
275}
276
277
278osg::Geometry* myCreateTexturedQuadGeometry(const osg::Vec3& pos,float width,float height, osg::Image* image, bool useTextureRectangle, bool xyPlane, bool option_flip)
279{
280    bool flip = image->getOrigin()==osg::Image::TOP_LEFT;
281    if (option_flip) flip = !flip;
282
283    if (useTextureRectangle)
284    {
285        osg::Geometry* pictureQuad = osg::createTexturedQuadGeometry(pos,
286                                           osg::Vec3(width,0.0f,0.0f),
287                                           xyPlane ? osg::Vec3(0.0f,height,0.0f) : osg::Vec3(0.0f,0.0f,height),
288                                           0.0f, flip ? image->t() : 0.0, image->s(), flip ? 0.0 : image->t());
289
290        osg::TextureRectangle* texture = new osg::TextureRectangle(image);
291        texture->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE);
292        texture->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE);
293
294
295        pictureQuad->getOrCreateStateSet()->setTextureAttributeAndModes(0,
296                                                                        texture,
297                                                                        osg::StateAttribute::ON);
298
299        return pictureQuad;
300    }
301    else
302    {
303        osg::Geometry* pictureQuad = osg::createTexturedQuadGeometry(pos,
304                                           osg::Vec3(width,0.0f,0.0f),
305                                           xyPlane ? osg::Vec3(0.0f,height,0.0f) : osg::Vec3(0.0f,0.0f,height),
306                                           0.0f, flip ? 1.0f : 0.0f , 1.0f, flip ? 0.0f : 1.0f);
307
308        osg::Texture2D* texture = new osg::Texture2D(image);
309        texture->setResizeNonPowerOfTwoHint(false);
310        texture->setFilter(osg::Texture::MIN_FILTER,osg::Texture::LINEAR);
311        texture->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE);
312        texture->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE);
313
314
315        pictureQuad->getOrCreateStateSet()->setTextureAttributeAndModes(0,
316                    texture,
317                    osg::StateAttribute::ON);
318
319        return pictureQuad;
320    }
321}
322
323#if USE_SDL
324
325#include "SDL.h"
326
327class SDLAudioSink : public osg::AudioSink
328{
329    public:
330
331        SDLAudioSink(osg::AudioStream* audioStream):
332            _playing(false),
333            _audioStream(audioStream) {}
334
335        ~SDLAudioSink();
336
337        virtual void startPlaying();
338        virtual bool playing() const { return _playing; }
339
340        static void soundReadCallback(void * user_data, uint8_t * data, int datalen);
341
342        bool                                _playing;
343        osg::observer_ptr<osg::AudioStream> _audioStream;
344};
345
346#endif
347
348int main(int argc, char** argv)
349{
350    // use an ArgumentParser object to manage the program arguments.
351    osg::ArgumentParser arguments(&argc,argv);
352
353    // set up the usage document, in case we need to print out how to use this program.
354    arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName());
355    arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" example demonstrates the use of ImageStream for rendering movies as textures.");
356    arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
357    arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
358    arguments.getApplicationUsage()->addCommandLineOption("--texture2D","Use Texture2D rather than TextureRectangle.");
359    arguments.getApplicationUsage()->addCommandLineOption("--shader","Use shaders to post process the video.");
360    arguments.getApplicationUsage()->addCommandLineOption("--interactive","Use camera manipulator to allow movement around movie.");
361    arguments.getApplicationUsage()->addCommandLineOption("--flip","Flip the movie so top becomes bottom.");
362#if defined(WIN32) || defined(__APPLE__)
363    arguments.getApplicationUsage()->addCommandLineOption("--devices","Print the Video input capability via QuickTime and exit.");
364#endif
365
366    bool useTextureRectangle = true;
367    bool useShader = false;
368
369    // construct the viewer.
370    osgViewer::Viewer viewer(arguments);
371
372    if (arguments.argc()<=1)
373    {
374        arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
375        return 1;
376    }
377
378#if defined(WIN32) || defined(__APPLE__)
379    // if user requests devices video capability.
380    if (arguments.read("-devices") || arguments.read("--devices"))
381    {
382        // Force load QuickTime plugin, probe video capability, exit
383        osgDB::readImageFile("devices.live");
384        return 1;
385    }
386#endif
387
388    while (arguments.read("--texture2D")) useTextureRectangle=false;
389    while (arguments.read("--shader")) useShader=true;
390
391    bool mouseTracking = false;
392    while (arguments.read("--mouse")) mouseTracking=true;
393
394
395    // if user request help write it out to cout.
396    if (arguments.read("-h") || arguments.read("--help"))
397    {
398        arguments.getApplicationUsage()->write(std::cout);
399        return 1;
400    }
401
402    bool fullscreen = !arguments.read("--interactive");
403    bool flip = arguments.read("--flip");
404
405    osg::ref_ptr<osg::Geode> geode = new osg::Geode;
406
407    osg::StateSet* stateset = geode->getOrCreateStateSet();
408    stateset->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
409
410    if (useShader)
411    {
412        //useTextureRectangle = false;
413
414        static const char *shaderSourceTextureRec = {
415            "uniform vec4 cutoff_color;\n"
416            "uniform samplerRect movie_texture;\n"
417            "void main(void)\n"
418            "{\n"
419            "    vec4 texture_color = textureRect(movie_texture, gl_TexCoord[0].st); \n"
420            "    if (all(lessThanEqual(texture_color,cutoff_color))) discard; \n"
421            "    gl_FragColor = texture_color;\n"
422            "}\n"
423        };
424
425        static const char *shaderSourceTexture2D = {
426            "uniform vec4 cutoff_color;\n"
427            "uniform sampler2D movie_texture;\n"
428            "void main(void)\n"
429            "{\n"
430            "    vec4 texture_color = texture2D(movie_texture, gl_TexCoord[0].st); \n"
431            "    if (all(lessThanEqual(texture_color,cutoff_color))) discard; \n"
432            "    gl_FragColor = texture_color;\n"
433            "}\n"
434        };
435
436        osg::Program* program = new osg::Program;
437
438        program->addShader(new osg::Shader(osg::Shader::FRAGMENT,
439                                           useTextureRectangle ? shaderSourceTextureRec : shaderSourceTexture2D));
440
441        stateset->addUniform(new osg::Uniform("cutoff_color",osg::Vec4(0.1f,0.1f,0.1f,1.0f)));
442        stateset->addUniform(new osg::Uniform("movie_texture",0));
443
444        stateset->setAttribute(program);
445
446    }
447
448    osg::Vec3 pos(0.0f,0.0f,0.0f);
449    osg::Vec3 topleft = pos;
450    osg::Vec3 bottomright = pos;
451
452    bool xyPlane = fullscreen;
453   
454    bool useAudioSink = false;
455    while(arguments.read("--audio")) { useAudioSink = true; }
456   
457#if USE_SDL
458    unsigned int numAudioStreamsEnabled = 0;
459#endif
460
461    for(int i=1;i<arguments.argc();++i)
462    {
463        if (arguments.isString(i))
464        {
465            osg::Image* image = osgDB::readImageFile(arguments[i]);
466            osg::ImageStream* imagestream = dynamic_cast<osg::ImageStream*>(image);
467            if (imagestream)
468            {
469                osg::ImageStream::AudioStreams& audioStreams = imagestream->getAudioStreams();
470                if (useAudioSink && !audioStreams.empty())
471                {
472                    osg::AudioStream* audioStream = audioStreams[0].get();
473                    osg::notify(osg::NOTICE)<<"AudioStream read ["<<audioStream->getName()<<"]"<<std::endl;
474#if USE_SDL
475                    if (numAudioStreamsEnabled==0)
476                    {
477                        audioStream->setAudioSink(new SDLAudioSink(audioStream));
478                       
479                        ++numAudioStreamsEnabled;
480                    }
481#endif
482                }
483
484
485                imagestream->play();
486            }
487
488            if (image)
489            {
490                osg::notify(osg::NOTICE)<<"image->s()"<<image->s()<<" image-t()="<<image->t()<<" aspectRatio="<<image->getPixelAspectRatio()<<std::endl;
491
492                float width = image->s() * image->getPixelAspectRatio();
493                float height = image->t();
494
495                osg::ref_ptr<osg::Drawable> drawable = myCreateTexturedQuadGeometry(pos, width, height,image, useTextureRectangle, xyPlane, flip);
496               
497                if (image->isImageTranslucent())
498                {
499                    osg::notify(osg::NOTICE)<<"Transparent movie, enabling blending."<<std::endl;
500
501                    drawable->getOrCreateStateSet()->setMode(GL_BLEND, osg::StateAttribute::ON);
502                    drawable->getOrCreateStateSet()->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
503                }
504
505                geode->addDrawable(drawable.get());
506
507                bottomright = pos + osg::Vec3(width,height,0.0f);
508
509                if (xyPlane) pos.y() += height*1.05f;
510                else pos.z() += height*1.05f;
511            }
512            else
513            {
514                std::cout<<"Unable to read file "<<arguments[i]<<std::endl;
515            }
516        }
517    }
518
519    // set the scene to render
520    viewer.setSceneData(geode.get());
521
522    if (viewer.getSceneData()==0)
523    {
524        arguments.getApplicationUsage()->write(std::cout);
525        return 1;
526    }
527
528    // pass the model to the MovieEventHandler so it can pick out ImageStream's to manipulate.
529    MovieEventHandler* meh = new MovieEventHandler();
530    meh->setMouseTracking( mouseTracking );
531    meh->set( viewer.getSceneData() );
532    viewer.addEventHandler( meh );
533
534    viewer.addEventHandler( new osgViewer::StatsHandler );
535    viewer.addEventHandler( new osgGA::StateSetManipulator( viewer.getCamera()->getOrCreateStateSet() ) );
536    viewer.addEventHandler( new osgViewer::WindowSizeHandler );
537
538    // add the record camera path handler
539    viewer.addEventHandler(new osgViewer::RecordCameraPathHandler);
540
541    // report any errors if they have occurred when parsing the program arguments.
542    if (arguments.errors())
543    {
544        arguments.writeErrorMessages(std::cout);
545        return 1;
546    }
547
548    if (fullscreen)
549    {
550        viewer.realize();
551       
552        viewer.getCamera()->setClearColor(osg::Vec4(0.0f,0.0f,0.0f,1.0f));
553
554        float screenAspectRatio = 1280.0f/1024.0f;
555
556        osg::GraphicsContext::WindowingSystemInterface* wsi = osg::GraphicsContext::getWindowingSystemInterface();
557        if (wsi)
558        {
559            unsigned int width, height;
560            wsi->getScreenResolution(osg::GraphicsContext::ScreenIdentifier(0), width, height);
561           
562            screenAspectRatio = float(width) / float(height);
563        }
564       
565        float modelAspectRatio = (bottomright.x()-topleft.x())/(bottomright.y()-topleft.y());
566       
567        viewer.getCamera()->setViewMatrix(osg::Matrix::identity());
568
569
570        osg::Vec3 center = (bottomright + topleft)*0.5f;
571        osg::Vec3 dx(bottomright.x()-center.x(), 0.0f, 0.0f);
572        osg::Vec3 dy(0.0f, topleft.y()-center.y(), 0.0f);
573
574        float ratio = modelAspectRatio/screenAspectRatio;
575
576        if (ratio>1.0f)
577        {
578            // use model width as the control on model size.
579            bottomright = center + dx - dy * ratio;
580            topleft = center - dx + dy * ratio;
581        }
582        else
583        {
584            // use model height as the control on model size.
585            bottomright = center + dx / ratio - dy;
586            topleft = center - dx / ratio + dy;
587        }
588
589        viewer.getCamera()->setProjectionMatrixAsOrtho2D(topleft.x(),bottomright.x(),topleft.y(),bottomright.y());
590
591        while(!viewer.done())
592        {
593            viewer.frame();
594        }
595        return 0;
596    }
597    else
598    {
599        // create the windows and run the threads.
600        return viewer.run();
601    }
602}
603
604#if USE_SDL
605
606#include "SDL.h"
607
608SDLAudioSink::~SDLAudioSink()
609{
610    if (_playing)
611    {
612
613        SDL_PauseAudio(1);
614        SDL_CloseAudio();
615
616        osg::notify(osg::NOTICE)<<"~SDLAudioSink() destructor, but still playing"<<std::endl;
617    }
618}
619
620void SDLAudioSink::startPlaying()
621{
622    _playing = true;
623    osg::notify(osg::NOTICE)<<"SDLAudioSink()::startPlaying()"<<std::endl;
624
625    osg::notify(osg::NOTICE)<<"  audioFrequency()="<<_audioStream->audioFrequency()<<std::endl;
626    osg::notify(osg::NOTICE)<<"  audioNbChannels()="<<_audioStream->audioNbChannels()<<std::endl;
627    osg::notify(osg::NOTICE)<<"  audioSampleFormat()="<<_audioStream->audioSampleFormat()<<std::endl;
628
629    SDL_AudioSpec specs = { 0 };
630    SDL_AudioSpec wanted_specs = { 0 };
631
632    wanted_specs.freq = _audioStream->audioFrequency();
633    wanted_specs.format = AUDIO_S16SYS;
634    wanted_specs.channels = _audioStream->audioNbChannels();
635    wanted_specs.silence = 0;
636    wanted_specs.samples = 1024;
637    wanted_specs.callback = soundReadCallback;
638    wanted_specs.userdata = this;
639
640    if (SDL_OpenAudio(&wanted_specs, &specs) < 0)
641        throw "SDL_OpenAudio() failed (" + std::string(SDL_GetError()) + ")";
642
643    SDL_PauseAudio(0);
644
645}
646
647void SDLAudioSink::soundReadCallback(void * const user_data, Uint8 * const data, const int datalen)
648{
649    SDLAudioSink * sink = reinterpret_cast<SDLAudioSink*>(user_data);
650    osg::ref_ptr<osg::AudioStream> as = sink->_audioStream.get();
651    if (as.valid())
652    {
653        as->consumeAudioBuffer(data, datalen);
654    }
655}
656
657#endif
Note: See TracBrowser for help on using the browser.