Mercurial > hg > vamp-live-host
view host/Processor.h @ 6:b046af03c719
* Added image window stuff
author | cannam |
---|---|
date | Fri, 10 Nov 2006 17:46:44 +0000 |
parents | 7fc28f7a935a |
children | b30fcffc5000 |
line wrap: on
line source
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ #ifndef _PROCESSOR_H_ #define _PROCESSOR_H_ #include <QThread> #include <QString> #include <QMutex> #include "audioio/BufferingAudioCallbackRecordTarget.h" #include <vamp-sdk/Plugin.h> #include "Rule.h" #include <map> #include <set> class Processor : public QThread { Q_OBJECT public: Processor(BufferingAudioCallbackRecordTarget *audioRecordTarget); virtual ~Processor(); int addPlugin(QString pluginId); // returns reference number, 0 for failure void removePlugin(int number); void addImageRule(Rule rule, QString image); signals: void showImage(QString image); protected: virtual void run(); bool runPlugins(); bool processRules(); bool m_exiting; BufferingAudioCallbackRecordTarget *m_audioRecordTarget; // Plugins indexed by plugin number typedef std::map<int, Vamp::Plugin *> PluginMap; PluginMap m_plugins; int m_nextNumber; // Map back from plugin to index typedef std::map<Vamp::Plugin *, int> PluginRMap; PluginRMap m_pluginRMap; // The same plugins, indexed by step and block sizes typedef std::set<Vamp::Plugin *> PluginSet; typedef std::map<size_t, PluginSet> BlockSizePluginMap; typedef std::map<size_t, BlockSizePluginMap> StepSizePluginMap; StepSizePluginMap m_processingMap; // A map from step size to ring buffer reader number typedef std::map<size_t, int> StepSizeReaderMap; typedef std::set<int> ReaderSet; StepSizeReaderMap m_stepSizeReaderMap; ReaderSet m_unusedReaders; // Map from rule to image name typedef std::multimap<Rule, QString> RuleImageMap; RuleImageMap m_imageRules; class OutputState { public: OutputState() : present(false), changed(false), value(0.f) { } OutputState(bool p, bool c, float v, Vamp::RealTime s, Vamp::RealTime g) : present(p), changed(c), value(v), laststamp(s), gap(g) { } bool present; bool changed; float value; Vamp::RealTime laststamp; Vamp::RealTime gap; }; // Map from plugin index to output index to state typedef std::map<int, OutputState> OutputStateMap; typedef std::map<int, OutputStateMap> PluginStateMap; PluginStateMap m_pluginStates; bool m_havePlugins; size_t m_minBlockSize; size_t m_maxBlockSize; QMutex m_mutex; }; #endif