aboutsummaryrefslogtreecommitdiffstats
path: root/src/mixer_api.h
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-02-16 01:39:52 +0100
committerMax Kellermann <max@duempel.org>2009-02-16 01:39:52 +0100
commit83ce0e5325b9bcf9b339ea9c69b658d45b4125cf (patch)
treefa7438905b1fa2219832ecfc4c1d4e9ecc40c55e /src/mixer_api.h
parent37bc31d161d486d0499cf64123b7561f57dd0c53 (diff)
downloadmpd-83ce0e5325b9bcf9b339ea9c69b658d45b4125cf.tar.gz
mpd-83ce0e5325b9bcf9b339ea9c69b658d45b4125cf.tar.xz
mpd-83ce0e5325b9bcf9b339ea9c69b658d45b4125cf.zip
mixer_api: replaced method "control()" with "{get,set}_volume()"
The method control() is too complicated, and overengineered. Replace it with two trivial functions: get_volume() and set_volume().
Diffstat (limited to '')
-rw-r--r--src/mixer_api.h34
1 files changed, 28 insertions, 6 deletions
diff --git a/src/mixer_api.h b/src/mixer_api.h
index b79d02a1c..8dbbbe820 100644
--- a/src/mixer_api.h
+++ b/src/mixer_api.h
@@ -45,14 +45,25 @@ struct mixer_plugin {
bool (*open)(struct mixer *data);
/**
- * Control mixer device.
- */
- bool (*control)(struct mixer *data, int cmd, void *arg);
-
- /**
* Close mixer device
*/
void (*close)(struct mixer *data);
+
+ /**
+ * Reads the current volume.
+ *
+ * @return the current volume (0..100 including) or -1 on
+ * error
+ */
+ int (*get_volume)(struct mixer *mixer);
+
+ /**
+ * Sets the volume.
+ *
+ * @param volume the new volume (0..100 including)
+ * @return true on success
+ */
+ bool (*set_volume)(struct mixer *mixer, unsigned volume);
};
struct mixer {
@@ -72,7 +83,18 @@ void
mixer_free(struct mixer *mixer);
bool mixer_open(struct mixer *mixer);
-bool mixer_control(struct mixer *mixer, int cmd, void *arg);
void mixer_close(struct mixer *mixer);
+static inline int
+mixer_get_volume(struct mixer *mixer)
+{
+ return mixer->plugin->get_volume(mixer);
+}
+
+static inline bool
+mixer_set_volume(struct mixer *mixer, unsigned volume)
+{
+ return mixer->plugin->set_volume(mixer, volume);
+}
+
#endif