summaryrefslogtreecommitdiffstats
path: root/tinyalsa_audio/audio_hw.h
diff options
context:
space:
mode:
authorAndrew Dodd <atd7@cornell.edu>2012-11-10 14:23:08 -0500
committercodeworkx <codeworkx@cyanogenmod.org>2012-12-02 15:33:50 +0100
commitcdc1a96ac05f2eb3e2fea69aa90a18ae3d5696cd (patch)
tree45b05501c3321d44b4a6e48c39f06d000911e41f /tinyalsa_audio/audio_hw.h
parentfd9472ca4bff6c415a1bdfc95a56e64efee5ccf7 (diff)
downloaddevice_samsung_galaxys2-common-cdc1a96ac05f2eb3e2fea69aa90a18ae3d5696cd.zip
device_samsung_galaxys2-common-cdc1a96ac05f2eb3e2fea69aa90a18ae3d5696cd.tar.gz
device_samsung_galaxys2-common-cdc1a96ac05f2eb3e2fea69aa90a18ae3d5696cd.tar.bz2
mc1n2: Opensource audio HAL from Replicant
Thanks to Paul Kocialkowski of the Replicant project for this work. Original sources: https://gitorious.org/replicant/hardware_tinyalsa-audio http://git.paulk.fr/gitweb/?p=yamaha-mc1n2-audio.git;a=summary Change-Id: Ia3d89c67d64decb56e3d6518c5f382d38e5a1fa9
Diffstat (limited to 'tinyalsa_audio/audio_hw.h')
-rw-r--r--tinyalsa_audio/audio_hw.h119
1 files changed, 119 insertions, 0 deletions
diff --git a/tinyalsa_audio/audio_hw.h b/tinyalsa_audio/audio_hw.h
new file mode 100644
index 0000000..903d202
--- /dev/null
+++ b/tinyalsa_audio/audio_hw.h
@@ -0,0 +1,119 @@
+/*
+ * 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_HW_H
+#define TINYALSA_AUDIO_HW_H
+
+#include <hardware/hardware.h>
+#include <hardware/audio.h>
+#include <system/audio.h>
+
+#include <audio_utils/resampler.h>
+
+#ifdef YAMAHA_MC1N2_AUDIO
+#include <yamaha-mc1n2-audio.h>
+#endif
+
+#include "mixer.h"
+#include "audio_ril_interface.h"
+
+struct tinyalsa_audio_stream_out {
+ struct audio_stream_out stream;
+ struct tinyalsa_audio_device *device;
+
+ struct tinyalsa_mixer_io_props *mixer_props;
+ int rate;
+ audio_channel_mask_t channel_mask;
+ audio_format_t format;
+
+ audio_devices_t device_current;
+
+ struct resampler_itfe *resampler;
+
+ struct pcm *pcm;
+ int standby;
+
+ pthread_mutex_t lock;
+};
+
+struct tinyalsa_audio_stream_in {
+ struct audio_stream_in stream;
+ struct tinyalsa_audio_device *device;
+
+ struct tinyalsa_mixer_io_props *mixer_props;
+ int rate;
+
+ audio_channel_mask_t channel_mask;
+ audio_format_t format;
+
+ audio_devices_t device_current;
+
+ struct resampler_itfe *resampler;
+ struct resampler_buffer_provider buffer_provider;
+ void *buffer;
+ int frames_left;
+
+ struct pcm *pcm;
+ int standby;
+
+ pthread_mutex_t lock;
+};
+
+struct tinyalsa_audio_device {
+ struct audio_hw_device device;
+
+ struct tinyalsa_audio_stream_out *stream_out;
+ struct tinyalsa_audio_stream_in *stream_in;
+ struct tinyalsa_audio_ril_interface *ril_interface;
+
+#ifdef YAMAHA_MC1N2_AUDIO
+ struct yamaha_mc1n2_audio_pdata *mc1n2_pdata;
+#endif
+
+ struct tinyalsa_mixer *mixer;
+ audio_mode_t mode;
+
+ float voice_volume;
+ int mic_mute;
+
+ pthread_mutex_t lock;
+};
+
+int audio_out_set_route(struct tinyalsa_audio_stream_out *stream_out,
+ audio_devices_t device);
+
+void audio_hw_close_output_stream(struct audio_hw_device *dev,
+ struct audio_stream_out *stream);
+int audio_hw_open_output_stream(struct audio_hw_device *dev,
+ audio_io_handle_t handle,
+ audio_devices_t devices,
+ audio_output_flags_t flags,
+ struct audio_config *config,
+ struct audio_stream_out **stream_out);
+
+int audio_in_set_route(struct tinyalsa_audio_stream_in *stream_in,
+ audio_devices_t device);
+
+void audio_hw_close_input_stream(struct audio_hw_device *dev,
+ struct audio_stream_in *stream);
+int audio_hw_open_input_stream(struct audio_hw_device *dev,
+ audio_io_handle_t handle,
+ audio_devices_t devices,
+ struct audio_config *config,
+ struct audio_stream_in **stream_in);
+
+#endif