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 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);

6
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
};
}
}
Loading…
Cancel
Save