diff --git a/src/Sources/VideoSource.cpp b/src/Sources/VideoSource.cpp index 4ccbdb4..1f66e9c 100644 --- a/src/Sources/VideoSource.cpp +++ b/src/Sources/VideoSource.cpp @@ -2,6 +2,9 @@ namespace ofx { namespace piMapper { + + bool VideoSource::enableAudio = false; + VideoSource::VideoSource() { //cout << "VideoSource constr" << endl; loadable = true; @@ -28,7 +31,7 @@ namespace ofx { settings.useHDMIForAudio = true; //default true settings.enableTexture = 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 omxPlayer = new ofxOMXPlayer(); omxPlayer->setup(settings); @@ -38,6 +41,7 @@ namespace ofx { videoPlayer = new ofVideoPlayer(); videoPlayer->loadMovie(filePath); videoPlayer->setLoopState(OF_LOOP_NORMAL); + videoPlayer->setVolume(VideoSource::enableAudio ? 1.0f : 0.0f); videoPlayer->play(); texture = &(videoPlayer->getTextureReference()); ofAddListener(ofEvents().update, this, &VideoSource::update); diff --git a/src/Sources/VideoSource.h b/src/Sources/VideoSource.h index 9ab8a97..3ad9550 100644 --- a/src/Sources/VideoSource.h +++ b/src/Sources/VideoSource.h @@ -26,6 +26,11 @@ namespace ofx { namespace piMapper { class VideoSource : public BaseSource { public: + + // TODO: Create enableAudio() and disableAudio() methods + // for live audio enabling and disabling. + static bool enableAudio; + VideoSource(); ~VideoSource(); std::string& getPath(); @@ -43,6 +48,7 @@ namespace ofx { // TODO: High Performance Video player on newer Macs ofVideoPlayer* videoPlayer; #endif + }; } } \ No newline at end of file