Browse Source

Add static enableAudio member to `VideoSource` class

master
Krisjanis Rijnieks 10 years ago
parent
commit
aa1397f50a
  1. 6
      src/Sources/VideoSource.cpp
  2. 6
      src/Sources/VideoSource.h

6
src/Sources/VideoSource.cpp

@ -2,6 +2,9 @@
namespace ofx { namespace ofx {
namespace piMapper { namespace piMapper {
bool VideoSource::enableAudio = false;
VideoSource::VideoSource() { VideoSource::VideoSource() {
//cout << "VideoSource constr" << endl; //cout << "VideoSource constr" << endl;
loadable = true; loadable = true;
@ -28,7 +31,7 @@ namespace ofx {
settings.useHDMIForAudio = true; //default true settings.useHDMIForAudio = true; //default true
settings.enableTexture = true; //default true settings.enableTexture = true; //default true
settings.enableLooping = true; //default true settings.enableLooping = true; //default true
settings.enableAudio = false; //default true, save resources by disabling settings.enableAudio = VideoSource::enableAudio; //default true, save resources by disabling
//settings.doFlipTexture = true; //default false //settings.doFlipTexture = true; //default false
omxPlayer = new ofxOMXPlayer(); omxPlayer = new ofxOMXPlayer();
omxPlayer->setup(settings); omxPlayer->setup(settings);
@ -38,6 +41,7 @@ namespace ofx {
videoPlayer = new ofVideoPlayer(); videoPlayer = new ofVideoPlayer();
videoPlayer->loadMovie(filePath); videoPlayer->loadMovie(filePath);
videoPlayer->setLoopState(OF_LOOP_NORMAL); videoPlayer->setLoopState(OF_LOOP_NORMAL);
videoPlayer->setVolume(VideoSource::enableAudio ? 1.0f : 0.0f);
videoPlayer->play(); videoPlayer->play();
texture = &(videoPlayer->getTextureReference()); texture = &(videoPlayer->getTextureReference());
ofAddListener(ofEvents().update, this, &VideoSource::update); ofAddListener(ofEvents().update, this, &VideoSource::update);

6
src/Sources/VideoSource.h

@ -26,6 +26,11 @@ namespace ofx {
namespace piMapper { namespace piMapper {
class VideoSource : public BaseSource { class VideoSource : public BaseSource {
public: public:
// TODO: Create enableAudio() and disableAudio() methods
// for live audio enabling and disabling.
static bool enableAudio;
VideoSource(); VideoSource();
~VideoSource(); ~VideoSource();
std::string& getPath(); std::string& getPath();
@ -43,6 +48,7 @@ namespace ofx {
// TODO: High Performance Video player on newer Macs // TODO: High Performance Video player on newer Macs
ofVideoPlayer* videoPlayer; ofVideoPlayer* videoPlayer;
#endif #endif
}; };
} }
} }
Loading…
Cancel
Save