当前位置:网站首页>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
边栏推荐
- SQL injection vulnerability (MSSQL injection)
- [leetcode question brushing day 33] 1189 The maximum number of "balloons", 201. The number range is bitwise AND
- Visio draws Tai Chi
- Bubble sort
- IPv6 comprehensive experiment
- web工程导入了mysql驱动jar包却无法加载到驱动的问题
- Supreme Court, judgment standard of divorce cases
- Solve the compilation problem of "c2001: line breaks in constants"
- P3500 [poi2010]tes intelligence test (two points & offline)
- coreldraw2022新版本新功能介绍cdr2022
猜你喜欢
How to estimate the population with samples? (mean, variance, standard deviation)
[Zhao Yuqiang] deploy kubernetes cluster with binary package
Use sentinel to interface locally
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
IPv6 comprehensive experiment
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
[detailed steps of FreeRTOS shift value for the first time]
MPLS experiment
Postman断言
Easyrecovery靠谱不收费的数据恢复电脑软件
随机推荐
Redis - redis in action - redis actual combat - actual combat Chapter 1 - SMS login function based on redis - redis + token shared session application - with code
View workflow
也算是學習中的小總結
【HBZ分享】ArrayList的增删慢查询快的原因
Platformio create libopencm3 + FreeRTOS project
The implementation of the maize negotiable digital warehouse receipt standard will speed up the asset digitization process of the industry
JVM garbage collector concept
项目经理,你会画原型嘛?项目经理需要做产品设计了?
1008 circular right shift of array elements (20 points)
Canal synchronizes MySQL data changes to Kafka (CentOS deployment)
Introduction to hashtable
DMA use of stm32
. Net interprocess communication
Quatre méthodes de redis pour dépanner les grandes clés sont nécessaires pour optimiser
IPv6 comprehensive experiment
NPM command -- install dependent packages -- Usage / explanation
ue5 小知识点 开启lumen的设置
Use sentinel to interface locally
Project manager, can you draw prototypes? Does the project manager need to do product design?
Ue5 small knowledge freezerendering view rendered objects in the cone