diff options
author | Dave Reisner <dreisner@archlinux.org> | 2013-01-21 10:17:49 -0500 |
---|---|---|
committer | Dave Reisner <dreisner@archlinux.org> | 2013-01-21 15:49:31 -0500 |
commit | 46f6e64539f77eb07b2886aaaab358afd72569ce (patch) | |
tree | 0cb0e0555d0ce6fb20d9683cf0ec70e233314b49 /notify.h | |
parent | 2bdbd84cc41975c7d9855551cecef02ff41c2b2a (diff) | |
download | mirror-ponymix-46f6e64539f77eb07b2886aaaab358afd72569ce.tar.gz mirror-ponymix-46f6e64539f77eb07b2886aaaab358afd72569ce.tar.bz2 mirror-ponymix-46f6e64539f77eb07b2886aaaab358afd72569ce.zip |
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.
Diffstat (limited to 'notify.h')
-rw-r--r-- | notify.h | 38 |
1 files changed, 38 insertions, 0 deletions
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 <stdio.h> + +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: |