Changeset 10925
- Timestamp:
- 01/07/10 15:35:17 (3 years ago)
- Location:
- OpenSceneGraph/trunk
- Files:
-
- 4 modified
-
examples/osgmovie/osgmovie.cpp (modified) (3 diffs)
-
include/osg/AudioStream (modified) (2 diffs)
-
src/osgPlugins/ffmpeg/FFmpegDecoderAudio.cpp (modified) (2 diffs)
-
src/osgWrappers/osg/AudioStream.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/examples/osgmovie/osgmovie.cpp
r10809 r10925 384 384 385 385 SDLAudioSink(osg::AudioStream* audioStream): 386 _playing(false), 386 _started(false), 387 _paused(false), 387 388 _audioStream(audioStream) {} 388 389 389 390 ~SDLAudioSink(); 390 391 391 virtual void startPlaying(); 392 virtual bool playing() const { return _playing; } 393 394 395 bool _playing; 392 virtual void play(); 393 virtual void pause(); 394 virtual void stop(); 395 396 virtual bool playing() const { return _started && !_paused; } 397 398 399 bool _started; 400 bool _paused; 396 401 osg::observer_ptr<osg::AudioStream> _audioStream; 397 402 }; … … 671 676 SDLAudioSink::~SDLAudioSink() 672 677 { 673 if (_playing) 674 { 675 676 SDL_PauseAudio(1); 677 SDL_CloseAudio(); 678 679 osg::notify(osg::NOTICE)<<"~SDLAudioSink() destructor, but still playing"<<std::endl; 680 } 681 } 682 683 void SDLAudioSink::startPlaying() 684 { 685 _playing = true; 678 stop(); 679 } 680 681 void SDLAudioSink::play() 682 { 683 if (_started) 684 { 685 if (_paused) 686 { 687 SDL_PauseAudio(0); 688 _paused = false; 689 } 690 return; 691 } 692 693 _started = true; 694 _paused = false; 695 686 696 osg::notify(osg::NOTICE)<<"SDLAudioSink()::startPlaying()"<<std::endl; 687 697 … … 708 718 } 709 719 720 void SDLAudioSink::pause() 721 { 722 if (_started) 723 { 724 SDL_PauseAudio(1); 725 _paused = true; 726 } 727 } 728 729 void SDLAudioSink::stop() 730 { 731 if (_started) 732 { 733 if (!_paused) SDL_PauseAudio(1); 734 SDL_CloseAudio(); 735 736 osg::notify(osg::NOTICE)<<"~SDLAudioSink() destructor, but still playing"<<std::endl; 737 } 738 } 710 739 711 740 #endif -
OpenSceneGraph/trunk/include/osg/AudioStream
r10764 r10925 27 27 AudioSink(); 28 28 29 virtual void startPlaying() = 0; 29 virtual const char * libraryName() const { return "osg"; } 30 virtual const char * className() const { return "AudioSinkInterface"; } 31 32 virtual void play() = 0; 33 virtual void pause() = 0; 34 virtual void stop() = 0; 35 30 36 virtual bool playing() const = 0; 31 37 … … 33 39 virtual void setDelay(const double delay) { _delay = delay; } 34 40 35 virtual const char * libraryName() const { return "osgFFmpeg"; }36 virtual const char * className() const { return "AudioSinkInterface"; }37 41 38 42 private: -
OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegDecoderAudio.cpp
r10892 r10925 92 92 void FFmpegDecoderAudio::pause(bool pause) 93 93 { 94 if(pause) 95 m_paused = true; 96 else 97 m_paused = false; 94 if (pause != m_paused) 95 { 96 m_paused = pause; 97 if (m_audio_sink.valid()) 98 { 99 if (m_paused) m_audio_sink->pause(); 100 else m_audio_sink->play(); 101 } 102 } 98 103 } 99 104 … … 184 189 { 185 190 m_clocks.audioSetDelay(m_audio_sink->getDelay()); 186 m_audio_sink-> startPlaying();191 m_audio_sink->play(); 187 192 } 188 193 else -
OpenSceneGraph/trunk/src/osgWrappers/osg/AudioStream.cpp
r9918 r10925 29 29 "", 30 30 ""); 31 I_Method0(void, startPlaying, 31 I_Method0(const char *, libraryName, 32 Properties::VIRTUAL, 33 __C5_char_P1__libraryName, 34 "return the name of the object's library. ", 35 "Must be defined by derived classes. The OpenSceneGraph convention is that the namespace of a library is the same as the library name. "); 36 I_Method0(const char *, className, 37 Properties::VIRTUAL, 38 __C5_char_P1__className, 39 "return the name of the object's class type. ", 40 "Must be defined by derived classes. "); 41 I_Method0(void, play, 32 42 Properties::PURE_VIRTUAL, 33 __void__startPlaying, 43 __void__play, 44 "", 45 ""); 46 I_Method0(void, pause, 47 Properties::PURE_VIRTUAL, 48 __void__pause, 49 "", 50 ""); 51 I_Method0(void, stop, 52 Properties::PURE_VIRTUAL, 53 __void__stop, 34 54 "", 35 55 ""); … … 49 69 "", 50 70 ""); 51 I_Method0(const char *, libraryName,52 Properties::VIRTUAL,53 __C5_char_P1__libraryName,54 "return the name of the object's library. ",55 "Must be defined by derived classes. The OpenSceneGraph convention is that the namespace of a library is the same as the library name. ");56 I_Method0(const char *, className,57 Properties::VIRTUAL,58 __C5_char_P1__className,59 "return the name of the object's class type. ",60 "Must be defined by derived classes. ");61 71 I_SimpleProperty(double, Delay, 62 72 __double__getDelay,
