]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - mix.h
fade: Switch to modular mixer API.
[paraslash.git] / mix.h
diff --git a/mix.h b/mix.h
new file mode 100644 (file)
index 0000000..a410554
--- /dev/null
+++ b/mix.h
@@ -0,0 +1,28 @@
+/**
+ * Opaque structure which corresponds to an instance of a mixer.
+ *
+ * A pointer to a structure of this type is returned by ->open().  This pointer
+ * must be passed to most other methods of \ref struct mixer.
+ */
+struct mixer_handle;
+
+/**
+ * Operations provided by each mixer plugin.
+ */
+struct mixer {
+       /** Called on startup, must fill in all other members. */
+       void (*init)(struct mixer *self);
+       /** Return a handle that can be passed to other methods. */
+       int (*open)(const char *dev, struct mixer_handle **handle);
+       /** Returns a string of all valid mixer channels. */
+       char *(*get_channels)(struct mixer_handle *handle);
+       /** Select the channel for subsequent get/set operations. */
+       int (*set_channel)(struct mixer_handle *handle,
+               const char *mixer_channel);
+       /** Return the (normalized) current value of the selected channel. */
+       int (*get)(struct mixer_handle *handle);
+       /** Change the value of the selected channel. */
+       int (*set)(struct mixer_handle *handle, int val);
+       /** Free all ressources associated with the given handle. */
+       void (*close)(struct mixer_handle **handle);
+};