Browse Source

Fixed a logic error in the way slides were being queued.

The activeSlides vector was being modified by enqueueSlide while it was being iterated in update(). enqueueSlide now raises a flag, and it is update() that now modifies the activeSlides vector.
master
c-mendoza 8 years ago
parent
commit
08976e4047
  1. 22
      src/Sources/magSlideShowSource.cpp
  2. 1
      src/Sources/magSlideShowSource.h

22
src/Sources/magSlideShowSource.cpp

@ -103,13 +103,22 @@ void magSlideShowSource::update() {
runningTime += deltaTime; runningTime += deltaTime;
lastTime = nowTime; lastTime = nowTime;
// ofLogVerbose() << "Delta: " << deltaTime << " running: " << runningTime;
for (auto &slide : activeSlides) for (auto &slide : activeSlides)
{ {
slide->update(deltaTime); slide->update(deltaTime);
} }
// Queue the next slide if it is time
if (doPlayNextSlide)
{
playNextSlide();
if (activeSlides.size() > 1)
{
activeSlides[1]->transition->start(activeSlides[0]);
}
doPlayNextSlide = false;
}
// Erase any complete slides: // Erase any complete slides:
auto iter = activeSlides.begin(); auto iter = activeSlides.begin();
for (; iter < activeSlides.end(); iter++) for (; iter < activeSlides.end(); iter++)
@ -497,13 +506,8 @@ void magSlideShowSource::slideStateChanged(const void *sender, ofEventArgs &args
// << slide->getSlideStateName(); // << slide->getSlideStateName();
if (slide->getSlideState() == magSlide::SlideState::BuildOut) if (slide->getSlideState() == magSlide::SlideState::BuildOut)
{ {
// slide->transition->start(); // Flag that we need to load the next slide:
// ofLogVerbose() << "BuildOut " << slide->getId(); doPlayNextSlide = true;
playNextSlide();
if (activeSlides.size() > 1)
{
activeSlides[1]->transition->start(activeSlides[0]);
}
} }
} }

1
src/Sources/magSlideShowSource.h

@ -161,6 +161,7 @@ class magSlideShowSource : public ofx::piMapper::FboSource {
void fileAddedListener(const void *sender); void fileAddedListener(const void *sender);
void fileRemovedListener(const void *sender); void fileRemovedListener(const void *sender);
bool doInit; bool doInit;
bool doPlayNextSlide = false;
}; };

Loading…
Cancel
Save