当前位置:网站首页>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
边栏推荐
- Patent | subject classification method based on graph convolution neural network fusion of multiple human brain maps
- 2327. 知道秘密的人数(递推)
- 2328. 网格图中递增路径的数目(记忆化搜索)
- 满足多元需求:捷码打造3大一站式开发套餐,助力高效开发
- [mathematical modeling] differential equation -- sustainable development of fishing industry
- Easyrecovery靠谱不收费的数据恢复电脑软件
- Solve the compilation problem of "c2001: line breaks in constants"
- [face recognition series] | realize automatic makeup
- RTP gb28181 document testing tool
- MPLS experiment
猜你喜欢
Programmers' position in the Internet industry | daily anecdotes
coreldraw2022新版本新功能介绍cdr2022
Uva1592 Database
Canal synchronizes MySQL data changes to Kafka (CentOS deployment)
CADD课程学习(7)-- 模拟靶点和小分子相互作用 (柔性对接 AutoDock)
Redis —— Redis In Action —— Redis 实战—— 实战篇一 —— 基于 Redis 的短信登录功能 —— Redis + Token 的共享 session 应用— 有代码
CADD course learning (8) -- virtual screening of Compound Library
How does computer nail adjust sound
A blog to achieve embedded entry
[network] channel attention network and spatial attention network
随机推荐
What should the project manager do if there is something wrong with team collaboration?
也算是学习中的小总结
Redis has four methods for checking big keys, which are necessary for optimization
Embedded development program framework
After learning classes and objects, I wrote a date class
MySQL reported an error datetime (0) null
CADD课程学习(8)-- 化合物库虚拟筛选(Virtual Screening)
Fedora/REHL 安装 semanage
Excellent PM must experience these three levels of transformation!
Dry goods collection | Vulkan game engine video tutorial
Flink kakfa data read and write to Hudi
[Chongqing Guangdong education] engineering fluid mechanics reference materials of southwestjiaotonguniversity
npm命令--安装依赖包--用法/详解
C. The third problem
The value of two date types is subtracted and converted to seconds
Selection sort
Guitar Pro 8.0最详细全面的更新内容及全部功能介绍
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
2328. Number of incremental paths in the grid graph (memory search)
It is also a small summary in learning