-
Notifications
You must be signed in to change notification settings - Fork 0
/
AudioModule.c
552 lines (501 loc) · 11.6 KB
/
AudioModule.c
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
* VMAN -- Audio module
*
* Copyright (C) 2023 Rockchip Electronics Co., Ltd.
*
*/
#include <hardware/hardware.h>
#include <log/log.h>
#include "AudioModule.h"
#ifdef LOG_TAG
#undef LOG_TAG
#define LOG_TAG "vman_audio"
#endif
/*
* Get volume value
* @return int:
* Current volume, range: 0~100
*/
static int get_speakerout_volume(struct audio_hal_module *module)
{
return 0;
}
/*
* Set volume value
* @param value int:
* Current volume, range: 0~100
*/
static void set_speakerout_volume(struct audio_hal_module *module, int value)
{
}
/*
* Get mute status
* @return boolean:
* mute status: true - mute; false - unmute;
*/
static int get_speakerout_mute(struct audio_hal_module *module)
{
return 0;
}
/*
* Set mute status
* @param value boolean:
* mute status: true - mute; false - unmute;
*/
static void set_speakerout_mute(struct audio_hal_module *module, int value)
{
}
/*
* Set the audio device type for the forced output
* @param outputDevice: audio device type
*
* @return result, true: successfully; false: failure
*/
static bool set_force_use_outputdevice(struct audio_hal_module *module,
enumaudiooutputdevicetype outputDevice)
{
return 0;
}
/*
* Get the audio device type for the forced output
*
* @return audio device type
*/
static enumaudiooutputdevicetype get_force_use_outputdevice(struct audio_hal_module *module)
{
return 0;
}
/*
* Get the PA mute status
* @param amptype
* AudioCtrlManager.AMP_TYPE_TREBLE: treble
* AudioCtrlManager.AMP_TYPE_BASS: bass
* @return mute status
* AudioCtrlManager.AMP_UNMUTE: unmute
* AudioCtrlManager.AMP_MUTE: mute
*/
static int get_audio_amp_mute(struct audio_hal_module *module, int amptype)
{
return 0;
}
/*
* Set the PA mute status
* @param amptype
* AudioCtrlManager.AMP_TYPE_TREBLE: treble
* AudioCtrlManager.AMP_TYPE_BASS: bass
* @param status
* AudioCtrlManager.AMP_UNMUTE:unmute
* AudioCtrlManager.AMP_MUTE: mute
* @return result:true - successfully; false - failure;
*/
static bool set_audio_amp_mute(struct audio_hal_module *module, int amptype, int status)
{
return 0;
}
/*
* Get LineOut/Headphone PA mute status
* @return mute status
* AudioCtrlManager.HEADPHONE_UNMUTE: false = unmute
* AudioCtrlManager.HEADPHONE_MUTE: true = mute
*/
static bool get_headphone_mute(struct audio_hal_module *module)
{
return 0;
}
/*
* Set LineOut/Headphone PA mute status
* @param status
* AudioCtrlManager.HEADPHONE_UNMUTE: false = unmute
* AudioCtrlManager.HEADPHONE_MUTE: true = mute
* @return result:true - successfully; false - failure;
*/
static bool set_headphone_mute(struct audio_hal_module *module, bool status)
{
return 0;
}
/*
* Get DRC status
* @return DRC status: false - Disable DRC; true - Enable DRC
*/
static bool get_drc_enable(struct audio_hal_module *module)
{
return 0;
}
/*
* Set DRC status
* @param enable boolean
* Set DRC : false - Disable DRC; true - Enable DRC
* @return result:true - successfully; false - failure;
*/
static bool set_drc_enable(struct audio_hal_module *module, bool enable)
{
return 0;
}
/*
* Get EQ status
* @return EQ status: false - DisableEQ; true - EnableEQ;
*/
static bool get_eq_enable(struct audio_hal_module *module)
{
return 0;
}
/*
* Set EQ status
* @param enable boolean
* Set EQ: false - DisableEQ; true - EnableEQ;
* @return result:true - successfully; false - failure;
*/
static bool set_eq_enable(struct audio_hal_module *module, bool enable)
{
return 0;
}
/*
* Get balance
* @return balance
*/
static int get_balance(struct audio_hal_module *module)
{
return 0;
}
/*
* Set balance
* @param balance value
* @return result:true - successfully; false - failure;
*/
static bool set_balance(struct audio_hal_module *module, int balance)
{
return 0;
}
/*
* Get treble
* @return treble
*/
static int get_treble(struct audio_hal_module *module)
{
return 0;
}
/*
* Set treble
* @param treble : treble tytpe
* @return result:true - successfully; false - failure;
*/
static bool set_treble(struct audio_hal_module *module, int treble)
{
return 0;
}
/*
* Get bass
* @return bass
*/
static int get_bass(struct audio_hal_module *module)
{
return 0;
}
/*
* Set bass
* @param bass :bass value
* @return result:true - successfully; false - failure;
*/
static bool set_bass(struct audio_hal_module *module, int bass)
{
return 0;
}
/*
* Get AudioOutMode
* @return AudioOutMode
* AudioCtrlManager.AUDIOOUT_MODE_HEADSET :Headset
* AudioCtrlManager.AUDIOOUT_MODE_LINEOUT :Lineout
* AudioCtrlManager.AUDIOOUT_MODE_SPEAKER :Speaker
* AudioCtrlManager.AUDIOOUT_MODE_BOTH :Both
*/
static int get_audio_out_Mode(struct audio_hal_module *module)
{
return 0;
}
/*
* Set AudioOutMode
* @param mode: audio ouput mode
* AudioCtrlManager.AUDIOOUT_MODE_HEADSET :Headset
* AudioCtrlManager.AUDIOOUT_MODE_LINEOUT :Lineout
* AudioCtrlManager.AUDIOOUT_MODE_SPEAKER :Speaker
* AudioCtrlManager.AUDIOOUT_MODE_BOTH :Both
* @return result:true - successfully; false - failure;
*/
static bool set_audio_out_mode(struct audio_hal_module *module, int mode)
{
return 0;
}
/*
* Get Sound mode
* @return EQ mode:
* 0: Standard mode 1: Movie mode 2: Classroom mode 3: Conference mode 4: User mode
*/
static int get_sound_mode(struct audio_hal_module *module)
{
return 0;
}
/*
* Set Sound mode
* @param mode:
* 0: Standard mode 1: Movie mode 2: Classroom mode 3: Conference mode 4: User mode
* @return result:true - successfully; false - failure;
*/
static bool set_sound_mode(struct audio_hal_module *module, int mode)
{
return 0;
}
/*
* Set AEC status (Speaker and Headset output simultaneously)
* Synchronous / Asynchronous: Synchronous
*
* @param enable :
* bool,enable or disable
*/
static void set_auto_matic_echo_cancel(struct audio_hal_module *module, bool enable)
{
}
/*
* Get AEC status
* Synchronous / Asynchronous: Synchronous
*
* @return : bool,enable or disable
*/
static bool get_auto_matic_echo_cancel(struct audio_hal_module *module)
{
return 0;
}
/*
* Get LineOut fix output
* Synchronous / Asynchronous: Synchronous
*
* @return
* true:LineOut fix output;false:The LineOut output follows the volume change
*/
static bool get_lineout_fix_output(struct audio_hal_module *module)
{
return 0;
}
/*
* Set LineOut fix output
* Synchronous / Asynchronous: Synchronous
*
* @param fix
* 0 : The LineOut output follows the volume change 1 : LineOut fix output
* @return result:true - successfully; false - failure;
*/
static bool set_lineout_fix_output(struct audio_hal_module *module, int fix)
{
return 0;
}
/*
* Get delay time of sound output
* Synchronous / Asynchronous: Synchronous
*
* @param channel
* The channel of Sound delay
* @return
* int: The time of sound delay
*/
static int get_audio_delay(struct audio_hal_module *module, int channel)
{
return 0;
}
/*
* Set delay time of sound output
* Synchronous / Asynchronous: Synchronous
*
* @param channel
* The channel of Sound delay
* @param ms
* The time of sound delay
* @return result:true - successfully; false - failure;
*/
static bool set_audio_delay(struct audio_hal_module *module, int channel, int ms)
{
return 0;
}
/*
* Get GEQ value
* Synchronous / Asynchronous: Synchronous
*
* @return
* int array, GEQ value of each band
*/
static int* get_geq(struct audio_hal_module *module)
{
return 0;
}
/*
* Set GEQ value of the specified band
* Synchronous / Asynchronous: Synchronous
*
* @param band
* index
* @param value
* GEQ value of the specified band
* @return result:true - successfully; false - failure;
*/
static int set_geq(struct audio_hal_module *module, int band, int value)
{
return 0;
}
/*
* Get PEQ status
* Synchronous / Asynchronous: Synchronous
*
* @return
* status true:enable,false:disable
*/
static bool get_peq_enable(struct audio_hal_module *module)
{
return 0;
}
/*
* Set PEQ status
* Synchronous / Asynchronous: Synchronous
*
* @param enable : true:enable,false:disable
* @return result:true - successfully; false - failure;
*/
static bool set_peq_enable(struct audio_hal_module *module, bool enable)
{
return 0;
}
/*
* Get PEQ value
* Synchronous / Asynchronous: Synchronous
*
* @param band
* index
* @return
* PEQ value of the specified band
*/
static int* get_band_peq(struct audio_hal_module *module, int band)
{
return 0;
}
/*
* Set PEQ value of the specified band
* Synchronous / Asynchronous: Synchronous
*
* @param band
* index
* @param size
* peqvalue size
* @param peqvalue
* PEQ value
* @return result:0 - successfully; -1 - failure;
*/
static int set_band_peq(struct audio_hal_module *module, int band, int size, int peqvalue[])
{
return 0;
}
/*
* Get DRC value
* Synchronous / Asynchronous: Synchronous
*
* @param band
* index
* @return
* int,DRC value of the specified band
*/
static int* get_band_drc(struct audio_hal_module *module, int band)
{
return 0;
}
/*
* Set DRC value of the specified band
* Synchronous / Asynchronous: Synchronous
*
* @param band
* index
* @param size
* drcvalue size
* @param drcvalue
* DRC value
* @return result:0 - successfully; -1 - failure;
*/
static int set_band_drc(struct audio_hal_module *module, int band, int size, int drcvalue[])
{
return 0;
}
/*
* Get Prescale of sound channel
* Synchronous / Asynchronous: Synchronous
*
* @return
* int Prescale value
*/
static int get_prescale(struct audio_hal_module *module)
{
return 0;
}
/*
* Set Prescale of sound channel
* Synchronous / Asynchronous: Synchronous
*
* @param value
* Prescale value
* @return result:true - successfully; false - failure;
*/
static bool set_prescale(struct audio_hal_module *module, int value)
{
return 0;
}
static struct hw_module_methods_t audio_hal_module_methods =
{
.open = NULL,
};
struct audio_hal_module HAL_MODULE_INFO_SYM =
{
.common = {
.tag = HARDWARE_MODULE_TAG,
.module_api_version = AUDIO_HAL_MODULE_API_VERSION_0_1,
.hal_api_version = HARDWARE_HAL_API_VERSION,
.id = AUDIO_HAL_HARDWARE_MODULE_ID,
.name ="Default AUDIO HAL",
.author = "The AUDIO Project",
.methods = &audio_hal_module_methods,
},
.get_speakerout_volume = get_speakerout_volume,
.set_speakerout_volume = set_speakerout_volume,
.get_speakerout_mute = get_speakerout_mute,
.set_speakerout_mute = set_speakerout_mute,
.set_force_use_outputdevice = set_force_use_outputdevice,
.get_force_use_outputdevice = get_force_use_outputdevice,
.get_audio_amp_mute = get_audio_amp_mute,
.set_audio_amp_mute = set_audio_amp_mute,
.get_headphone_mute = get_headphone_mute,
.set_headphone_mute = set_headphone_mute,
.get_drc_enable = get_drc_enable,
.set_drc_enable = set_drc_enable,
.get_eq_enable = get_eq_enable,
.set_eq_enable = set_eq_enable,
.get_balance = get_balance,
.set_balance = set_balance,
.get_treble = get_treble,
.set_treble = set_treble,
.get_bass = get_bass,
.set_bass = set_bass,
.get_audio_out_Mode = get_audio_out_Mode,
.set_audio_out_mode = set_audio_out_mode,
.get_sound_mode = get_sound_mode,
.set_sound_mode = set_sound_mode,
.set_auto_matic_echo_cancel = set_auto_matic_echo_cancel,
.get_auto_matic_echo_cancel = get_auto_matic_echo_cancel,
.get_lineout_fix_output = get_lineout_fix_output,
.set_lineout_fix_output = set_lineout_fix_output,
.get_audio_delay = get_audio_delay,
.set_audio_delay = set_audio_delay,
.get_geq = get_geq,
.set_geq = set_geq,
.get_peq_enable = get_peq_enable,
.set_peq_enable = set_peq_enable,
.get_band_peq = get_band_peq,
.set_band_peq = set_band_peq,
.get_band_drc = get_band_drc,
.set_band_drc = set_band_drc,
.get_prescale = get_prescale,
.set_prescale = set_prescale,
};