summaryrefslogtreecommitdiffstats
path: root/audio_hw.h
blob: dc5d395154b4e29810fc065aad011b06e9d9270b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*
 * 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>

#ifdef YAMAHA_MC1N2_AUDIO
#include <yamaha-mc1n2-audio.h>
#endif

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_channels_t channels;
	audio_format_t format;

	audio_devices_t device_current;

	struct pcm *pcm;
	int standby;
};

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_channels_t channels;
	audio_format_t format;

	audio_devices_t device_current;

	struct pcm *pcm;
	int standby;
};

struct tinyalsa_audio_device {
	struct audio_hw_device device;

	struct tinyalsa_audio_stream_out *stream_out;
	struct tinyalsa_audio_stream_in *stream_in;

#ifdef YAMAHA_MC1N2_AUDIO
	struct yamaha_mc1n2_audio_pdata *mc1n2_pdata;
#endif

	struct tinyalsa_mixer *mixer;
	audio_mode_t mode;
	int mic_mute;
};

int audio_hw_open_output_stream(struct audio_hw_device *dev,
	uint32_t devices, int *format, uint32_t *channels, uint32_t *sample_rate,
	struct audio_stream_out **stream_out);
void audio_hw_close_output_stream(struct audio_hw_device *dev,
	struct audio_stream_out *stream);

int audio_out_set_route(struct tinyalsa_audio_stream_out *stream_out,
	audio_devices_t device);

int audio_hw_open_input_stream(struct audio_hw_device *dev,
	uint32_t devices, int *format, uint32_t *channels, uint32_t *sample_rate,
	audio_in_acoustics_t acoustics, struct audio_stream_in **stream_in);
void audio_hw_close_input_stream(struct audio_hw_device *dev,
	struct audio_stream_in *stream);

#endif