Mercurial > hg > vamp-live-host
view host/Processor.h @ 15:df33703ace3b
Get building with newer libraries &c
author | Chris Cannam |
---|---|
date | Tue, 03 Dec 2013 16:05:14 +0000 |
parents | bd4589c609c7 |
children |
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-hostsdk/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 addRule(Rule *rule); // I take ownership of rule 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; typedef std::multiset<Rule *> RuleSet; RuleSet m_rules; class OutputState { public: OutputState() : present(false), silentInput(true), changed(false), value(0.f) { } OutputState(bool p, bool si, bool c, float v, Vamp::RealTime s, Vamp::RealTime g) : present(p), silentInput(si), changed(c), value(v), laststamp(s), gap(g) { } bool present; bool silentInput; 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