diff --git a/examples/osgmovie/osgmovie.cpp b/examples/osgmovie/osgmovie.cpp index 21e621e9d..e0dca8061 100644 --- a/examples/osgmovie/osgmovie.cpp +++ b/examples/osgmovie/osgmovie.cpp @@ -327,74 +327,22 @@ osg::Geometry* myCreateTexturedQuadGeometry(const osg::Vec3& pos,float width,flo class SDLAudioSink : public osg::AudioSink { public: - + SDLAudioSink(osg::AudioStream* audioStream): _playing(false), _audioStream(audioStream) {} - - ~SDLAudioSink() - { - if (_playing) - { - SDL_PauseAudio(1); - SDL_CloseAudio(); + ~SDLAudioSink(); - osg::notify(osg::NOTICE)<<"~SDLAudioSink() destructor, but still playing"< _audioStream; }; - -void SDLAudioSink::soundReadCallback(void * const user_data, Uint8 * const data, const int datalen) -{ - SDLAudioSink * sink = reinterpret_cast(user_data); - osg::ref_ptr as = sink->_audioStream.get(); - if (as.valid()) - { - as->consumeAudioBuffer(data, datalen); - } -} - -#endif - -#if defined(USE_SDL) && defined(__APPLE__) - // SDL under OSX causes a link error with a unresolved _main symbol - // so we have to add this dummy implementation to get round it. - main() {} #endif int main(int argc, char** argv) @@ -653,3 +601,58 @@ int main(int argc, char** argv) } } +#if USE_SDL + +#include "SDL.h" + +SDLAudioSink::~SDLAudioSink() +{ + if (_playing) + { + + SDL_PauseAudio(1); + SDL_CloseAudio(); + + osg::notify(osg::NOTICE)<<"~SDLAudioSink() destructor, but still playing"<(user_data); + osg::ref_ptr as = sink->_audioStream.get(); + if (as.valid()) + { + as->consumeAudioBuffer(data, datalen); + } +} + +#endif +