Changeset 10961

Show
Ignore:
Timestamp:
01/18/10 13:43:02 (5 years ago)
Author:
robert
Message:

From Serge Lages, "Here is a patch to allow setting an audio volume with the AudioSink? interface, I've also modified the ffmpeg plugin code to implement the ImageStream?'s setVolume method with its AudioSink?."

Location:
OpenSceneGraph/trunk
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/include/osg/AudioStream

    r10925 r10961  
    3939    virtual void setDelay(const double delay) { _delay = delay; } 
    4040 
     41    virtual void setVolume(float) {} 
     42    virtual float getVolume() const { return 0.0f; } 
    4143 
    4244private: 
  • OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegDecoderAudio.cpp

    r10925 r10961  
    113113} 
    114114 
     115void FFmpegDecoderAudio::setVolume(float volume) 
     116{ 
     117    if (m_audio_sink.valid()) 
     118    { 
     119        m_audio_sink->setVolume(volume); 
     120    } 
     121} 
     122 
     123float FFmpegDecoderAudio::getVolume() const 
     124{ 
     125    if (m_audio_sink.valid()) 
     126    { 
     127        return m_audio_sink->getVolume(); 
     128    } 
     129    return 0.0f; 
     130} 
    115131 
    116132void FFmpegDecoderAudio::run() 
  • OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegDecoderAudio.hpp

    r10851 r10961  
    3535    void close(bool waitForThreadToExit); 
    3636     
     37    void setVolume(float volume); 
     38    float getVolume() const; 
     39 
    3740    virtual void run(); 
    3841 
  • OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegImageStream.cpp

    r10851 r10961  
    153153} 
    154154 
     155void FFmpegImageStream::setVolume(float volume) 
     156{ 
     157    m_decoder->audio_decoder().setVolume(volume); 
     158} 
     159 
     160float FFmpegImageStream::getVolume() const 
     161{ 
     162    return m_decoder->audio_decoder().getVolume(); 
     163} 
    155164 
    156165double FFmpegImageStream::getLength() const 
  • OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegImageStream.hpp

    r10851 r10961  
    3333        virtual void seek(double time); 
    3434        virtual void quit(bool waitForThreadToExit = true); 
     35 
     36        virtual void setVolume(float volume); 
     37        virtual float getVolume() const; 
    3538 
    3639        virtual double getLength() const;