1 /* acoustics_default.cpp
3 ** Copyright 2009 Wind River Systems
5 ** Licensed under the Apache License, Version 2.0 (the "License");
6 ** you may not use this file except in compliance with the License.
7 ** You may obtain a copy of the License at
9 ** http://www.apache.org/licenses/LICENSE-2.0
11 ** Unless required by applicable law or agreed to in writing, software
12 ** distributed under the License is distributed on an "AS IS" BASIS,
13 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 ** See the License for the specific language governing permissions and
15 ** limitations under the License.
19 #define LOG_TAG "AudioHardwareALSA"
20 #include <utils/Log.h>
22 #include "AudioHardwareALSA.h"
26 static int s_device_open(const hw_module_t*, const char*, hw_device_t**);
27 static int s_device_close (hw_device_t*);
28 static status_t s_set_acoustics (snd_pcm_t *, AudioSystem::audio_in_acoustics);
29 static ssize_t s_filter (snd_pcm_t *, void *, ssize_t);
31 static hw_module_methods_t s_module_methods = {
35 extern "C" const hw_module_t HAL_MODULE_INFO_SYM = {
36 tag: HARDWARE_MODULE_TAG,
39 id: ACOUSTICS_HARDWARE_MODULE_ID,
40 name: "ALSA acoustics module",
42 methods: &s_module_methods,
46 static int s_device_open(const hw_module_t* module,
50 acoustic_device_t *dev;
51 dev = (acoustic_device_t *)malloc(sizeof(*dev));
52 if (! dev) return -ENOMEM;
54 memset(dev, 0, sizeof(*dev));
56 /* initialize the procs */
57 dev->common.tag = HARDWARE_DEVICE_TAG;
58 dev->common.version = 0;
59 dev->common.module = (hw_module_t *)module;
60 dev->common.close = s_device_close;
61 dev->set_acoustics = s_set_acoustics;
62 dev->filter = s_filter;
64 *device = &dev->common;
68 static int s_device_close (hw_device_t* device)
74 static status_t s_set_acoustics (snd_pcm_t *handle, AudioSystem::audio_in_acoustics acoustics)
76 LOGD("Acoustics set_acoustics stub called with %d.", (int)acoustics);
80 static ssize_t s_filter (snd_pcm_t *handle, void *buffer, ssize_t frames)
82 // Default acoustics doesn't apply any filtering