当前位置:网站首页>On the solution of es8316's audio burst
On the solution of es8316's audio burst
2022-07-06 04:43:00 【Never bald programmer】
List of articles
Recently, I encountered a problem about playing audio before and after , The horn will produce Da A voice , At present, the real reason has not been found , But you can do software evasion .
One 、 Evasive thinking
Control the power amplifier angle of the horn , Turn on the power amplifier horn before using the horn , Turn off the power amplifier corner after using the horn , In this way, you can avoid the appearance of this sound .
Two 、 Related codes
frameworks/av/
diff --git a/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp b/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
index dce34db..1b2db64 100644
--- a/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
+++ b/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
@@ -31,6 +31,12 @@
#include <media/AudioUtilmtk.h>
#endif
// Add node path here
+const char *SPEAKER_ENABLE_PATH = "/sys/class/gpio/gpio114/value";
+static bool stream_system_on = false;
+static bool stream_notification_on = false;
+static bool stream_music_on = false;
+static bool stream_other_on = false;
+
namespace android {
@@ -270,8 +276,33 @@
sp<AudioPlaybackClient> client;
sp<AudioPolicyEffects>audioPolicyEffects;
// open audio The process time enables the power amplifier
+ FILE *fp = fopen(SPEAKER_ENABLE_PATH, "w");
+ if (fp != NULL) {
+ char buf[2] = "1";
+ if (fwrite(buf, 1, 1, fp))
+ ALOGE("%s() fwrite success", __FUNCTION__);
+ else
+ ALOGE("%s() fwrite fail", __FUNCTION__);
+ fclose(fp);
+ } else
+ ALOGE("+%s() open failed", __FUNCTION__);
+
getPlaybackClientAndEffects(portId, client, audioPolicyEffects, __func__);
+ switch (client->stream) {
+ case 1: //AUDIO_STREAM_SYSTEM button sound
+ stream_system_on = true;
+ break;
+ case 3: //AUDIO_STREAM_MUSIC
+ stream_music_on = true;
+ break;
+ case 5://AUDIO_STREAM_NOTIFICATION
+ stream_notification_on = true;
+ break;
+ default:
+ stream_other_on = true;
+ }
+
if (audioPolicyEffects != 0) {
// create audio processors according to stream
status_t status = audioPolicyEffects->addOutputSessionEffects(
@@ -307,6 +338,34 @@
getPlaybackClientAndEffects(portId, client, audioPolicyEffects, __func__);
+ switch (client->stream) {
+ case 1: //AUDIO_STREAM_SYSTEM button sound
+ stream_system_on = false;
+ break;
+ case 3: //AUDIO_STREAM_MUSIC
+ stream_music_on = false;
+ break;
+ case 5://AUDIO_STREAM_NOTIFICATION
+ stream_notification_on = false;
+ break;
+ default:
+ stream_other_on = false;
+ }
+ // close audio Turn off the power amplifier during the process
+ if ((stream_system_on == false) && (stream_music_on == false) &&
+ (stream_notification_on == false) && (stream_other_on == false)) {
+ FILE *fp = fopen(SPEAKER_ENABLE_PATH, "w");
+ if (fp != NULL) {
+ char buf[2] = "0";
+ if (fwrite(buf, 1, 1, fp))
+ ALOGE("%s() fwrite success", __FUNCTION__);
+ else
+ ALOGE("%s() fwrite fail", __FUNCTION__);
+ fclose(fp);
+ } else
+ ALOGE("+%s() open failed", __FUNCTION__);
+ }
+
if (audioPolicyEffects != 0) {
// release audio processors from the stream
status_t status = audioPolicyEffects->releaseOutputSessionEffects(
device/nxp/
Add corresponding permissions
diff --git a/init.mt8168.rc b/init.mt8168.rc
index 40ef21b..015f327 100644
--- a/init.mt8168.rc
+++ b/init.mt8168.rc
@@ -623,6 +623,10 @@
# EEPROM
chmod 0666 /sys/bus/i2c/devices/2-0050/eeprom
+# SPEAKER_ENABLE
+ chown system system /sys/class/gpio/gpio114/value
+ chmod 0666 /sys/class/gpio/gpio114/value
+
on property:vold.decrypt=trigger_reset_main
write /proc/bootprof "INIT:vold.decrypt=trigger_reset_main"
setprop sys.boot_completed 0
kernel Lieutenant general frameworks Apply for the required nodes
diff --git a/drivers/misc/biol_misc.c b/drivers/misc/biol_misc.c
index 6d98a60ed992..a651892d2dda 100644
--- a/drivers/misc/biol_misc.c
+++ b/drivers/misc/biol_misc.c
@@ -122,8 +122,9 @@ static int sbc_biol_probe(struct platform_device *pdev)
amp_en = of_get_named_gpio(np,"amp-en", 0);
if (!gpio_is_valid(amp_en))
{
return -ENODEV;
}
gpio_request(amp_en, "amp-en");
gpio_direction_output(amp_en, 0);
// Application node , It needs to be changed to 1 Otherwise No, /sys/class/gpio/gpio114/ Of direction Catalog
gpio_export(amp_en, 1);
msleep(1);
gpio_set_value(amp_en, 1);
msleep(1);
// Corresponding dts You can refer to what I wrote before , It's just a tool for adding nodes
// https://blog.csdn.net/weixin_51178981/article/details/125097672?spm=1001.2014.3001.5501
边栏推荐
- Coreldraw2022 new version new function introduction cdr2022
- Certbot failed to update certificate solution
- C'est un petit résumé de l'étude.
- Introduction of several RS485 isolated communication schemes
- Etcd database source code analysis -- etcdserver bootstrap initialization storage
- 牛顿插值法
- 2327. 知道秘密的人数(递推)
- Selection of slow motion function
- Knowledge consolidation source code implementation 3: buffer ringbuffer
- Quick sort
猜你喜欢

Introduction to hashtable

Certbot failed to update certificate solution

Canal synchronizes MySQL data changes to Kafka (CentOS deployment)

Lombok principle and the pit of ⽤ @data and @builder at the same time
![[数学建模] 微分方程--捕鱼业的持续发展](/img/7c/2ab6f2a34bc2c97318537ec8e0b0c5.png)
[数学建模] 微分方程--捕鱼业的持续发展
![[mathematical modeling] differential equation -- sustainable development of fishing industry](/img/7c/2ab6f2a34bc2c97318537ec8e0b0c5.png)
[mathematical modeling] differential equation -- sustainable development of fishing industry

Delete subsequence < daily question >

RTP gb28181 document testing tool

Selection of slow motion function

比尔·盖茨晒18岁个人简历,48年前期望年薪1.2万美元
随机推荐
CADD课程学习(7)-- 模拟靶点和小分子相互作用 (柔性对接 AutoDock)
coreldraw2022新版本新功能介绍cdr2022
Introduction of several RS485 isolated communication schemes
After learning classes and objects, I wrote a date class
cdc 能全量拉去oracle 表嘛
Sqlserver query results are not displayed in tabular form. How to modify them
团队协作出了问题,项目经理怎么办?
RTP GB28181 文件测试工具
P3500 [poi2010]tes intelligence test (two points & offline)
Easyrecovery reliable and toll free data recovery computer software
Can Flink SQL read multiple topics at the same time. How to write in with
1008 circular right shift of array elements (20 points)
Platformio create libopencm3 + FreeRTOS project
Etcd database source code analysis -- etcdserver bootstrap initialization storage
The value of two date types is subtracted and converted to seconds
Redis —— Redis In Action —— Redis 实战—— 实战篇一 —— 基于 Redis 的短信登录功能 —— Redis + Token 的共享 session 应用— 有代码
MIT CMS. 300 session 8 – immersion / immersion
Database - MySQL storage engine (deadlock)
What should the project manager do if there is something wrong with team collaboration?
捷码赋能案例:专业培训、技术支撑,多措并举推动毕业生搭建智慧校园毕设系统