diff --git a/MoviePlugin/MWLibrary.xml b/MoviePlugin/MWLibrary.xml
index 7773984..82c73aa 100644
--- a/MoviePlugin/MWLibrary.xml
+++ b/MoviePlugin/MWLibrary.xml
@@ -13,32 +13,5 @@
-
-
-
- action[@type='play_movie']
- Action
-
-
- Start playing a movie stimulus
-
-
-
-
-
-
-
-
- action[@type='stop_movie']
- Action
-
-
- Stop playing a movie stimulus
-
-
-
-
-
-
-
-
+
+
diff --git a/MoviePlugin/MovieFrame.cpp b/MoviePlugin/MovieFrame.cpp
deleted file mode 100644
index 2881b6c..0000000
--- a/MoviePlugin/MovieFrame.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * MovieFrame.cpp
- * MWorksCore
- *
- * Created by labuser on 5/16/08.
- * Copyright 2008 MIT. All rights reserved.
- *
- */
-#include "MovieFrame.h"
-using namespace mw;
-
-
-MovieFrame::MovieFrame(const shared_ptr frame,
- const MWorksTime next_frame_time) :
-frame_node(frame),
-next_frame_at(next_frame_time)
-{}
-
-shared_ptr MovieFrame::stimNode() {
- return frame_node;
-}
-
-MWorksTime MovieFrame::nextFrameTime() const {
- return next_frame_at;
-}
-
-
diff --git a/MoviePlugin/MovieFrame.h b/MoviePlugin/MovieFrame.h
deleted file mode 100644
index 4971fa6..0000000
--- a/MoviePlugin/MovieFrame.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * MovieFrame.h
- * MWorksCore
- *
- * Created by labuser on 5/16/08.
- * Copyright 2008 MIT. All rights reserved.
- *
- */
-
-#ifndef MOVIE_FRAME_H_
-#define MOVIE_FRAME_H_
-
-#include "MWorksCore/StimulusNode.h"
-using namespace mw;
-
-class MovieFrame {
-private:
- shared_ptr frame_node;
- MWorksTime next_frame_at;
- std::string stim_tag;
-public:
- MovieFrame(const shared_ptr frame,
- const MWorksTime next_frame_time);
- shared_ptr stimNode();
- MWorksTime nextFrameTime() const;
-};
-
-
-
-#endif /* MOVIE_FRAME */
-
-
diff --git a/MoviePlugin/MovieStimulus.cpp b/MoviePlugin/MovieStimulus.cpp
index bf78489..86e9a03 100644
--- a/MoviePlugin/MovieStimulus.cpp
+++ b/MoviePlugin/MovieStimulus.cpp
@@ -8,294 +8,50 @@
*/
#include "MovieStimulus.h"
-#include "MWorksCore/OpenGLContextManager.h"
-#include "MWorksCore/Experiment.h"
-#include "boost/bind.hpp"
-#include "MovieStimulusFrameNotification.h"
-
-void *nextUpdate(const shared_ptr &movie);
-void *finalFrame(const shared_ptr &movie);
#define STIM_TYPE_MOVIE "movie"
#define STIM_MOVIE_PLAYING "playing"
#define STIM_MOVIE_CURRENT_FRAME "current_frame"
-MovieStimulus::MovieStimulus(const shared_ptr &a_scheduler,
- const shared_ptr &a_display,
- const std::string &new_tag,
- const shared_ptr new_stimulus_group,
- const shared_ptr frames_per_seconds_var,
- const shared_ptr movie_stats_var,
- const shared_ptr error_reporting_var,
- const shared_ptr start_frame_var,
- const shared_ptr end_frame_var) : Stimulus(new_tag) {
- scheduler = a_scheduler;
- display = a_display;
-
- stimulus_group = new_stimulus_group;
- frames_per_second = frames_per_seconds_var;
- movie_stats = movie_stats_var;
- error_reporting = error_reporting_var;
- start_frame_index=start_frame_var;
- end_frame_index=end_frame_var;
- movie_started = false;
-
- updates_scheduled = 0;
-
- // connect this to #stimDisplayUpdate
- stimDisplayUpdateNotificationObject = shared_ptr(new MovieStimulusFrameNotification(this));
- stimDisplayUpdate->addNotification(stimDisplayUpdateNotificationObject);
-
- current_stimulus_group_index = -1;
-}
-
-// what's a frozen movie stim? I don't know either...return a copy of the existing movie
-Stimulus * MovieStimulus::frozenClone() {
- boost::mutex::scoped_lock locker(movie_lock);
-
- shared_ptr frozen_frames_per_second(frames_per_second->frozenClone());
- shared_ptr frozen_start_frame_index(start_frame_index->frozenClone());
- shared_ptr frozen_end_frame_index(end_frame_index->frozenClone());
-
- // static int frozen_counter = 0;
- // frozen_counter++;
- //
- // std::ostringstream x;
- //
- // x << frozen_counter;
- //
- return new MovieStimulus(scheduler,
- display,
- tag,
- stimulus_group,
- frozen_frames_per_second,
- movie_stats,
- error_reporting,
- frozen_start_frame_index,
- frozen_end_frame_index);
-}
-
-int MovieStimulus::getNFramesToShow() {
- boost::mutex::scoped_lock locker(movie_lock);
- return (end_frame_index->getValue().getInteger()-start_frame_index->getValue().getInteger()) + 1;
-}
-
-int MovieStimulus::getNFramesShown() {
- boost::mutex::scoped_lock locker(movie_lock);
- return updates_scheduled;
-}
-
-void MovieStimulus::play() {
- boost::mutex::scoped_lock locker(movie_lock);
-
- if (!movie_started) {
- if(end_frame_index->getValue().getInteger() == -1) {
- shared_ptr temp_end_frame_index(new ConstantVariable(Datum(M_INTEGER,stimulus_group->getNElements()-1)));
- end_frame_index = temp_end_frame_index;
- }
-
- const double frames_per_us = frames_per_second->getValue().getFloat()/1000000;
-
- movie_started = true;
- movie_ended = false;
- movie_will_end = false;
- start_time = scheduler->getClock()->getCurrentTimeUS();
- updates_scheduled = 0;
-
- times_shown.clear();
-
- for(int i=0;
- igetNElements();
- ++i) {
- // each element of the vector will have a frame and the time when the next frame is shown (also describes when this frame is "erased")
-
- shared_ptr p(new StimulusNode(stimulus_group->getElement(i)));
-
- // store a hash of {'stim name' => 'frame index'}
- // this is used to look up the stimuli when they are announced via #stimDisplayUpdate
- // index_hash.insert(std::pair(p->getCurrentAnnounceDrawData().getElement(STIM_NAME), i));
- shared_ptr > times(new std::vector());
- times_shown.push_back(times);
- }
-
- shared_ptr shared_ptr_to_this = shared_from_this();
-
- schedule_node = scheduler->scheduleUS(FILELINE,
- 0,
- (MWorksTime)(1/frames_per_us),
- (end_frame_index->getValue().getInteger()-start_frame_index->getValue().getInteger()) + 1,
- boost::bind(nextUpdate, shared_ptr_to_this),
- M_DEFAULT_PRIORITY,
- M_DEFAULT_WARN_SLOP_US,
- M_DEFAULT_FAIL_SLOP_US,
- M_MISSED_EXECUTION_CATCH_UP);
- }
-}
-
-void MovieStimulus::stopAndRewind() {
- boost::mutex::scoped_lock locker(movie_lock);
-
- // If movie is already stopped, do nothing
- if (movie_ended && !movie_started)
- return;
-
- // just drew the final frame
- movie_ended = true;
- movie_started = false;
- current_stimulus_group_index = -1;
-
- // cancel any existing updates
- schedule_node->cancel();
- //schedule_node->kill();
+MovieStimulus::MovieStimulus(const std::string &_tag,
+ const shared_ptr &_scheduler,
+ const shared_ptr &_display,
+ const shared_ptr &_frames_per_second,
+ const shared_ptr &_statistics_reporting,
+ const shared_ptr &_error_reporting,
+ const shared_ptr &_stimulus_group) :
+ DynamicStimulusDriver(_scheduler,
+ _display,
+ _frames_per_second,
+ _statistics_reporting,
+ _error_reporting),
+ Stimulus(_tag)
+{
+ stimulus_group = _stimulus_group;
}
void MovieStimulus::draw(shared_ptr display) {
- boost::mutex::scoped_lock locker(movie_lock);
-
- // this is the first draw that the movie has recieved...schedule the display updates accordingly
- if(!movie_ended && movie_started) {
- const double frames_per_us = frames_per_second->getValue().getFloat()/1000000;
- const int number_of_frames_to_show = (end_frame_index->getValue().getInteger()-start_frame_index->getValue().getInteger()) + 1;
- // don't go over the end of the series of frames when you get to it (i.e. the max frame to reach is the last one)
- current_stimulus_group_index = min((long)floor((scheduler->getClock()->getCurrentTimeUS()-start_time)*frames_per_us), end_frame_index->getValue().getInteger());
-
- stimulus_group->getElement(current_stimulus_group_index)->draw(display);
- if(current_stimulus_group_index >= (unsigned int)end_frame_index->getValue().getInteger()) {
- // just drew the final frame
- movie_will_end = true;
-
- // cancel any existing updates
- schedule_node->kill();
-
- // schedule the time to hide the last frame
- const MWorksTime time_to_hide_final_frame = start_time + (1/frames_per_us)*number_of_frames_to_show;
-
- shared_ptr shared_ptr_to_this = shared_from_this();
-
- schedule_node = scheduler->scheduleUS(FILELINE,
- time_to_hide_final_frame - scheduler->getClock()->getCurrentTimeUS(),
- 0,
- 1,
- boost::bind(finalFrame, shared_ptr_to_this),
- M_DEFAULT_PRIORITY,
- M_DEFAULT_WARN_SLOP_US,
- M_DEFAULT_FAIL_SLOP_US,
- M_MISSED_EXECUTION_CATCH_UP);
-
- }
- }
-}
-
-void MovieStimulus::endMovie() {
- {
- boost::mutex::scoped_lock locker(movie_lock);
-
- schedule_node->kill();
-
- // package up the results of the movie
- Datum times_shown_report(M_LIST, 1);
- int total_frames_shown = 0;
-
- for(std::vector > >::const_iterator i = times_shown.begin();
- i != times_shown.end();
- ++i) {
- Datum times_shown_for_stim(M_LIST, 1);
-
- for(std::vector::const_iterator j = (*i)->begin();
- j != (*i)->end();
- ++j) {
- times_shown_for_stim.addElement(*j);
- ++total_frames_shown;
- }
-
- times_shown_report.addElement(times_shown_for_stim);
- }
-
- const bool error_occured = total_frames_shown != (end_frame_index->getValue().getInteger()-start_frame_index->getValue().getInteger()) + 1;
-
- Datum movie_stats_report(M_DICTIONARY, 7);
- movie_stats_report.addElement("movie_tag", tag);
- movie_stats_report.addElement("times_shown", times_shown_report);
- movie_stats_report.addElement("frames_per_second", frames_per_second->getValue());
- movie_stats_report.addElement("start_frame_index", start_frame_index->getValue());
- movie_stats_report.addElement("end_frame_index", end_frame_index->getValue());
- movie_stats_report.addElement("total_frames_shown", Datum(M_INTEGER, total_frames_shown));
- movie_stats_report.addElement("error_occured", error_occured);
-
- movie_stats->setValue(movie_stats_report);
- error_reporting->setValue(error_occured);
- }
-
- display->updateDisplay();
-}
-
-
-
-void MovieStimulus::callUpdateDisplay() {
- {
- boost::mutex::scoped_lock locker(movie_lock);
- ++updates_scheduled;
- }
-
- display->asynchronousUpdateDisplay();
-}
-
-void MovieStimulus::stimDisplayUpdateNotification(const Datum &data, const MWorksTime time_us) {
- boost::mutex::scoped_lock locker(movie_lock);
-
- if(movie_started && !movie_ended) {
-
- // go through each #stimDisplayUpdate set and pull out the frames that are shown in the movie
- for(int i=0; i > times_to_date = times_shown.at(current_stimulus_group_index);
- times_to_date->push_back(time_us);
- // std::map > >::size_type>::iterator iter = index_hash.find(stim_tag);
- // if(iter != index_hash.end()) {
- // shared_ptr > times_to_date = times_shown.at(iter->second);
- // times_to_date->push_back(time_us);
- // }
- }
- }
- }
-
- // if the movie is planned on ending after this frame, end it
- if(movie_will_end) {
- movie_ended = true;
- current_stimulus_group_index = -1;
- }
- }
+ int currentFrame = getFrameNumber();
+
+ if(currentFrame < stimulus_group->getNElements()) {
+ // Draw the current frame
+ stimulus_group->getElement(currentFrame)->draw(display);
+ } else {
+ // Out of frames; end the movie
+ stop();
+ }
}
Datum MovieStimulus::getCurrentAnnounceDrawData() {
- boost::mutex::scoped_lock locker(movie_lock);
- // mprintf("%s, announcing: %d", tag.c_str(), current_stimulus_group_index);
- //
- // if(movie_playing && !movie_ended) {
- Datum announceData(M_DICTIONARY, 3);
- announceData.addElement(STIM_NAME,tag); // char
- announceData.addElement(STIM_ACTION,STIM_ACTION_DRAW);
+ boost::mutex::scoped_lock locker(stim_lock);
+ Datum announceData = DynamicStimulusDriver::getCurrentAnnounceDrawData();
+ announceData.addElement(STIM_NAME,tag);
announceData.addElement(STIM_TYPE,STIM_TYPE_MOVIE);
- announceData.addElement(STIM_MOVIE_PLAYING, Datum(movie_started && !movie_ended));
- announceData.addElement(STIM_MOVIE_CURRENT_FRAME, Datum((long)current_stimulus_group_index));
+ announceData.addElement(STIM_MOVIE_PLAYING, Datum(started));
+ announceData.addElement(STIM_MOVIE_CURRENT_FRAME, Datum((long)getFrameNumber()));
return (announceData);
}
-void *nextUpdate(const shared_ptr &movie){
- movie->callUpdateDisplay();
- return 0;
-}
-
-void *finalFrame(const shared_ptr &movie){
- movie->endMovie();
- return 0;
-}
-
shared_ptr MovieStimulusFactory::createObject(std::map parameters,
ComponentRegistry *reg) {
const char *TAG = "tag";
@@ -303,9 +59,6 @@ shared_ptr MovieStimulusFactory::createObject(std::map MovieStimulusFactory::createObject(std::map error_reporting = reg->getVariable(parameters.find(ERROR_REPORTING)->second);
checkAttribute(error_reporting, parameters.find("reference_id")->second, ERROR_REPORTING, parameters.find(ERROR_REPORTING)->second);
-
- boost::shared_ptr start_frame_index = boost::shared_ptr(new ConstantVariable(Datum(M_INTEGER, 0)));
- if(parameters.find(START_FRAME_INDEX) != parameters.end()) {
- start_frame_index = reg->getVariable(parameters.find(START_FRAME_INDEX)->second);
- checkAttribute(start_frame_index,
- parameters.find("reference_id")->second,
- START_FRAME_INDEX,
- parameters.find(START_FRAME_INDEX)->second);
- }
-
- boost::shared_ptr end_frame_index = boost::shared_ptr(new ConstantVariable(Datum(M_INTEGER, -1)));
- if(parameters.find(END_FRAME_INDEX) != parameters.end()) {
- end_frame_index = reg->getVariable(parameters.find(END_FRAME_INDEX)->second);
- checkAttribute(end_frame_index,
- parameters.find("reference_id")->second,
- END_FRAME_INDEX,
- parameters.find(END_FRAME_INDEX)->second);
- }
-
boost::shared_ptr scheduler = Scheduler::instance();
if(scheduler == 0) {
throw SimpleException("Attempt to create movie stimulus without a valid scheduler");
@@ -359,15 +93,13 @@ shared_ptr MovieStimulusFactory::createObject(std::map new_movie = shared_ptr(new MovieStimulus(scheduler,
- display,
- tagname,
- the_group,
- frames_per_second,
- movie_stats,
- error_reporting,
- start_frame_index,
- end_frame_index));
+ shared_ptr new_movie = shared_ptr(new MovieStimulus(tagname,
+ scheduler,
+ display,
+ frames_per_second,
+ movie_stats,
+ error_reporting,
+ the_group));
shared_ptr thisStimNode = shared_ptr(new StimulusNode(new_movie));
reg->registerStimulusNode(tagname, thisStimNode);
diff --git a/MoviePlugin/MovieStimulus.h b/MoviePlugin/MovieStimulus.h
index 27ac263..7dd26d3 100644
--- a/MoviePlugin/MovieStimulus.h
+++ b/MoviePlugin/MovieStimulus.h
@@ -10,75 +10,31 @@
#ifndef MOVIE_STIMULUS_H_
#define MOVIE_STIMULUS_H_
-#include
-#include "MovieFrame.h"
-#include "MWorksCore/StimulusNode.h"
-#include "MWorksCore/Scheduler.h"
+#include "MWorksCore/DynamicStimulusDriver.h"
+#include "MWorksCore/Stimulus.h"
#include "MWorksCore/ComponentRegistry.h"
-#include "MovieStimulusFrameNotification.h"
-#include
-#include
using namespace mw;
-class MovieStimulusFrameNotification;
-
-class MovieStimulus : public Stimulus, public boost::enable_shared_from_this {
+class MovieStimulus : public DynamicStimulusDriver, public Stimulus {
protected:
- boost::shared_ptr scheduler;
- boost::shared_ptr display;
boost::shared_ptr stimulus_group;
- boost::shared_ptr schedule_node;
-
- boost::shared_ptr frames_per_second;
- boost::shared_ptr movie_stats;
- boost::shared_ptr error_reporting;
- boost::shared_ptr start_frame_index;
- boost::shared_ptr end_frame_index;
- boost::shared_ptr stimDisplayUpdateNotificationObject;
-
- unsigned int current_stimulus_group_index;
- unsigned int updates_scheduled;
-
- std::vector > > times_shown;
-
- bool movie_ended;
- bool movie_will_end;
- bool movie_started;
- MWorksTime start_time;
-
- boost::mutex movie_lock;
public:
- MovieStimulus(const boost::shared_ptr &a_scheduler,
- const boost::shared_ptr &a_display,
- const std::string &new_tag,
- const boost::shared_ptr stimulus_group,
- const boost::shared_ptr frames_per_second_var,
- const boost::shared_ptr movie_stats_var,
- const boost::shared_ptr error_reporting_var,
- const boost::shared_ptr start_frame_var,
- const boost::shared_ptr end_frame_var);
-
- Stimulus *frozenClone();
-
- void play();
- void stopAndRewind();
-
- int getNFramesToShow();
- int getNFramesShown();
-
- void draw(shared_ptr display);
+ MovieStimulus(const std::string &_tag,
+ const boost::shared_ptr &_scheduler,
+ const boost::shared_ptr &_display,
+ const boost::shared_ptr &_frames_per_second,
+ const boost::shared_ptr &_statistics_reporting,
+ const boost::shared_ptr &_error_reporting,
+ const boost::shared_ptr &_stimulus_group);
- void callUpdateDisplay();
- void endMovie();
- Datum getCurrentAnnounceDrawData();
+ virtual void draw(shared_ptr display);
+ virtual Datum getCurrentAnnounceDrawData();
- void stimDisplayUpdateNotification(const Datum &data,
- const MWorksTime time_us);
};
class MovieStimulusFactory : public ComponentFactory {
diff --git a/MoviePlugin/MovieStimulusFrameNotification.cpp b/MoviePlugin/MovieStimulusFrameNotification.cpp
deleted file mode 100644
index 92cd1bf..0000000
--- a/MoviePlugin/MovieStimulusFrameNotification.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * MovieStimulusFrameNotification.cpp
- * MWorksCore
- *
- * Created by labuser on 5/23/08.
- * Copyright 2008 MIT. All rights reserved.
- *
- */
-
-#include "MovieStimulusFrameNotification.h"
-
-MovieStimulusFrameNotification::MovieStimulusFrameNotification(MovieStimulus *the_ms){
- movie_stimulus = the_ms;
-}
-
-void MovieStimulusFrameNotification::notify(const Datum &data) {
- shared_ptr clock = Clock::instance();
- this->notify(data, clock->getCurrentTimeUS());
-}
-
-void MovieStimulusFrameNotification::notify(const Datum &data, MWorksTime time_us) {
- movie_stimulus->stimDisplayUpdateNotification(data, time_us);
-}
diff --git a/MoviePlugin/MovieStimulusFrameNotification.h b/MoviePlugin/MovieStimulusFrameNotification.h
deleted file mode 100644
index f2211c0..0000000
--- a/MoviePlugin/MovieStimulusFrameNotification.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * MovieStimulusFrameNotification.h
- * MWorksCore
- *
- * Created by labuser on 5/23/08.
- * Copyright 2008 MIT. All rights reserved.
- *
- */
-
-#ifndef MOVIE_STIMULUS_FRAME_NOTIFICATION_H_
-#define MOVIE_STIMULUS_FRAME_NOTIFICATION_H_
-
-#include "MovieStimulus.h"
-#include "MWorksCore/GenericVariable.h"
-
-class MovieStimulus;
-
-class MovieStimulusFrameNotification : public VariableNotification {
-protected:
-
- MovieStimulus *movie_stimulus;
-
-public:
-
- MovieStimulusFrameNotification(MovieStimulus *the_ms);
- virtual void notify(const Datum& data);
- virtual void notify(const Datum& data, MWorksTime timeUS);
-
-};
-
-
-#endif /* MOVIE_STIMULUS_FRAME_NOTIFICATION_H_ */
diff --git a/MoviePlugin/MovieStimulusPlugin.xcodeproj/project.pbxproj b/MoviePlugin/MovieStimulusPlugin.xcodeproj/project.pbxproj
index 39d5948..620de2c 100644
--- a/MoviePlugin/MovieStimulusPlugin.xcodeproj/project.pbxproj
+++ b/MoviePlugin/MovieStimulusPlugin.xcodeproj/project.pbxproj
@@ -34,9 +34,7 @@
/* Begin PBXBuildFile section */
0E37FBA30E59C3DD008B885D /* MovieStimulusPlugin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0E37FBA10E59C3DD008B885D /* MovieStimulusPlugin.cpp */; };
0E3A0B530EEDA37500F5C65A /* MWLibrary.xml in Resources */ = {isa = PBXBuildFile; fileRef = 0E3A0B520EEDA37500F5C65A /* MWLibrary.xml */; };
- 0EDE104B0E58BA690031005B /* MovieFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0EDE10450E58BA690031005B /* MovieFrame.cpp */; };
0EDE104C0E58BA690031005B /* MovieStimulus.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0EDE10470E58BA690031005B /* MovieStimulus.cpp */; };
- 0EDE104D0E58BA690031005B /* MovieStimulusFrameNotification.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0EDE10490E58BA690031005B /* MovieStimulusFrameNotification.cpp */; };
0EDE10520E58BAD90031005B /* PlayMovie.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0EDE10510E58BAD90031005B /* PlayMovie.cpp */; };
0EDE10550E58BAE60031005B /* StopMovie.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0EDE10540E58BAE60031005B /* StopMovie.cpp */; };
5C4B0A650DC79212001BC518 /* MWorksCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5C4B0A630DC79212001BC518 /* MWorksCore.framework */; };
@@ -60,12 +58,8 @@
0E37FBA10E59C3DD008B885D /* MovieStimulusPlugin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MovieStimulusPlugin.cpp; sourceTree = ""; };
0E37FBA20E59C3DD008B885D /* MovieStimulusPlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MovieStimulusPlugin.h; sourceTree = ""; };
0E3A0B520EEDA37500F5C65A /* MWLibrary.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = MWLibrary.xml; sourceTree = ""; };
- 0EDE10450E58BA690031005B /* MovieFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MovieFrame.cpp; sourceTree = ""; };
- 0EDE10460E58BA690031005B /* MovieFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MovieFrame.h; sourceTree = ""; };
0EDE10470E58BA690031005B /* MovieStimulus.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MovieStimulus.cpp; sourceTree = ""; };
0EDE10480E58BA690031005B /* MovieStimulus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MovieStimulus.h; sourceTree = ""; };
- 0EDE10490E58BA690031005B /* MovieStimulusFrameNotification.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MovieStimulusFrameNotification.cpp; sourceTree = ""; };
- 0EDE104A0E58BA690031005B /* MovieStimulusFrameNotification.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MovieStimulusFrameNotification.h; sourceTree = ""; };
0EDE10500E58BAD90031005B /* PlayMovie.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlayMovie.h; sourceTree = ""; };
0EDE10510E58BAD90031005B /* PlayMovie.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlayMovie.cpp; sourceTree = ""; };
0EDE10530E58BAE60031005B /* StopMovie.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StopMovie.h; sourceTree = ""; };
@@ -136,12 +130,8 @@
0EDE10440E58BA400031005B /* MovieStimuli */ = {
isa = PBXGroup;
children = (
- 0EDE10450E58BA690031005B /* MovieFrame.cpp */,
- 0EDE10460E58BA690031005B /* MovieFrame.h */,
0EDE10470E58BA690031005B /* MovieStimulus.cpp */,
0EDE10480E58BA690031005B /* MovieStimulus.h */,
- 0EDE10490E58BA690031005B /* MovieStimulusFrameNotification.cpp */,
- 0EDE104A0E58BA690031005B /* MovieStimulusFrameNotification.h */,
0EDE10500E58BAD90031005B /* PlayMovie.h */,
0EDE10510E58BAD90031005B /* PlayMovie.cpp */,
0EDE10530E58BAE60031005B /* StopMovie.h */,
@@ -280,9 +270,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- 0EDE104B0E58BA690031005B /* MovieFrame.cpp in Sources */,
0EDE104C0E58BA690031005B /* MovieStimulus.cpp in Sources */,
- 0EDE104D0E58BA690031005B /* MovieStimulusFrameNotification.cpp in Sources */,
0EDE10520E58BAD90031005B /* PlayMovie.cpp in Sources */,
0EDE10550E58BAE60031005B /* StopMovie.cpp in Sources */,
0E37FBA30E59C3DD008B885D /* MovieStimulusPlugin.cpp in Sources */,
diff --git a/MoviePlugin/PlayMovie.cpp b/MoviePlugin/PlayMovie.cpp
index 6c5a934..e6cd4de 100644
--- a/MoviePlugin/PlayMovie.cpp
+++ b/MoviePlugin/PlayMovie.cpp
@@ -8,24 +8,17 @@
*/
#include "PlayMovie.h"
-
-PlayMovie::PlayMovie(shared_ptr the_movie) :
-Action()
-{
- setName("PlayMovie");
- movie=the_movie;
-}
-
-bool PlayMovie::execute() {
- movie->play();
- return true;
-}
+#include "MovieStimulus.h"
+#include "MWorksCore/PlayDynamicStimulus.h"
shared_ptr PlayMovieFactory::createObject(std::map parameters,
ComponentRegistry *reg) {
- const char *MOVIE = "movie";
+ mwarning(M_PLUGIN_MESSAGE_DOMAIN,
+ "\"Play Movie\" is deprecated. Please use \"Play Dynamic Stimulus\" instead.");
+ const char *MOVIE = "movie";
+
REQUIRE_ATTRIBUTES(parameters, MOVIE);
shared_ptr the_movie = reg->getObject(parameters.find(MOVIE)->second);
@@ -34,7 +27,7 @@ shared_ptr PlayMovieFactory::createObject(std::mapsecond, MOVIE, parameters.find(MOVIE)->second);
}
- shared_ptr new_play_movie_action = shared_ptr(new PlayMovie(the_movie));
+ shared_ptr new_play_movie_action = shared_ptr(new PlayDynamicStimulus(the_movie));
return new_play_movie_action;
}
diff --git a/MoviePlugin/PlayMovie.h b/MoviePlugin/PlayMovie.h
index 6167a42..5ea414d 100644
--- a/MoviePlugin/PlayMovie.h
+++ b/MoviePlugin/PlayMovie.h
@@ -11,20 +11,9 @@
#define PLAY_MOVIE_ACTION_H_
#include "MWorksCore/TrialBuildingBlocks.h"
-#include "MovieStimulus.h"
using namespace mw;
-class PlayMovie : public Action {
-protected:
- shared_ptr movie;
-
-public:
-
- PlayMovie(shared_ptr the_movie);
- virtual bool execute();
-};
-
class PlayMovieFactory : public ComponentFactory {
virtual boost::shared_ptr createObject(std::map parameters,
ComponentRegistry *reg);
diff --git a/MoviePlugin/StopMovie.cpp b/MoviePlugin/StopMovie.cpp
index c58b0e0..4377b74 100644
--- a/MoviePlugin/StopMovie.cpp
+++ b/MoviePlugin/StopMovie.cpp
@@ -8,25 +8,17 @@
*/
#include "StopMovie.h"
-
-StopMovie::StopMovie(shared_ptr the_movie) :
-Action()
-{
- setName("StopAndRewindMovie");
- movie=the_movie;
-}
-
-bool StopMovie::execute() {
- movie->stopAndRewind();
- return true;
-}
-
+#include "MovieStimulus.h"
+#include "MWorksCore/StopDynamicStimulus.h"
shared_ptr StopMovieFactory::createObject(std::map parameters,
ComponentRegistry *reg) {
- const char *MOVIE = "movie";
+ mwarning(M_PLUGIN_MESSAGE_DOMAIN,
+ "\"Stop Movie\" is deprecated. Please use \"Stop Dynamic Stimulus\" instead.");
+ const char *MOVIE = "movie";
+
REQUIRE_ATTRIBUTES(parameters, MOVIE);
shared_ptr the_movie = reg->getObject(parameters.find(MOVIE)->second);
@@ -35,6 +27,6 @@ shared_ptr StopMovieFactory::createObject(std::mapsecond, MOVIE, parameters.find(MOVIE)->second);
}
- shared_ptr new_stop_movie_action = shared_ptr(new StopMovie(the_movie));
+ shared_ptr new_stop_movie_action = shared_ptr(new StopDynamicStimulus(the_movie));
return new_stop_movie_action;
}
diff --git a/MoviePlugin/StopMovie.h b/MoviePlugin/StopMovie.h
index cbd5690..eca50fb 100644
--- a/MoviePlugin/StopMovie.h
+++ b/MoviePlugin/StopMovie.h
@@ -11,16 +11,8 @@
#define STOP_MOVIE_ACTION_H_
#include "MWorksCore/TrialBuildingBlocks.h"
-#include "MovieStimulus.h"
using namespace mw;
-class StopMovie : public Action {
-protected:
- shared_ptr movie;
-public:
- StopMovie(shared_ptr the_movie);
- virtual bool execute();
-};
class StopMovieFactory : public ComponentFactory {
virtual boost::shared_ptr createObject(std::map parameters,