2 #define LOG_TAG "AudioHardwareALSA"
5 #include "AudioHardwareALSA.h"
9 static int s_device_open(const hw_module_t*, const char*, hw_device_t**);
10 static int s_device_close (hw_device_t*);
11 static status_t s_set_acoustics (snd_pcm_t *, AudioSystem::audio_in_acoustics);
12 static ssize_t s_filter (snd_pcm_t *, void *, ssize_t);
14 static hw_module_methods_t s_module_methods = {
18 extern "C" const hw_module_t HAL_MODULE_INFO_SYM = {
19 tag: HARDWARE_MODULE_TAG,
22 id: ACOUSTICS_HARDWARE_MODULE_ID,
23 name: "ALSA acoustics module",
25 methods: &s_module_methods,
29 static int s_device_open(const hw_module_t* module,
33 acoustic_device_t *dev;
34 dev = (acoustic_device_t *)malloc(sizeof(*dev));
35 if (! dev) return -ENOMEM;
37 memset(dev, 0, sizeof(*dev));
39 /* initialize the procs */
40 dev->common.tag = HARDWARE_DEVICE_TAG;
41 dev->common.version = 0;
42 dev->common.module = (hw_module_t *)module;
43 dev->common.close = s_device_close;
44 dev->set_acoustics = s_set_acoustics;
45 dev->filter = s_filter;
47 *device = &dev->common;
51 static int s_device_close (hw_device_t* device)
57 static status_t s_set_acoustics (snd_pcm_t *handle, AudioSystem::audio_in_acoustics acoustics)
59 LOGD("Acoustics set_acoustics stub called with %d.", (int)acoustics);
63 static ssize_t s_filter (snd_pcm_t *handle, void *buffer, ssize_t frames)
65 // Default acoustics doesn't apply any filtering