当前位置:网站首页>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
边栏推荐
- C'est un petit résumé de l'étude.
- The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
- Guitar Pro 8.0最详细全面的更新内容及全部功能介绍
- Recommendation | recommendation of 9 psychotherapy books
- The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
- English Vocabulary - life scene memory method
- What should the project manager do if there is something wrong with team collaboration?
- Certbot failed to update certificate solution
- Flink kakfa data read and write to Hudi
- Dry goods collection | Vulkan game engine video tutorial
猜你喜欢
ue5 小知识点 开启lumen的设置
Redis —— Redis In Action —— Redis 实战—— 实战篇一 —— 基于 Redis 的短信登录功能 —— Redis + Token 的共享 session 应用— 有代码
Coreldraw2022 new version new function introduction cdr2022
coreldraw2022新版本新功能介绍cdr2022
How does computer nail adjust sound
Yyds dry inventory automatic lighting system based on CC2530 (ZigBee)
满足多元需求:捷码打造3大一站式开发套餐,助力高效开发
Easyrecovery靠谱不收费的数据恢复电脑软件
Sorting out the latest Android interview points in 2022 to help you easily win the offer - attached is the summary of Android intermediate and advanced interview questions in 2022
L'introduction en bourse de MSK Electronics a pris fin: 800 millions de RMB d'actifs de Henan étaient des actionnaires
随机推荐
【Try to Hack】john哈希破解工具
cdc 能全量拉去oracle 表嘛
word封面下划线
Fuzzy -- basic application method of AFL
拉格朗日插值法
Visio draw fan
Bill Gates posted his 18-year-old resume and expected an annual salary of $12000 48 years ago
The IPO of mesk Electronics was terminated: Henan assets, which was once intended to raise 800 million yuan, was a shareholder
Selection sort
After learning classes and objects, I wrote a date class
Sqlserver query results are not displayed in tabular form. How to modify them
Dynamic programming (tree DP)
Mixed development of QML and QWidget (preliminary exploration)
win10电脑系统里的视频不显示缩略图
How do programmers teach their bosses to do things in one sentence? "I'm off duty first. You have to work harder."
Canal synchronizes MySQL data changes to Kafka (CentOS deployment)
flink sql 能同时读多个topic吗。with里怎么写
RTP GB28181 文件测试工具
Mysql database storage engine
[Yu Yue education] reference materials of complex variable function and integral transformation of Northwestern Polytechnic University