summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Kocialkowski <contact@paulk.fr>2013-12-27 16:24:44 +0100
committerPaul Kocialkowski <contact@paulk.fr>2013-12-27 16:24:44 +0100
commiteaed2075d9d07e230779e2d5cc8cb509f43c98de (patch)
treed9e4542f665aeef224982d17cff845105bac7ebb
parentecc275e7fdbb5c61f3a39baaf74cd160545c7ef8 (diff)
downloadhardware_tinyalsa-audio-eaed2075d9d07e230779e2d5cc8cb509f43c98de.zip
hardware_tinyalsa-audio-eaed2075d9d07e230779e2d5cc8cb509f43c98de.tar.gz
hardware_tinyalsa-audio-eaed2075d9d07e230779e2d5cc8cb509f43c98de.tar.bz2
Changes for JellyBean
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
-rw-r--r--audio_hw.c71
-rw-r--r--audio_hw.h12
-rw-r--r--audio_in.c120
-rw-r--r--audio_out.c105
-rw-r--r--audio_ril_interface.c24
-rw-r--r--mixer.c202
-rw-r--r--mixer.h3
7 files changed, 237 insertions, 300 deletions
diff --git a/audio_hw.c b/audio_hw.c
index 63a9303..0a7afa0 100644
--- a/audio_hw.c
+++ b/audio_hw.c
@@ -40,28 +40,11 @@
* Functions
*/
-static uint32_t audio_hw_get_supported_devices(const struct audio_hw_device *dev)
-{
- struct tinyalsa_audio_device *device;
-
- LOGD("%s(%p)", __func__, dev);
-
- if(dev == NULL)
- return -1;
-
- device = (struct tinyalsa_audio_device *) dev;
-
- if(device->mixer == NULL)
- return -1;
-
- return (uint32_t) tinyalsa_mixer_get_supported_devices(device->mixer);
-}
-
static int audio_hw_init_check(const struct audio_hw_device *dev)
{
struct tinyalsa_audio_device *device;
- LOGD("%s(%p)", __func__, dev);
+ ALOGD("%s(%p)", __func__, dev);
if(dev == NULL)
return -1;
@@ -79,7 +62,7 @@ static int audio_hw_set_voice_volume(struct audio_hw_device *dev, float volume)
struct tinyalsa_audio_device *device;
audio_devices_t device_modem;
- LOGD("%s(%p, %f)", __func__, dev, volume);
+ ALOGD("%s(%p, %f)", __func__, dev, volume);
if(dev == NULL)
return -1;
@@ -119,7 +102,7 @@ static int audio_hw_set_master_volume(struct audio_hw_device *dev, float volume)
{
struct tinyalsa_audio_device *device;
- LOGD("%s(%p, %f)", __func__, dev, volume);
+ ALOGD("%s(%p, %f)", __func__, dev, volume);
if(dev == NULL)
return -1;
@@ -143,7 +126,7 @@ static int audio_hw_set_mode(struct audio_hw_device *dev, int mode)
audio_devices_t device_modem;
int rc;
- LOGD("%s(%p, %d)", __func__, dev, mode);
+ ALOGD("%s(%p, %d)", __func__, dev, mode);
if(dev == NULL)
return -1;
@@ -166,13 +149,13 @@ static int audio_hw_set_mode(struct audio_hw_device *dev, int mode)
#ifdef YAMAHA_MC1N2_AUDIO
rc = yamaha_mc1n2_audio_modem_start(device->mc1n2_pdata);
if(rc < 0) {
- LOGE("Failed to set Yamaha-MC1N2-Audio route");
+ ALOGE("Failed to set Yamaha-MC1N2-Audio route");
}
#endif
rc = audio_ril_interface_open((struct audio_hw_device *) device, device_modem, &ril_interface);
if(rc < 0 || ril_interface == NULL) {
- LOGE("Failed to open RIL interface");
+ ALOGE("Failed to open RIL interface");
device->ril_interface = NULL;
} else {
device->ril_interface = ril_interface;
@@ -186,7 +169,7 @@ static int audio_hw_set_mode(struct audio_hw_device *dev, int mode)
#ifdef YAMAHA_MC1N2_AUDIO
rc = yamaha_mc1n2_audio_modem_stop(device->mc1n2_pdata);
if(rc < 0) {
- LOGE("Failed to set Yamaha-MC1N2-Audio route");
+ ALOGE("Failed to set Yamaha-MC1N2-Audio route");
}
#endif
@@ -207,7 +190,7 @@ static int audio_hw_set_mic_mute(struct audio_hw_device *dev, bool state)
struct tinyalsa_audio_device *device;
audio_devices_t device_modem;
- LOGD("%s(%p, %d)", __func__, dev, state);
+ ALOGD("%s(%p, %d)", __func__, dev, state);
if(dev == NULL)
return -1;
@@ -252,7 +235,7 @@ static int audio_hw_get_mic_mute(const struct audio_hw_device *dev, bool *state)
{
struct tinyalsa_audio_device *device;
- LOGD("%s(%p, %p)", __func__, dev, state);
+ ALOGD("%s(%p, %p)", __func__, dev, state);
if(dev == NULL)
return -1;
@@ -273,7 +256,7 @@ static int audio_hw_set_parameters(struct audio_hw_device *dev,
int value;
int rc;
- LOGD("%s(%p, %s)", __func__, dev, kvpairs);
+ ALOGD("%s(%p, %s)", __func__, dev, kvpairs);
if(dev == NULL || kvpairs == NULL)
return -1;
@@ -327,21 +310,22 @@ error_params:
static char *audio_hw_get_parameters(const struct audio_hw_device *dev,
const char *keys)
{
- LOGD("%s(%p, %s)", __func__, dev, keys);
+ ALOGD("%s(%p, %s)", __func__, dev, keys);
return strdup("");
}
static size_t audio_hw_get_input_buffer_size(const struct audio_hw_device *dev,
- uint32_t sample_rate, int format, int channel_count)
+ const struct audio_config *config)
{
struct tinyalsa_audio_device *device;
struct tinyalsa_mixer_io_props *mixer_props;
+ int channel_count;
size_t size;
- LOGD("%s(%p, %d, %d, %d)", __func__, dev, sample_rate, format, channel_count);
+ ALOGD("%s(%p, %p)", __func__, dev, config);
- if(dev == NULL)
+ if(dev == NULL || config == NULL)
return -1;
device = (struct tinyalsa_audio_device *) dev;
@@ -357,16 +341,18 @@ static size_t audio_hw_get_input_buffer_size(const struct audio_hw_device *dev,
if(mixer_props->rate == 0)
mixer_props->rate = 44100;
- size = (mixer_props->period_size * sample_rate) / mixer_props->rate;
+ channel_count = popcount(config->channel_mask);
+
+ size = (mixer_props->period_size * config->sample_rate) / mixer_props->rate;
size = ((size + 15) / 16) * 16;
- size = size * channel_count * audio_bytes_per_sample(format);
+ size = size * channel_count * audio_bytes_per_sample(config->format);
return size;
}
static int audio_hw_dump(const audio_hw_device_t *device, int fd)
{
- LOGD("%s(%p, %d)", __func__, device, fd);
+ ALOGD("%s(%p, %d)", __func__, device, fd);
return 0;
}
@@ -379,7 +365,7 @@ int audio_hw_close(hw_device_t *device)
{
struct tinyalsa_audio_device *tinyalsa_audio_device;
- LOGD("%s(%p)", __func__, device);
+ ALOGD("%s(%p)", __func__, device);
if(device != NULL) {
tinyalsa_audio_device = (struct tinyalsa_audio_device *) device;
@@ -410,7 +396,7 @@ int audio_hw_open(const hw_module_t *module, const char *name,
struct audio_hw_device *dev;
int rc;
- LOGD("%s(%p, %s, %p)", __func__, module, name, device);
+ ALOGD("%s(%p, %s, %p)", __func__, module, name, device);
if(device == NULL)
return -EINVAL;
@@ -425,11 +411,10 @@ int audio_hw_open(const hw_module_t *module, const char *name,
dev = &(tinyalsa_audio_device->device);
dev->common.tag = HARDWARE_DEVICE_TAG;
- dev->common.version = 0;
+ dev->common.version = AUDIO_DEVICE_API_VERSION_CURRENT;
dev->common.module = (struct hw_module_t *) module;
dev->common.close = audio_hw_close;
- dev->get_supported_devices = audio_hw_get_supported_devices;
dev->init_check = audio_hw_init_check;
dev->set_voice_volume = audio_hw_set_voice_volume;
dev->set_master_volume = audio_hw_set_master_volume;
@@ -452,19 +437,19 @@ int audio_hw_open(const hw_module_t *module, const char *name,
rc = yamaha_mc1n2_audio_start(&tinyalsa_audio_device->mc1n2_pdata,
YAMAHA_MC1N2_AUDIO_DEVICE);
if(rc < 0) {
- LOGE("Failed to open Yamaha-MC1N2-Audio");
+ ALOGE("Failed to open Yamaha-MC1N2-Audio");
goto error_device;
}
rc = yamaha_mc1n2_audio_init(tinyalsa_audio_device->mc1n2_pdata);
if(rc < 0) {
- LOGE("Failed to init Yamaha-MC1N2-Audio");
+ ALOGE("Failed to init Yamaha-MC1N2-Audio");
}
#endif
rc = tinyalsa_mixer_open(&tinyalsa_mixer, TINYALSA_MIXER_CONFIG_FILE);
if(rc < 0 || tinyalsa_mixer == NULL) {
- LOGE("Failed to open mixer!");
+ ALOGE("Failed to open mixer!");
goto error_device;
}
@@ -488,8 +473,8 @@ struct hw_module_methods_t audio_hw_module_methods = {
struct audio_module HAL_MODULE_INFO_SYM = {
.common = {
.tag = HARDWARE_MODULE_TAG,
- .version_major = 1,
- .version_minor = 0,
+ .module_api_version = AUDIO_MODULE_API_VERSION_0_1,
+ .hal_api_version = HARDWARE_HAL_API_VERSION,
.id = AUDIO_HARDWARE_MODULE_ID,
.name = "TinyALSA-Audio",
.author = "Paul Kocialkowski",
diff --git a/audio_hw.h b/audio_hw.h
index d0be2a1..2ba184f 100644
--- a/audio_hw.h
+++ b/audio_hw.h
@@ -36,9 +36,8 @@ struct tinyalsa_audio_stream_out {
struct tinyalsa_audio_device *device;
struct tinyalsa_mixer_io_props *mixer_props;
-
int rate;
- audio_channels_t channels;
+ audio_channel_mask_t channel_mask;
audio_format_t format;
audio_devices_t device_current;
@@ -57,7 +56,7 @@ struct tinyalsa_audio_stream_in {
struct tinyalsa_mixer_io_props *mixer_props;
int rate;
- audio_channels_t channels;
+ audio_channel_mask_t channel_mask;
audio_format_t format;
audio_devices_t device_current;
@@ -99,7 +98,8 @@ int audio_out_set_route(struct tinyalsa_audio_stream_out *stream_out,
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,
- uint32_t devices, int *format, uint32_t *channels, uint32_t *sample_rate,
+ 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,
@@ -108,7 +108,7 @@ int audio_in_set_route(struct tinyalsa_audio_stream_in *stream_in,
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,
- uint32_t devices, int *format, uint32_t *channels, uint32_t *sample_rate,
- audio_in_acoustics_t acoustics, struct audio_stream_in **stream_in);
+ audio_io_handle_t handle, audio_devices_t devices,
+ struct audio_config *config, struct audio_stream_in **stream_in);
#endif
diff --git a/audio_in.c b/audio_in.c
index 618daf1..8d9db89 100644
--- a/audio_in.c
+++ b/audio_in.c
@@ -48,7 +48,7 @@ int audio_in_pcm_open(struct tinyalsa_audio_stream_in *stream_in)
return -1;
memset(&pcm_config, 0, sizeof(pcm_config));
- pcm_config.channels = popcount(stream_in->mixer_props->channels);
+ pcm_config.channels = popcount(stream_in->mixer_props->channel_mask);
pcm_config.rate = stream_in->mixer_props->rate;
switch(stream_in->mixer_props->format) {
case AUDIO_FORMAT_PCM_16_BIT:
@@ -58,7 +58,7 @@ int audio_in_pcm_open(struct tinyalsa_audio_stream_in *stream_in)
pcm_config.format = PCM_FORMAT_S32_LE;
break;
default:
- LOGE("Invalid format: 0x%x", stream_in->mixer_props->format);
+ ALOGE("Invalid format: 0x%x", stream_in->mixer_props->format);
return -1;
}
pcm_config.period_size = stream_in->mixer_props->period_size;
@@ -68,7 +68,7 @@ int audio_in_pcm_open(struct tinyalsa_audio_stream_in *stream_in)
stream_in->mixer_props->device, PCM_IN, &pcm_config);
if(pcm == NULL || !pcm_is_ready(pcm)) {
- LOGE("Unable to open pcm device: %s", pcm_get_error(pcm));
+ ALOGE("Unable to open pcm device: %s", pcm_get_error(pcm));
return -1;
}
@@ -122,17 +122,17 @@ int audio_in_resampler_open(struct tinyalsa_audio_stream_in *stream_in)
rc = create_resampler(stream_in->mixer_props->rate,
stream_in->rate,
- popcount(stream_in->mixer_props->channels),
+ popcount(stream_in->mixer_props->channel_mask),
RESAMPLER_QUALITY_DEFAULT,
&stream_in->buffer_provider,
&stream_in->resampler);
if(rc < 0 || stream_in->resampler == NULL) {
- LOGE("Failed to create resampler");
+ ALOGE("Failed to create resampler");
return -1;
}
stream_in->buffer = malloc(stream_in->mixer_props->period_size *
- popcount(stream_in->mixer_props->channels) *
+ popcount(stream_in->mixer_props->channel_mask) *
audio_bytes_per_sample(stream_in->mixer_props->format));
return 0;
@@ -168,16 +168,16 @@ int audio_in_get_next_buffer(struct resampler_buffer_provider *buffer_provider,
if(stream_in->frames_left == 0) {
if(stream_in->pcm == NULL || !pcm_is_ready(stream_in->pcm)) {
- LOGE("pcm device is not ready");
+ ALOGE("pcm device is not ready");
goto error_pcm;
}
rc = pcm_read(stream_in->pcm, stream_in->buffer,
stream_in->mixer_props->period_size *
- popcount(stream_in->mixer_props->channels) *
+ popcount(stream_in->mixer_props->channel_mask) *
audio_bytes_per_sample(stream_in->mixer_props->format));
if(rc != 0) {
- LOGE("pcm read failed!");
+ ALOGE("pcm read failed!");
goto error_pcm;
}
@@ -189,7 +189,7 @@ int audio_in_get_next_buffer(struct resampler_buffer_provider *buffer_provider,
buffer->raw = stream_in->buffer +
(stream_in->mixer_props->period_size - stream_in->frames_left) *
- popcount(stream_in->mixer_props->channels) *
+ popcount(stream_in->mixer_props->channel_mask) *
audio_bytes_per_sample(stream_in->mixer_props->format);
return 0;
@@ -244,7 +244,7 @@ int audio_in_read_process(struct tinyalsa_audio_stream_in *stream_in, void *buff
if(stream_in->resampler != NULL) {
frames_out_resampler = frames_in;
- size_out_resampler = frames_out_resampler * popcount(stream_in->mixer_props->channels) * audio_bytes_per_sample(stream_in->mixer_props->format);
+ size_out_resampler = frames_out_resampler * popcount(stream_in->mixer_props->channel_mask) * audio_bytes_per_sample(stream_in->mixer_props->format);
buffer_out_resampler = calloc(1, size_out_resampler);
frames_out = 0;
@@ -262,17 +262,17 @@ int audio_in_read_process(struct tinyalsa_audio_stream_in *stream_in, void *buff
buffer_in = buffer_out_resampler;
} else {
frames_out_read = frames_in;
- size_out_read = frames_out_read * popcount(stream_in->mixer_props->channels) * audio_bytes_per_sample(stream_in->mixer_props->format);
+ size_out_read = frames_out_read * popcount(stream_in->mixer_props->channel_mask) * audio_bytes_per_sample(stream_in->mixer_props->format);
buffer_out_read = calloc(1, size_out_read);
if(stream_in->pcm == NULL || !pcm_is_ready(stream_in->pcm)) {
- LOGE("pcm device is not ready");
+ ALOGE("pcm device is not ready");
goto error;
}
rc = pcm_read(stream_in->pcm, buffer_out_read, size_out_read);
if(rc != 0) {
- LOGE("pcm read failed!");
+ ALOGE("pcm read failed!");
goto error;
}
@@ -285,13 +285,13 @@ int audio_in_read_process(struct tinyalsa_audio_stream_in *stream_in, void *buff
goto error;
//FIXME: This is only for PCM 16
- if(popcount(stream_in->channels) < popcount(stream_in->mixer_props->channels)) {
+ if(popcount(stream_in->channel_mask) < popcount(stream_in->mixer_props->channel_mask)) {
frames_out_channels = frames_in;
size_out_channels = frames_out_channels * audio_stream_frame_size((struct audio_stream *) stream_in);
buffer_out_channels = calloc(1, size_out_channels);
- int channels_count_in = popcount(stream_in->mixer_props->channels);
- int channels_count_out = popcount(stream_in->channels);
+ int channels_count_in = popcount(stream_in->mixer_props->channel_mask);
+ int channels_count_out = popcount(stream_in->channel_mask);
int ratio = channels_count_in / channels_count_out;
int16_t *byte_in = (int16_t *) buffer_in;
@@ -312,8 +312,8 @@ int audio_in_read_process(struct tinyalsa_audio_stream_in *stream_in, void *buff
frames_in = frames_out_channels;
size_in = size_out_channels;
buffer_in = buffer_out_channels;
- } else if(popcount(stream_in->channels) != popcount(stream_in->mixer_props->channels)) {
- LOGE("Asked for more channels than hardware can provide!");
+ } else if(popcount(stream_in->channel_mask) != popcount(stream_in->mixer_props->channel_mask)) {
+ ALOGE("Asked for more channels than hardware can provide!");
goto error;
}
@@ -356,7 +356,7 @@ static int audio_in_set_sample_rate(struct audio_stream *stream, uint32_t rate)
{
struct tinyalsa_audio_stream_in *stream_in;
- LOGD("%s(%p, %d)", __func__, stream, rate);
+ ALOGD("%s(%p, %d)", __func__, stream, rate);
if(stream == NULL)
return -1;
@@ -399,7 +399,7 @@ static size_t audio_in_get_buffer_size(const struct audio_stream *stream)
return size;
}
-static uint32_t audio_in_get_channels(const struct audio_stream *stream)
+static audio_channel_mask_t audio_in_get_channels(const struct audio_stream *stream)
{
struct tinyalsa_audio_stream_in *stream_in;
@@ -408,10 +408,10 @@ static uint32_t audio_in_get_channels(const struct audio_stream *stream)
stream_in = (struct tinyalsa_audio_stream_in *) stream;
- return stream_in->channels;
+ return stream_in->channel_mask;
}
-static int audio_in_get_format(const struct audio_stream *stream)
+static audio_format_t audio_in_get_format(const struct audio_stream *stream)
{
struct tinyalsa_audio_stream_in *stream_in;
@@ -423,11 +423,11 @@ static int audio_in_get_format(const struct audio_stream *stream)
return stream_in->format;
}
-static int audio_in_set_format(struct audio_stream *stream, int format)
+static int audio_in_set_format(struct audio_stream *stream, audio_format_t format)
{
struct tinyalsa_audio_stream_in *stream_in;
- LOGD("%s(%p, %d)", __func__, stream, format);
+ ALOGD("%s(%p, %d)", __func__, stream, format);
if(stream == NULL)
return -1;
@@ -453,7 +453,7 @@ static int audio_in_standby(struct audio_stream *stream)
struct tinyalsa_audio_stream_in *stream_in;
int rc;
- LOGD("%s(%p)", __func__, stream);
+ ALOGD("%s(%p)", __func__, stream);
if(stream == NULL)
return -1;
@@ -469,7 +469,7 @@ static int audio_in_standby(struct audio_stream *stream)
if(!stream_in->standby) {
rc = yamaha_mc1n2_audio_input_stop(stream_in->device->mc1n2_pdata);
if(rc < 0) {
- LOGE("Failed to set Yamaha-MC1N2-Audio route");
+ ALOGE("Failed to set Yamaha-MC1N2-Audio route");
}
}
#endif
@@ -483,7 +483,7 @@ static int audio_in_standby(struct audio_stream *stream)
static int audio_in_dump(const struct audio_stream *stream, int fd)
{
- LOGD("%s(%p, %d)", __func__, stream, fd);
+ ALOGD("%s(%p, %d)", __func__, stream, fd);
return 0;
}
@@ -496,7 +496,7 @@ static int audio_in_set_parameters(struct audio_stream *stream, const char *kvpa
int value;
int rc;
- LOGD("%s(%p, %s)", __func__, stream, kvpairs);
+ ALOGD("%s(%p, %s)", __func__, stream, kvpairs);
if(stream == NULL || kvpairs == NULL)
return -1;
@@ -539,7 +539,7 @@ error_params:
static char *audio_in_get_parameters(const struct audio_stream *stream,
const char *keys)
{
- LOGD("%s(%p, %s)", __func__, stream, keys);
+ ALOGD("%s(%p, %s)", __func__, stream, keys);
return strdup("");
}
@@ -548,7 +548,7 @@ static int audio_in_set_gain(struct audio_stream_in *stream, float gain)
{
struct tinyalsa_audio_stream_in *stream_in;
- LOGD("%s(%p, %f)", __func__, stream, gain);
+ ALOGD("%s(%p, %f)", __func__, stream, gain);
if(stream == NULL)
return -1;
@@ -586,13 +586,13 @@ static ssize_t audio_in_read(struct audio_stream_in *stream,
#ifdef YAMAHA_MC1N2_AUDIO
rc = yamaha_mc1n2_audio_input_start(stream_in->device->mc1n2_pdata);
if(rc < 0) {
- LOGE("Failed to set Yamaha-MC1N2-Audio route");
+ ALOGE("Failed to set Yamaha-MC1N2-Audio route");
}
#endif
rc = audio_in_pcm_open(stream_in);
if(rc < 0) {
- LOGE("Unable to open pcm device");
+ ALOGE("Unable to open pcm device");
goto error;
}
@@ -601,7 +601,7 @@ static ssize_t audio_in_read(struct audio_stream_in *stream,
rc = audio_in_read_process(stream_in, buffer, (int) bytes);
if(rc < 0) {
- LOGE("Read and process failed!");
+ ALOGE("Read and process failed!");
goto error;
}
@@ -625,14 +625,14 @@ static uint32_t audio_in_get_input_frames_lost(struct audio_stream_in *stream)
static int audio_in_add_audio_effect(const struct audio_stream *stream, effect_handle_t effect)
{
- LOGD("%s(%p, %p)", __func__, stream, effect);
+ ALOGD("%s(%p, %p)", __func__, stream, effect);
return 0;
}
static int audio_in_remove_audio_effect(const struct audio_stream *stream, effect_handle_t effect)
{
- LOGD("%s(%p, %p)", __func__, stream, effect);
+ ALOGD("%s(%p, %p)", __func__, stream, effect);
return 0;
}
@@ -647,7 +647,7 @@ void audio_hw_close_input_stream(struct audio_hw_device *dev,
struct tinyalsa_audio_stream_in *stream_in;
struct tinyalsa_audio_device *tinyalsa_audio_device;
- LOGD("%s(%p)", __func__, stream);
+ ALOGD("%s(%p)", __func__, stream);
stream_in = (struct tinyalsa_audio_stream_in *) stream;
@@ -676,18 +676,18 @@ void audio_hw_close_input_stream(struct audio_hw_device *dev,
}
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)
+ audio_io_handle_t handle, audio_devices_t devices,
+ struct audio_config *config, struct audio_stream_in **stream_in)
{
struct tinyalsa_audio_device *tinyalsa_audio_device;
struct tinyalsa_audio_stream_in *tinyalsa_audio_stream_in;
struct audio_stream_in *stream;
int rc;
- LOGD("%s(%p, %d, %p, %p, %p, %d, %p)",
- __func__, dev, devices, format, channels, sample_rate, acoustics, stream_in);
+ ALOGD("%s(%p, %d, %p, %p)",
+ __func__, dev, devices, config, stream_in);
- if(dev == NULL || format == NULL || channels == NULL || sample_rate == NULL || stream_in == NULL)
+ if(dev == NULL || config == NULL || stream_in == NULL)
return -EINVAL;
tinyalsa_audio_device = (struct tinyalsa_audio_device *) dev;
@@ -728,49 +728,49 @@ int audio_hw_open_input_stream(struct audio_hw_device *dev,
// Default values
if(tinyalsa_audio_stream_in->mixer_props->rate == 0)
tinyalsa_audio_stream_in->mixer_props->rate = 44100;
- if(tinyalsa_audio_stream_in->mixer_props->channels == 0)
- tinyalsa_audio_stream_in->mixer_props->channels = AUDIO_CHANNEL_IN_STEREO;
+ if(tinyalsa_audio_stream_in->mixer_props->channel_mask == 0)
+ tinyalsa_audio_stream_in->mixer_props->channel_mask = AUDIO_CHANNEL_IN_STEREO;
if(tinyalsa_audio_stream_in->mixer_props->format == 0)
tinyalsa_audio_stream_in->mixer_props->format = AUDIO_FORMAT_PCM_16_BIT;
- if(*sample_rate == 0)
+ if(config->sample_rate == 0)
tinyalsa_audio_stream_in->rate =
tinyalsa_audio_stream_in->mixer_props->rate;
else
- tinyalsa_audio_stream_in->rate = *sample_rate;
- if(*channels == 0)
- tinyalsa_audio_stream_in->channels =
- tinyalsa_audio_stream_in->mixer_props->channels;
+ tinyalsa_audio_stream_in->rate = config->sample_rate;
+ if(config->channel_mask == 0)
+ tinyalsa_audio_stream_in->channel_mask =
+ tinyalsa_audio_stream_in->mixer_props->channel_mask;
else
- tinyalsa_audio_stream_in->channels = *channels;
- if(*format == 0)
+ tinyalsa_audio_stream_in->channel_mask = config->channel_mask;
+ if(config->format == 0)
tinyalsa_audio_stream_in->format =
tinyalsa_audio_stream_in->mixer_props->format;
else
- tinyalsa_audio_stream_in->format = *format;
+ tinyalsa_audio_stream_in->format = config->format;
- tinyalsa_audio_stream_in->buffer_provider.get_next_buffer =
+ tinyalsa_audio_stream_in->buffer_provider.get_next_buffer =
audio_in_get_next_buffer;
- tinyalsa_audio_stream_in->buffer_provider.release_buffer =
+ tinyalsa_audio_stream_in->buffer_provider.release_buffer =
audio_in_release_buffer;
if(tinyalsa_audio_stream_in->rate != tinyalsa_audio_stream_in->mixer_props->rate) {
rc = audio_in_resampler_open(tinyalsa_audio_stream_in);
if(rc < 0) {
- LOGE("Unable to open resampler!");
+ ALOGE("Unable to open resampler!");
goto error_stream;
}
}
- *sample_rate = (uint32_t) tinyalsa_audio_stream_in->rate;
- *channels = (uint32_t) tinyalsa_audio_stream_in->channels;
- *format = (uint32_t) tinyalsa_audio_stream_in->format;
+ config->sample_rate = tinyalsa_audio_stream_in->rate;
+ config->channel_mask = tinyalsa_audio_stream_in->channel_mask;
+ config->format = tinyalsa_audio_stream_in->format;
pthread_mutex_lock(&tinyalsa_audio_device->lock);
rc = tinyalsa_mixer_set_input_state(tinyalsa_audio_device->mixer, 1);
if(rc < 0) {
- LOGE("Unable to set input state");
+ ALOGE("Unable to set input state");
pthread_mutex_unlock(&tinyalsa_audio_device->lock);
goto error_stream;
}
@@ -783,7 +783,7 @@ int audio_hw_open_input_stream(struct audio_hw_device *dev,
rc = audio_in_pcm_open(tinyalsa_audio_stream_in);
if(rc < 0) {
- LOGE("Unable to open pcm device");
+ ALOGE("Unable to open pcm device");
pthread_mutex_unlock(&tinyalsa_audio_stream_in->lock);
goto error_stream;
}
diff --git a/audio_out.c b/audio_out.c
index 8a8814c..ca605f4 100644
--- a/audio_out.c
+++ b/audio_out.c
@@ -52,7 +52,7 @@ int audio_out_pcm_open(struct tinyalsa_audio_stream_out *stream_out)
return -1;
memset(&pcm_config, 0, sizeof(pcm_config));
- pcm_config.channels = popcount(stream_out->mixer_props->channels);
+ pcm_config.channels = popcount(stream_out->mixer_props->channel_mask);
pcm_config.rate = stream_out->mixer_props->rate;
switch(stream_out->mixer_props->format) {
case AUDIO_FORMAT_PCM_16_BIT:
@@ -62,7 +62,7 @@ int audio_out_pcm_open(struct tinyalsa_audio_stream_out *stream_out)
pcm_config.format = PCM_FORMAT_S32_LE;
break;
default:
- LOGE("Invalid format: 0x%x", stream_out->mixer_props->format);
+ ALOGE("Invalid format: 0x%x", stream_out->mixer_props->format);
return -1;
}
pcm_config.period_size = stream_out->mixer_props->period_size;
@@ -72,7 +72,7 @@ int audio_out_pcm_open(struct tinyalsa_audio_stream_out *stream_out)
stream_out->mixer_props->device, PCM_OUT, &pcm_config);
if(pcm == NULL || !pcm_is_ready(pcm)) {
- LOGE("Unable to open pcm device: %s", pcm_get_error(pcm));
+ ALOGE("Unable to open pcm device: %s", pcm_get_error(pcm));
return -1;
}
@@ -126,12 +126,12 @@ int audio_out_resampler_open(struct tinyalsa_audio_stream_out *stream_out)
rc = create_resampler(stream_out->rate,
stream_out->mixer_props->rate,
- popcount(stream_out->channels),
+ popcount(stream_out->channel_mask),
RESAMPLER_QUALITY_DEFAULT,
NULL,
&stream_out->resampler);
if(rc < 0 || stream_out->resampler == NULL) {
- LOGE("Failed to create resampler");
+ ALOGE("Failed to create resampler");
return -1;
}
@@ -195,13 +195,13 @@ int audio_out_write_process(struct tinyalsa_audio_stream_out *stream_out, void *
goto error;
//FIXME: This is only for PCM 16
- if(popcount(stream_out->mixer_props->channels) < popcount(stream_out->channels)) {
+ if(popcount(stream_out->mixer_props->channel_mask) < popcount(stream_out->channel_mask)) {
frames_out_channels = frames_in;
- size_out_channels = frames_out_channels * popcount(stream_out->mixer_props->channels) * audio_bytes_per_sample(stream_out->mixer_props->format);
+ size_out_channels = frames_out_channels * popcount(stream_out->mixer_props->channel_mask) * audio_bytes_per_sample(stream_out->mixer_props->format);
buffer_out_channels = calloc(1, size_out_channels);
- int channels_count_in = popcount(stream_out->channels);
- int channels_count_out = popcount(stream_out->mixer_props->channels);
+ int channels_count_in = popcount(stream_out->channel_mask);
+ int channels_count_out = popcount(stream_out->mixer_props->channel_mask);
int ratio = channels_count_in / channels_count_out;
int16_t *byte_in = (int16_t *) buffer_in;
@@ -222,20 +222,20 @@ int audio_out_write_process(struct tinyalsa_audio_stream_out *stream_out, void *
frames_in = frames_out_channels;
size_in = size_out_channels;
buffer_in = buffer_out_channels;
- } else if(popcount(stream_out->channels) != popcount(stream_out->mixer_props->channels)) {
- LOGE("Asked for more channels than software can provide!");
+ } else if(popcount(stream_out->channel_mask) != popcount(stream_out->mixer_props->channel_mask)) {
+ ALOGE("Asked for more channels than software can provide!");
goto error;
}
if(buffer_in != NULL) {
if(stream_out->pcm == NULL || !pcm_is_ready(stream_out->pcm)) {
- LOGE("pcm device is not ready");
+ ALOGE("pcm device is not ready");
goto error;
}
rc = pcm_write(stream_out->pcm, buffer_in, size_in);
if(rc != 0) {
- LOGE("pcm write failed!");
+ ALOGE("pcm write failed!");
goto error;
}
}
@@ -272,7 +272,7 @@ static int audio_out_set_sample_rate(struct audio_stream *stream, uint32_t rate)
{
struct tinyalsa_audio_stream_out *stream_out;
- LOGD("%s(%p, %d)", __func__, stream, rate);
+ ALOGD("%s(%p, %d)", __func__, stream, rate);
if(stream == NULL)
return -1;
@@ -315,7 +315,7 @@ static size_t audio_out_get_buffer_size(const struct audio_stream *stream)
return size;
}
-static uint32_t audio_out_get_channels(const struct audio_stream *stream)
+static audio_channel_mask_t audio_out_get_channels(const struct audio_stream *stream)
{
struct tinyalsa_audio_stream_out *stream_out;
@@ -324,10 +324,10 @@ static uint32_t audio_out_get_channels(const struct audio_stream *stream)
stream_out = (struct tinyalsa_audio_stream_out *) stream;
- return stream_out->channels;
+ return stream_out->channel_mask;
}
-static int audio_out_get_format(const struct audio_stream *stream)
+static audio_format_t audio_out_get_format(const struct audio_stream *stream)
{
struct tinyalsa_audio_stream_out *stream_out;
@@ -339,11 +339,11 @@ static int audio_out_get_format(const struct audio_stream *stream)
return stream_out->format;
}
-static int audio_out_set_format(struct audio_stream *stream, int format)
+static int audio_out_set_format(struct audio_stream *stream, audio_format_t format)
{
struct tinyalsa_audio_stream_out *stream_out;
- LOGD("%s(%p, %d)", __func__, stream, format);
+ ALOGD("%s(%p, %d)", __func__, stream, format);
if(stream == NULL)
return -1;
@@ -369,7 +369,7 @@ static int audio_out_standby(struct audio_stream *stream)
struct tinyalsa_audio_stream_out *stream_out;
int rc;
- LOGD("%s(%p)", __func__, stream);
+ ALOGD("%s(%p)", __func__, stream);
if(stream == NULL)
return -1;
@@ -385,7 +385,7 @@ static int audio_out_standby(struct audio_stream *stream)
if(!stream_out->standby) {
rc = yamaha_mc1n2_audio_output_stop(stream_out->device->mc1n2_pdata);
if(rc < 0) {
- LOGE("Failed to set Yamaha-MC1N2-Audio route");
+ ALOGE("Failed to set Yamaha-MC1N2-Audio route");
}
}
#endif
@@ -399,7 +399,7 @@ static int audio_out_standby(struct audio_stream *stream)
static int audio_out_dump(const struct audio_stream *stream, int fd)
{
- LOGD("%s(%p, %d)", __func__, stream, fd);
+ ALOGD("%s(%p, %d)", __func__, stream, fd);
return 0;
}
@@ -412,7 +412,7 @@ static int audio_out_set_parameters(struct audio_stream *stream, const char *kvp
int value;
int rc;
- LOGD("%s(%p, %s)", __func__, stream, kvpairs);
+ ALOGD("%s(%p, %s)", __func__, stream, kvpairs);
if(stream == NULL || kvpairs == NULL)
return -1;
@@ -457,7 +457,7 @@ error_params:
static char *audio_out_get_parameters(const struct audio_stream *stream, const char *keys)
{
- LOGD("%s(%p, %s)", __func__, stream, keys);
+ ALOGD("%s(%p, %s)", __func__, stream, keys);
return strdup("");
}
@@ -467,8 +467,6 @@ static uint32_t audio_out_get_latency(const struct audio_stream_out *stream)
struct tinyalsa_audio_stream_out *stream_out;
uint32_t latency;
- LOGD("%s(%p)", __func__, stream);
-
if(stream == NULL)
return -1;
@@ -487,7 +485,7 @@ static int audio_out_set_volume(struct audio_stream_out *stream, float left,
struct tinyalsa_audio_stream_out *stream_out;
float volume;
- LOGD("%s(%p, %f, %f)", __func__, stream, left, right);
+ ALOGD("%s(%p, %f, %f)", __func__, stream, left, right);
if(stream == NULL)
return -1;
@@ -527,13 +525,13 @@ static ssize_t audio_out_write(struct audio_stream_out *stream,
#ifdef YAMAHA_MC1N2_AUDIO
rc = yamaha_mc1n2_audio_output_start(stream_out->device->mc1n2_pdata);
if(rc < 0) {
- LOGE("Failed to set Yamaha-MC1N2-Audio route");
+ ALOGE("Failed to set Yamaha-MC1N2-Audio route");
}
#endif
rc = audio_out_pcm_open(stream_out);
if(rc < 0) {
- LOGE("Unable to open pcm device");
+ ALOGE("Unable to open pcm device");
goto error;
}
@@ -542,7 +540,7 @@ static ssize_t audio_out_write(struct audio_stream_out *stream,
rc = audio_out_write_process(stream_out, (void *) buffer, (int) bytes);
if(rc < 0) {
- LOGE("Process and write failed!");
+ ALOGE("Process and write failed!");
goto error;
}
@@ -559,21 +557,21 @@ error:
static int audio_out_get_render_position(const struct audio_stream_out *stream,
uint32_t *dsp_frames)
{
- LOGD("%s(%p, %p)", __func__, stream, dsp_frames);
+ ALOGD("%s(%p, %p)", __func__, stream, dsp_frames);
return -EINVAL;
}
static int audio_out_add_audio_effect(const struct audio_stream *stream, effect_handle_t effect)
{
- LOGD("%s(%p, %p)", __func__, stream, effect);
+ ALOGD("%s(%p, %p)", __func__, stream, effect);
return 0;
}
static int audio_out_remove_audio_effect(const struct audio_stream *stream, effect_handle_t effect)
{
- LOGD("%s(%p, %p)", __func__, stream, effect);
+ ALOGD("%s(%p, %p)", __func__, stream, effect);
return 0;
}
@@ -588,7 +586,7 @@ void audio_hw_close_output_stream(struct audio_hw_device *dev,
struct tinyalsa_audio_stream_out *stream_out;
struct tinyalsa_audio_device *tinyalsa_audio_device;
- LOGD("%s(%p)", __func__, stream);
+ ALOGD("%s(%p)", __func__, stream);
stream_out = (struct tinyalsa_audio_stream_out *) stream;
@@ -617,7 +615,8 @@ void audio_hw_close_output_stream(struct audio_hw_device *dev,
}
int audio_hw_open_output_stream(struct audio_hw_device *dev,
- uint32_t devices, int *format, uint32_t *channels, uint32_t *sample_rate,
+ audio_io_handle_t handle, audio_devices_t devices,
+ audio_output_flags_t flags, struct audio_config *config,
struct audio_stream_out **stream_out)
{
struct tinyalsa_audio_device *tinyalsa_audio_device;
@@ -625,10 +624,10 @@ int audio_hw_open_output_stream(struct audio_hw_device *dev,
struct audio_stream_out *stream;
int rc;
- LOGD("%s(%p, %d, %p, %p, %p, %p)",
- __func__, dev, devices, format, channels, sample_rate, stream_out);
+ ALOGD("%s(%p, %d, %p, %p)",
+ __func__, dev, devices, config, stream_out);
- if(dev == NULL || format == NULL || channels == NULL || sample_rate == NULL || stream_out == NULL)
+ if(dev == NULL || config == NULL || stream_out == NULL)
return -EINVAL;
tinyalsa_audio_device = (struct tinyalsa_audio_device *) dev;
@@ -670,42 +669,42 @@ int audio_hw_open_output_stream(struct audio_hw_device *dev,
// Default values
if(tinyalsa_audio_stream_out->mixer_props->rate == 0)
tinyalsa_audio_stream_out->mixer_props->rate = 44100;
- if(tinyalsa_audio_stream_out->mixer_props->channels == 0)
- tinyalsa_audio_stream_out->mixer_props->channels = AUDIO_CHANNEL_OUT_STEREO;
+ if(tinyalsa_audio_stream_out->mixer_props->channel_mask == 0)
+ tinyalsa_audio_stream_out->mixer_props->channel_mask = AUDIO_CHANNEL_OUT_STEREO;
if(tinyalsa_audio_stream_out->mixer_props->format == 0)
tinyalsa_audio_stream_out->mixer_props->format = AUDIO_FORMAT_PCM_16_BIT;
//Default incoming data will always be 44100Hz, stereo, PCM 16
- if(*sample_rate == 0)
+ if(config->sample_rate == 0)
tinyalsa_audio_stream_out->rate = 44100;
else
- tinyalsa_audio_stream_out->rate = *sample_rate;
- if(*channels == 0)
- tinyalsa_audio_stream_out->channels = AUDIO_CHANNEL_OUT_STEREO;
+ tinyalsa_audio_stream_out->rate = config->sample_rate;
+ if(config->channel_mask == 0)
+ tinyalsa_audio_stream_out->channel_mask = AUDIO_CHANNEL_OUT_STEREO;
else
- tinyalsa_audio_stream_out->channels = *channels;
- if(*format == 0)
+ tinyalsa_audio_stream_out->channel_mask = config->channel_mask;
+ if(config->format == 0)
tinyalsa_audio_stream_out->format = AUDIO_FORMAT_PCM_16_BIT;
else
- tinyalsa_audio_stream_out->format = *format;
+ tinyalsa_audio_stream_out->format = config->format;
if(tinyalsa_audio_stream_out->rate != tinyalsa_audio_stream_out->mixer_props->rate) {
rc = audio_out_resampler_open(tinyalsa_audio_stream_out);
if(rc < 0) {
- LOGE("Unable to open resampler!");
+ ALOGE("Unable to open resampler!");
goto error_stream;
}
}
- *sample_rate = (uint32_t) tinyalsa_audio_stream_out->rate;
- *channels = (uint32_t) tinyalsa_audio_stream_out->channels;
- *format = (uint32_t) tinyalsa_audio_stream_out->format;
+ config->sample_rate = (uint32_t) tinyalsa_audio_stream_out->rate;
+ config->channel_mask = (uint32_t) tinyalsa_audio_stream_out->channel_mask;
+ config->format = (uint32_t) tinyalsa_audio_stream_out->format;
pthread_mutex_lock(&tinyalsa_audio_device->lock);
rc = tinyalsa_mixer_set_output_state(tinyalsa_audio_device->mixer, 1);
if(rc < 0) {
- LOGE("Unable to set output state");
+ ALOGE("Unable to set output state");
pthread_mutex_unlock(&tinyalsa_audio_device->lock);
goto error_stream;
}
@@ -718,7 +717,7 @@ int audio_hw_open_output_stream(struct audio_hw_device *dev,
rc = audio_out_pcm_open(tinyalsa_audio_stream_out);
if(rc < 0) {
- LOGE("Unable to open pcm device");
+ ALOGE("Unable to open pcm device");
pthread_mutex_unlock(&tinyalsa_audio_stream_out->lock);
goto error_stream;
}
diff --git a/audio_ril_interface.c b/audio_ril_interface.c
index 0b4383d..b4c7111 100644
--- a/audio_ril_interface.c
+++ b/audio_ril_interface.c
@@ -40,7 +40,7 @@ int audio_ril_interface_set_mic_mute(struct tinyalsa_audio_ril_interface *ril_in
if(ril_interface == NULL)
return -1;
- LOGD("%s(%d)", __func__, state);
+ ALOGD("%s(%d)", __func__, state);
pthread_mutex_lock(&ril_interface->lock);
@@ -49,7 +49,7 @@ int audio_ril_interface_set_mic_mute(struct tinyalsa_audio_ril_interface *ril_in
rc = ril_interface->interface->mic_mute(ril_interface->interface->pdata, (int) state);
if(rc < 0) {
- LOGE("Failed to set RIL interface mic mute");
+ ALOGE("Failed to set RIL interface mic mute");
goto error;
}
@@ -71,7 +71,7 @@ int audio_ril_interface_set_voice_volume(struct tinyalsa_audio_ril_interface *ri
if(ril_interface == NULL)
return -1;
- LOGD("%s(%d, %f)", __func__, device, volume);
+ ALOGD("%s(%d, %f)", __func__, device, volume);
pthread_mutex_lock(&ril_interface->lock);
@@ -80,7 +80,7 @@ int audio_ril_interface_set_voice_volume(struct tinyalsa_audio_ril_interface *ri
rc = ril_interface->interface->voice_volume(ril_interface->interface->pdata, device, volume);
if(rc < 0) {
- LOGE("Failed to set RIL interface voice volume");
+ ALOGE("Failed to set RIL interface voice volume");
goto error;
}
@@ -98,7 +98,7 @@ int audio_ril_interface_set_route(struct tinyalsa_audio_ril_interface *ril_inter
{
int rc;
- LOGD("%s(%d)", __func__, device);
+ ALOGD("%s(%d)", __func__, device);
if(ril_interface == NULL)
return -1;
@@ -112,7 +112,7 @@ int audio_ril_interface_set_route(struct tinyalsa_audio_ril_interface *ril_inter
rc = ril_interface->interface->route(ril_interface->interface->pdata, device);
if(rc < 0) {
- LOGE("Failed to set RIL interface route");
+ ALOGE("Failed to set RIL interface route");
goto error;
}
@@ -137,14 +137,14 @@ void audio_ril_interface_close(struct audio_hw_device *dev,
struct tinyalsa_audio_device *tinyalsa_audio_device;
- LOGD("%s(%p)", __func__, ril_interface);
+ ALOGD("%s(%p)", __func__, ril_interface);
if(ril_interface->dl_handle != NULL) {
audio_ril_interface_close = (void (*)(struct audio_ril_interface *interface))
dlsym(ril_interface->dl_handle, "audio_ril_interface_close");
if(audio_ril_interface_close == NULL) {
- LOGE("Unable to get close function from: %s", AUDIO_RIL_INTERFACE_LIB);
+ ALOGE("Unable to get close function from: %s", AUDIO_RIL_INTERFACE_LIB);
} else {
audio_ril_interface_close(ril_interface->interface);
}
@@ -175,7 +175,7 @@ int audio_ril_interface_open(struct audio_hw_device *dev, audio_devices_t device
void *dl_handle;
int rc;
- LOGD("%s(%p, %d, %p)", __func__, dev, device, ril_interface);
+ ALOGD("%s(%p, %d, %p)", __func__, dev, device, ril_interface);
if(dev == NULL || ril_interface == NULL)
return -EINVAL;
@@ -191,20 +191,20 @@ int audio_ril_interface_open(struct audio_hw_device *dev, audio_devices_t device
dl_handle = dlopen(AUDIO_RIL_INTERFACE_LIB, RTLD_NOW);
if(dl_handle == NULL) {
- LOGE("Unable to dlopen lib: %s", AUDIO_RIL_INTERFACE_LIB);
+ ALOGE("Unable to dlopen lib: %s", AUDIO_RIL_INTERFACE_LIB);
goto error_interface;
}
audio_ril_interface_open = (struct audio_ril_interface *(*)(void))
dlsym(dl_handle, "audio_ril_interface_open");
if(audio_ril_interface_open == NULL) {
- LOGE("Unable to get open function from: %s", AUDIO_RIL_INTERFACE_LIB);
+ ALOGE("Unable to get open function from: %s", AUDIO_RIL_INTERFACE_LIB);
goto error_interface;
}
interface = audio_ril_interface_open();
if(interface == NULL) {
- LOGE("Unable to open audio ril interface");
+ ALOGE("Unable to open audio ril interface");
goto error_interface;
}
diff --git a/mixer.c b/mixer.c
index e77feb5..f22b96d 100644
--- a/mixer.c
+++ b/mixer.c
@@ -250,7 +250,7 @@ void tinyalsa_mixer_config_start(void *data, const XML_Char *elem,
for(i=0 ; attr[i] != NULL && attr[i+1] != NULL ; i++) {
if(strcmp(attr[i], "device") == 0) {
i++;
- LOGD("Parsing config for device: %s", attr[i]);
+ ALOGD("Parsing config for device: %s", attr[i]);
}
}
} else if(strcmp(elem, "output") == 0) {
@@ -270,22 +270,22 @@ void tinyalsa_mixer_config_start(void *data, const XML_Char *elem,
i++;
switch(atoi(attr[i])) {
case 1:
- config_data->io_props.channels = AUDIO_CHANNEL_OUT_MONO;
+ config_data->io_props.channel_mask = AUDIO_CHANNEL_OUT_MONO;
break;
case 2:
- config_data->io_props.channels = AUDIO_CHANNEL_OUT_STEREO;
+ config_data->io_props.channel_mask = AUDIO_CHANNEL_OUT_STEREO;
break;
case 4:
- config_data->io_props.channels = AUDIO_CHANNEL_OUT_SURROUND;
+ config_data->io_props.channel_mask = AUDIO_CHANNEL_OUT_SURROUND;
break;
case 6:
- config_data->io_props.channels = AUDIO_CHANNEL_OUT_5POINT1;
+ config_data->io_props.channel_mask = AUDIO_CHANNEL_OUT_5POINT1;
break;
case 8:
- config_data->io_props.channels = AUDIO_CHANNEL_OUT_7POINT1;
+ config_data->io_props.channel_mask = AUDIO_CHANNEL_OUT_7POINT1;
break;
default:
- LOGE("Unknown channel attr: %s", attr[i]);
+ ALOGE("Unknown channel attr: %s", attr[i]);
break;
}
} else if(strcmp(attr[i], "format") == 0) {
@@ -299,7 +299,7 @@ void tinyalsa_mixer_config_start(void *data, const XML_Char *elem,
} else if(strcmp(attr[i], "PCM_8_24") == 0) {
config_data->io_props.format = AUDIO_FORMAT_PCM_8_24_BIT;
} else {
- LOGE("Unknown format attr: %s", attr[i]);
+ ALOGE("Unknown format attr: %s", attr[i]);
}
} else if(strcmp(attr[i], "period_size") == 0) {
i++;
@@ -308,7 +308,7 @@ void tinyalsa_mixer_config_start(void *data, const XML_Char *elem,
i++;
config_data->io_props.period_count = atoi(attr[i]);
} else {
- LOGE("Unknown output attr: %s", attr[i]);
+ ALOGE("Unknown output attr: %s", attr[i]);
}
}
} else if(strcmp(elem, "input") == 0) {
@@ -328,13 +328,13 @@ void tinyalsa_mixer_config_start(void *data, const XML_Char *elem,
i++;
switch(atoi(attr[i])) {
case 1:
- config_data->io_props.channels = AUDIO_CHANNEL_IN_MONO;
+ config_data->io_props.channel_mask = AUDIO_CHANNEL_IN_MONO;
break;
case 2:
- config_data->io_props.channels = AUDIO_CHANNEL_IN_STEREO;
+ config_data->io_props.channel_mask = AUDIO_CHANNEL_IN_STEREO;
break;
default:
- LOGE("Unknown channel attr: %s", attr[i]);
+ ALOGE("Unknown channel attr: %s", attr[i]);
break;
}
} else if(strcmp(attr[i], "format") == 0) {
@@ -348,7 +348,7 @@ void tinyalsa_mixer_config_start(void *data, const XML_Char *elem,
} else if(strcmp(attr[i], "PCM_8_24") == 0) {
config_data->io_props.format = AUDIO_FORMAT_PCM_8_24_BIT;
} else {
- LOGE("Unknown format attr: %s", attr[i]);
+ ALOGE("Unknown format attr: %s", attr[i]);
}
} else if(strcmp(attr[i], "period_size") == 0) {
i++;
@@ -357,7 +357,7 @@ void tinyalsa_mixer_config_start(void *data, const XML_Char *elem,
i++;
config_data->io_props.period_count = atoi(attr[i]);
} else {
- LOGE("Unknown input attr: %s", attr[i]);
+ ALOGE("Unknown input attr: %s", attr[i]);
}
}
} else if(strcmp(elem, "modem") == 0) {
@@ -371,7 +371,7 @@ void tinyalsa_mixer_config_start(void *data, const XML_Char *elem,
i++;
config_data->io_props.device = atoi(attr[i]);
} else {
- LOGE("Unknown modem attr: %s", attr[i]);
+ ALOGE("Unknown modem attr: %s", attr[i]);
}
}
} else if(strcmp(elem, "device") == 0) {
@@ -408,10 +408,8 @@ void tinyalsa_mixer_config_start(void *data, const XML_Char *elem,
config_data->device_props.type = AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET;
} else if(strcmp(attr[i], "digital-dock-headset") == 0) {
config_data->device_props.type = AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET;
- } else if(strcmp(attr[i], "fm") == 0) {
- config_data->device_props.type = AUDIO_DEVICE_OUT_FM;
} else {
- LOGE("Unknown device attr: %s", attr[i]);
+ ALOGE("Unknown device attr: %s", attr[i]);
}
} else if(config_data->direction == TINYALSA_MIXER_DIRECTION_INPUT) {
if(strcmp(attr[i], "default") == 0) {
@@ -433,18 +431,18 @@ void tinyalsa_mixer_config_start(void *data, const XML_Char *elem,
} else if(strcmp(attr[i], "back-mic") == 0) {
config_data->device_props.type = AUDIO_DEVICE_IN_BACK_MIC;
} else {
- LOGE("Unknown device attr: %s", attr[i]);
+ ALOGE("Unknown device attr: %s", attr[i]);
}
}
} else {
- LOGE("Unknown device attr: %s", attr[i]);
+ ALOGE("Unknown device attr: %s", attr[i]);
}
if(config_data->device_props.type != 0) {
config_data->device = tinyalsa_mixer_device_alloc();
memcpy(&config_data->device->props, &config_data->device_props, sizeof(config_data->device_props));
} else {
- LOGE("Missing attrs for elem: %s", elem);
+ ALOGE("Missing attrs for elem: %s", elem);
}
}
} else if(strcmp(elem, "path") == 0) {
@@ -456,10 +454,10 @@ void tinyalsa_mixer_config_start(void *data, const XML_Char *elem,
} else if(strcmp(attr[i], "disable") == 0) {
config_data->list_start = &config_data->device->disable;
} else {
- LOGE("Unknown path attr: %s", attr[i]);
+ ALOGE("Unknown path attr: %s", attr[i]);
}
} else {
- LOGE("Unknown path attr: %s", attr[i]);
+ ALOGE("Unknown path attr: %s", attr[i]);
}
}
} else if(strcmp(elem, "ctrl") == 0) {
@@ -470,7 +468,7 @@ void tinyalsa_mixer_config_start(void *data, const XML_Char *elem,
mixer_data->type = MIXER_DATA_TYPE_CTRL;
list->data = (void *) mixer_data;
} else {
- LOGE("Missing device/path for elem: %s", elem);
+ ALOGE("Missing device/path for elem: %s", elem);
return;
}
@@ -485,7 +483,7 @@ void tinyalsa_mixer_config_start(void *data, const XML_Char *elem,
i++;
mixer_data->value = strdup((char *) attr[i]);
} else {
- LOGE("Unknown ctrl attr: %s", attr[i]);
+ ALOGE("Unknown ctrl attr: %s", attr[i]);
}
}
@@ -510,7 +508,7 @@ void tinyalsa_mixer_config_start(void *data, const XML_Char *elem,
mixer_data->type = MIXER_DATA_TYPE_WRITE;
list->data = (void *) mixer_data;
} else {
- LOGE("Missing device/path for elem: %s", elem);
+ ALOGE("Missing device/path for elem: %s", elem);
return;
}
@@ -522,7 +520,7 @@ void tinyalsa_mixer_config_start(void *data, const XML_Char *elem,
i++;
mixer_data->value = strdup((char *) attr[i]);
} else {
- LOGE("Unknown write attr: %s", attr[i]);
+ ALOGE("Unknown write attr: %s", attr[i]);
}
}
@@ -637,13 +635,13 @@ int tinyalsa_mixer_config_parse(struct tinyalsa_mixer *mixer, char *config_file)
f = fopen(config_file, "r");
if(!f) {
- LOGE("Failed to open tinyalsa-audio config file!");
+ ALOGE("Failed to open tinyalsa-audio config file!");
return -1;
}
p = XML_ParserCreate(NULL);
if(!p) {
- LOGE("Failed to create XML parser!");
+ ALOGE("Failed to create XML parser!");
goto error_file;
}
@@ -656,14 +654,14 @@ int tinyalsa_mixer_config_parse(struct tinyalsa_mixer *mixer, char *config_file)
while(!eof) {
len = fread(buf, 1, sizeof(buf), f);
if(ferror(f)) {
- LOGE("Failed to read config file!");
+ ALOGE("Failed to read config file!");
goto error_xml_parser;
}
eof = feof(f);
if(XML_Parse(p, buf, len, eof) == XML_STATUS_ERROR) {
- LOGE("Failed to parse line %d: %s",
+ ALOGE("Failed to parse line %d: %s",
(int) XML_GetCurrentLineNumber(p),
(char *) XML_ErrorString(XML_GetErrorCode(p)));
goto error_xml_parser;
@@ -703,7 +701,7 @@ int tinyalsa_mixer_set_route_ctrl(struct tinyalsa_mixer *mixer,
ctl = mixer_get_ctl_by_name(mixer->mixer, mixer_data->name);
type = mixer_ctl_get_type(ctl);
- LOGD("Setting %s to %s", mixer_data->name, mixer_data->value);
+ ALOGD("Setting %s to %s", mixer_data->name, mixer_data->value);
switch(type) {
case MIXER_CTL_TYPE_BOOL:
@@ -743,7 +741,7 @@ int tinyalsa_mixer_set_route_write(struct tinyalsa_mixer *mixer,
if(mixer_data->type != MIXER_DATA_TYPE_WRITE)
return -1;
- LOGD("Writing %s to %s", mixer_data->value, mixer_data->name);
+ ALOGD("Writing %s to %s", mixer_data->value, mixer_data->name);
asprintf(&buffer, "%s\n", mixer_data->value);
if(buffer == NULL)
@@ -778,18 +776,18 @@ int tinyalsa_mixer_set_route_list(struct tinyalsa_mixer *mixer, struct list_head
if(mixer_data->type == MIXER_DATA_TYPE_CTRL) {
if(mixer_data->attr != NULL &&
strcmp(mixer_data->attr, "voice-volume") == 0) {
- LOGD("Skipping voice volume control");
+ ALOGD("Skipping voice volume control");
} else {
rc = tinyalsa_mixer_set_route_ctrl(mixer, mixer_data);
if(rc < 0) {
- LOGE("Unable to set control!");
+ ALOGE("Unable to set control!");
goto list_continue;
}
}
} else if(mixer_data->type == MIXER_DATA_TYPE_WRITE) {
rc = tinyalsa_mixer_set_route_write(mixer, mixer_data);
if(rc < 0) {
- LOGE("Unable to write!");
+ ALOGE("Unable to write!");
goto list_continue;
}
}
@@ -816,14 +814,14 @@ int tinyalsa_mixer_set_route(struct tinyalsa_mixer *mixer,
mixer->mixer = mixer_open(mixer_io->props.card);
if(mixer->mixer == NULL) {
- LOGE("Unable to open mixer for card: %d", mixer_io->props.card);
+ ALOGE("Unable to open mixer for card: %d", mixer_io->props.card);
return -1;
}
mixer_device = tinyalsa_mixer_get_device(mixer_io, device);
if(mixer_device == NULL) {
- LOGE("Unable to find a matching device: 0x%x", device);
+ ALOGE("Unable to find a matching device: 0x%x", device);
goto error_mixer;
}
@@ -834,14 +832,14 @@ int tinyalsa_mixer_set_route(struct tinyalsa_mixer *mixer,
if(mixer_io->device_current != NULL) {
rc = tinyalsa_mixer_set_route_list(mixer, mixer_io->device_current->disable);
if(rc < 0) {
- LOGE("Unable to disable current device controls");
+ ALOGE("Unable to disable current device controls");
goto error_mixer;
}
}
rc = tinyalsa_mixer_set_route_list(mixer, mixer_device->enable);
if(rc < 0) {
- LOGE("Unable to enable device controls");
+ ALOGE("Unable to enable device controls");
goto error_mixer;
}
@@ -886,24 +884,24 @@ int tinyalsa_mixer_set_device_volume_with_attr(struct tinyalsa_mixer *mixer,
mixer_io = &mixer->modem;
break;
default:
- LOGE("Invalid diretion: 0x%x", direction);
+ ALOGE("Invalid diretion: 0x%x", direction);
return -1;
}
if(!mixer_io->state) {
- LOGE("Unable to set device for the asked direction: state is %d", mixer_io->state);
+ ALOGE("Unable to set device for the asked direction: state is %d", mixer_io->state);
return -1;
}
mixer->mixer = mixer_open(mixer_io->props.card);
if(mixer->mixer == NULL) {
- LOGE("Unable to open mixer for card: %d", mixer_io->props.card);
+ ALOGE("Unable to open mixer for card: %d", mixer_io->props.card);
return -1;
}
mixer_device = tinyalsa_mixer_get_device(mixer_io, device);
if(mixer_device == NULL) {
- LOGE("Unable to find a matching device: 0x%x", device);
+ ALOGE("Unable to find a matching device: 0x%x", device);
goto error_mixer;
}
@@ -911,18 +909,18 @@ int tinyalsa_mixer_set_device_volume_with_attr(struct tinyalsa_mixer *mixer,
mixer_data = tinyalsa_mixer_get_data_with_attr(list, attr);
if(mixer_data == NULL) {
- LOGE("Unable to find a matching ctrl with attr: %s", attr);
+ ALOGE("Unable to find a matching ctrl with attr: %s", attr);
goto error_mixer;
}
if(mixer_data->value == NULL) {
- LOGE("Missing mixer data value!");
+ ALOGE("Missing mixer data value!");
goto error_mixer;
}
values_count = sscanf(mixer_data->value, "%d-%d", &value_min, &value_max);
if(values_count != 2) {
- LOGE("Failed to get mixer data value!");
+ ALOGE("Failed to get mixer data value!");
goto error_mixer;
}
@@ -934,7 +932,7 @@ int tinyalsa_mixer_set_device_volume_with_attr(struct tinyalsa_mixer *mixer,
rc = tinyalsa_mixer_set_route_ctrl(mixer, mixer_data);
if(rc < 0) {
- LOGE("Unable to set ctrl!");
+ ALOGE("Unable to set ctrl!");
goto error_data;
}
@@ -983,24 +981,24 @@ int tinyalsa_mixer_set_device_state_with_attr(struct tinyalsa_mixer *mixer,
mixer_io = &mixer->modem;
break;
default:
- LOGE("Invalid diretion: 0x%x", direction);
+ ALOGE("Invalid diretion: 0x%x", direction);
return -1;
}
if(!mixer_io->state) {
- LOGE("Unable to set device for the asked direction: state is %d", mixer_io->state);
+ ALOGE("Unable to set device for the asked direction: state is %d", mixer_io->state);
return -1;
}
mixer->mixer = mixer_open(mixer_io->props.card);
if(mixer->mixer == NULL) {
- LOGE("Unable to open mixer for card: %d", mixer_io->props.card);
+ ALOGE("Unable to open mixer for card: %d", mixer_io->props.card);
return -1;
}
mixer_device = tinyalsa_mixer_get_device(mixer_io, device);
if(mixer_device == NULL) {
- LOGE("Unable to find a matching device: 0x%x", device);
+ ALOGE("Unable to find a matching device: 0x%x", device);
goto error_mixer;
}
@@ -1011,13 +1009,13 @@ int tinyalsa_mixer_set_device_state_with_attr(struct tinyalsa_mixer *mixer,
mixer_data = tinyalsa_mixer_get_data_with_attr(list, attr);
if(mixer_data == NULL) {
- LOGE("Unable to find a matching ctrl with attr: %s", attr);
+ ALOGE("Unable to find a matching ctrl with attr: %s", attr);
goto error_mixer;
}
rc = tinyalsa_mixer_set_route_ctrl(mixer, mixer_data);
if(rc < 0) {
- LOGE("Unable to set ctrl!");
+ ALOGE("Unable to set ctrl!");
goto error_mixer;
}
@@ -1061,18 +1059,18 @@ int tinyalsa_mixer_set_state(struct tinyalsa_mixer *mixer,
default_device = AUDIO_DEVICE_OUT_DEFAULT;
break;
default:
- LOGE("Invalid diretion: 0x%x", direction);
+ ALOGE("Invalid diretion: 0x%x", direction);
return -1;
}
if(mixer_io->state == state) {
- LOGD("Current state is already: %d", state);
+ ALOGD("Current state is already: %d", state);
return 0;
}
mixer->mixer = mixer_open(mixer_io->props.card);
if(mixer->mixer == NULL) {
- LOGE("Unable to open mixer for card: %d", mixer_io->props.card);
+ ALOGE("Unable to open mixer for card: %d", mixer_io->props.card);
return -1;
}
@@ -1080,27 +1078,27 @@ int tinyalsa_mixer_set_state(struct tinyalsa_mixer *mixer,
mixer_io->device_current->disable != NULL) {
rc = tinyalsa_mixer_set_route_list(mixer, mixer_io->device_current->disable);
if(rc < 0) {
- LOGE("Unable to disable current device controls");
+ ALOGE("Unable to disable current device controls");
goto error_mixer;
}
}
mixer_device = tinyalsa_mixer_get_device(mixer_io, default_device);
if(mixer_device == NULL) {
- LOGD("Unable to find default device");
+ ALOGD("Unable to find default device");
// This is not really an issue
}
if(state && mixer_device != NULL && mixer_device->enable != NULL) {
rc = tinyalsa_mixer_set_route_list(mixer, mixer_device->enable);
if(rc < 0) {
- LOGE("Unable to enable default device controls");
+ ALOGE("Unable to enable default device controls");
goto error_mixer;
}
} else if(!state && mixer_device != NULL) {
rc = tinyalsa_mixer_set_route_list(mixer, mixer_device->disable);
if(rc < 0) {
- LOGE("Unable to disable default device controls");
+ ALOGE("Unable to disable default device controls");
goto error_mixer;
}
}
@@ -1126,21 +1124,21 @@ error_mixer:
int tinyalsa_mixer_set_output_state(struct tinyalsa_mixer *mixer, int state)
{
- LOGD("%s(%d)", __func__, state);
+ ALOGD("%s(%d)", __func__, state);
return tinyalsa_mixer_set_state(mixer, TINYALSA_MIXER_DIRECTION_OUTPUT, state);
}
int tinyalsa_mixer_set_input_state(struct tinyalsa_mixer *mixer, int state)
{
- LOGD("%s(%d)", __func__, state);
+ ALOGD("%s(%d)", __func__, state);
return tinyalsa_mixer_set_state(mixer, TINYALSA_MIXER_DIRECTION_INPUT, state);
}
int tinyalsa_mixer_set_modem_state(struct tinyalsa_mixer *mixer, int state)
{
- LOGD("%s(%d)", __func__, state);
+ ALOGD("%s(%d)", __func__, state);
return tinyalsa_mixer_set_state(mixer, TINYALSA_MIXER_DIRECTION_MODEM, state);
}
@@ -1149,13 +1147,13 @@ int tinyalsa_mixer_set_device(struct tinyalsa_mixer *mixer, audio_devices_t devi
{
int rc;
- LOGD("%s(%x)", __func__, device);
+ ALOGD("%s(%x)", __func__, device);
if(mixer == NULL)
return -1;
if(!audio_is_output_device(device) && !audio_is_input_device(device)) {
- LOGE("Invalid device: 0x%x", device);
+ ALOGE("Invalid device: 0x%x", device);
return -1;
}
@@ -1163,7 +1161,7 @@ int tinyalsa_mixer_set_device(struct tinyalsa_mixer *mixer, audio_devices_t devi
if(audio_is_output_device(device) && mixer->output.state) {
rc = tinyalsa_mixer_set_route(mixer, &mixer->output, device);
if(rc < 0) {
- LOGE("Unable to set route for device: %x", device);
+ ALOGE("Unable to set route for output device: 0x%x", device);
return -1;
}
}
@@ -1171,7 +1169,7 @@ int tinyalsa_mixer_set_device(struct tinyalsa_mixer *mixer, audio_devices_t devi
if(audio_is_input_device(device) && mixer->input.state) {
rc = tinyalsa_mixer_set_route(mixer, &mixer->input, device);
if(rc < 0) {
- LOGE("Unable to set route for device: %x", device);
+ ALOGE("Unable to set route for input device: 0x%x", device);
return -1;
}
}
@@ -1179,7 +1177,7 @@ int tinyalsa_mixer_set_device(struct tinyalsa_mixer *mixer, audio_devices_t devi
if(audio_is_output_device(device) && mixer->modem.state) {
rc = tinyalsa_mixer_set_route(mixer, &mixer->modem, device);
if(rc < 0) {
- LOGE("Unable to set route for device: %x", device);
+ ALOGE("Unable to set route for modem device: 0x%x", device);
return -1;
}
}
@@ -1190,7 +1188,7 @@ int tinyalsa_mixer_set_device(struct tinyalsa_mixer *mixer, audio_devices_t devi
int tinyalsa_mixer_set_output_volume(struct tinyalsa_mixer *mixer,
audio_devices_t device, float volume)
{
- LOGD("%s(%p, %x, %f)", __func__, mixer, device, volume);
+ ALOGD("%s(%p, %x, %f)", __func__, mixer, device, volume);
return tinyalsa_mixer_set_device_volume_with_attr(mixer,
TINYALSA_MIXER_DIRECTION_OUTPUT, device,
@@ -1199,7 +1197,7 @@ int tinyalsa_mixer_set_output_volume(struct tinyalsa_mixer *mixer,
int tinyalsa_mixer_set_master_volume(struct tinyalsa_mixer *mixer, float volume)
{
- LOGD("%s(%p, %f)", __func__, mixer, volume);
+ ALOGD("%s(%p, %f)", __func__, mixer, volume);
return tinyalsa_mixer_set_device_volume_with_attr(mixer,
TINYALSA_MIXER_DIRECTION_OUTPUT, AUDIO_DEVICE_OUT_DEFAULT,
@@ -1209,7 +1207,7 @@ int tinyalsa_mixer_set_master_volume(struct tinyalsa_mixer *mixer, float volume)
int tinyalsa_mixer_set_mic_mute(struct tinyalsa_mixer *mixer,
audio_devices_t device, int mute)
{
- LOGD("%s(%p, %x, %d)", __func__, mixer, device, mute);
+ ALOGD("%s(%p, %x, %d)", __func__, mixer, device, mute);
// Mic mute can be set for both input and modem directions
if(audio_is_input_device(device)) {
@@ -1228,7 +1226,7 @@ int tinyalsa_mixer_set_mic_mute(struct tinyalsa_mixer *mixer,
int tinyalsa_mixer_set_input_gain(struct tinyalsa_mixer *mixer,
audio_devices_t device, float gain)
{
- LOGD("%s(%p, %x, %f)", __func__, mixer, device, gain);
+ ALOGD("%s(%p, %x, %f)", __func__, mixer, device, gain);
return tinyalsa_mixer_set_device_volume_with_attr(mixer,
TINYALSA_MIXER_DIRECTION_INPUT, device,
@@ -1238,81 +1236,37 @@ int tinyalsa_mixer_set_input_gain(struct tinyalsa_mixer *mixer,
int tinyalsa_mixer_set_voice_volume(struct tinyalsa_mixer *mixer,
audio_devices_t device, float volume)
{
- LOGD("%s(%p, %x, %f)", __func__, mixer, device, volume);
+ ALOGD("%s(%p, %x, %f)", __func__, mixer, device, volume);
return tinyalsa_mixer_set_device_volume_with_attr(mixer,
TINYALSA_MIXER_DIRECTION_MODEM, device,
"voice-volume", volume);
}
-audio_devices_t tinyalsa_mixer_get_supported_devices(struct tinyalsa_mixer *mixer)
-{
- struct tinyalsa_mixer_device *mixer_device;
- audio_devices_t devices = 0x00;
- struct list_head *list;
-
- LOGD("%s(%p)", __func__, mixer);
-
- if(mixer == NULL)
- return -1;
-
- list = mixer->output.devices;
- while(list != NULL) {
- if(list->data != NULL) {
- mixer_device = (struct tinyalsa_mixer_device *) list->data;
- devices |= mixer_device->props.type;
- }
-
- list = list->next;
- }
-
- list = mixer->input.devices;
- while(list != NULL) {
- if(list->data != NULL) {
- mixer_device = (struct tinyalsa_mixer_device *) list->data;
- devices |= mixer_device->props.type;
- }
-
- list = list->next;
- }
-
- list = mixer->modem.devices;
- while(list != NULL) {
- if(list->data != NULL) {
- mixer_device = (struct tinyalsa_mixer_device *) list->data;
- devices |= mixer_device->props.type;
- }
-
- list = list->next;
- }
-
- return devices;
-}
-
struct tinyalsa_mixer_io_props *tinyalsa_mixer_get_output_props(struct tinyalsa_mixer *mixer)
{
- LOGD("%s(%p)", __func__, mixer);
+ ALOGD("%s(%p)", __func__, mixer);
return &(mixer->output.props);
}
struct tinyalsa_mixer_io_props *tinyalsa_mixer_get_input_props(struct tinyalsa_mixer *mixer)
{
- LOGD("%s(%p)", __func__, mixer);
+ ALOGD("%s(%p)", __func__, mixer);
return &(mixer->input.props);
}
struct tinyalsa_mixer_io_props *tinyalsa_mixer_get_modem_props(struct tinyalsa_mixer *mixer)
{
- LOGD("%s(%p)", __func__, mixer);
+ ALOGD("%s(%p)", __func__, mixer);
return &(mixer->modem.props);
}
void tinyalsa_mixer_close(struct tinyalsa_mixer *mixer)
{
- LOGD("%s(%p)", __func__, mixer);
+ ALOGD("%s(%p)", __func__, mixer);
if(mixer == NULL)
return;
@@ -1333,7 +1287,7 @@ int tinyalsa_mixer_open(struct tinyalsa_mixer **mixer_p, char *config_file)
struct tinyalsa_mixer *mixer = NULL;
int rc;
- LOGD("%s(%p, %s)", __func__, mixer_p, config_file);
+ ALOGD("%s(%p, %s)", __func__, mixer_p, config_file);
if(mixer_p == NULL || config_file == NULL)
return -1;
@@ -1342,7 +1296,7 @@ int tinyalsa_mixer_open(struct tinyalsa_mixer **mixer_p, char *config_file)
rc = tinyalsa_mixer_config_parse(mixer, config_file);
if(rc < 0) {
- LOGE("Unable to parse mixer config!");
+ ALOGE("Unable to parse mixer config!");
goto error_mixer;
}
diff --git a/mixer.h b/mixer.h
index a6f7cca..5301b7c 100644
--- a/mixer.h
+++ b/mixer.h
@@ -60,7 +60,7 @@ struct tinyalsa_mixer_io_props {
int device;
int rate;
- audio_channels_t channels;
+ audio_channel_mask_t channel_mask;
audio_format_t format;
int period_size;
@@ -115,7 +115,6 @@ int tinyalsa_mixer_set_input_gain(struct tinyalsa_mixer *mixer,
int tinyalsa_mixer_set_voice_volume(struct tinyalsa_mixer *mixer,
audio_devices_t device, float volume);
-audio_devices_t tinyalsa_mixer_get_supported_devices(struct tinyalsa_mixer *mixer);
struct tinyalsa_mixer_io_props *tinyalsa_mixer_get_output_props(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_modem_props(struct tinyalsa_mixer *mixer);