summaryrefslogtreecommitdiffstats
path: root/mixer.h
diff options
context:
space:
mode:
Diffstat (limited to 'mixer.h')
-rw-r--r--mixer.h108
1 files changed, 108 insertions, 0 deletions
diff --git a/mixer.h b/mixer.h
new file mode 100644
index 0000000..5812b76
--- /dev/null
+++ b/mixer.h
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2012 Paul Kocialkowski <contact@paulk.fr>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef TINYALSA_AUDIO_MIXER_H
+#define TINYALSA_AUDIO_MIXER_H
+
+#include <tinyalsa/asoundlib.h>
+
+#include <hardware/audio.h>
+#include <system/audio.h>
+
+#define TINYALSA_MIXER_CONFIG_FILE "/system/etc/tinyalsa-audio.xml"
+
+struct list_head {
+ struct list_head *prev;
+ struct list_head *next;
+
+ void *data;
+};
+
+enum tinyalsa_mixer_data_type {
+ MIXER_DATA_TYPE_CTRL,
+ MIXER_DATA_TYPE_WRITE,
+ MIXER_DATA_TYPE_MAX
+};
+
+struct tinyalsa_mixer_data {
+ enum tinyalsa_mixer_data_type type;
+ char *name;
+ char *value;
+ char *attr;
+};
+
+struct tinyalsa_mixer_device_props {
+ audio_devices_t type;
+ audio_mode_t mode;
+};
+
+struct tinyalsa_mixer_device {
+ struct tinyalsa_mixer_device_props props;
+ struct list_head *enable;
+ struct list_head *disable;
+};
+
+struct tinyalsa_mixer_io_props {
+ int card;
+ int device;
+
+ int rate;
+ audio_channels_t channels;
+ audio_format_t format;
+
+ int period_size;
+ int period_count;
+};
+
+struct tinyalsa_mixer_io {
+ struct tinyalsa_mixer_io_props props;
+ struct tinyalsa_mixer_device *device_current;
+ struct list_head *devices;
+};
+
+struct tinyalsa_mixer {
+ struct tinyalsa_mixer_io output;
+ struct tinyalsa_mixer_io input;
+ struct mixer *mixer;
+};
+
+struct tinyalsa_mixer_config_data {
+ struct tinyalsa_mixer *mixer;
+ struct tinyalsa_mixer_io_props io_props;
+ struct tinyalsa_mixer_device_props device_props;
+ int direction;
+
+ struct tinyalsa_mixer_device *device;
+ struct list_head **list_start;
+ struct list_head *list;
+};
+
+int tinyalsa_mixer_open(struct tinyalsa_mixer **mixer_p, char *config_file);
+void tinyalsa_mixer_close(struct tinyalsa_mixer *mixer);
+
+struct tinyalsa_mixer_io_props *tinyalsa_mixer_get_input_props(struct tinyalsa_mixer *mixer);
+struct tinyalsa_mixer_io_props *tinyalsa_mixer_get_output_props(struct tinyalsa_mixer *mixer);
+
+int tinyalsa_mixer_set_voice_volume(struct tinyalsa_mixer *mixer, audio_devices_t device);
+int tinyalsa_mixer_set_input_gain(struct tinyalsa_mixer *mixer, audio_devices_t device);
+int tinyalsa_mixer_set_mic_mute(struct tinyalsa_mixer *mixer, audio_devices_t device, int mute);
+int tinyalsa_mixer_set_master_volume(struct tinyalsa_mixer *mixer, audio_devices_t device);
+int tinyalsa_mixer_set_output_volume(struct tinyalsa_mixer *mixer, audio_devices_t device);
+
+int tinyalsa_mixer_set_route(struct tinyalsa_mixer *mixer, audio_devices_t device, audio_mode_t mode);
+
+#endif