#pragma once #include "ofMain.h" #include "SourceType.h" namespace ofx { namespace piMapper { class DirectoryWatcher : public ofThread { public: DirectoryWatcher(std::string path, int watcherMediaType); virtual ~DirectoryWatcher(); std::vector &getFilePaths(); int getMediaType(); void beginWatch(int intervalInMillis = 5000); void threadedFunction(); /** * Notifies when files are added to this directory. * Sender is a pointer to this DirectoryWatcher */ ofEvent directoryFileAddedEvent; /** * Notifies when files are removed from this directory. * Sender is a pointer to this DirectoryWatcher */ ofEvent directoryFileRemovedEvent; private: ofDirectory _directory; std::vector _filePaths; std::string directoryPath; int _mediaType; int dirSize; long watchInterval; // in millis. }; } // namespace piMapper } // namespace ofx