1 /*
2 * Copyright (C) 2018 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #define LOG_TAG "ma_listener"
18 /*#define LOG_NDEBUG 0*/
19
20 #include <stdlib.h>
21 #include <dlfcn.h>
22 #include <math.h>
23 #include <pthread.h>
24 #include <unistd.h>
25 #include <cutils/list.h>
26 #include <cutils/log.h>
27 #include <hardware/audio_effect.h>
28 #include <audio-base.h>
29
30 #define MA_FLAG ( EFFECT_FLAG_TYPE_INSERT | \
31 EFFECT_FLAG_VOLUME_MONITOR | \
32 EFFECT_FLAG_DEVICE_IND | \
33 EFFECT_FLAG_OFFLOAD_SUPPORTED | \
34 EFFECT_FLAG_NO_PROCESS)
35
36 #define PRINT_STREAM_TYPE(i) ALOGV("descriptor found and is of stream type %s ",\
37 i == AUDIO_STREAM_MUSIC ? "MUSIC": \
38 i == AUDIO_STREAM_RING ? "RING": \
39 i == AUDIO_STREAM_ALARM ? "ALARM": \
40 i == AUDIO_STREAM_VOICE_CALL ? "Voice_call": \
41 i == AUDIO_STREAM_SYSTEM ? "SYSTEM": \
42 i == AUDIO_STREAM_NOTIFICATION ? "Notification":\
43 "--INVALID--"); \
44
45 #define MA_SET_STATE "audio_hw_send_ma_parameter"
46 #define HAL_VENDOR_PATH "/vendor/lib/hw"
47
48 enum {
49 MA_LISTENER_STATE_UNINITIALIZED,
50 MA_LISTENER_STATE_INITIALIZED,
51 MA_LISTENER_STATE_ACTIVE,
52 };
53
54 typedef struct ma_listener_context_s ma_listener_context_t;
55 static const struct effect_interface_s effect_interface;
56
57 struct ma_state {
58 float vol;
59 bool active;
60 };
61
62 static const audio_stream_type_t MIN_STREAM_TYPES = AUDIO_STREAM_VOICE_CALL;
63 static const audio_stream_type_t MAX_STREAM_TYPES = AUDIO_STREAM_NOTIFICATION;
64 static struct ma_state g_cur_state[MAX_STREAM_TYPES + 1];
65
66 struct ma_listener_context_s {
67 const struct effect_interface_s *itfe;
68 struct listnode effect_list_node;
69 effect_config_t config;
70 const effect_descriptor_t *desc;
71 uint32_t stream_type;
72 uint32_t session_id;
73 uint32_t state;
74 uint32_t dev_id;
75 float left_vol;
76 float right_vol;
77 };
78
79 /* voice UUID: 4ece09c2-3728-11e8-a9f9-fc4dd4486b6d */
80 const effect_descriptor_t ma_listener_voice_descriptor = {
81 { 0x46f924ed, 0x25c3, 0x4272, 0x85b1, { 0x41, 0x78, 0x3f, 0x0d, 0xc6, 0x38 } }, // type
82 { 0x4ece09c2, 0x3728, 0x11e8, 0xa9f9, { 0xfc, 0x4d, 0xd4, 0x48, 0x6b, 0x6d } }, // uuid
83 EFFECT_CONTROL_API_VERSION,
84 MA_FLAG,
85 0, /* TODO */
86 1,
87 "MAXXAUDIO listener for Voice",
88 "The Android Open Source Project",
89 };
90
91 /* system UUID: 4f705ff6-3728-11e8-a0c6-fc4dd4486b6d */
92 const effect_descriptor_t ma_listener_system_descriptor = {
93 { 0x8bd0f979, 0x5266, 0x4791, 0x9213, { 0x11, 0x3a, 0xbc, 0xf7, 0xd3, 0xdc } }, // type
94 { 0x4f705ff6, 0x3728, 0x11e8, 0xa0c6, { 0xfc, 0x4d, 0xd4, 0x48, 0x6b, 0x6d } }, // uuid
95 EFFECT_CONTROL_API_VERSION,
96 MA_FLAG,
97 0, /* TODO */
98 1,
99 "MAXXAUDIO listener for System",
100 "The Android Open Source Project",
101 };
102
103 /* ring UUID: 4fd6e5c8-3728-11e8-8303-fc4dd4486b6d */
104 const effect_descriptor_t ma_listener_ring_descriptor = {
105 { 0x5380692a, 0x872e, 0x4697, 0x8e38, { 0xcd, 0xd1, 0x09, 0xf6, 0xcb, 0x87 } }, // type
106 { 0x4fd6e5c8, 0x3728, 0x11e8, 0x8303, { 0xfc, 0x4d, 0xd4, 0x48, 0x6b, 0x6d } }, // uuid
107 EFFECT_CONTROL_API_VERSION,
108 MA_FLAG,
109 0, /* TODO */
110 1,
111 "MAXXAUDIO listener for Ring",
112 "The Android Open Source Project",
113 };
114 /* music UUID: 5036194e-3728-11e8-8db9-fc4dd4486b6d */
115 const effect_descriptor_t ma_listener_music_descriptor = {
116 { 0x3a3a19b2, 0x62b1, 0x4785, 0xb55e, { 0xb2, 0x8f, 0xd4, 0x1b, 0x83, 0x58 } }, // type
117 { 0x5036194e, 0x3728, 0x11e8, 0x8db9, { 0xfc, 0x4d, 0xd4, 0x48, 0x6b, 0x6d } }, // uuid
118 EFFECT_CONTROL_API_VERSION,
119 MA_FLAG,
120 0, /* TODO */
121 1,
122 "MAXXAUDIO listener for Music",
123 "The Android Open Source Project",
124 };
125 /* alarm UUID: 50b9f084-3728-11e8-9225-fc4dd4486b6d */
126 const effect_descriptor_t ma_listener_alarm_descriptor = {
127 { 0x8d08d30f, 0xb4c3, 0x4600, 0x8f99, { 0xfc, 0xbb, 0x5d, 0x05, 0x8b, 0x60 } }, // type
128 { 0x50b9f084, 0x3728, 0x11e8, 0x9225, { 0xfc, 0x4d, 0xd4, 0x48, 0x6b, 0x6d } }, // uuid
129 EFFECT_CONTROL_API_VERSION,
130 MA_FLAG,
131 0, /* TODO */
132 1,
133 "MAXXAUDIO listener for Alarm",
134 "The Android Open Source Project",
135 };
136 /* notification UUID: 50fe4d56-3728-11e8-ac73-fc4dd4486b6d */
137 const effect_descriptor_t ma_listener_notification_descriptor = {
138 { 0x513d09f5, 0xae7f, 0x483d, 0x922a, { 0x5c, 0x72, 0xc5, 0xe5, 0x68, 0x4c } }, // type
139 { 0x50fe4d56, 0x3728, 0x11e8, 0xac73, { 0xfc, 0x4d, 0xd4, 0x48, 0x6b, 0x6d } }, // uuid
140 EFFECT_CONTROL_API_VERSION,
141 MA_FLAG,
142 0, /* TODO */
143 1,
144 "MAXXAUDIO listener for Notification",
145 "The Android Open Source Project",
146 };
147
148 static const effect_descriptor_t *descriptors[] = {
149 &ma_listener_voice_descriptor,
150 &ma_listener_system_descriptor,
151 &ma_listener_ring_descriptor,
152 &ma_listener_music_descriptor,
153 &ma_listener_alarm_descriptor,
154 &ma_listener_notification_descriptor,
155 NULL,
156 };
157
158 /* function of sending state to HAL */
159 static bool (*send_ma_parameter)(int, float, bool);
160
161 static int init_state = -1;
162 pthread_once_t once = PTHREAD_ONCE_INIT;
163
164 struct listnode ma_effect_list;
165 pthread_mutex_t ma_listner_init_lock;
166
167 /*
168 * Local functions
169 */
valid_dev_in_context(struct ma_listener_context_s * context)170 static inline bool valid_dev_in_context(struct ma_listener_context_s *context)
171 {
172 /* check device */
173 if ((context->dev_id & AUDIO_DEVICE_OUT_SPEAKER) ||
174 (context->dev_id & AUDIO_DEVICE_OUT_SPEAKER_SAFE) ||
175 /* TODO: it should be dynamic if hybird split A2SP is implemented. */
176 (context->dev_id & AUDIO_DEVICE_OUT_ALL_A2DP) ||
177 (context->dev_id & AUDIO_DEVICE_OUT_ALL_USB)) {
178 return true;
179 }
180
181 return false;
182 }
183
check_and_set_ma_parameter(uint32_t stream_type)184 static void check_and_set_ma_parameter(uint32_t stream_type)
185 {
186 bool active = false;
187 float temp_vol = 0.0;
188 float max_vol = 0.0;
189 struct listnode *node = NULL;
190 ma_listener_context_t *context = NULL;
191
192 ALOGV("%s .. called ..", __func__);
193 // get maximum volume for the active session with same strem type
194 list_for_each(node, &ma_effect_list) {
195 context = node_to_item(node, struct ma_listener_context_s, effect_list_node);
196 if (context->stream_type == stream_type &&
197 valid_dev_in_context(context)) {
198 if (context->state == MA_LISTENER_STATE_ACTIVE) {
199 active = true;
200 temp_vol = fmax(context->left_vol, context->right_vol);
201 if (max_vol < temp_vol)
202 max_vol = temp_vol;
203 ALOGV("%s: check session(%d) volume(%f) for stream(%d)",
204 __func__, context->session_id, temp_vol, stream_type);
205 }
206 }
207 }
208
209 // check volume
210 if (max_vol < 0.0) max_vol = 0;
211 else if (max_vol > 1.0) max_vol = 1.0;
212
213 if (send_ma_parameter != NULL &&
214 stream_type >= MIN_STREAM_TYPES &&
215 stream_type <= MAX_STREAM_TYPES &&
216 (g_cur_state[stream_type].vol != max_vol ||
217 g_cur_state[stream_type].active != active)) {
218
219 ALOGV("%s: set stream(%d) active(%s->%s) volume(%f->%f)",
220 __func__, stream_type,
221 g_cur_state[stream_type].active ? "T" : "F", active ? "T" : "F",
222 g_cur_state[stream_type].vol, max_vol);
223
224 // update changes to hal
225 send_ma_parameter(stream_type, max_vol, active);
226 g_cur_state[stream_type].vol = max_vol;
227 g_cur_state[stream_type].active = active;
228 }
229
230 return;
231 }
232
233 /*
234 * Effect Control Interface Implementation
235 */
ma_effect_command(effect_handle_t self,uint32_t cmd_code,uint32_t cmd_size,void * p_cmd_data,uint32_t * reply_size,void * p_reply_data)236 static int ma_effect_command(effect_handle_t self,
237 uint32_t cmd_code, uint32_t cmd_size,
238 void *p_cmd_data, uint32_t *reply_size,
239 void *p_reply_data)
240 {
241 ma_listener_context_t *context = (ma_listener_context_t *)self;
242 int status = 0;
243
244 ALOGV("%s .. called ..", __func__);
245 pthread_mutex_lock(&ma_listner_init_lock);
246
247 if (context == NULL || context->state == MA_LISTENER_STATE_UNINITIALIZED) {
248 ALOGE("%s: %s is NULL", __func__, (context == NULL) ?
249 "context" : "context->state");
250 status = -EINVAL;
251 goto exit;
252 }
253
254 switch (cmd_code) {
255 case EFFECT_CMD_INIT:
256 ALOGV("%s :: cmd called EFFECT_CMD_INIT", __func__);
257 if (p_reply_data == NULL || *reply_size != sizeof(int)) {
258 ALOGE("%s: EFFECT_CMD_INIT: %s, sending -EINVAL", __func__,
259 (p_reply_data == NULL) ? "p_reply_data is NULL" :
260 "*reply_size != sizeof(int)");
261 status = -EINVAL;
262 goto exit;
263 }
264 *(int *)p_reply_data = 0;
265 break;
266
267 case EFFECT_CMD_SET_CONFIG:
268 ALOGV("%s :: cmd called EFFECT_CMD_SET_CONFIG", __func__);
269 if (p_cmd_data == NULL || cmd_size != sizeof(effect_config_t)
270 || p_reply_data == NULL || reply_size == NULL || *reply_size != sizeof(int)) {
271 status = -EINVAL;
272 goto exit;
273 }
274 context->config = *(effect_config_t *)p_cmd_data;
275 *(int *)p_reply_data = 0;
276 break;
277
278 case EFFECT_CMD_GET_CONFIG:
279 ALOGV("%s :: cmd called EFFECT_CMD_GET_CONFIG", __func__);
280 break;
281
282 case EFFECT_CMD_RESET:
283 ALOGV("%s :: cmd called EFFECT_CMD_RESET", __func__);
284 break;
285
286 case EFFECT_CMD_SET_AUDIO_MODE:
287 ALOGV("%s :: cmd called EFFECT_CMD_SET_AUDIO_MODE", __func__);
288 break;
289
290 case EFFECT_CMD_OFFLOAD:
291 ALOGV("%s :: cmd called EFFECT_CMD_OFFLOAD", __func__);
292 if (p_reply_data == NULL || *reply_size != sizeof(int)) {
293 ALOGE("%s: EFFECT_CMD_OFFLOAD: %s, sending -EINVAL", __func__,
294 (p_reply_data == NULL) ? "p_reply_data is NULL" :
295 "*reply_size != sizeof(int)");
296 status = -EINVAL;
297 goto exit;
298 }
299 *(int *)p_reply_data = 0;
300 break;
301
302 case EFFECT_CMD_ENABLE:
303 ALOGV("%s :: cmd called EFFECT_CMD_ENABLE", __func__);
304 if (p_reply_data == NULL || *reply_size != sizeof(int)) {
305 ALOGE("%s: EFFECT_CMD_ENABLE: %s, sending -EINVAL", __func__,
306 (p_reply_data == NULL) ? "p_reply_data is NULL" :
307 "*reply_size != sizeof(int)");
308 status = -EINVAL;
309 goto exit;
310 }
311
312 if (context->state != MA_LISTENER_STATE_INITIALIZED) {
313 ALOGE("%s: EFFECT_CMD_ENABLE : state not INITIALIZED", __func__);
314 status = -ENOSYS;
315 goto exit;
316 }
317
318 context->state = MA_LISTENER_STATE_ACTIVE;
319 *(int *)p_reply_data = 0;
320
321 // After changing the state and if device is valid
322 // check and send state
323 if (valid_dev_in_context(context)) {
324 check_and_set_ma_parameter(context->stream_type);
325 }
326
327 break;
328
329 case EFFECT_CMD_DISABLE:
330 ALOGV("%s :: cmd called EFFECT_CMD_DISABLE", __func__);
331 if (p_reply_data == NULL || *reply_size != sizeof(int)) {
332 ALOGE("%s: EFFECT_CMD_DISABLE: %s, sending -EINVAL", __func__,
333 (p_reply_data == NULL) ? "p_reply_data is NULL" :
334 "*reply_size != sizeof(int)");
335 status = -EINVAL;
336 goto exit;
337 }
338
339 if (context->state != MA_LISTENER_STATE_ACTIVE) {
340 ALOGE("%s: EFFECT_CMD_ENABLE : state not ACTIVE", __func__);
341 status = -ENOSYS;
342 goto exit;
343 }
344
345 context->state = MA_LISTENER_STATE_INITIALIZED;
346 *(int *)p_reply_data = 0;
347
348 // After changing the state and if device is valid
349 // check and send state
350 if (valid_dev_in_context(context)) {
351 check_and_set_ma_parameter(context->stream_type);
352 }
353
354 break;
355
356 case EFFECT_CMD_GET_PARAM:
357 ALOGV("%s :: cmd called EFFECT_CMD_GET_PARAM", __func__);
358 break;
359
360 case EFFECT_CMD_SET_PARAM:
361 ALOGV("%s :: cmd called EFFECT_CMD_SET_PARAM", __func__);
362 break;
363
364 case EFFECT_CMD_SET_DEVICE:
365 {
366 uint32_t new_device;
367
368 if (p_cmd_data == NULL) {
369 ALOGE("%s: EFFECT_CMD_SET_DEVICE: cmd data NULL", __func__);
370 status = -EINVAL;
371 goto exit;
372 }
373
374 new_device = *(uint32_t *)p_cmd_data;
375 ALOGV("%s :: EFFECT_CMD_SET_DEVICE: (current/new) device (0x%x / 0x%x)",
376 __func__, context->dev_id, new_device);
377
378 context->dev_id = new_device;
379 // After changing the state and if device is valid
380 // check and send parameter
381 if (valid_dev_in_context(context)) {
382 check_and_set_ma_parameter(context->stream_type);
383 }
384 }
385 break;
386
387 case EFFECT_CMD_SET_VOLUME:
388 {
389 float left_vol = 0, right_vol = 0;
390
391 ALOGV("cmd called EFFECT_CMD_SET_VOLUME");
392 if (p_cmd_data == NULL || cmd_size != 2 * sizeof(uint32_t)) {
393 ALOGE("%s: EFFECT_CMD_SET_VOLUME: %s", __func__, (p_cmd_data == NULL) ?
394 "p_cmd_data is NULL" : "cmd_size issue");
395 status = -EINVAL;
396 goto exit;
397 }
398
399 left_vol = (float)(*(uint32_t *)p_cmd_data) / (1 << 24);
400 right_vol = (float)(*((uint32_t *)p_cmd_data + 1)) / (1 << 24);
401 ALOGV("Current Volume (%f / %f ) new Volume (%f / %f)", context->left_vol,
402 context->right_vol, left_vol, right_vol);
403
404 context->left_vol = left_vol;
405 context->right_vol = right_vol;
406
407 // After changing the state and if device is valid
408 // check and send volume
409 if (valid_dev_in_context(context)) {
410 check_and_set_ma_parameter(context->stream_type);
411 }
412 }
413 break;
414
415 default:
416 ALOGW("%s: unknow command %d", __func__, cmd_code);
417 status = -ENOSYS;
418 break;
419 }
420
421 exit:
422 pthread_mutex_unlock(&ma_listner_init_lock);
423 return status;
424 }
425
426 /* Effect Control Interface Implementation: get_descriptor */
ma_effect_get_descriptor(effect_handle_t self,effect_descriptor_t * descriptor)427 static int ma_effect_get_descriptor(effect_handle_t self,
428 effect_descriptor_t *descriptor)
429 {
430 ma_listener_context_t *context = (ma_listener_context_t *)self;
431 ALOGV("%s .. called ..", __func__);
432
433 if (descriptor == NULL) {
434 ALOGE("%s: descriptor is NULL", __func__);
435 return -EINVAL;
436 }
437
438 *descriptor = *context->desc;
439 return 0;
440 }
441
init_once()442 static void init_once()
443 {
444 int ret = 0;
445 void *handle = NULL;
446 char lib_path[PATH_MAX] = {0};
447
448 if (init_state == 0) {
449 ALOGD("%s : already init ... do nothing", __func__);
450 return;
451 }
452
453 ALOGV("%s .. called ..", __func__);
454
455 send_ma_parameter = NULL;
456
457 ret = snprintf(lib_path, PATH_MAX, "%s/%s", HAL_VENDOR_PATH, HAL_LIB_NAME);
458 if (ret < 0) {
459 ALOGE("%s: snprintf failed for lib %s ret %d", __func__, HAL_LIB_NAME, ret);
460 return;
461 }
462
463 handle = dlopen(lib_path, RTLD_NOW);
464 if (handle == NULL) {
465 ALOGE("%s: DLOPEN failed for %s", __func__, HAL_LIB_NAME);
466 return;
467 } else {
468 ALOGV("%s: DLOPEN successful for %s", __func__, HAL_LIB_NAME);
469 send_ma_parameter = (bool (*)(int, float, bool))dlsym(handle, MA_SET_STATE);
470
471 if (!send_ma_parameter) {
472 ALOGE("%s: dlsym error %s for send_ma_parameter", __func__, dlerror());
473 return;
474 }
475 }
476
477 pthread_mutex_init(&ma_listner_init_lock, NULL);
478 list_init(&ma_effect_list);
479 init_state = 0;
480
481 ALOGD("%s: exit ret %d", __func__, init_state);
482 }
483
lib_init()484 static bool lib_init()
485 {
486 pthread_once(&once, init_once);
487 return init_state;
488 }
489
ma_prc_lib_create(const effect_uuid_t * uuid,int32_t session_id,int32_t io_id __unused,effect_handle_t * p_handle)490 static int ma_prc_lib_create(const effect_uuid_t *uuid,
491 int32_t session_id,
492 int32_t io_id __unused,
493 effect_handle_t *p_handle)
494 {
495 int itt = 0;
496 ma_listener_context_t *context = NULL;
497
498 ALOGV("%s .. called ..", __func__);
499
500 if (lib_init() != 0) {
501 return init_state;
502 }
503
504 if (p_handle == NULL || uuid == NULL) {
505 ALOGE("%s: %s is NULL", __func__, (p_handle == NULL) ? "p_handle" : "uuid");
506 return -EINVAL;
507 }
508
509 context = (ma_listener_context_t *)calloc(1, sizeof(ma_listener_context_t));
510
511 if (context == NULL) {
512 ALOGE("%s: failed to allocate for context .. oops !!", __func__);
513 return -EINVAL;
514 }
515
516 // check if UUID is supported
517 for (itt = 0; descriptors[itt] != NULL; itt++) {
518 if (memcmp(uuid, &descriptors[itt]->uuid, sizeof(effect_uuid_t)) == 0) {
519 context->desc = descriptors[itt];
520 context->stream_type = itt;
521 PRINT_STREAM_TYPE(itt)
522 break;
523 }
524 }
525
526 if (descriptors[itt] == NULL) {
527 ALOGE("%s .. couldnt find passed uuid, something wrong", __func__);
528 free(context);
529 return -EINVAL;
530 }
531
532 ALOGV("%s CREATED_CONTEXT %p", __func__, context);
533
534 context->itfe = &effect_interface;
535 context->state = MA_LISTENER_STATE_INITIALIZED;
536 context->dev_id = AUDIO_DEVICE_NONE;
537 context->session_id = session_id;
538
539 // Add this to master list
540 pthread_mutex_lock(&ma_listner_init_lock);
541 list_add_tail(&ma_effect_list, &context->effect_list_node);
542
543 pthread_mutex_unlock(&ma_listner_init_lock);
544
545 *p_handle = (effect_handle_t)context;
546 return 0;
547 }
548
ma_prc_lib_release(effect_handle_t handle)549 static int ma_prc_lib_release(effect_handle_t handle)
550 {
551 struct listnode *node, *temp_node_next;
552 ma_listener_context_t *context = NULL;
553 ma_listener_context_t *recv_contex = (ma_listener_context_t *)handle;
554 int status = -EINVAL;
555
556 ALOGV("%s: context %p", __func__, handle);
557
558 if (recv_contex == NULL) {
559 return status;
560 }
561
562 pthread_mutex_lock(&ma_listner_init_lock);
563 // check if the handle/context provided is valid
564 list_for_each_safe(node, temp_node_next, &ma_effect_list) {
565 context = node_to_item(node, struct ma_listener_context_s, effect_list_node);
566 if (context == recv_contex) {
567 ALOGV("--- Found something to remove ---");
568 list_remove(node);
569 PRINT_STREAM_TYPE(context->stream_type);
570 free(context);
571 status = 0;
572 }
573 }
574
575 if (status != 0) {
576 ALOGE("%s: nothing to remove, ret %d", __func__, status);
577 pthread_mutex_unlock(&ma_listner_init_lock);
578 return status;
579 }
580
581 pthread_mutex_unlock(&ma_listner_init_lock);
582 return status;
583 }
584
ma_prc_lib_get_descriptor(const effect_uuid_t * uuid,effect_descriptor_t * descriptor)585 static int ma_prc_lib_get_descriptor(const effect_uuid_t *uuid,
586 effect_descriptor_t *descriptor)
587 {
588 int i = 0;
589
590 ALOGV("%s .. called ..", __func__);
591 if (lib_init() != 0) {
592 return init_state;
593 }
594
595 if (descriptor == NULL || uuid == NULL) {
596 ALOGE("%s: %s is NULL", __func__, (descriptor == NULL) ? "descriptor" : "uuid");
597 return -EINVAL;
598 }
599
600 for (i = 0; descriptors[i] != NULL; i++) {
601 if (memcmp(uuid, &descriptors[i]->uuid, sizeof(effect_uuid_t)) == 0) {
602 *descriptor = *descriptors[i];
603 return 0;
604 }
605 }
606
607 ALOGE("%s: couldnt found uuid passed, oops", __func__);
608 return -EINVAL;
609 }
610
611
612 /* effect_handle_t interface implementation for volume listener effect */
613 static const struct effect_interface_s effect_interface = {
614 NULL,
615 ma_effect_command,
616 ma_effect_get_descriptor,
617 NULL,
618 };
619
620 __attribute__((visibility("default")))
621 audio_effect_library_t AUDIO_EFFECT_LIBRARY_INFO_SYM = {
622 .tag = AUDIO_EFFECT_LIBRARY_TAG,
623 .version = EFFECT_LIBRARY_API_VERSION,
624 .name = "MAXXAUDIO Listener Effect Library",
625 .implementor = "The Android Open Source Project",
626 .create_effect = ma_prc_lib_create,
627 .release_effect = ma_prc_lib_release,
628 .get_descriptor = ma_prc_lib_get_descriptor,
629 };
630