From 46f6e64539f77eb07b2886aaaab358afd72569ce Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Mon, 21 Jan 2013 10:17:49 -0500 Subject: abstract volume/balance output away from ponymix Add a Notifier virtual base class and a CommandLineNotifier implementation which handles output of volume and balance levels after a change. --- notify.h | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 notify.h (limited to 'notify.h') diff --git a/notify.h b/notify.h new file mode 100644 index 0000000..03f6775 --- /dev/null +++ b/notify.h @@ -0,0 +1,38 @@ +#pragma once + +#include + +enum NotificationType { + NOTIFY_VOLUME, + NOTIFY_BALANCE, + NOTIFY_UNMUTE, + NOTIFY_MUTE, +}; + +class Notifier { + public: + virtual ~Notifier() {} + + virtual void Notify(enum NotificationType type, long value, bool mute) = 0; + + protected: + bool initialized_; +}; + +class CommandLineNotifier : public Notifier { + public: + virtual ~CommandLineNotifier() {} + + virtual void Notify(enum NotificationType type, long value, bool) { + switch (type) { + case NOTIFY_VOLUME: + case NOTIFY_BALANCE: + case NOTIFY_UNMUTE: + case NOTIFY_MUTE: + printf("%ld\n", value); + break; + } + } +}; + +// vim: set et ts=2 sw=2: -- cgit v1.2.3