diff options
author | David Robillard <d@drobilla.net> | 2020-11-28 22:23:54 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-11-28 22:49:10 +0100 |
commit | 924775a79c07a4f5798fcefddb523b189e473080 (patch) | |
tree | 6a201df93b109d10cb5c5cab018ee89448c00e00 /src/AlsaDriver.hpp | |
parent | 5128bfab7ddb9504abf17375e910e5bc94af291e (diff) | |
download | patchage-924775a79c07a4f5798fcefddb523b189e473080.tar.gz patchage-924775a79c07a4f5798fcefddb523b189e473080.tar.bz2 patchage-924775a79c07a4f5798fcefddb523b189e473080.zip |
Abstract out sending of events
This removes the details of how events are handled from drivers, so the owner
can set them up to do anything. For example, a driver could be run in the GUI
thread and have its events simply dispatched immediately, but here everything
is enqueued to the same queue which is drained later for simplicity.
Diffstat (limited to 'src/AlsaDriver.hpp')
-rw-r--r-- | src/AlsaDriver.hpp | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/src/AlsaDriver.hpp b/src/AlsaDriver.hpp index 15a5086..2f4b1e3 100644 --- a/src/AlsaDriver.hpp +++ b/src/AlsaDriver.hpp @@ -23,19 +23,16 @@ #include <pthread.h> #include <map> -#include <mutex> -#include <queue> #include <set> #include <string> class ILog; -class Patchage; /// Driver for ALSA Sequencer ports class AlsaDriver : public Driver { public: - explicit AlsaDriver(ILog& log); + explicit AlsaDriver(ILog& log, EventSink emit_event); AlsaDriver(const AlsaDriver&) = delete; AlsaDriver& operator=(const AlsaDriver&) = delete; @@ -57,8 +54,6 @@ public: void print_addr(snd_seq_addr_t addr); - void process_events(Patchage* app) override; - private: bool create_refresh_port(); static void* refresh_main(void* me); @@ -68,9 +63,6 @@ private: snd_seq_t* _seq; pthread_t _refresh_thread; - std::mutex _events_mutex; - std::queue<PatchageEvent> _events; - struct SeqAddrComparator { bool operator()(const snd_seq_addr_t& a, const snd_seq_addr_t& b) const |