[go: up one dir, main page]

CN117715163B - Audio play control method, electronic device and readable storage medium - Google Patents

Audio play control method, electronic device and readable storage medium Download PDF

Info

Publication number
CN117715163B
CN117715163B CN202310901148.1A CN202310901148A CN117715163B CN 117715163 B CN117715163 B CN 117715163B CN 202310901148 A CN202310901148 A CN 202310901148A CN 117715163 B CN117715163 B CN 117715163B
Authority
CN
China
Prior art keywords
audio
power amplifier
electronic device
mute
audio data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202310901148.1A
Other languages
Chinese (zh)
Other versions
CN117715163A (en
Inventor
王纲
高强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Honor Device Co Ltd
Original Assignee
Honor Device Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Honor Device Co Ltd filed Critical Honor Device Co Ltd
Priority to CN202310901148.1A priority Critical patent/CN117715163B/en
Publication of CN117715163A publication Critical patent/CN117715163A/en
Application granted granted Critical
Publication of CN117715163B publication Critical patent/CN117715163B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/16Sound input; Sound output
    • G06F3/165Management of the audio stream, e.g. setting of volume, audio stream path
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M1/00Substation equipment, e.g. for use by subscribers
    • H04M1/72Mobile telephones; Cordless telephones, i.e. devices for establishing wireless links to base stations without route selection
    • H04M1/724User interfaces specially adapted for cordless or mobile telephones
    • H04M1/72403User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality
    • H04M1/72442User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality for playing music files
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W52/00Power management, e.g. Transmission Power Control [TPC] or power classes
    • H04W52/02Power saving arrangements
    • H04W52/0209Power saving arrangements in terminal devices
    • H04W52/0261Power saving arrangements in terminal devices managing power supply demand, e.g. depending on battery level
    • H04W52/0274Power saving arrangements in terminal devices managing power supply demand, e.g. depending on battery level by switching on or off the equipment or parts thereof
    • H04W52/028Power saving arrangements in terminal devices managing power supply demand, e.g. depending on battery level by switching on or off the equipment or parts thereof switching on or off only a part of the equipment circuit blocks
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Human Computer Interaction (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Theoretical Computer Science (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • General Health & Medical Sciences (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Circuit For Audible Band Transducer (AREA)

Abstract

本申请公开了一种音频播放的控制方法、电子设备及可读存储介质,属于终端技术领域。该方法包括:响应于音频播放操作,在电子设备处于非静音播放模式的情况下,通过音频播放应用程序向电子设备的音频功率放大器传输目标音频的音频数据,以播放目标音频,音频功率放大器在接收音频播放操作之前处于开启状态;在电子设备由非静音播放模式切换至静音播放模式的情况下,关闭音频功率放大器,并停止向音频功率放大器传输目标音频的音频数据;模拟向音频功率放大器传输目标音频的音频数据的操作,使得在播放目标音频期间目标音频的播放速度不发生变化。本申请在播放目标音频的过程中,可以关闭音频功率放大器,从而降低了电子设备的功耗。

The present application discloses a control method for audio playback, an electronic device, and a readable storage medium, and belongs to the field of terminal technology. The method includes: in response to an audio playback operation, when the electronic device is in a non-silent playback mode, transmitting the audio data of the target audio to the audio power amplifier of the electronic device through an audio playback application to play the target audio, and the audio power amplifier is in an on state before receiving the audio playback operation; when the electronic device switches from a non-silent playback mode to a silent playback mode, turning off the audio power amplifier and stopping transmitting the audio data of the target audio to the audio power amplifier; simulating the operation of transmitting the audio data of the target audio to the audio power amplifier, so that the playback speed of the target audio does not change during the playback of the target audio. The present application can turn off the audio power amplifier during the process of playing the target audio, thereby reducing the power consumption of the electronic device.

Description

音频播放的控制方法、电子设备及可读存储介质Audio playback control method, electronic device and readable storage medium

技术领域Technical Field

本申请涉及终端技术领域,特别涉及一种音频播放的控制方法、电子设备及可读存储介质。The present application relates to the field of terminal technology, and in particular to a method for controlling audio playback, an electronic device, and a readable storage medium.

背景技术Background Art

随着终端技术的发展,用户通过电子设备进行娱乐的方式越来越丰富,比如,用户可以通过播放视频、音频等方式进行娱乐。With the development of terminal technology, users have more and more ways to entertain themselves through electronic devices. For example, users can entertain themselves by playing videos, audios, etc.

但是,电子设备在播放音频或视频的过程中会产生功耗,导致电子设备整体功耗增加,从而影响电子设备的电池的续航。因此,为了降低播放音频过程中产生的功耗,亟需一种音频播放的控制方法。However, when playing audio or video, the electronic device generates power consumption, which increases the overall power consumption of the electronic device, thereby affecting the battery life of the electronic device. Therefore, in order to reduce the power consumption generated during the audio playback process, a method for controlling audio playback is urgently needed.

发明内容Summary of the invention

本申请提供了一种音频播放的控制方法、电子设备及可读存储介质,可以用于降低播音频过程中产生的功耗。所述技术方案如下:The present application provides a method for controlling audio playback, an electronic device, and a readable storage medium, which can be used to reduce the power consumption generated during audio playback. The technical solution is as follows:

第一方面,提供了一种音频播放的控制方法,应用于电子设备中,所述方法包括:In a first aspect, a method for controlling audio playback is provided, which is applied to an electronic device, and the method includes:

响应于音频播放操作,在所述电子设备处于非静音播放模式的情况下,通过音频播放应用程序向所述电子设备的音频功率放大器传输目标音频的音频数据,以播放所述目标音频,所述音频功率放大器在接收所述音频播放操作之前处于开启状态;In response to an audio playback operation, when the electronic device is in a non-silent playback mode, transmitting audio data of a target audio to an audio power amplifier of the electronic device through an audio playback application to play the target audio, the audio power amplifier being in an on state before receiving the audio playback operation;

在所述电子设备由所述非静音播放模式切换至静音播放模式的情况下,关闭所述音频功率放大器,并停止向所述音频功率放大器传输所述目标音频的音频数据;When the electronic device is switched from the non-silent playback mode to the silent playback mode, turning off the audio power amplifier and stopping transmitting the audio data of the target audio to the audio power amplifier;

模拟向所述音频功率放大器传输所述目标音频的音频数据的操作,使得在播放所述目标音频期间所述目标音频的播放速度不发生变化。The operation of transmitting the audio data of the target audio to the audio power amplifier is simulated so that the playing speed of the target audio does not change during the playing of the target audio.

如此,在电子设备播放目标音频的过程中,若电子设备切换至静音播放模式,则可以关闭音频功率放大器,在音频功率放大器处于关闭状态下,音频功率放大器并不会产生功耗,从而降低了电子设备功耗,提高了电子设备的电池的续航能力。另外,由于在关闭音频功率放大器的情况下,可以模拟向音频功率放大器传输音频数据的操作,从而避免了目标音频播放速度发生变化,保证了目标音频正常播放。In this way, when the electronic device is playing the target audio, if the electronic device is switched to the silent playback mode, the audio power amplifier can be turned off. When the audio power amplifier is in the off state, the audio power amplifier does not generate power consumption, thereby reducing the power consumption of the electronic device and improving the battery life of the electronic device. In addition, since the operation of transmitting audio data to the audio power amplifier can be simulated when the audio power amplifier is turned off, the target audio playback speed is avoided from changing, ensuring the normal playback of the target audio.

作为本申请的一个示例,所述在所述电子设备由所述非静音播放模式切换至静音播放模式的情况下,关闭所述音频功率放大器,并停止向所述音频功率放大器传输所述目标音频的音频数据之后,还包括:As an example of the present application, when the electronic device is switched from the non-silent playback mode to the silent playback mode, after turning off the audio power amplifier and stopping transmitting the audio data of the target audio to the audio power amplifier, it also includes:

在所述电子设备由所述静音播放模式切换至所述非静音播放模式的情况下,开启所述音频功率放大器,并恢复向所述音频功率放大器传输所述目标音频的音频数据。When the electronic device switches from the silent play mode to the non-silent play mode, the audio power amplifier is turned on, and the transmission of the audio data of the target audio to the audio power amplifier is resumed.

如此,在电子设备处于非静音播放模式的情况下,通过开启音频功率放大器,可以使目标音频能够正常播放,避免了目标音频播放错误的情况发生。In this way, when the electronic device is in a non-silent playback mode, the target audio can be played normally by turning on the audio power amplifier, thereby avoiding the occurrence of target audio playback errors.

作为本申请的一个示例,所述在所述电子设备由所述非静音播放模式切换至静音播放模式的情况下,关闭所述音频功率放大器,并停止向所述音频功率放大器传输所述目标音频的音频数据之前,还包括:As an example of the present application, when the electronic device is switched from the non-silent playback mode to the silent playback mode, before turning off the audio power amplifier and stopping transmitting the audio data of the target audio to the audio power amplifier, it also includes:

获取所述目标音频的音量信息,所述音量信息用于指示所述目标音频当前的音量大小;Acquire volume information of the target audio, where the volume information is used to indicate the current volume of the target audio;

在所述音量信息指示所述目标音频当前的音量大小为零的情况下,确定所述音量大小为零的持续时长;When the volume information indicates that the current volume of the target audio is zero, determining a duration during which the volume is zero;

在所述持续时长大于或等于时长阈值的情况下,确定所述电子设备由所述非静音播放模式切换至所述静音播放模式。When the duration is greater than or equal to the duration threshold, it is determined that the electronic device is switched from the non-silent play mode to the silent play mode.

如此,通过检测音量大小为零的持续时长,从而避免频繁开关音频功率放大器,降低了对音频功率放大器的损伤。In this way, by detecting the duration of the volume being zero, frequent switching of the audio power amplifier can be avoided, thereby reducing damage to the audio power amplifier.

作为本申请的一个示例,所述电子设备中包括场景识别模块和静音控制模块;As an example of the present application, the electronic device includes a scene recognition module and a mute control module;

所述在所述电子设备由所述非静音播放模式切换至静音播放模式的情况下,关闭所述音频功率放大器,并停止向所述音频功率放大器传输所述目标音频的音频数据,包括:When the electronic device is switched from the non-silent play mode to the silent play mode, turning off the audio power amplifier and stopping transmitting the audio data of the target audio to the audio power amplifier comprises:

在所述电子设备由所述非静音播放模式切换至静音播放模式的情况下,所述场景识别模块向所述静音控制模块发送静音控制指令;When the electronic device switches from the non-silent playback mode to the silent playback mode, the scene recognition module sends a silent control instruction to the silent control module;

响应于所述静音控制指令,所述静音控制模块向所述音频功率放大器发送关闭指令,并丢弃来自所述音频播放应用程序传输的音频数据;In response to the mute control instruction, the mute control module sends a shutdown instruction to the audio power amplifier and discards the audio data transmitted from the audio playback application;

响应于所述关闭指令,所述音频功率放大器由所述开启状态切换至关闭状态。In response to the shut-down instruction, the audio power amplifier switches from the on state to the off state.

如此,通过向音频功率放大器发送关闭指令,使得音频功率放大器由开启状态切换至关闭状态,从而减少了音频功率放大器产生的功耗,进而降低了电子设备的功耗,保障了电子设备电池的续航能力。In this way, by sending a shutdown command to the audio power amplifier, the audio power amplifier is switched from an on state to an off state, thereby reducing the power consumption generated by the audio power amplifier, thereby reducing the power consumption of the electronic device and ensuring the battery life of the electronic device.

作为本申请的一个示例,所述在所述电子设备由所述非静音播放模式切换至静音播放模式的情况下,关闭所述音频功率放大器,并停止向所述音频功率放大器传输所述目标音频的音频数据,包括:As an example of the present application, when the electronic device is switched from the non-silent playback mode to the silent playback mode, turning off the audio power amplifier and stopping transmitting the audio data of the target audio to the audio power amplifier include:

在所述电子设备由所述非静音播放模式切换至所述静音播放模式的情况下,若预设白名单中存在所述音频播放应用程序的目标应用标识,则关闭所述音频功率放大器,并停止向所述音频功率放大器传输所述目标音频的音频数据。When the electronic device switches from the non-silent playback mode to the silent playback mode, if the target application identifier of the audio playback application exists in the preset whitelist, the audio power amplifier is turned off and the transmission of the target audio data to the audio power amplifier is stopped.

如此,通过设置预设白名单,从而给使得对音频功率放大器的控制更具有针对性,提高了对音频功率放大器进行静音控制的准确性。In this way, by setting a preset white list, the control of the audio power amplifier is made more targeted, thereby improving the accuracy of the mute control of the audio power amplifier.

作为本申请的一个示例,所述电子设备中包括场景识别模块和白名单控制模块;As an example of the present application, the electronic device includes a scene recognition module and a whitelist control module;

所述在所述电子设备由所述非静音播放模式切换至静音播放模式的情况下,若预设白名单中存在所述音频播放应用程序的目标应用标识,则关闭所述音频功率放大器,并停止向所述音频功率放大器传输音频数据之前,还包括:When the electronic device is switched from the non-silent playback mode to the silent playback mode, if the target application identifier of the audio playback application program exists in the preset whitelist, before turning off the audio power amplifier and stopping transmitting audio data to the audio power amplifier, the method further includes:

所述白名单控制模块获取所述目标应用标识;The whitelist control module obtains the target application identifier;

在所述预设白名单中存在所述目标应用标识的情况下,所述白名单控制模块向所述场景识别模块发送匹配通过消息,所述匹配通过消息用于指示在所述电子设备由所述非静音播放模式切换至所述静音播放模式的情况下允许关闭所述音频功率放大器。When the target application identifier exists in the preset whitelist, the whitelist control module sends a match pass message to the scene recognition module, and the match pass message is used to indicate that the audio power amplifier is allowed to be turned off when the electronic device switches from the non-silent playback mode to the silent playback mode.

如此,通过识别目标应用标识是否位于预设白名单中,可以快速确定在电子设备处于静音播放模式下,是否能够关闭对音频功率放大器,从而提高了控制音频功率放大器的效率。In this way, by identifying whether the target application identifier is in the preset whitelist, it can be quickly determined whether the audio power amplifier can be turned off when the electronic device is in the silent playback mode, thereby improving the efficiency of controlling the audio power amplifier.

作为本申请的一个示例,所述电子设备包括静音控制模块;As an example of the present application, the electronic device includes a mute control module;

所述模拟向所述音频功率放大器传输所述目标音频的音频数据的操作,包括:The operation of simulating transmitting the audio data of the target audio to the audio power amplifier includes:

在音频数据传输过程中,所述静音控制模块每接收音频播放线程传输的一帧音频数据,开始进行延时操作,并丢弃当前接收的一帧音频数据,其中,所述音频播放应用程序通过所述音频播放线程向所述静音控制模块传输所述目标音频的音频数据;During the audio data transmission process, the mute control module starts a delay operation each time it receives a frame of audio data transmitted by the audio playback thread, and discards a frame of audio data currently received, wherein the audio playback application transmits the audio data of the target audio to the mute control module through the audio playback thread;

在延时时长达到传输时长的情况下,所述静音控制模块向所述音频播放线程发送反馈信息,所述传输时长为所述目标音频的音频数据从所述静音控制模块传输至所述音频功率放大器的时长,所述反馈信息用于指示所述音频播放线程继续传输下一帧音频数据。When the delay duration reaches the transmission duration, the mute control module sends feedback information to the audio playback thread. The transmission duration is the duration for the audio data of the target audio to be transmitted from the mute control module to the audio power amplifier. The feedback information is used to instruct the audio playback thread to continue transmitting the next frame of audio data.

如此,通过发送反馈信息,可以使得音频播放线程能够准确进行音频数据的传输,避免目标音频的进度条异常。In this way, by sending feedback information, the audio playback thread can accurately transmit the audio data and avoid abnormal progress bar of the target audio.

作为本申请的一个示例,所述静音控制模块包括音频开关模块和音频模拟模块;As an example of the present application, the mute control module includes an audio switch module and an audio simulation module;

所述在音频数据传输过程中,所述静音控制模块每接收音频播放线程传输的一帧音频数据,开始进行延时操作,并丢弃当前接收的一帧音频数据,包括:During the audio data transmission process, the mute control module starts a delay operation each time it receives a frame of audio data transmitted by the audio playback thread, and discards a currently received frame of audio data, including:

在音频数据传输过程中,所述音频开关模块每接收所述音频播放线程传输的一帧音频数据,向所述音频模拟模块发送模拟消息,并丢弃当前接收的一帧音频数据;During the audio data transmission process, the audio switch module sends a simulation message to the audio simulation module each time it receives a frame of audio data transmitted by the audio playback thread, and discards a currently received frame of audio data;

所述音频模拟模块在接收到所述模拟消息的情况下开始进行延时操作;The audio simulation module starts to perform a delay operation when receiving the simulation message;

所述在延时时长达到传输时长的情况下,所述静音控制模块向所述音频播放线程发送反馈信息,包括:When the delay duration reaches the transmission duration, the mute control module sends feedback information to the audio playback thread, including:

在所述延时时长达到所述传输时长的情况下,所述音频模拟模块向所述音频播放线程发送所述反馈信息。When the delay duration reaches the transmission duration, the audio simulation module sends the feedback information to the audio playback thread.

如此,通过音频模拟模块进行延时操作,并在延时时长达到传输时长的情况下,发送反馈信息,从而保证了目标音频的播放速度,避免出现目标音频的加速播放。In this way, the delay operation is performed through the audio simulation module, and feedback information is sent when the delay time reaches the transmission time, thereby ensuring the playback speed of the target audio and avoiding accelerated playback of the target audio.

第二方面,提供了一种电子设备,所述电子设备的结构中包括处理器和存储器,所述存储器用于存储支持电子设备执行上述第一方面所提供的音频播放的控制方法的程序,以及存储用于实现上述第一方面所述的音频播放的控制方法所涉及的数据。所述处理器被配置为用于执行所述存储器中存储的程序。所述电子设备还可以包括通信总线,所述通信总线用于在所述处理器与所述存储器之间建立连接。In a second aspect, an electronic device is provided, wherein the structure of the electronic device includes a processor and a memory, wherein the memory is used to store a program that supports the electronic device to execute the audio playback control method provided in the first aspect, and to store data involved in implementing the audio playback control method described in the first aspect. The processor is configured to execute the program stored in the memory. The electronic device may also include a communication bus, wherein the communication bus is used to establish a connection between the processor and the memory.

第三方面,提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有指令,当其在计算机上运行时,使得计算机执行上述第一方面所述的音频播放的控制方法。In a third aspect, a computer-readable storage medium is provided, wherein instructions are stored in the computer-readable storage medium, and when the computer-readable storage medium is executed on a computer, the computer executes the audio playback control method described in the first aspect.

第四方面,提供了一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述第一方面所述的音频播放的控制方法。In a fourth aspect, a computer program product comprising instructions is provided, which, when executed on a computer, enables the computer to execute the audio playback control method described in the first aspect.

上述第二方面、第三方面、第四方面和第五方面所获得的技术效果与上述第一方面中对应的技术手段获得的技术效果近似,在这里不再赘述。The technical effects obtained by the above-mentioned second, third, fourth and fifth aspects are similar to the technical effects obtained by the corresponding technical means in the above-mentioned first aspect, and will not be repeated here.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

图1是本申请实施例提供的一种应用场景的示意图;FIG1 is a schematic diagram of an application scenario provided by an embodiment of the present application;

图2是本申请实施例提供的一种音频数据传输流程示意图;FIG2 is a schematic diagram of an audio data transmission process provided by an embodiment of the present application;

图3是本申请实施例提供的一种电子设备的软件系统的框图;FIG3 is a block diagram of a software system of an electronic device provided in an embodiment of the present application;

图4是本申请实施例提供的一种音频播放的控制方法的流程示意图;FIG4 is a flow chart of a method for controlling audio playback provided in an embodiment of the present application;

图5是本申请实施例提供的一种场景识别流程示意图;FIG5 is a schematic diagram of a scene recognition process provided by an embodiment of the present application;

图6是本申请实施例提供的另一种音频播放的控制方法的流程示意图;FIG6 is a flow chart of another method for controlling audio playback provided in an embodiment of the present application;

图7是本申请实施例提供的一种循环线程的流程示意图;FIG7 is a schematic diagram of a flow chart of a loop thread provided in an embodiment of the present application;

图8是本申请实施例提供的一种静音控制流程的示意图;FIG8 is a schematic diagram of a mute control process provided in an embodiment of the present application;

图9是本申请实施例提供的一种电子设备的结构示意图。FIG. 9 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application.

具体实施方式DETAILED DESCRIPTION

为使本申请的目的、技术方案和优点更加清楚,下面将结合附图对本申请的实施方式作进一步地详细描述。In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below in conjunction with the accompanying drawings.

应当理解的是,本申请提及的“多个”是指两个或两个以上。在本申请的描述中,除非另有说明,“/”表示或的意思,比如,A/B可以表示A或B;本文中的“和/或”仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,比如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,为了便于清楚描述本申请的技术方案,采用了“第一”、“第二”等字样对功能和作用基本相同的相同项或相似项进行区分。本领域技术人员可以理解“第一”、“第二”等字样并不对数量和执行次序进行限定,并且“第一”、“第二”等字样也并不限定一定不同。It should be understood that the "multiple" mentioned in this application refers to two or more. In the description of this application, unless otherwise specified, "/" means or, for example, A/B can mean A or B; "and/or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and/or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in order to facilitate the clear description of the technical solution of this application, the words "first" and "second" are used to distinguish between the same or similar items with basically the same functions and effects. Those skilled in the art can understand that the words "first" and "second" do not limit the quantity and execution order, and the words "first" and "second" do not limit them to be different.

在本申请说明书中描述的参考“一个实施例”或“一些实施例”等意味着在本申请的一个或多个实施例中包括结合该实施例描述的特定特征、结构或特点。由此,在本说明书中的不同之处出现的语句“在一个实施例中”、“在一些实施例中”、“在其他一些实施例中”、“在另外一些实施例中”等不是必然都参考相同的实施例,而是意味着“一个或多个但不是所有的实施例”,除非是以其他方式另外特别强调。术语“包括”、“包含”、“具有”及它们的变形都意味着“包括但不限于”,除非是以其他方式另外特别强调。References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

在一种应用场景中,用户在使用诸如手机、平板电脑等电子设备的过程中,可能会进行音频或视频的播放,在播放音频或视频的过程中可能会因一些原因,将音频或视频以静音的方式进行播放。比如,参见图1中的(a)图或(b)图,用户在打开能够播放视频的应用程序后,比如打开视频应用程序后,若设置视频自动预览,则在视频位于视频展示界面的指定位置下,可以自动以静音的方式进行播放,比如图1中的(a)图中,名称为“超越自我”的视频位于该视频展示界面的最顶端的情况下,以静音的方式进行播放;图1中的(b)图中,用户c上传的视频显示在画面中间位置处时,以静音的方式进行播放。在视频以静音的方式进行播放的情况下,视频画面处于正常播放状态,视频中的音频处于静音状态,也即是,用户可以看到视频处于播放状态但并不能听到视频中的音频。该种情况下,视频中音频的音频数据还是会正常进行传递,即音频数据可以由视频应用程序传递至音频功率放大器,并由音频功率放大器将处理后的音频数据传递至电子设备的喇叭进行播放,从而音频功率放大器仍然会产生功耗,增加了电子设备的功耗,不利于电子设备的电池的续航。示例性地,参见图2,视频应用程序响应于对目标视频的播放操作,可以将音频数据通过框架层、HAL层和内核层传输至硬件层中的音频功率放大器中,音频功率放大器可以对接收到的音频数据进行处理,并将处理后的音频数据传输至喇叭,从而喇叭对目标音频进行静音播放,由于音频功率放大器一直处于工作状态,从而音频功率放大器仍然会产生功耗,增加了电子设备的功耗,不利于电子设备的电池的续航。In an application scenario, a user may play audio or video while using an electronic device such as a mobile phone or tablet computer. During the process of playing audio or video, the audio or video may be played in a silent mode for some reasons. For example, referring to (a) or (b) in FIG. 1, after a user opens an application that can play videos, such as a video application, if the video is set to be automatically previewed, the video can be automatically played in a silent mode when it is located at a specified position of the video display interface. For example, in (a) in FIG. 1, the video named "Surpassing Self" is located at the top of the video display interface and is played in a silent mode; in (b) in FIG. 1, the video uploaded by user c is displayed in the middle of the screen and is played in a silent mode. When the video is played in a silent mode, the video screen is in a normal playing state and the audio in the video is in a silent state, that is, the user can see that the video is in a playing state but cannot hear the audio in the video. In this case, the audio data of the audio in the video will still be transmitted normally, that is, the audio data can be transmitted from the video application to the audio power amplifier, and the audio power amplifier transmits the processed audio data to the speaker of the electronic device for playback, so that the audio power amplifier will still generate power consumption, which increases the power consumption of the electronic device, which is not conducive to the battery life of the electronic device. For example, referring to Figure 2, in response to the playback operation of the target video, the video application can transmit the audio data to the audio power amplifier in the hardware layer through the framework layer, the HAL layer and the kernel layer. The audio power amplifier can process the received audio data and transmit the processed audio data to the speaker, so that the speaker plays the target audio silently. Since the audio power amplifier is always in a working state, the audio power amplifier will still generate power consumption, which increases the power consumption of the electronic device, which is not conducive to the battery life of the electronic device.

为了在静音播放音频过程中降低电子设备的功耗,本申请实施例提供了一种音频播放的控制方法,该方法中,在通过音频播放应用程序向音频功率放大器传输音频数据的过程中,若电子设备由非静音播放模式切换至静音播放模式,则可以关闭音频功率放大器,并停止向音频功率放大器传输音频数据,同时为了在播放目标音频期间目标音频的播放速度不发生变化,还可以模拟向音频功率放大器传输音频数据的操作。由于在电子设备播放目标音频的过程中,若电子设备切换至静音播放模式,则可以关闭音频功率放大器,在音频功率放大器处于关闭状态下,音频功率放大器并不会产生功耗,从而降低了电子设备功耗,提高了电子设备的电池的续航能力。In order to reduce the power consumption of an electronic device during silent audio playback, an embodiment of the present application provides a method for controlling audio playback, in which, during the process of transmitting audio data to an audio power amplifier through an audio playback application, if the electronic device switches from a non-silent playback mode to a silent playback mode, the audio power amplifier can be turned off and the transmission of audio data to the audio power amplifier can be stopped. At the same time, in order to prevent the playback speed of the target audio from changing during the playback of the target audio, the operation of transmitting audio data to the audio power amplifier can also be simulated. Since during the process of the electronic device playing the target audio, if the electronic device switches to a silent playback mode, the audio power amplifier can be turned off, and when the audio power amplifier is in the off state, the audio power amplifier does not generate power consumption, thereby reducing the power consumption of the electronic device and improving the battery life of the electronic device.

接下来对电子设备100的软件系统予以说明。Next, the software system of the electronic device 100 will be described.

电子设备100的软件系统可以采用分层架构,事件驱动架构,微核架构,微服务架构,或云架构。本申请实施例以分层架构的安卓(Android)系统为例,对电子设备100的软件系统进行示例性说明。The software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present application takes the Android system of the layered architecture as an example to exemplify the software system of the electronic device 100.

图3是本申请实施例提供的一种电子设备100的软件系统的框图。参见图3,分层架构将软件分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。在一些实施例中,将Android系统分为四层,从上至下分别为应用层,框架层(还可以称为本地框架层或native层),安卓运行时(Android runtime)和系统层,以及内核层。FIG3 is a block diagram of a software system of an electronic device 100 provided in an embodiment of the present application. Referring to FIG3 , the layered architecture divides the software into several layers, each layer having a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom, namely, the application layer, the framework layer (also referred to as the local framework layer or native layer), the Android runtime (Android runtime) and the system layer, and the kernel layer.

应用层可以包括一系列应用程序包。如图3所示,应用程序包可以包括图库,音乐,视频,购物等应用程序。The application layer may include a series of application packages. As shown in FIG3 , the application package may include applications such as gallery, music, video, shopping, etc.

作为一个示例,框架层中还可以包括场景识别模块、白名单控制模块和音频播放线程;白名单控制模块用于识别当前传输音频数据的应用程序的应用标识是否位于预设白名单中。音频播放线程用于传输当前播放的音频的音频数据。场景识别模块用于识别当前播放音频的场景,比如,场景识别模块可以识别当前是否处于静音播放模式、当前播放音频的应用程序的应用标识是否位于白名单中,是否通过电子设备100的喇叭播放音频等,并在识别到当前处于静音播放模式,和/或当前播放音频的应用程序的应用标识位于白名单中,和/或通过喇叭播放音频的情况下,向HAL层发送静音控制指令。As an example, the framework layer may also include a scene recognition module, a whitelist control module, and an audio playback thread; the whitelist control module is used to identify whether the application identifier of the application currently transmitting audio data is in a preset whitelist. The audio playback thread is used to transmit the audio data of the currently playing audio. The scene recognition module is used to identify the scene of the currently playing audio. For example, the scene recognition module can identify whether it is currently in silent playback mode, whether the application identifier of the application currently playing audio is in the whitelist, whether the audio is played through the speaker of the electronic device 100, etc., and send a mute control instruction to the HAL layer when it is identified that it is currently in silent playback mode, and/or the application identifier of the application currently playing audio is in the whitelist, and/or the audio is played through the speaker.

作为一个示例,白名单控制模块中包括应用标识获取模块、白名单匹配模块和信息传递模块。应用标识获取模块用于识别当前传输音频数据的应用程序的应用标识,并将识别到的应用标识发送给白名单匹配模块,且应用标识获取模块还用于在接收到白名单匹配模块返回的白名单匹配结果的情况下,信息传递模块发送白名单匹配结果;白名单匹配模块用于存储预设白名单,并识别应用标识获取模块发送的应用程序的应用标识是否位于白名单中,且在得到白名单匹配结果后,将白名单匹配结果返回至应用标识获取模块;信息传递模块用于将白名单匹配结果转发至场景识别模块中。As an example, the whitelist control module includes an application identification acquisition module, a whitelist matching module and an information transmission module. The application identification acquisition module is used to identify the application identification of the application currently transmitting audio data, and send the identified application identification to the whitelist matching module, and the application identification acquisition module is also used to send the whitelist matching result to the information transmission module when receiving the whitelist matching result returned by the whitelist matching module; the whitelist matching module is used to store a preset whitelist, and identify whether the application identification of the application sent by the application identification acquisition module is in the whitelist, and after obtaining the whitelist matching result, return the whitelist matching result to the application identification acquisition module; the information transmission module is used to forward the whitelist matching result to the scene recognition module.

在一些实施例中,HAL层中包括静音控制模块和音频写入模块,其中,音频写入模块用于接收音频播放线程写入的音频数据,并将音频数据传递至静音控制模块。静音控制模块用于在接收到静音控制指令的情况下,向硬件层的音频功率放大器发送关闭指令,并丢弃音频写入模块传输的音频数据。In some embodiments, the HAL layer includes a mute control module and an audio writing module, wherein the audio writing module is used to receive audio data written by the audio playback thread and pass the audio data to the mute control module. The mute control module is used to send a shutdown instruction to the audio power amplifier of the hardware layer and discard the audio data transmitted by the audio writing module when receiving the mute control instruction.

作为本申请的一个示例,静音控制模块中可以包括静音开关模块和音频模拟模块。静音开关模块用于向硬件层的音频功率放大器发送关闭指令,并丢弃音频写入模块传输的音频数据,并向音频模拟模块发送模拟消息。音频模拟模块用于进行延时操作,并在延时时长达到音频数据从静音控制模块传输至音频功率放大器的时长的情况下,向音频播放线程发送反馈信息。As an example of the present application, the mute control module may include a mute switch module and an audio simulation module. The mute switch module is used to send a shutdown instruction to the audio power amplifier of the hardware layer, discard the audio data transmitted by the audio write module, and send an analog message to the audio simulation module. The audio simulation module is used to perform a delay operation, and when the delay time reaches the time it takes for the audio data to be transmitted from the mute control module to the audio power amplifier, feedback information is sent to the audio playback thread.

示例性地,参见图3,该静音开关模块中还可以包括音频开关模块和音频控制模块。其中,音频控制模块用于在接收到静音控制指令的情况下,向硬件层的音频功率放大器发送关闭指令,并向音频模拟模块发送模拟消息,并向音频开关模块发送停止传输指令。音频开关模块用于在接收到停止传输指令的情况下,丢弃音频写入模块传输的音频数据。Exemplarily, referring to FIG3 , the mute switch module may further include an audio switch module and an audio control module. The audio control module is used to send a shutdown instruction to the audio power amplifier of the hardware layer, send an analog message to the audio simulation module, and send a stop transmission instruction to the audio switch module when receiving a mute control instruction. The audio switch module is used to discard the audio data transmitted by the audio write module when receiving a stop transmission instruction.

内核层是硬件和软件之间的层。内核层至少包含显示驱动,摄像头驱动,音频驱动,传感器驱动。The kernel layer is the layer between hardware and software. The kernel layer contains at least display driver, camera driver, audio driver, and sensor driver.

硬件层中可以包括数字信号处理芯片(Digital Singal Processor,DSP)、音频功率放大器、喇叭等。其中,音频功率放大器在接收到关闭指令的情况下,可以由开启状态进入关闭状态。The hardware layer may include a digital signal processing chip (Digital Singal Processor, DSP), an audio power amplifier, a speaker, etc. Among them, the audio power amplifier may enter a closed state from an open state when receiving a close instruction.

为了清楚理解本申请实施例,下面对音频功率放大器处于不同状态时音频数据的传输路径进行说明。In order to clearly understand the embodiments of the present application, the transmission path of audio data when the audio power amplifier is in different states is described below.

在一些实施例中,在音频功率放大器处于开启状态的情况下,当前播放音频的应用程序可以将音频数据传输至音频播放线程,音频播放线程将接收到的音频数据传输至音频写入模块,音频写入模块将音频数据传输至静音控制模块中的音频开关模块,音频开关模块将音频数据通过内核层传输至DSP,DSP将音频数据传输至音频功率放大器,音频功率放大器对音频数据进行处理后,将处理后的音频数据传输至喇叭进行播放。In some embodiments, when the audio power amplifier is in the on state, the application currently playing audio can transmit audio data to the audio playback thread, the audio playback thread transmits the received audio data to the audio write module, the audio write module transmits the audio data to the audio switch module in the mute control module, the audio switch module transmits the audio data to the DSP through the kernel layer, the DSP transmits the audio data to the audio power amplifier, and after the audio power amplifier processes the audio data, it transmits the processed audio data to the speaker for playback.

在一些实施例中,在音频功率放大器处于关闭状态的情况下,当前播放音频的应用程序将音频数据传输至音频播放线程,音频播放线程将接收到的音频数据传输至音频写入模块,音频写入模块将音频数据传输至静音控制模块中的音频开关模块,音频开关模块将接收到的音频数据丢弃。In some embodiments, when the audio power amplifier is in the off state, the application currently playing audio transmits the audio data to the audio playback thread, the audio playback thread transmits the received audio data to the audio write module, the audio write module transmits the audio data to the audio switch module in the mute control module, and the audio switch module discards the received audio data.

需要说明的是,在附图3中音频数据的传输线路以实线箭头进行表示,控制信号的传输路线以虚线箭头进行表示。It should be noted that in FIG. 3 , the transmission line of the audio data is represented by a solid arrow, and the transmission line of the control signal is represented by a dotted arrow.

接下来对本申请实施例提供的音频播放的控制方法进行介绍。这里以电子设备通过音频应用程序静音播放目标音频为例进行说明。请参见图4,图4是根据一示例性实施例示出的一种音频播放的控制方法的流程示意图。该方法可以由上述电子设备执行,电子设备可以通过图3所示的多个模块交互实现,该方法可以包括如下部分或者全部内容:Next, the control method of audio playback provided by the embodiment of the present application is introduced. Here, an electronic device plays the target audio silently through an audio application as an example. Please refer to Figure 4, which is a flow chart of a control method of audio playback according to an exemplary embodiment. The method can be executed by the above-mentioned electronic device, and the electronic device can be implemented by the interaction of multiple modules shown in Figure 3. The method may include some or all of the following contents:

步骤401:音频应用程序接收音频播放操作。Step 401: The audio application receives an audio playing operation.

用户在使用电子设备的过程中,可能会通过音乐应用程序、视频应用程序播放目标音频,该种情况下,用户可以触发音频播放操作。或者,有些视频应用程序提供有静音预览视频的功能,即在视频浏览页面,目标视频处于显示屏的指定位置的情况下,可以自动以静音方式进行预览播放,该种情况下同样可以触发音频播放操作,示例性地,该场景可以如图1所示。在音频播放操作被触发的情况下,音频应用程序可以接收到音频播放操作。When using an electronic device, a user may play the target audio through a music application or a video application. In this case, the user can trigger the audio playback operation. Alternatively, some video applications provide a function of previewing videos in silence, that is, when the target video is at a specified position on the display screen on a video browsing page, it can be automatically previewed and played in silence. In this case, the audio playback operation can also be triggered. For example, the scene can be shown in FIG. 1. When the audio playback operation is triggered, the audio application can receive the audio playback operation.

需要说明的是,在本申请实施例中,音频应用程序为能够播放音频的应用程序,如视频应用程序、音乐应用程序、购物应用程序、短视频应用程序等,本申请实施例对此不做具体限制。It should be noted that in the embodiment of the present application, the audio application is an application that can play audio, such as a video application, a music application, a shopping application, a short video application, etc. The embodiment of the present application does not impose any specific restrictions on this.

作为一个示例,音频功率放大器在音频应用程序接收音频播放操作之前处于开启状态。As an example, the audio power amplifier is turned on before the audio application receives an audio playback operation.

步骤402:响应于音频播放操作,音频应用程序向音频播放线程传输音频数据。Step 402: In response to the audio playback operation, the audio application transmits audio data to the audio playback thread.

步骤403:音频播放线程向音频写入模块传输音频数据。Step 403: The audio playback thread transmits audio data to the audio writing module.

步骤404:音频写入模块向静音开关模块传输音频数据。Step 404: The audio writing module transmits the audio data to the mute switch module.

步骤405:在音频数据传输过程中,应用标识获取模块获取当前传输音频数据的音频应用程序的应用标识。Step 405: During the audio data transmission process, the application identification acquisition module acquires the application identification of the audio application program currently transmitting the audio data.

电子设备中可能设置有白名单,该种情况下,在音频应用程序响应于音频播放操作的情况下,应用标识获取模块可以获取当前传输音频数据的音频应用程序的应用标识。A whitelist may be provided in the electronic device. In this case, when the audio application responds to the audio playing operation, the application identification acquisition module may acquire the application identification of the audio application currently transmitting the audio data.

在当前存在多个音频应用程序传输音频数据的情况下,应用标识获取模块可以获取多个音频应用程序中每个音频应用程序的应用标识。In the case that there are currently multiple audio applications transmitting audio data, the application identification acquisition module may acquire the application identification of each audio application in the multiple audio applications.

步骤406:应用标识获取模块向白名单匹配模块发送获取到的应用标识。Step 406: The application identifier acquisition module sends the acquired application identifier to the whitelist matching module.

由上述可知,白名单匹配模块中存储有预设白名单,该预设白名单中存储的应用标识为能够允许在使用对应应用程序过程中关闭音频功率放大器的应用程序的应用标识。因此,应用标识获取模块可以将获取到的每个应用标识发送给白名单匹配模块。As can be seen from the above, the whitelist matching module stores a preset whitelist, and the application identifiers stored in the preset whitelist are application identifiers of applications that can allow the audio power amplifier to be turned off during the use of the corresponding application. Therefore, the application identifier acquisition module can send each acquired application identifier to the whitelist matching module.

需要说明的是,预设白名单可以是在电子设备开发过程中预置的,也可以是用户在使用电子设备的过程中主动设置的,或者可以说,预设白名单在电子设备开发过程中预置,该预置的白名单允许用户在使用过程中进行编辑,比如,允许用户在预设白名单中增加应用标识,删除应用标识等。It should be noted that the preset whitelist can be preset during the development of the electronic device, or it can be actively set by the user during the use of the electronic device. In other words, the preset whitelist is preset during the development of the electronic device, and the preset whitelist allows the user to edit it during use, for example, allowing the user to add application identifiers to the preset whitelist, delete application identifiers, etc.

步骤407:白名单匹配模块识别接收到的应用标识是否位于预设白名单中。Step 407: The whitelist matching module identifies whether the received application identifier is in a preset whitelist.

作为一个示例,白名单匹配模块在接收到应用标识获取模块发送的应用标识的情况下,可以遍历预设白名单,在预设白名单中存在接收到的应用标识的情况下,确定接收到的应用标识与预设白名单匹配,在预设白名单中不存在接收到的应用标识的情况下,确定接收到的应用标识与预设白名单不匹配。As an example, when the whitelist matching module receives the application identifier sent by the application identifier acquisition module, it can traverse the preset whitelist. When the received application identifier exists in the preset whitelist, it determines that the received application identifier matches the preset whitelist; when the received application identifier does not exist in the preset whitelist, it determines that the received application identifier does not match the preset whitelist.

由上述可知,当前可能存在多个音频应用程序在播放音频数据,该种情况下,白名单匹配模块可能会接收到多个应用标识,在预设白名单中存在该多个应用标识中的每个应用标识的情况下,可以确定接收到的多个应用标识与预设白名单匹配;在多个应用标识中的至少一个应用标识未位于预设白名单中的情况下,确定多个应用标识与预设白名单不匹配。From the above, it can be seen that there may be multiple audio applications currently playing audio data. In this case, the whitelist matching module may receive multiple application identifiers. When each of the multiple application identifiers exists in the preset whitelist, it can be determined that the received multiple application identifiers match the preset whitelist; when at least one application identifier among the multiple application identifiers is not in the preset whitelist, it is determined that the multiple application identifiers do not match the preset whitelist.

步骤408:在接收到的应用标识位于预设白名单的情况下,白名单匹配模块向应用标识获取模块发送匹配消息。Step 408: When the received application identifier is in the preset whitelist, the whitelist matching module sends a matching message to the application identifier acquisition module.

在一种可能的情况下,在接收到的应用标识中存在未位于预设白名单的应用标识的情况下,白名单匹配模块向应用标识获取模块发送不匹配消息。In a possible case, when there is an application identifier that is not in the preset whitelist among the received application identifiers, the whitelist matching module sends a non-matching message to the application identifier obtaining module.

步骤409:应用标识获取模块向信息传递模块发送匹配消息。Step 409: The application identification acquisition module sends a matching message to the information transmission module.

在一种可能的情况下,应用标识获取模块可能会接收到不匹配消息,该种情况下,应用标识获取模块可以将不匹配消息发送给信息传递模块,也可以不向信息传递模块发送任何消息。本申请实施例中以向信息传递模块发送不匹配消息为例进行说明。In one possible case, the application identification acquisition module may receive a mismatch message, in which case the application identification acquisition module may send the mismatch message to the information delivery module, or may not send any message to the information delivery module. In the embodiment of the present application, sending a mismatch message to the information delivery module is used as an example for explanation.

在另一种可能的情况下,白名单匹配模块在得到白名单匹配结果的情况下,可以直接向信息传递模块发送该白名单匹配结果,该白名单匹配结果包括接收到的应用标识中存在未位于预设白名单的应用标识,或者,接收到的应用标识位于预设白名单中。示例性的,在接收到的应用标识位于预设白名单中的情况下,白名单匹配模块向信息传递模块发送匹配消息;在接收到的应用标识中存在未位于预设白名单的应用标识的情况下,白名单匹配模块向信息传递模块发送不匹配消息。In another possible case, when the whitelist matching module obtains the whitelist matching result, it can directly send the whitelist matching result to the information transmission module, and the whitelist matching result includes that the received application identifiers have application identifiers that are not in the preset whitelist, or the received application identifiers are in the preset whitelist. Exemplarily, when the received application identifier is in the preset whitelist, the whitelist matching module sends a matching message to the information transmission module; when the received application identifiers have application identifiers that are not in the preset whitelist, the whitelist matching module sends a non-matching message to the information transmission module.

步骤410:信息传递模块向场景识别模块发送匹配消息。Step 410: The information transfer module sends a matching message to the scene recognition module.

在一种可能的情况下,信息传递模块还可能接收到不匹配消息,该种情况下,信息传递模块可以将不匹配消息发送给场景识别模块。In one possible case, the information transmission module may also receive a non-matching message. In this case, the information transmission module may send the non-matching message to the scene recognition module.

步骤411:在音频数据传输过程中,场景识别模块识别当前是否处于静音播放模式。Step 411: During the audio data transmission process, the scene recognition module identifies whether the current mode is silent playback.

需要说明的是,本申请实施例对执行步骤403、步骤405和步骤411的顺序并不做具体限制。也即是在执行步骤403的过程中,可以同时执行步骤405和步骤411的操作,或者,在执行步骤403的过程中,先执行步骤405的操作,再执行步骤411的操作,或者,在执行步骤403的过程中,先执行步骤411的操作,再执行步骤403的操作,本申请实施例对此不作具体限制。It should be noted that the embodiment of the present application does not specifically limit the order of executing step 403, step 405, and step 411. That is, in the process of executing step 403, the operations of step 405 and step 411 can be executed simultaneously, or, in the process of executing step 403, the operation of step 405 is executed first, and then the operation of step 411 is executed, or, in the process of executing step 403, the operation of step 411 is executed first, and then the operation of step 403 is executed. The embodiment of the present application does not specifically limit this.

在一些实施例中,场景识别模块可以从框架层中获取当前播放的音频的音量信息,该音量信息用于指示当前播放的音频的音量大小。若获取音量信息指示当前播放的音频的音量大小为零,则可以确定当前处于静音播放模式。若获取音量信息指示当前播放的音频的音量大小不为零,则可以确定当前处于非静音播放模式。In some embodiments, the scene recognition module can obtain volume information of the currently played audio from the framework layer, and the volume information is used to indicate the volume of the currently played audio. If the volume information obtained indicates that the volume of the currently played audio is zero, it can be determined that the current silent playback mode is in progress. If the volume information obtained indicates that the volume of the currently played audio is not zero, it can be determined that the current non-silent playback mode is in progress.

由于当前可能通过多个音频应用程序播放音频,那么音频播放线程中可能会传输多个音频的音频数据,该种情况下,场景识别模块在识别到多个音频的音量大小均为零的情况下,可以确定当前处于静音播放模式。场景识别模块在识别到其中一个音频的音量信息指示该音频的音量大小不为零,则可以确定当前处于非静音播放模式。示例性地,在电子设备通过音乐应用程序播放第一音频的情况下,若用户打开视频应用程序,则电子设备在显示视频应用程序的视频浏览界面的过程中,可能会对第一视频进行静音预览播放,该种情况下,场景识别模块识别到第一视频中第二音频的音量信息指示第二音频的音量大小为零,且识别到第一音频的音量信息指示第一音频的音量大小不为零,因此,场景识别模块可以确定当前处于非静音播放模式。Since the audio may be played through multiple audio applications at present, the audio data of multiple audios may be transmitted in the audio playback thread. In this case, the scene recognition module can determine that it is currently in silent playback mode when it recognizes that the volume of multiple audios is zero. The scene recognition module can determine that it is currently in non-silent playback mode when it recognizes that the volume information of one of the audios indicates that the volume of the audio is not zero. Exemplarily, in the case where the electronic device plays the first audio through a music application, if the user opens a video application, the electronic device may perform a silent preview of the first video while displaying the video browsing interface of the video application. In this case, the scene recognition module recognizes that the volume information of the second audio in the first video indicates that the volume of the second audio is zero, and recognizes that the volume information of the first audio indicates that the volume of the first audio is not zero. Therefore, the scene recognition module can determine that it is currently in non-silent playback mode.

在一些实施例中,场景识别模块在识别到音量信息指示当前播放的音频的音量大小为零的情况下,还可以确定音量大小为零的持续时长;在持续时长大于或等于时长阈值的情况下,确定当前处于静音播放模式,在持续时长小于时长阈值的情况下,确定当前处于非静音播放模式。In some embodiments, when the scene recognition module recognizes that the volume information indicates that the volume of the currently playing audio is zero, it can also determine the duration of the volume being zero; when the duration is greater than or equal to a duration threshold, it is determined that the current playback mode is silent; when the duration is less than the duration threshold, it is determined that the current playback mode is non-silent.

需要说明的是,该时长阈值可以根据需求预先进行设置,比如,该时长阈值可以为10秒、20秒、30秒等。It should be noted that the duration threshold can be pre-set according to needs, for example, the duration threshold can be 10 seconds, 20 seconds, 30 seconds, etc.

在一些实施例中,场景识别模块中可以设置有一个时间门限(Threshold),在音频数据传输过程中,若检测到当前播放的音频的音量大小为零,则可以检测时间门限是否小于或等于0,若时间门限大于0,则在当前时间门限基础上减1,并继续检测当前播放的音频的音量大是否为零,直至检测到时间门限小于或等于0的情况下,确定音量大小为零的持续时长大于或等于时长阈值,该时间门限最初的大小与时长阈值相同,也即是,时间门限初始化的大小为时长阈值的大小。In some embodiments, a time threshold (Threshold) can be set in the scene recognition module. During the audio data transmission process, if it is detected that the volume of the currently played audio is zero, it can be detected whether the time threshold is less than or equal to 0. If the time threshold is greater than 0, 1 is subtracted from the current time threshold, and the volume of the currently played audio is continuously detected to be zero. Until it is detected that the time threshold is less than or equal to 0, it is determined that the duration of the volume being zero is greater than or equal to the duration threshold. The initial size of the time threshold is the same as the duration threshold, that is, the size of the time threshold initialized is the size of the duration threshold.

在一些实施例中,场景识别模块不仅可以获取音量信息,还可以获取其他音频播放信息,比如,还可以获取音频播放方式(即音频由耳机播放还是喇叭播放等)和音频数据类型等。In some embodiments, the scene recognition module can not only obtain volume information, but also obtain other audio playback information, for example, it can also obtain the audio playback mode (i.e., whether the audio is played by headphones or speakers, etc.) and audio data type, etc.

作为一个示例,音频播放信息携带于当前传输的音频数据中,因此,场景识别模块可以从框架层中获取音频播放信息。示例性地,场景识别模块从框架层中获取到“SPEAKER==ture”,则可以确定当前通过喇叭播放,获取到“CVOL==0”,则可以确定当前播放的音频的音量大小为零。As an example, the audio playback information is carried in the currently transmitted audio data, so the scene recognition module can obtain the audio playback information from the framework layer. Exemplarily, if the scene recognition module obtains "SPEAKER==ture" from the framework layer, it can be determined that the audio is currently being played through the speaker, and if it obtains "CVOL==0", it can be determined that the volume of the currently played audio is zero.

由于电子设备在进行通信过程中同样会进行音频数据传输,因此,场景识别模块还可以检测当前传输的音频数据是否不为通信过程中传输的音频数据,即识别音频数据类型,示例性地,在场景识别模块从框架层中获取到“MODE!=IN_CALL”、“MODE!=COMMUNICATION”以及“STREAM==MUSIC”的情况下,可以确定当前传输的音频数据不为音频通信过程中的音频数据。Since electronic devices also transmit audio data during the communication process, the scene recognition module can also detect whether the currently transmitted audio data is not the audio data transmitted during the communication process, that is, identify the audio data type. For example, when the scene recognition module obtains "MODE!=IN_CALL", "MODE!=COMMUNICATION" and "STREAM==MUSIC" from the framework layer, it can be determined that the currently transmitted audio data is not the audio data in the audio communication process.

在一些实施例中,场景识别模块可以在识别到当前处于静音播放模式的情况下,执行下述步骤412的操作,也可以在识别到当前处于静音播放模式,且当前由喇叭进行播放,且音频数据不为音频通信过程中传输的音频数据的情况下,执行下述步骤412的操作。否则,结束本次操作。示例性地,场景识别模块在识别到当前处于静音播放模式的情况下,若当前通过电子设备的喇叭进行音频播放,则场景识别模块可以执行下述步骤412的操作。若当前通过耳机进行音频播放,则场景识别模块可以不作任何处理。In some embodiments, the scene recognition module may perform the following step 412 when it is recognized that the audio is currently in silent playback mode, or it may perform the following step 412 when it is recognized that the audio is currently in silent playback mode and is currently played by a speaker, and the audio data is not audio data transmitted during audio communication. Otherwise, this operation ends. Exemplarily, when the scene recognition module recognizes that the audio is currently in silent playback mode, if the audio is currently played through the speaker of the electronic device, the scene recognition module may perform the following step 412. If the audio is currently played through headphones, the scene recognition module may not perform any processing.

步骤412:场景识别模块在识别到当前处于静音播放模式的情况下,若接收到匹配消息,则向静音开关模块发送静音控制指令。Step 412: When the scene recognition module recognizes that the current mode is silent playback, if a matching message is received, the scene recognition module sends a silent control instruction to the silent switch module.

作为一个示例,场景识别模块可以通过参数设置函数向静音开关模块发送静音控制指令,该参数设置函数可以为setparameter函数,该静音控制指令中可以携带静音状态标识,比如,携带的该静音状态标识可以为flag==1。As an example, the scene recognition module may send a mute control instruction to the mute switch module through a parameter setting function, where the parameter setting function may be a setparameter function. The mute control instruction may carry a mute state flag, for example, the mute state flag may be flag==1.

在一种可能的情况下,场景识别模块识别到当前处于静音播放模式的情况下,若接收到不匹配消息,则在音频功率放大器处于开启状态的情况下,场景识别模块不做任何处理,即不会向静音开关模块发送静音控制指令。在音频功率放大器处于关闭状态的情况下,场景识别模块可以执行下述步骤417的操作。In one possible case, when the scene recognition module recognizes that the current mode is mute playback, if a mismatch message is received, the scene recognition module does not perform any processing when the audio power amplifier is in the on state, that is, does not send a mute control instruction to the mute switch module. When the audio power amplifier is in the off state, the scene recognition module can perform the following step 417.

在一些实施例中,电子设备中也可以不存在预设白名单,在不存在预设白名单的情况下,场景识别模块在识别到当前处于静音播放模式的情况下,可以向静音开关模块发送静音控制指令。In some embodiments, there may not be a preset whitelist in the electronic device. In the absence of a preset whitelist, the scene recognition module may send a mute control instruction to the mute switch module when recognizing that the current mode is mute playback.

步骤413:静音开关模块在接收到静音控制指令的情况下,向音频功率放大器发送关闭指令,且向音频模拟模块发送模拟消息,并停止向音频功率放大器发送音频数据。Step 413: upon receiving the mute control instruction, the mute switch module sends a close instruction to the audio power amplifier, sends an analog message to the audio analog module, and stops sending audio data to the audio power amplifier.

由于在场景识别模块识别当前是否处于静音播放模式的过程中,音频数据是正常传输的,且该静音控制指令中携带静音状态标识,因此,静音开关模块在接收到静音控制指令的情况下,若从静音控制指令中获取到该静音状态标识,则可以向音频功率放大器发送关闭指令,且向音频模拟模块发送模拟消息,并停止向音频功率放大器发送音频数据。Since the audio data is transmitted normally during the process of the scene recognition module identifying whether the current mode is silent playback, and the silent control instruction carries a silent status flag, when the silent switch module receives the silent control instruction, if it obtains the silent status flag from the silent control instruction, it can send a shutdown command to the audio power amplifier, send an analog message to the audio simulation module, and stop sending audio data to the audio power amplifier.

示例性地,静音开关模块可以调用HAL层接口,比如调用Standby()接口关闭音频功率放大器。Exemplarily, the mute switch module may call a HAL layer interface, such as calling a Standby() interface to turn off the audio power amplifier.

在一些实施例中,静音开关模块可以通过丢弃当前接收的音频数据的方式停止向音频功率放大器发送音频数据,也可以通过其他方式。In some embodiments, the mute switch module may stop sending audio data to the audio power amplifier by discarding currently received audio data, or by other means.

在一些实施例中,静音开关模块中可以包括音频开关模块和音频控制模块,音频控制模块可以接收静音控制指令,在接收到静音控制指令的情况下,音频控制模块可以向音频功率放大器发送关闭指令,向音频模拟模块发送模拟消息,并向音频开关模块发送停止传输消息。音频开关模块在接收到停止传输消息的情况下,设置第一停止标识,并停止向音频功率放大器发送音频数据,该第一停止标识用于指示音频开关模块在接收到音频数据的情况下,停止向音频功率放大器发送音频数据。In some embodiments, the mute switch module may include an audio switch module and an audio control module. The audio control module may receive a mute control instruction. When receiving the mute control instruction, the audio control module may send a shutdown instruction to the audio power amplifier, send an analog message to the audio analog module, and send a stop transmission message to the audio switch module. When receiving the stop transmission message, the audio switch module sets a first stop flag and stops sending audio data to the audio power amplifier. The first stop flag is used to instruct the audio switch module to stop sending audio data to the audio power amplifier when receiving audio data.

步骤414:音频功率放大器响应于关闭指令,由开启状态切换为关闭状态。Step 414: The audio power amplifier switches from the on state to the off state in response to the off instruction.

步骤415:音频模拟模块在接收到模拟消息的情况下开始进行延时操作。Step 415: The audio simulation module starts to perform a delay operation when receiving the simulation message.

作为一个示例,音频模拟模块在接收到模拟消息的情况下,可以通过模拟函数确定传输时长,并通过延时函数进行延时操作,该模拟函数可以为MockWriteDelay(),该延时函数可以为Usleep(SleepTimeUs),本申请实施例对此不做具体限制。As an example, when the audio simulation module receives a simulated message, it can determine the transmission duration through a simulation function and perform a delay operation through a delay function. The simulation function can be MockWriteDelay(), and the delay function can be Usleep(SleepTimeUs). The embodiments of the present application do not impose any specific restrictions on this.

在一些实施例中,音频模拟模块可以在接收到模拟消息的情况下,开始进行延时操作,也可以在其他情况下进行延时操作。示例性地,静音开关模块在接收到静音控制指令的情况下,可以向音频功率放大器发送关闭指令,并向音频模拟模块发送音频数据和第二停止标识,该第二停止标识用于指示音频模拟模块进行延时操作,并停止向音频功率放大器发送音频数据。音频模拟模块在接收到音频数据和第二停止标识的情况下,进行延时操作,并停止向音频功率放大器发送音频数据。In some embodiments, the audio simulation module may start a delay operation when receiving a simulation message, or may perform a delay operation in other situations. Exemplarily, when the mute switch module receives a mute control instruction, it may send a shutdown instruction to the audio power amplifier, and send audio data and a second stop mark to the audio simulation module, the second stop mark being used to instruct the audio simulation module to perform a delay operation and stop sending audio data to the audio power amplifier. When the audio simulation module receives the audio data and the second stop mark, it performs a delay operation and stops sending audio data to the audio power amplifier.

由上述可知,静音开关模块中可以音频开关模块和音频控制模块,在通过第二停止标识指示音频模拟模块进行延时操作的情况下,在接收到静音控制指令的情况下,音频控制模块可以向音频功率放大器发送关闭指令,并向音频开关模块发送停止传输消息。音频开关模块在接收到停止传输消息的情况下,向音频模拟模块发送音频数据和第二停止标识;音频模拟模块在接收到音频数据和第二停止标识的情况下,进行延时操作,并停止向音频功率放大器发送音频数据。As can be seen from the above, the mute switch module can include an audio switch module and an audio control module. When the audio simulation module is instructed to perform a delay operation through the second stop mark, the audio control module can send a shutdown command to the audio power amplifier and send a stop transmission message to the audio switch module when the mute control instruction is received. When the audio switch module receives the stop transmission message, it sends audio data and the second stop mark to the audio simulation module; when the audio simulation module receives the audio data and the second stop mark, it performs a delay operation and stops sending audio data to the audio power amplifier.

步骤416:音频模拟模块在延时时长达到传输时长的情况下,向音频播放线程发送反馈信息。Step 416: When the delay duration reaches the transmission duration, the audio simulation module sends feedback information to the audio playback thread.

需要说明的是,该传输时长为目标音频的音频数据从静音控制模块传输至音频功率放大器的时长,反馈信息用于指示音频播放线程继续传输下一帧音频数据。It should be noted that the transmission duration is the duration for the audio data of the target audio to be transmitted from the mute control module to the audio power amplifier, and the feedback information is used to instruct the audio playback thread to continue transmitting the next frame of audio data.

由于音频数据由音频开关模块传输至音频功率放大器需要一定的时长,且在音频数据传输至底层(如硬件层)后,底层的模块可以向音频播放线程发送反馈信息,以指示音频播放线程继续传输音频数据,若静音开关模块停止向底层传输音频数据,则静音开关模块会直接向音频播放线程发送反馈信息,音频播放线程在接收到反馈信息的情况下,可以继续传输音频数据,这样一来,导致音频播放线程几乎不间断地传输音频数据,很快就会将当前播放的音频的所有音频数据传输完成,从而在后续恢复音频功率放大器后,导致无法播放音频数据,或者会拉快音频播放的进度。若音频为视频中的音频,那么由于视频帧会跟随音频帧的时序,在音频的播放进度加快的情况下,会导致视频帧播放速度加快,从而导致视频播放过程中出现丢帧现象。因此,在关闭音频功率放大器的情况下,音频模拟模块需要模拟向音频功率放大器传输目标音频的音频数据的操作。即音频模拟模块可以在接收到模拟消息的情况下开始进行延时操作,并在延时时长达到传输时长的情况下,向音频播放线程发送反馈信息。Since it takes a certain amount of time for the audio data to be transmitted from the audio switch module to the audio power amplifier, and after the audio data is transmitted to the bottom layer (such as the hardware layer), the bottom layer module can send feedback information to the audio playback thread to instruct the audio playback thread to continue transmitting the audio data. If the mute switch module stops transmitting the audio data to the bottom layer, the mute switch module will directly send feedback information to the audio playback thread. The audio playback thread can continue to transmit the audio data when receiving the feedback information. In this way, the audio playback thread transmits the audio data almost uninterruptedly, and soon all the audio data of the currently played audio will be transmitted. After the audio power amplifier is restored later, the audio data cannot be played, or the progress of the audio playback will be accelerated. If the audio is the audio in the video, then because the video frame will follow the timing of the audio frame, when the progress of the audio playback is accelerated, the video frame playback speed will be accelerated, resulting in frame loss during the video playback process. Therefore, when the audio power amplifier is turned off, the audio simulation module needs to simulate the operation of transmitting the audio data of the target audio to the audio power amplifier. That is, the audio simulation module can start the delay operation when receiving the simulation message, and send feedback information to the audio playback thread when the delay time reaches the transmission time.

步骤417:场景识别模块在识别到由静音播放模式切换为非静音播放模式的情况下,向静音开关模块发送静音解除指令。Step 417: When the scene recognition module recognizes that the silent playback mode is switched to the non-silent playback mode, the scene recognition module sends a mute release instruction to the mute switch module.

由于电子设备处于静音播放模式下用户可能会打开电子设备的音量,该种情况下,电子设备将由静音播放模块切换为非静音播放模块,在电子设备处于非静音播放模式的情况下,需要音频功率放大器对音频数据进行处理,因此,场景识别模块在识别到由静音播放模式切换为非静音播放模式的情况下,可以向静音开关模块发送静音解除指令。该静音解除指令中可以携带非静音状态标识,比如,携带的该非静音状态标识可以为flag==0。Since the user may turn on the volume of the electronic device when the electronic device is in the silent playback mode, in this case, the electronic device will switch from the silent playback module to the non-silent playback module. When the electronic device is in the non-silent playback mode, the audio power amplifier is required to process the audio data. Therefore, when the scene recognition module recognizes that the silent playback mode is switched to the non-silent playback mode, it can send a mute release instruction to the mute switch module. The mute release instruction can carry a non-silent state flag, for example, the non-silent state flag carried can be flag==0.

为了便于理解场景识别流程,本申请实施例提供了一种场景识别流程示意图,示例性地,参见图5,步骤B1:在音频数据传输过程中,场景识别模块检测当前传输的音频数据是否为符合静音控制条件的音频数据,若否,则执行下述步骤B8的操作,若是,则执行下述步骤B2的操作。步骤B2:白名单控制模块检测当前传输音频数据的应用程序的应用标识是否位于预设白名单中,若是,则执行下述步骤B3的操作,若否,则执行下述步骤B8的操作。步骤B3:场景识别模块判断时间门限是否小于或等于零,若是,则执行下述步骤B4,若否,则执行下述步骤B5的操作。步骤B4:场景识别模块判断音频功率放大器当前是否处于关闭状态,若是,则结束本次场景识别,若否,则执行下述步骤B6的操作。步骤B5:在时间门限的基础上减1,并返回步骤B1的操作。步骤B6:场景识别模块向静音开关模块发送静音控制指令,其中,该静音控制指令可以以函数setparameter的参数形式表示,该参数可以为client_zero_volume=ture。步骤B7:场景识别模块将时间门限的大小初始化为时长阈值。步骤B8:场景识别模块判断音频功率放大器当前是否处于关闭状态,若否,则结束本次场景识别,若是,则执行下述步骤B9的操作。步骤B9:场景识别模块向静音开关控制模块发送静音解除指令,该静音解除指令同样可以以函数setparameter的参数形式表示,该参数可以为client_zero_volume=false。In order to facilitate the understanding of the scene recognition process, the embodiment of the present application provides a scene recognition process diagram. For example, see Figure 5. Step B1: During the audio data transmission process, the scene recognition module detects whether the currently transmitted audio data is audio data that meets the mute control condition. If not, the operation of the following step B8 is performed. If so, the operation of the following step B2 is performed. Step B2: The whitelist control module detects whether the application identifier of the application currently transmitting the audio data is located in the preset whitelist. If so, the operation of the following step B3 is performed. If not, the operation of the following step B8 is performed. Step B3: The scene recognition module determines whether the time threshold is less than or equal to zero. If so, the following step B4 is performed. If not, the operation of the following step B5 is performed. Step B4: The scene recognition module determines whether the audio power amplifier is currently in the off state. If so, the current scene recognition is terminated. If not, the operation of the following step B6 is performed. Step B5: Subtract 1 from the time threshold and return to the operation of step B1. Step B6: The scene recognition module sends a mute control instruction to the mute switch module, wherein the mute control instruction can be expressed in the form of a parameter of the function setparameter, and the parameter can be client_zero_volume=true. Step B7: The scene recognition module initializes the size of the time threshold to the duration threshold. Step B8: The scene recognition module determines whether the audio power amplifier is currently in the off state. If not, the scene recognition is terminated. If so, the operation of the following step B9 is performed. Step B9: The scene recognition module sends a mute release instruction to the mute switch control module, wherein the mute release instruction can also be expressed in the form of a parameter of the function setparameter, and the parameter can be client_zero_volume=false.

需要说明的是,静音控制条件包括音频数据由喇叭播放、音频数据的音量大小为零以及音频数据不为通信过程中传输的音频数据等。It should be noted that the mute control conditions include that the audio data is played by a speaker, the volume of the audio data is zero, and the audio data is not audio data transmitted during the communication process.

步骤418:静音开关模块在接收到静音解除指令的情况下,向音频功率放大器发送启动指令,且向音频模拟模块发送取消模拟消息,并将接收到的音频数据传输至音频功率放大器。Step 418: When receiving the mute release instruction, the mute switch module sends a start instruction to the audio power amplifier, sends a cancel simulation message to the audio simulation module, and transmits the received audio data to the audio power amplifier.

作为一个示例,静音开关模块可以通过内核层将音频数据传输至DSP,DSP可以将接收到的音频数据传输至音频功率放大器。As an example, the mute switch module may transmit the audio data to the DSP through the kernel layer, and the DSP may transmit the received audio data to the audio power amplifier.

由于在音频数据正常传输的情况下,无需进行音频数据传输过程中的模拟,因此,静音开关模块在接收到静音解除指令的情况下,可以向音频模拟模块发送取消模拟消息。Since there is no need to simulate the audio data transmission process when the audio data is transmitted normally, the mute switch module can send a simulation cancellation message to the audio simulation module when receiving the mute release instruction.

步骤419:音频模拟模块停止音频数据传输的模拟。Step 419: The audio simulation module stops the simulation of audio data transmission.

步骤420:音频功率放大器对接收到的音频数据进行处理,并将处理后的音频数据发送给喇叭,以使喇叭进行音频播放。Step 420: The audio power amplifier processes the received audio data and sends the processed audio data to the speaker so that the speaker plays the audio.

在本申请实施例中,由于在电子设备播放目标音频的过程中,若电子设备切换至静音播放模式,则可以关闭音频功率放大器,在音频功率放大器处于关闭状态下,音频功率放大器并不会产生功耗,从而降低了电子设备功耗,提高了电子设备的电池的续航能力。另外,由于在关闭音频功率放大器的情况下,可以模拟向音频功率放大器传输音频数据的操作,从而避免了目标音频播放速度发生变化,保证了目标音频正常播放。In the embodiment of the present application, since the audio power amplifier can be turned off when the electronic device is switched to the silent playback mode during the process of playing the target audio, the audio power amplifier will not generate power consumption when the audio power amplifier is in the off state, thereby reducing the power consumption of the electronic device and improving the battery life of the electronic device. In addition, since the operation of transmitting audio data to the audio power amplifier can be simulated when the audio power amplifier is turned off, the target audio playback speed is avoided from changing, and the target audio is ensured to be played normally.

接下来对本申请实施例提供的另一种音频播放的控制方法进行介绍。请参考图6,图6是根据一示例性实施例示出的一种音频播放的控制方法流程示意图。作为示例而非限定,图6以该方法应用于电子设备中为例进行说明,该方法可以包括如下部分或者全部内容:Next, another method for controlling audio playback provided by an embodiment of the present application is introduced. Please refer to Figure 6, which is a flow chart of a method for controlling audio playback according to an exemplary embodiment. As an example but not a limitation, Figure 6 takes the method applied to an electronic device as an example for explanation, and the method may include some or all of the following contents:

步骤601:响应于音频播放操作,在电子设备处于非静音播放模式的情况下,通过音频播放应用程序向电子设备的音频功率放大器传输目标音频的音频数据,以播放目标音频。Step 601: In response to an audio playback operation, when the electronic device is in a non-silent playback mode, audio data of a target audio is transmitted to an audio power amplifier of the electronic device through an audio playback application to play the target audio.

需要说明的是,音频功率放大器在接收音频播放操作之前处于开启状态。It should be noted that the audio power amplifier is in an on state before receiving the audio playback operation.

由于用户在使用电子设备的过程中,可能需要进行音频播放,该种情况下,用户可以在音频播放应用程序中触发音频播放操作,电子设备可以接收到该音频播放操作,并响应于该音频播放操作,进行音频数据的传输,且由于电子设备处于非静音状态即非静音播放模式,则可以将音频数据由音频播放应用程序传输至音频功率放大器。Since users may need to play audio when using electronic devices, in this case, the user can trigger an audio playback operation in an audio playback application, the electronic device can receive the audio playback operation, and transmit audio data in response to the audio playback operation, and since the electronic device is in a non-silent state, i.e., a non-silent playback mode, the audio data can be transmitted from the audio playback application to the audio power amplifier.

作为一个示例,电子设备处于非静音播放模式的情况是指电子设备当前播放的至少一个音频中任意一个音频的音量大小不为零的情况。As an example, the situation that the electronic device is in a non-silent playing mode refers to a situation that the volume of any one of at least one audio currently played by the electronic device is not zero.

在一些实施例中,电子设备的框架层中存在一个threadloop(循环线程),threadloop的流程在电子设备处于何种播放模式的情况下,都会被执行。In some embodiments, there is a threadloop in the framework layer of the electronic device, and the process of the threadloop will be executed regardless of the playback mode of the electronic device.

示例性地,参见图7,该循环线程的流程包括:步骤A:检测是否存在音频数据的传输,也即检测是否接收到音频播放操作;若不存在,则继续进行检测;若存在,则可以执行步骤B的操作;步骤B:识别电子设备当前的播放模式,并根据播放模式控制音频功率放大器的开关;步骤C:通过音频播放线程对当前播放的音频数据进行混音操作(即threadloop_mix);步骤D:将混音处理后的音频数据进行写数据流程(即threadloop_write),并返回步骤A的操作,其中,写数据流程是指将音频数据写入HAL层。另外,该threadloop的流程中还可以包括其他步骤,本申请实施例对此不再进行一一举例。Exemplarily, referring to FIG. 7 , the process of the loop thread includes: step A: detecting whether there is audio data transmission, that is, detecting whether an audio playback operation is received; if not, continuing to detect; if present, the operation of step B can be performed; step B: identifying the current playback mode of the electronic device, and controlling the switch of the audio power amplifier according to the playback mode; step C: mixing the currently played audio data through the audio playback thread (i.e., threadloop_mix); step D: writing the audio data after mixing (i.e., threadloop_write), and returning to the operation of step A, wherein the writing data process refers to writing the audio data to the HAL layer. In addition, the process of the threadloop may also include other steps, and the embodiments of the present application will not be given examples one by one.

示例性地,电子设备执行步骤B的具体操作可以参考图5中的步骤B1-步骤B9的操作,或者参考下述步骤602-步骤605的操作,本申请实施例对此不再进行一一赘述。Exemplarily, the specific operations of the electronic device in executing step B may refer to the operations of step B1 to step B9 in FIG. 5 , or refer to the operations of step 602 to step 605 described below, which will not be described one by one in the embodiments of the present application.

步骤602:获取目标音频的音量信息。Step 602: Obtain volume information of the target audio.

需要说明的是,音量信息用于指示目标音频当前的音量大小。It should be noted that the volume information is used to indicate the current volume of the target audio.

由于电子设备在播放目标音频的过程中,可能会进行一些操作,使得目标音频的音量大小变为零,因此,为了及时的确认电子设备的播放模式,电子设备可以在传输音频数据的过程中获取目标音频的音量信息。Since the electronic device may perform some operations during the process of playing the target audio, causing the volume of the target audio to become zero, in order to timely confirm the playing mode of the electronic device, the electronic device may obtain the volume information of the target audio during the process of transmitting audio data.

示例性地,电子设备获取目标表音频的音量信息的操作可以参考上述步骤411的操作,本申请实施例对此不再进行一一赘述。Exemplarily, the operation of the electronic device obtaining the volume information of the target audio may refer to the operation of step 411 above, which will not be described in detail in the embodiment of the present application.

作为一个示例,该音频数据中不仅包括音量信息,还可以携带其他音频播放信息,比如,当前音频数据的播放方式、当前音频数据是否为通信过程中传输的音频数据等。因此,电子设备不仅可以在框架框中获取到音量信息,还可以获取其他音频播放信息。As an example, the audio data includes not only volume information but also other audio playback information, such as the playback mode of the current audio data, whether the current audio data is the audio data transmitted during the communication process, etc. Therefore, the electronic device can not only obtain the volume information in the frame frame, but also obtain other audio playback information.

步骤603:在音量信息指示目标音频当前的音量大小为零的情况下,确定音量大小为零的持续时长。Step 603: When the volume information indicates that the current volume of the target audio is zero, determine the duration of the zero volume.

为了避免频繁开关音频功率放大器而导致音频功率放大器损伤,在音量信息指示目标音频当前的音量大小为零的情况下,电子设备还可以确定音量大小为零的持续时长。In order to avoid damage to the audio power amplifier due to frequent switching of the audio power amplifier, when the volume information indicates that the current volume of the target audio is zero, the electronic device can also determine the duration of the zero volume.

作为一个示例,在音量信息指示目标音频当前的音量大小为零的情况下,电子设备还可以直接确定电子设备由非静音播放模式切换为静音播放模式。As an example, when the volume information indicates that the current volume of the target audio is zero, the electronic device may also directly determine that the electronic device is switched from a non-silent playback mode to a silent playback mode.

步骤604:在持续时长大于或等于时长阈值的情况下,确定电子设备由非静音播放模式切换至静音播放模式。Step 604: when the duration is greater than or equal to the duration threshold, determine that the electronic device is switched from the non-silent play mode to the silent play mode.

作为本申请的一个示例,电子设备可以通过设置时间门限来检测音频的音量大小为零的持续时长是否大于或等于时长阈值,示例性地,该操作可以参考上述步骤411的操作,本申请实施例对此不再进行一一赘述。As an example of the present application, the electronic device can detect whether the duration of the audio volume being zero is greater than or equal to the duration threshold by setting a time threshold. Exemplarily, this operation can refer to the operation of step 411 above, and the embodiments of the present application will not be described in detail.

值得说明的是,通过检测音量大小为零的持续时长,从而避免频繁开关音频功率放大器,降低了对音频功率放大器的损伤。It is worth noting that by detecting the duration of the volume being zero, frequent switching of the audio power amplifier can be avoided, thereby reducing damage to the audio power amplifier.

步骤605:在电子设备由非静音播放模式切换至静音播放模式的情况下,关闭音频功率放大器,并停止向音频功率放大器传输目标音频的音频数据。Step 605: When the electronic device switches from the non-silent play mode to the silent play mode, the audio power amplifier is turned off, and the transmission of the audio data of the target audio to the audio power amplifier is stopped.

由于电子设备处于静音播放模式下,用户本身无法听到播放的音频,电子设备没有必要通过音频功率放大器对接收到的音频数据进行处理。因此,为了降低电子设备的功耗,电子设备可以关闭音频功率放大器。由于在音频功率放大器处于关闭状态的情况下,音频功率放大器无法接收音频数据,因此,电子设备可以停止向音频功率放大器传输目标音频的音频数据。Since the electronic device is in silent playback mode, the user cannot hear the played audio, and the electronic device does not need to process the received audio data through the audio power amplifier. Therefore, in order to reduce the power consumption of the electronic device, the electronic device can turn off the audio power amplifier. Since the audio power amplifier cannot receive audio data when the audio power amplifier is turned off, the electronic device can stop transmitting the audio data of the target audio to the audio power amplifier.

由上述可知,电子设备中包括场景识别模块和静音控制模块;如此,在电子设备由非静音播放模式切换至静音播放模式的情况下,电子设备关闭音频功率放大器,并停止向音频功率放大器传输目标音频的音频数据的操作包括:场景识别模块向静音控制模块发送静音控制指令;响应于静音控制指令,静音控制模块向音频功率放大器发送关闭指令,并丢弃来自音频播放应用程序传输的音频数据;响应于关闭指令,该音频功率放大器由开启状态切换至关闭状态。From the above, it can be seen that the electronic device includes a scene recognition module and a mute control module; thus, when the electronic device switches from a non-silent playback mode to a silent playback mode, the electronic device turns off the audio power amplifier and stops transmitting the audio data of the target audio to the audio power amplifier. The operations include: the scene recognition module sends a mute control instruction to the mute control module; in response to the mute control instruction, the mute control module sends a shutdown instruction to the audio power amplifier and discards the audio data transmitted from the audio playback application; in response to the shutdown instruction, the audio power amplifier switches from an on state to an off state.

需要说明的是,由于音频播放应用程序可以将音频数据传输至音频播放线程,音频播放线程可以将音频数据传输音频写入模块,该音频写入模块可以将音频数据传输至静音控制模块,而在静音控制模块向音频功率放大器发送关闭指令的情况下,说明音频功率放大器后续将处于关闭状态,音频功率放大器不会再接收音频数据,因此,静音控制模块没有必要继续传输音频数据,静音控制模块可以丢弃音频播放应用程序传输的音频数据。It should be noted that since the audio playback application can transmit audio data to the audio playback thread, the audio playback thread can transmit the audio data to the audio writing module, and the audio writing module can transmit the audio data to the mute control module, and when the mute control module sends a shutdown command to the audio power amplifier, it means that the audio power amplifier will be in a shutdown state subsequently and the audio power amplifier will no longer receive audio data. Therefore, there is no need for the mute control module to continue transmitting audio data, and the mute control module can discard the audio data transmitted by the audio playback application.

值得说明的是,通过向音频功率放大器发送关闭指令,使得音频功率放大器由开启状态切换至关闭状态,从而减少了音频功率放大器产生的功耗,进而降低了电子设备的功耗,保障了电子设备电池的续航能力。It is worth noting that by sending a shutdown command to the audio power amplifier, the audio power amplifier is switched from an on state to an off state, thereby reducing the power consumption generated by the audio power amplifier, thereby reducing the power consumption of the electronic device and ensuring the battery life of the electronic device.

在一些实施例中,静音控制模块中可以包括静音开关模块和音频模拟模块,响应于静音控制指令,静音开关模块可以向音频功率放大器发送关闭指令,并丢弃来自音频播放应用程序传输的音频数据,并向音频模拟模块发送模拟消息,该模拟消息用于指示音频模拟模块模拟向音频功率放大器传输目标音频的音频数据的操作,该模拟操作可以参考下述步骤606的操作。In some embodiments, the mute control module may include a mute switch module and an audio simulation module. In response to the mute control instruction, the mute switch module may send a shutdown instruction to the audio power amplifier, discard the audio data transmitted from the audio playback application, and send a simulation message to the audio simulation module. The simulation message is used to instruct the audio simulation module to simulate the operation of transmitting the target audio data to the audio power amplifier. The simulation operation can refer to the operation of step 606 described below.

在一些实施例中,电子设备中还可以存储有预设白名单,如此,在电子设备由非静音播放模式切换至静音播放模式的情况下,电子设备可以检测预设白名单中是否存在音频播放应用程序的目标应用标识,若预设白名单中存在音频播放应用程序的目标应用标识,则关闭音频功率放大器,并停止向音频功率放大器传输目标音频的音频数据。In some embodiments, a preset whitelist may also be stored in the electronic device. In this way, when the electronic device switches from a non-silent playback mode to a silent playback mode, the electronic device can detect whether there is a target application identifier of the audio playback application in the preset whitelist. If there is a target application identifier of the audio playback application in the preset whitelist, the audio power amplifier is turned off and the transmission of audio data of the target audio to the audio power amplifier is stopped.

需要说明的是,该预设白名单为预先设置的白名单,且该预设白名单可以由用户进行编辑。It should be noted that the preset whitelist is a pre-set whitelist, and the preset whitelist can be edited by the user.

值得说明的是,通过设置预设白名单,从而使得对音频功率放大器的控制更具有针对性,提高了对音频功率放大器进行静音控制的准确性。It is worth noting that by setting a preset whitelist, the control of the audio power amplifier is made more targeted, thereby improving the accuracy of the mute control of the audio power amplifier.

由上述可知,电子设备中包括场景识别模块和白名单控制模块;如此,白名单控制模块可以获取目标应用标识;在预设白名单中存在目标应用标识的情况下,白名单控制模块向场景识别模块发送匹配通过消息,该匹配通过消息用于指示在电子设备由非静音播放模式切换至静音播放模式的情况下允许关闭音频功率放大器。From the above, it can be seen that the electronic device includes a scene recognition module and a whitelist control module; in this way, the whitelist control module can obtain the target application identifier; when the target application identifier exists in the preset whitelist, the whitelist control module sends a match pass message to the scene recognition module, and the match pass message is used to indicate that the audio power amplifier is allowed to be turned off when the electronic device switches from a non-silent playback mode to a silent playback mode.

由上述图3可知,白名单控制模块中包括应用标识获取模块、白名单匹配模块和信息传递模块。如此,应用标识获取模块可以识别目标应用标识,并将识别到的目标应用标识发送给白名单匹配模块;白名单匹配模块可以识别目标应用标识是否位于预设白名单中,并在该目标应用标识位于预设白名单中的情况下,向应用标识获取模块发送匹配通过的消息,在该目标应用标识不位于预设白名单中的情况下,向应用标识获取模块发送匹配未通过消息。应用标识获取模块在接收到匹配通过消息或匹配未通过消息的情况下,可以将接收回到的消息转发给信息传递模块;信息传递模块可以将接收到的消息发至场景识别模块。As can be seen from Figure 3 above, the whitelist control module includes an application identification acquisition module, a whitelist matching module and an information transmission module. In this way, the application identification acquisition module can identify the target application identification and send the identified target application identification to the whitelist matching module; the whitelist matching module can identify whether the target application identification is in the preset whitelist, and if the target application identification is in the preset whitelist, send a match passed message to the application identification acquisition module, and if the target application identification is not in the preset whitelist, send a match failed message to the application identification acquisition module. When the application identification acquisition module receives a match passed message or a match failed message, it can forward the received message to the information transmission module; the information transmission module can send the received message to the scene recognition module.

值得说明的是,通过识别目标应用标识是否位于预设白名单中,可以快速确定在电子设备处于静音播放模式下,是否能够关闭对音频功率放大器,从而提高了控制音频功率放大器的效率。It is worth noting that by identifying whether the target application identifier is in the preset whitelist, it can be quickly determined whether the audio power amplifier can be turned off when the electronic device is in silent playback mode, thereby improving the efficiency of controlling the audio power amplifier.

步骤606:模拟向音频功率放大器传输目标音频的音频数据的操作,使得在播放目标音频期间目标音频的播放速度不发生变化。Step 606: Simulate the operation of transmitting the audio data of the target audio to the audio power amplifier, so that the playback speed of the target audio does not change during the playback of the target audio.

由于音频数据在传输过程中需要向音频播放线程返回反馈信息,该反馈信息可以保证目标音频的播放时序为正常时序,也即是,使得目标音频在播放期间的播放速度不发生变化,或者说目标音频不会主动发生倍速播放的情况,因此,为了保证目标音频的正常播放的时序,电子设备在关闭音频功率放大器的情况下,还可以模拟向音频功率放大器传输目标音频的音频数据的操作。Since the audio data needs to return feedback information to the audio playback thread during the transmission process, the feedback information can ensure that the playback timing of the target audio is normal, that is, the playback speed of the target audio does not change during the playback, or the target audio will not actively play at double the speed. Therefore, in order to ensure the normal playback timing of the target audio, the electronic device can also simulate the operation of transmitting the audio data of the target audio to the audio power amplifier when the audio power amplifier is turned off.

由上述可知,电子设备包括静音控制模块,如此,模拟向音频功率放大器传输目标音频的音频数据的操作包括:在音频数据传输过程中,静音控制模块每接收音频播放线程传输的一帧音频数据,开始进行延时操作,并丢弃当前接收的一帧音频数据,其中,音频播放应用程序通过音频播放线程向静音控制模块传输目标音频的音频数据;在延时时长达到传输时长的情况下,静音控制模块向音频播放线程发送反馈信息,该传输时长为目标音频的音频数据从静音控制模块传输至音频功率放大器的时长,该反馈信息用于指示音频播放线程继续传输下一帧音频数据。From the above, it can be seen that the electronic device includes a mute control module, so that the operation of simulating the transmission of audio data of the target audio to the audio power amplifier includes: during the audio data transmission process, the mute control module starts a delay operation every time it receives a frame of audio data transmitted by the audio playback thread, and discards the currently received frame of audio data, wherein the audio playback application transmits the audio data of the target audio to the mute control module through the audio playback thread; when the delay duration reaches the transmission duration, the mute control module sends feedback information to the audio playback thread, and the transmission duration is the duration for the audio data of the target audio to be transmitted from the mute control module to the audio power amplifier, and the feedback information is used to instruct the audio playback thread to continue transmitting the next frame of audio data.

由于在音频数据传输过程中,音频数据会正常传输至静音控制模块,但是静音控制模块不再向音频功率放大器传输音频数据,因此,为了避免过快传输音频数据,导致加快目标音频的播放速度,静音控制模块可以进行延时操作,并在延时时长达到传输时长的情况下,向音频播放线程发送反馈信息。During the audio data transmission process, the audio data will be transmitted to the mute control module normally, but the mute control module will no longer transmit the audio data to the audio power amplifier. Therefore, in order to avoid transmitting the audio data too quickly and thus speeding up the playback speed of the target audio, the mute control module can perform a delay operation and send feedback information to the audio playback thread when the delay time reaches the transmission time.

值得说明的是,通过发送反馈信息,可以使得音频播放线程能够准确进行音频数据的传输,避免目标音频的进度条异常。It is worth noting that by sending feedback information, the audio playback thread can accurately transmit audio data and avoid abnormal progress bar of the target audio.

在一些实施例中,该静音控制模块可以包括静音开关模块和音频模拟模块;如此,在音频数据传输过程中,静音开关模块每接收音频播放线程传输的一帧音频数据,可以向音频模拟模块发送模拟消息,并丢弃当前接收的一帧音频数据;该音频模拟模块在接收到模拟消息的情况下开始进行延时操作;在延时时长达到传输时长的情况下,音频模拟模块向音频播放线程发送反馈信息。In some embodiments, the mute control module may include a mute switch module and an audio simulation module; thus, during the audio data transmission process, the mute switch module may send an analog message to the audio simulation module and discard the currently received frame of audio data each time it receives a frame of audio data transmitted by the audio playback thread; the audio simulation module starts a delay operation when it receives the analog message; when the delay duration reaches the transmission duration, the audio simulation module sends feedback information to the audio playback thread.

作为一个示例,音频模拟模块在接收到模拟消息的情况下,可以计算该延时时长,然后进行延时操作,并在延时时长达到传输时长的情况下,向音频播放线程发送反馈信息。As an example, when the audio simulation module receives a simulation message, it can calculate the delay duration, then perform a delay operation, and send feedback information to the audio playback thread when the delay duration reaches the transmission duration.

需要说明的是,音频模拟模块计算延时时长的速度非常快,因此,可以该计算过程的时长可以忽略不计。It should be noted that the audio simulation module calculates the delay duration very quickly, so the duration of the calculation process can be ignored.

在一些实施例中,音频模拟模块可以获取一帧音频数据的字节数、音频数据的传输通道数和采样率等,根据一帧音频数据的字节数、音频数据的传输通道数和采样率等,可以确定每秒传输字节数,然后将一帧音频数据的字节数与每秒传输字节数相处,得到传输时长。In some embodiments, the audio simulation module can obtain the number of bytes of a frame of audio data, the number of transmission channels of the audio data and the sampling rate, etc. Based on the number of bytes of a frame of audio data, the number of transmission channels of the audio data and the sampling rate, etc., the number of bytes transmitted per second can be determined, and then the number of bytes of a frame of audio data can be added to the number of bytes transmitted per second to obtain the transmission duration.

值得说明的是,通过音频模拟模块进行延时操作,并在延时时长达到传输时长的情况下,发送反馈信息,从而保证了目标音频的播放速度,避免出现目标音频的加速播放。It is worth noting that the delay operation is performed through the audio simulation module, and feedback information is sent when the delay time reaches the transmission time, thereby ensuring the playback speed of the target audio and avoiding accelerated playback of the target audio.

在一些实施例中,在播放目标音频的过程中,在电子设备由静音播放模式切换至非静音播放模式的情况下,电子设备可以开启音频功率放大器,并恢复向音频功率放大器传输目标音频的音频数据。In some embodiments, during the process of playing the target audio, when the electronic device switches from the silent playback mode to the non-silent playback mode, the electronic device can turn on the audio power amplifier and resume transmitting audio data of the target audio to the audio power amplifier.

值得说明的是,在电子设备处于非静音播放模式的情况下,通过开启音频功率放大器,可以使目标音频能够正常播放,避免了目标音频播放错误的情况发生。It is worth noting that when the electronic device is in a non-silent playback mode, the target audio can be played normally by turning on the audio power amplifier, thereby avoiding the occurrence of target audio playback errors.

在一些实施例中,在播放目标音频的过程中,若增加新的音频进行播放,且电子设备处于静音播放模式,但增加的音频的应用程序的应用标识未位于预设白名单的情况下,电子设备可以开启音频功率放大器。In some embodiments, during the process of playing the target audio, if new audio is added for playback and the electronic device is in silent playback mode, but the application identifier of the application of the added audio is not in the preset whitelist, the electronic device can turn on the audio power amplifier.

作为一个示例,场景识别模块在检测到音频数据中的音量大小不为零的情况下,可以确定电子设备由静音播放模式切换为非静音播放模式,该种情况下,场景识别模块可以向静音控制模块发送静音解除指令;静音控制模块响应于该静音解除指令,向音频功率放大器发送启动指令,且取消向音频播放放大器传输音频数据的模拟操作,并恢复向音频功率放大器传输目标音频的音频数据。As an example, when the scene recognition module detects that the volume level in the audio data is not zero, it can determine that the electronic device has switched from the silent playback mode to the non-silent playback mode. In this case, the scene recognition module can send a mute release instruction to the mute control module; the mute control module responds to the mute release instruction by sending a start instruction to the audio power amplifier, cancels the simulation operation of transmitting audio data to the audio playback amplifier, and resumes transmitting the target audio data to the audio power amplifier.

为了便于了解本申请中音频传输流程,本申请实施例提供了一种静音控制流程的示意图,参见图8,步骤F:电子设备在检测到音频数据写入HAL层的情况下,检测静音开关模块是否接收到静音控制指令,若是,则执行下述步骤G的操作,若否,则执行下述步骤J的操作。步骤G:在检测到静音开关模块接收到静音控制指令的情况下,电子设备通过静音开关模块向音频功率放大器发送关闭指令,并通过静音开关模块向音频模拟模块发送模拟消息。步骤H:电子设备通过音频模拟模块在接收到模拟消息的情况下,计算传输时长。步骤I:电子设备通过音频模拟模块进行延时操作,并在延时时长达到传输时长的情况下,向音频播放线程发送反馈信息。步骤J:电子设备通过静音开关模块向音频功率放大器传输音频数据。In order to facilitate understanding of the audio transmission process in the present application, an embodiment of the present application provides a schematic diagram of a mute control process, see Figure 8, step F: when the electronic device detects that the audio data is written to the HAL layer, it detects whether the mute switch module receives the mute control instruction. If so, it executes the operation of the following step G, if not, it executes the operation of the following step J. Step G: When it is detected that the mute switch module receives the mute control instruction, the electronic device sends a shutdown instruction to the audio power amplifier through the mute switch module, and sends an analog message to the audio simulation module through the mute switch module. Step H: When the electronic device receives the analog message through the audio simulation module, it calculates the transmission duration. Step I: The electronic device performs a delay operation through the audio simulation module, and sends feedback information to the audio playback thread when the delay duration reaches the transmission duration. Step J: The electronic device transmits audio data to the audio power amplifier through the mute switch module.

在本申请实施例中,由于在电子设备播放目标音频的过程中,若电子设备切换至静音播放模式,则可以关闭音频功率放大器,在音频功率放大器处于关闭状态下,音频功率放大器并不会产生功耗,从而降低了电子设备功耗,提高了电子设备的电池的续航能力。另外,由于在关闭音频功率放大器的情况下,可以模拟向音频功率放大器传输音频数据的操作,从而避免了目标音频播放速度发生变化,保证了目标音频正常播放。In the embodiment of the present application, since the audio power amplifier can be turned off when the electronic device is switched to the silent playback mode during the process of playing the target audio, the audio power amplifier will not generate power consumption when the audio power amplifier is in the off state, thereby reducing the power consumption of the electronic device and improving the battery life of the electronic device. In addition, since the operation of transmitting audio data to the audio power amplifier can be simulated when the audio power amplifier is turned off, the target audio playback speed is avoided from changing, and the target audio is ensured to be played normally.

接下来,对本申请实施例涉及的电子设备予以说明。Next, the electronic device involved in the embodiment of the present application is described.

本申请实施例提供的方法可以由电子设备执行,电子设备支持音频播放功能。作为示例而非限定,电子设备可以是但不限于平板电脑、桌面型、膝上型、手持计算机、笔记本电脑、上网本、增强现实(augmented reality,AR)\虚拟现实(virtual reality,VR)设备、手机等,本申请实施例对此不作限定。The method provided in the embodiment of the present application can be executed by an electronic device, and the electronic device supports an audio playback function. As an example and not a limitation, the electronic device can be, but is not limited to, a tablet computer, a desktop, a laptop, a handheld computer, a notebook computer, a netbook, an augmented reality (AR)\virtual reality (VR) device, a mobile phone, etc., and the embodiment of the present application does not limit this.

图9是本申请实施例提供的一种电子设备的结构示意图。参见图9,电子设备100可以包括处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serialbus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线S1,天线S2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,摄像头193,显示屏194,以及用户标识模块(subscriber identification module,SIM)卡接口195等。其中,传感器模块180可以包括压力传感器180A,陀螺仪传感器180B,气压传感器180C,磁传感器180D,加速度传感器180E,距离传感器180F,接近光传感器180G,指纹传感器180H,温度传感器180J,触摸传感器180K,环境光传感器180L,骨传导传感器180M等。9 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Referring to FIG9 , the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna S1, an antenna S2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. Among them, the sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

可以理解的是,本申请实施例示意的结构并不构成对电子设备100的具体限定。在本申请另一些实施例中,电子设备100可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

处理器110可以包括一个或多个处理单元,比如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processingunit,GPU),图像信号处理器(image signal processor,ISP),控制器,存储器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and/or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.

其中,控制器可以是电子设备100的神经中枢和指挥中心。控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。The controller may be the nerve center and command center of the electronic device 100. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.

处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从该存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

在一些实施例中,处理器110可以包括一个或多个接口,如可以包括集成电路(inter-integrated circuit,I2C)接口,集成电路内置音频(inter-integrated circuitsound,I2S)接口,脉冲编码调制(pulse code modulation,PCM)接口,通用异步收发传输器(universal asynchronous receiver/transmitter,UART)接口,移动产业处理器接口(mobile industry processor interface,MIPI),通用输入输出(general-purposeinput/output,GPIO)接口,用户标识模块(subscriber identity module,SIM)接口,和/或通用串行总线(universal serial bus,USB)接口等。In some embodiments, the processor 110 may include one or more interfaces, such as an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver/transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input/output (GPIO) interface, a subscriber identity module (SIM) interface, and/or a universal serial bus (USB) interface, etc.

I2S接口可以用于音频通信。在一些实施例中,处理器110可以包含多组I2S接口。处理器110可以通过I2S接口与音频模块170耦合,实现处理器110与音频模块170之间的通信。在一些实施例中,音频模块170可以通过I2S接口向无线通信模块160传递音频信号,实现通过蓝牙耳机接听电话的功能。The I2S interface can be used for audio communication. In some embodiments, the processor 110 can include multiple groups of I2S interfaces. The processor 110 can be coupled to the audio module 170 via the I2S interface to achieve communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 can transmit an audio signal to the wireless communication module 160 via the I2S interface to achieve the function of answering a call through a Bluetooth headset.

PCM接口也可以用于音频通信,将模拟信号抽样,量化和编码。在一些实施例中,音频模块170与无线通信模块160可以通过PCM接口耦合。在一些实施例中,音频模块170也可以通过PCM接口向无线通信模块160传递音频信号,实现通过蓝牙耳机接听电话的功能。The PCM interface can also be used for audio communication, sampling, quantizing and encoding analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 can be coupled via the PCM interface. In some embodiments, the audio module 170 can also transmit audio signals to the wireless communication module 160 via the PCM interface to realize the function of answering calls through a Bluetooth headset.

UART接口是一种通用串行数据总线,用于异步通信。UART接口可以为双向通信总线。UART接口可以将要传输的数据在串行通信与并行通信之间转换。在一些实施例中,UART接口通常被用于连接处理器110与无线通信模块160。比如:处理器110通过UART接口与无线通信模块160中的蓝牙模块通信,实现蓝牙功能。在一些实施例中,音频模块170可以通过UART接口向无线通信模块160传递音频信号,实现通过蓝牙耳机播放音乐的功能。The UART interface is a universal serial data bus for asynchronous communication. The UART interface can be a bidirectional communication bus. The UART interface can convert the data to be transmitted between serial communication and parallel communication. In some embodiments, the UART interface is generally used to connect the processor 110 and the wireless communication module 160. For example: the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to implement the Bluetooth function. In some embodiments, the audio module 170 can transmit an audio signal to the wireless communication module 160 through the UART interface to implement the function of playing music through a Bluetooth headset.

可以理解的是,本申请实施例示意的各模块间的接口连接关系,只是示意性说明,并不构成对电子设备100的结构限定。在本申请另一些实施例中,电子设备100也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present application is only a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.

充电管理模块140用于从充电器接收充电输入。其中,充电器可以是无线充电器,也可以是有线充电器。在一些有线充电的实施例中,充电管理模块140可以通过USB接口130接收有线充电器的充电输入。在一些无线充电的实施例中,充电管理模块140可以通过电子设备100的无线充电线圈接收无线充电输入。充电管理模块140为电池142充电的同时,还可以通过电源管理模块141为电子设备100供电。The charging management module 140 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from a wired charger through the USB interface 130. In some wireless charging embodiments, the charging management module 140 may receive wireless charging input through a wireless charging coil of the electronic device 100. While the charging management module 140 is charging the battery 142, it may also power the electronic device 100 through the power management module 141.

电源管理模块141用于连接电池142,充电管理模块140与处理器110。电源管理模块141接收电池142和/或充电管理模块140的输入,为处理器110,内部存储器121,外部存储器,显示屏194,摄像头193和无线通信模块160等供电。电源管理模块141还可以用于监测电池容量,电池循环次数,电池健康状态(漏电,阻抗)等参数。在其他一些实施例中,电源管理模块141也可以设置于处理器110中。在另一些实施例中,电源管理模块141和充电管理模块140也可以设置于同一个器件中。The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and/or the charging management module 140, and supplies power to the processor 110, the internal memory 121, the external memory, the display screen 194, the camera 193 and the wireless communication module 160. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc. In some other embodiments, the power management module 141 can also be set in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.

电子设备100的无线通信功能可以通过天线S1,天线S2,移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。The wireless communication function of the electronic device 100 can be implemented through the antenna S1, the antenna S2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.

电子设备100通过GPU,显示屏194,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏194和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.

显示屏194用于显示图像,视频等。显示屏194包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emittingdiode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrixorganic light emitting diode,AMOLED),柔性发光二极管(flex light-emittingdiode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot lightemitting diodes,QLED)等。在一些实施例中,电子设备100可以包括1个或N个显示屏194,N为大于1的整数。The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light emitting diode or an active-matrix organic light emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is an integer greater than 1.

电子设备100可以通过ISP,摄像头193,视频编解码器,GPU,显示屏194以及应用处理器等实现拍摄功能。The electronic device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.

数字信号处理器用于处理数字信号,除了可以处理数字图像信号,还可以处理其他数字信号。比如,当电子设备100在频点选择时,数字信号处理器用于对频点能量进行傅里叶变换等。The digital signal processor is used to process digital signals, and can process not only digital image signals but also other digital signals. For example, when the electronic device 100 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.

视频编解码器用于对数字视频压缩或解压缩。电子设备100可以支持一种或多种视频编解码器。这样,电子设备100可以播放或录制多种编码格式的视频,比如:动态图像专家组(moving picture experts group,MPEG)1,MPEG2,MPEG3,MPEG4等。Video codecs are used to compress or decompress digital videos. The electronic device 100 may support one or more video codecs. Thus, the electronic device 100 may play or record videos in various coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.

外部存储器接口120可以用于连接外部存储卡,比如Micro SD卡,实现扩展电子设备100的存储能力。外部存储卡通过外部存储器接口120与处理器110通信,实现数据存储功能。比如将音乐,视频等文件保存在外部存储卡中。The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function, such as storing music, video and other files in the external memory card.

内部存储器121可以用于存储计算机可执行程序代码,计算机可执行程序代码包括指令。处理器110通过运行存储在内部存储器121的指令,来执行电子设备100的各种功能应用以及数据处理。内部存储器121可以包括存储程序区和存储数据区。其中,存储程序区可存储操作系统,至少一个功能所需的应用程序(比如声音播放功能,图像播放功能等)等。存储数据区可存储电子设备100在使用过程中所创建的数据(比如音频数据,电话本等)等。此外,内部存储器121可以包括高速随机存取存储器,还可以包括非易失性存储器,比如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universal flash storage,UFS)等。The internal memory 121 can be used to store computer executable program codes, which include instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created by the electronic device 100 during use (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.

电子设备100可以通过音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D以及应用处理器等实现音频功能,比如音乐播放,录音等。The electronic device 100 can implement audio functions, such as music playback, recording, etc., through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone interface 170D and the application processor.

音频模块170用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。音频模块170还可以用于对音频信号编码和解码。在一些实施例中,音频模块170可以设置于处理器110中,或将音频模块170的部分功能模块设置于处理器110中。The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be arranged in the processor 110, or some functional modules of the audio module 170 can be arranged in the processor 110.

扬声器170A,也称“喇叭”,用于将音频电信号转换为声音信号。电子设备100可以通过扬声器170A收听音乐,或收听免提通话。The speaker 170A, also called a "speaker", is used to convert an audio electrical signal into a sound signal. The electronic device 100 can listen to music or listen to a hands-free call through the speaker 170A.

压力传感器180A用于感受压力信号,可以将压力信号转换成电信号。在一些实施例中,压力传感器180A可以设置于显示屏194。压力传感器180A的种类很多,如电阻式压力传感器,电感式压力传感器,电容式压力传感器等。电容式压力传感器可以是包括至少两个具有导电材料的平行板。当有力作用于压力传感器180A,电极之间的电容改变。电子设备100根据电容的变化确定压力的强度。当有触摸操作作用于显示屏194,电子设备100根据压力传感器180A检测触摸操作强度。电子设备100也可以根据压力传感器180A的检测信号计算触摸的位置。在一些实施例中,作用于相同触摸位置,但不同触摸操作强度的触摸操作,可以对应不同的操作指令。比如:当有触摸操作强度小于压力阈值的触摸操作作用于短消息应用图标时,执行查看短消息的指令。当有触摸操作强度大于或等于压力阈值的触摸操作作用于短消息应用图标时,执行新建短消息的指令。The pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A can be set on the display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. The capacitive pressure sensor can be a parallel plate including at least two conductive materials. When a force acts on the pressure sensor 180A, the capacitance between the electrodes changes. The electronic device 100 determines the intensity of the pressure based on the change in capacitance. When a touch operation acts on the display screen 194, the electronic device 100 detects the touch operation intensity according to the pressure sensor 180A. The electronic device 100 can also calculate the touch position according to the detection signal of the pressure sensor 180A. In some embodiments, touch operations acting on the same touch position but with different touch operation intensities can correspond to different operation instructions. For example: when a touch operation with a touch operation intensity less than a pressure threshold acts on a short message application icon, an instruction to view the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the pressure threshold acts on a short message application icon, an instruction to create a new short message is executed.

触摸传感器180K,也称“触控面板”。触摸传感器180K可以设置于显示屏194,由触摸传感器180K与显示屏194组成触摸屏,也称“触控屏”。触摸传感器180K用于检测作用于其上或附近的触摸操作。触摸传感器180K可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏194提供与触摸操作相关的视觉输出。在另一些实施例中,触摸传感器180K也可以设置于电子设备100的表面,与显示屏194所处的位置不同。The touch sensor 180K is also called a "touch panel". The touch sensor 180K can be set on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, also called a "touch screen". The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor 180K can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K can also be set on the surface of the electronic device 100, which is different from the position of the display screen 194.

在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意结合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机指令时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络或其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,比如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(比如:同轴电缆、光纤、数据用户线(Digital Subscriber Line,DSL))或无线(比如:红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质,或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质(比如:软盘、硬盘、磁带)、光介质(比如:数字通用光盘(Digital Versatile Disc,DVD))或半导体介质(比如:固态硬盘(Solid State Disk,SSD))等。In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server or data center by wired (such as: coaxial cable, optical fiber, data subscriber line (Digital Subscriber Line, DSL)) or wireless (such as: infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access, or a data storage device such as a server or data center that includes one or more available media integrations. The available medium may be a magnetic medium (such as a floppy disk, a hard disk, a magnetic tape), an optical medium (such as a digital versatile disc (DVD)), or a semiconductor medium (such as a solid state disk (SSD)).

以上所述为本申请提供的可选实施例,并不用以限制本申请,凡在本申请的揭露的技术范围之内,所作的任何修改、等同替换、改进等,均应包含在本申请的保护范围之内。The above are optional embodiments provided for the present application and are not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the technical scope disclosed in the present application shall be included in the protection scope of the present application.

Claims (9)

1. A control method for audio playing, which is applied to an electronic device, the method comprising:
in response to an audio playing operation, transmitting audio data of target audio to an audio power amplifier of the electronic device through an audio playing application program under the condition that the electronic device is in a non-mute playing mode so as to play the target audio, wherein the audio power amplifier is in an on state before receiving the audio playing operation;
Under the condition that the electronic equipment is switched from the non-mute play mode to the mute play mode, the audio power amplifier is turned off, and the transmission of the audio data of the target audio to the audio power amplifier is stopped;
In the audio data transmission process, each time a mute control module in the electronic equipment receives a frame of audio data transmitted by an audio playing thread, starting delay operation, and discarding the currently received frame of audio data, wherein the audio playing application program transmits the audio data of the target audio to the mute control module through the audio playing thread;
And under the condition that the time delay time length reaches the transmission time length, the mute control module sends feedback information to the audio playing thread, wherein the transmission time length is the time length of the audio data of the target audio transmitted from the mute control module to the audio power amplifier, and the feedback information is used for indicating the audio playing thread to continuously transmit the audio data of the next frame, so that the playing speed of the target audio is not changed during the playing of the target audio.
2. The method of claim 1, wherein after turning off the audio power amplifier and stopping transmitting the audio data of the target audio to the audio power amplifier in the case where the electronic device is switched from the non-mute play mode to the mute play mode, further comprising:
And under the condition that the electronic equipment is switched from the mute play mode to the non-mute play mode, starting the audio power amplifier, and recovering the audio data of the target audio transmitted to the audio power amplifier.
3. The method of claim 1, wherein the turning off the audio power amplifier and stopping the transmission of the audio data of the target audio to the audio power amplifier before the electronic device switches from the non-silent play mode to the silent play mode, further comprises:
Acquiring volume information of the target audio, wherein the volume information is used for indicating the current volume of the target audio;
Determining the duration time of zero volume when the volume information indicates that the current volume of the target audio is zero;
And under the condition that the duration time is greater than or equal to a time threshold, determining that the electronic equipment is switched from the non-mute play mode to the mute play mode.
4. The method of any of claims 1-3, wherein the electronic device includes a scene recognition module and a mute control module therein;
And when the electronic device is switched from the non-mute play mode to the mute play mode, turning off the audio power amplifier and stopping transmitting the audio data of the target audio to the audio power amplifier, including:
under the condition that the electronic equipment is switched from the non-mute play mode to the mute play mode, the scene recognition module sends a mute control instruction to the mute control module;
responding to the mute control instruction, the mute control module sends a closing instruction to the audio power amplifier and discards audio data transmitted from the audio playing application program;
in response to the off command, the audio power amplifier switches from the on state to an off state.
5. The method of any of claims 1-3, wherein the turning off the audio power amplifier and ceasing to transmit audio data of the target audio to the audio power amplifier if the electronic device switches from the non-silent play mode to a silent play mode comprises:
And under the condition that the electronic equipment is switched from the non-mute play mode to the mute play mode, if a target application identifier of the audio play application program exists in a preset white list, closing the audio power amplifier, and stopping transmitting audio data of the target audio to the audio power amplifier.
6. The method of claim 5, wherein the electronic device includes a scene recognition module and a whitelist control module therein;
And if the target application identifier of the audio playing application program exists in the preset white list under the condition that the electronic equipment is switched from the non-mute playing mode to the mute playing mode, closing the audio power amplifier, and before stopping transmitting the audio data to the audio power amplifier, further comprising:
the white list control module acquires the target application identifier;
And under the condition that the target application identifier exists in the preset white list, the white list control module sends a matching passing message to the scene recognition module, wherein the matching passing message is used for indicating that the audio power amplifier is allowed to be turned off under the condition that the electronic equipment is switched from the non-mute play mode to the mute play mode.
7. The method of claim 1, wherein the mute control module comprises a mute switch module and an audio simulation module;
In the audio data transmission process, each time the silence control module receives a frame of audio data transmitted by the audio playing thread, delay operation is started, and the currently received frame of audio data is discarded, including:
in the audio data transmission process, each time the mute switch module receives one frame of audio data transmitted by the audio playing thread, an analog message is sent to the audio analog module, and the currently received one frame of audio data is discarded;
The audio simulation module starts to perform delay operation under the condition that the simulation message is received;
And under the condition that the delay time length reaches the transmission time length, the mute control module sends feedback information to the audio playing thread, and the method comprises the following steps:
and under the condition that the time delay time length reaches the transmission time length, the audio simulation module sends the feedback information to the audio playing thread.
8. An electronic device, wherein the electronic device comprises a processor and a memory in its structure;
The memory is configured to store a program for supporting the electronic device to perform the method according to any one of claims 1-7.
9. A computer readable storage medium having instructions stored therein which, when run on a computer, cause the computer to perform the method of any of claims 1-7.
CN202310901148.1A 2023-07-20 2023-07-20 Audio play control method, electronic device and readable storage medium Active CN117715163B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310901148.1A CN117715163B (en) 2023-07-20 2023-07-20 Audio play control method, electronic device and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310901148.1A CN117715163B (en) 2023-07-20 2023-07-20 Audio play control method, electronic device and readable storage medium

Publications (2)

Publication Number Publication Date
CN117715163A CN117715163A (en) 2024-03-15
CN117715163B true CN117715163B (en) 2024-10-11

Family

ID=90148616

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310901148.1A Active CN117715163B (en) 2023-07-20 2023-07-20 Audio play control method, electronic device and readable storage medium

Country Status (1)

Country Link
CN (1) CN117715163B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113747552A (en) * 2021-06-18 2021-12-03 荣耀终端有限公司 A power consumption optimization method and electronic device
CN115623278A (en) * 2022-10-14 2023-01-17 维沃移动通信有限公司 Audio processing method, apparatus, device and medium

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR950013614B1 (en) * 1991-06-27 1995-11-13 후지쓰텐 가부시끼가이샤 Audio output circuit
AU9785498A (en) * 1997-10-14 1999-05-03 Crystal Semiconductor Corp. Single-chip audio circuits, methods, and systems using the same
US8024055B1 (en) * 2004-05-15 2011-09-20 Sonos, Inc. Method and system for controlling amplifiers
CN201518536U (en) * 2009-09-14 2010-06-30 华为终端有限公司 Audio control circuit and terminal equipment
CN107195315A (en) * 2017-07-25 2017-09-22 成都德芯数字科技股份有限公司 Audio broadcast control device and method
CN111309282B (en) * 2020-02-11 2023-08-22 RealMe重庆移动通信有限公司 Audio equipment power consumption control method and device, audio equipment and storage medium
CN115729511A (en) * 2021-08-31 2023-03-03 华为技术有限公司 Audio playing method and electronic equipment
CN115776659A (en) * 2021-09-08 2023-03-10 Oppo广东移动通信有限公司 Audio playing control method and device, audio output equipment and storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113747552A (en) * 2021-06-18 2021-12-03 荣耀终端有限公司 A power consumption optimization method and electronic device
CN115623278A (en) * 2022-10-14 2023-01-17 维沃移动通信有限公司 Audio processing method, apparatus, device and medium

Also Published As

Publication number Publication date
CN117715163A (en) 2024-03-15

Similar Documents

Publication Publication Date Title
JP6742465B2 (en) Method, device and bluetooth speaker for continuous wakeup delay reduction in bluetooth speaker
US11659227B2 (en) Audio and video processing method and apparatus, terminal and storage medium
KR102299330B1 (en) Method for voice recognition and an electronic device thereof
CN107360458B (en) Play control method, device, storage medium and terminal
US20190286411A1 (en) Scene sound effect control method, and electronic device
CN108762881B (en) Interface drawing method and device, terminal and storage medium
CN108509176A (en) Method and device for playing audio data, storage medium and intelligent terminal
CN110147380B (en) Data update method, device, server and storage medium
WO2017215511A1 (en) Control method of scene sound effect and related products
CN115017096A (en) Data migration method, readable medium and electronic device
CN106412625B (en) multimedia synchronous playing method, device, terminal and system
CN117715163B (en) Audio play control method, electronic device and readable storage medium
CN112669884B (en) Audio data processing method, device, equipment and storage medium
CN110989816B (en) Application processing method and device and storage medium
CN117130824B (en) A method for handling abnormality, electronic equipment and storage medium
CN116737104B (en) Volume adjustment method and related device
CN106126166A (en) Method and terminal for sound effect processing
CN116775525A (en) Data transmission circuit, method, device, equipment and medium
CN116701238A (en) Drive file processing method and related device
CN114466149A (en) Video segment recording method, device, terminal device and storage medium
CN116049095B (en) Data migration method, electronic device and storage medium
CN116827205B (en) Motor vibration control method, electronic device and readable storage medium
CN117707752B (en) Method for eliminating pop sound in audio, electronic equipment and readable storage medium
CN118093272B (en) Audio service starting method and electronic equipment
CN117130698B (en) Menu display method and electronic device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CP03 Change of name, title or address

Address after: Unit 3401, unit a, building 6, Shenye Zhongcheng, No. 8089, Hongli West Road, Donghai community, Xiangmihu street, Futian District, Shenzhen, Guangdong 518040

Patentee after: Honor Terminal Co.,Ltd.

Country or region after: China

Address before: 3401, unit a, building 6, Shenye Zhongcheng, No. 8089, Hongli West Road, Donghai community, Xiangmihu street, Futian District, Shenzhen, Guangdong

Patentee before: Honor Device Co.,Ltd.

Country or region before: China

CP03 Change of name, title or address