Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/ofxThreadedVideo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ ofxThreadedVideo::ofxThreadedVideo(){
bPaused[0] = bPaused[1] = false;
bUseTexture = true;
volume[0] = volume[1] = 255;
balance[0] = balance[1] = .0f;
newSpeed[0] = newSpeed[1] = 1.0f;
newLoopType[0] = newLoopType[1] = -1;
frame[0] = frame[1] = 0;
Expand Down Expand Up @@ -171,6 +172,7 @@ void ofxThreadedVideo::update(){
bFrameNew[lastVideoID] = false;
bPaused[lastVideoID] = false;
volume[lastVideoID] = 255;
balance[lastVideoID] = .0f;
}

// send event notification
Expand Down Expand Up @@ -466,6 +468,25 @@ int ofxThreadedVideo::getVolume(){
}
}

//--------------------------------------------------------------
void ofxThreadedVideo::setBalance(float _balance){
Poco::ScopedLock<ofMutex> lock();
if(currentVideoID != VIDEO_NONE && loadVideoID == VIDEO_NONE){
balance[currentVideoID] = _balance;
videos[currentVideoID].setBalance(balance[currentVideoID]);
}
balance[getNextLoadID()] = _balance;
videos[getNextLoadID()].setBalance(balance[getNextLoadID()]);
}

//--------------------------------------------------------------
float ofxThreadedVideo::getBalance(){
Poco::ScopedLock<ofMutex> lock();
if(currentVideoID != VIDEO_NONE){
return balance[currentVideoID];
}
}

//--------------------------------------------------------------
void ofxThreadedVideo::setLoopState(ofLoopType state){
Poco::ScopedLock<ofMutex> lock();
Expand Down
3 changes: 3 additions & 0 deletions src/ofxThreadedVideo.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ class ofxThreadedVideo : public ofThread {
void setPosition(float pct);
void setVolume(int volume);
int getVolume();
void setBalance(float balance);
float getBalance();
void setLoopState(ofLoopType state);
int getLoopState();
void setSpeed(float speed);
Expand Down Expand Up @@ -133,6 +135,7 @@ class ofxThreadedVideo : public ofThread {
float newPosition[2];
int newFrame[2];
int volume[2];
float balance[2];
bool bPaused[2];
float newSpeed[2];
int newLoopType[2];
Expand Down