From 15ff70d298f1ab5a18a215e0a340b6295c787c03 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 28 Jun 2007 14:19:30 +0000 Subject: [PATCH] From Brad Colbert with ammendments by Robert Osfield, add set/getVolume support --- include/osg/ImageStream | 5 ++++- src/osgPlugins/quicktime/MovieData.h | 6 ++++-- src/osgPlugins/quicktime/QuicktimeImageStream.h | 4 ++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/include/osg/ImageStream b/include/osg/ImageStream index fe3b351dd..90591fdf0 100644 --- a/include/osg/ImageStream +++ b/include/osg/ImageStream @@ -73,7 +73,10 @@ class OSG_EXPORT ImageStream : public Image virtual double getReferenceTime() const { return 0.0; } virtual void setTimeMultiplier(double) {} - virtual double getTimeMultiplier() { return 0.0; } + virtual double getTimeMultiplier() const { return 0.0; } + + virtual void setVolume(float) {} + virtual float getVolume() const { return 0.0f; } virtual void update() {} diff --git a/src/osgPlugins/quicktime/MovieData.h b/src/osgPlugins/quicktime/MovieData.h index 8947f73dc..aab3c624a 100644 --- a/src/osgPlugins/quicktime/MovieData.h +++ b/src/osgPlugins/quicktime/MovieData.h @@ -16,6 +16,8 @@ #include "QTUtils.h" +#include + /** * the class MovieData encapsulates all quicktime-related stuff, so it doesn't polute the namespaces @@ -60,8 +62,8 @@ void setMovieRate(float rate); /** sets the volume for the soundtrack of this movie */ - void setVolume(float volume) { SetMovieVolume(_movie,(short)(volume*255));} - float getVolume() { return GetMovieVolume(_movie) / 255.0f; } + void setVolume(float volume) { SetMovieVolume(_movie,(short)(ceil(volume*255.0f)));} + float getVolume() const { return GetMovieVolume(_movie) / 255.0f; } void setAudioBalance(float f) { Float32 balance = f; diff --git a/src/osgPlugins/quicktime/QuicktimeImageStream.h b/src/osgPlugins/quicktime/QuicktimeImageStream.h index a1a0fde77..41a91dea5 100644 --- a/src/osgPlugins/quicktime/QuicktimeImageStream.h +++ b/src/osgPlugins/quicktime/QuicktimeImageStream.h @@ -131,6 +131,10 @@ public: return 0.0; } + // Get and Set the playback volume of the stream. + virtual void setVolume(float volume); + virtual float getVolume() const; + protected: /// apply the looping mode to quicktime