You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
927 B
41 lines
927 B
#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<std::string> &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<void> directoryFileAddedEvent;
|
|
/**
|
|
* Notifies when files are removed from this directory.
|
|
* Sender is a pointer to this DirectoryWatcher
|
|
*/
|
|
ofEvent<void> directoryFileRemovedEvent;
|
|
|
|
private:
|
|
ofDirectory _directory;
|
|
std::vector<std::string> _filePaths;
|
|
std::string directoryPath;
|
|
int _mediaType;
|
|
|
|
int dirSize;
|
|
long watchInterval; // in millis.
|
|
};
|
|
|
|
} // namespace piMapper
|
|
} // namespace ofx
|
|
|