Audio output control method and electronic device
By lowering the volume of the audio playback channel and maintaining the mute duration when the target audio output device is connected, the problem of current sound caused by earphone disconnection and reconnection in the Recording APP is solved, improving the user experience and the stability of audio output.
Patent Information
- Application Number
- CN202410405220.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-07
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2044-04-07
AI Technical Summary
When using the song-recording APP on an electronic device that does not support hardware ear-return technology, when the earphones are disconnected and reconnected to the device, it is easy to cause current sound due to abnormal audio data, affecting the user's song-recording experience.
When the target audio output device is connected, lower the volume of the audio playback channel to the first volume and maintain it at the target duration to make the switched audio data close to mute and avoid current sounds caused by abnormal audio data.
This effectively prevents users from hearing current sounds in the target audio output device, improves the user experience of the target audio application, and reduces the impact of audio output device switching on audio playback.
Smart Images

Figure CN118102176B
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of audio processing, and in particular to an audio output control method and an electronic device. Background Art
[0002] In-ear feedback technology is a technology that collects the user's voice and feeds it back to the user through headphones, allowing the user to hear his or her own voice through headphones. At present, with the continuous development of Internet technology, in-ear feedback technology is not only used in traditional live singing, live broadcasting, studio recording and other scenarios, but can also be used in the scenario of recording songs through recording applications (applications, APPs) installed on electronic devices.
[0003] The ear return technology used in electronic devices usually includes hardware ear return technology and software ear return technology. Hardware ear return technology refers to the ear return technology that relies on the hardware system of the electronic device. It is usually the ear return technology developed by the manufacturer of the electronic device when the electronic device leaves the factory. At present, there are still many electronic devices that do not support hardware ear return technology. When a user uses a song recording APP to record songs on an electronic device that does not support hardware ear return technology, if the connection between the headphones and the electronic device is temporarily disconnected during the recording process, then when the user connects the headphones to the electronic device again, the song recording APP will output the multi-frame audio data that was blocked due to the switching of the audio output device to the headphones in an instant, causing the user to hear an electric current sound similar to a blast (POP) sound in the headphones, affecting the user's song recording experience. Summary of the invention
[0004] The embodiments of the present application provide an audio output control method and an electronic device, which can prevent the user from hearing an electric current sound caused by abnormal audio data in the target audio output device after the audio output device of the electronic device is switched to the target audio output device, thereby improving the user's experience of using the target audio application.
[0005] In a first aspect, an embodiment of the present application provides an audio output control method, comprising: when a target audio output device is connected, and the target audio output device is different from the current audio output device, and the audio client corresponding to each current audio playback channel includes a target audio application, and the target audio playback channel corresponding to the target audio application is a low-latency audio playback channel, the volume of each audio playback channel is lowered to a first volume, and the current audio output device of each audio playback channel is switched to the target audio output device, and each audio playback channel is controlled to maintain the first volume target duration; the target duration is greater than the default duration, and the default duration is the default mute duration of the audio playback channel by the software system when switching the audio output device.
[0006] According to the audio output control method provided in the embodiment of the present application, when a target audio output device is connected, and the target audio output device is different from the current audio output device, and the audio client corresponding to each current audio playback channel includes a target audio application, and the target audio playback channel corresponding to the target audio application is a low-latency audio playback channel, the volume of each audio playback channel is lowered to a first volume, and the current audio output device of each audio playback channel is switched to the target audio output device, and each audio playback channel is controlled to maintain the first volume target duration, so that after switching to the target audio output device, the first few frames of audio data output by the target audio output device are close to silence, and because the duration close to silence is longer than the default duration, it can avoid the user from hearing the current sound caused by abnormal audio data in the target audio output device, which is beneficial to improving the user's experience of the target audio application.
[0007] The audio client corresponding to the audio playback channel may refer to an application that plays audio through the audio playback channel.
[0008] Exemplarily, the electronic device may store type identifiers of various audio playback channels and identifiers of all audio clients corresponding to each audio playback channel.
[0009] The identifier of the audio client may be an application package name of the audio client.
[0010] The type identifier of the audio playback channel can be used to describe the type of the audio playback channel. The type identifier of the audio playback channel can include, for example, a low-latency identifier or a normal identifier. The low-latency identifier is used to indicate that the audio playback channel is a low-latency playback channel, and the normal identifier is used to indicate that the audio playback channel is a normal playback channel.
[0011] The target audio application may be, for example, a song recording APP.
[0012] Based on this, optionally, in the case where there is an audio client whose identifier is the same as the identifier of the target audio application in the audio clients corresponding to the current audio playback channels, the electronic device can determine that the target audio application is included in the audio clients corresponding to the current audio playback channels. In the case where the target audio application is included in the audio clients corresponding to the current audio playback channels, it means that the target audio application is currently playing audio. Optionally, in the case where there is no audio client whose identifier is the same as the identifier of the target audio application in the audio clients corresponding to the current audio playback channels, the electronic device can determine that the target audio application is not included in the audio clients corresponding to the current audio playback channels.
[0013] Optionally, when the type identifier of the target audio playback channel corresponding to the target audio application is a low-latency identifier, the electronic device can determine that the target audio playback channel corresponding to the target audio application is a low-latency audio playback channel. Optionally, when the type identifier of the target audio playback channel corresponding to the target audio application is not a low-latency identifier, the electronic device can determine that the target audio playback channel corresponding to the target audio application is not a low-latency audio playback channel.
[0014] In an optional implementation manner of the first aspect, it also includes: when a target audio output device is connected, and the target audio output device is different from the current audio output device, and the audio client corresponding to each current audio playback channel does not include the target audio application, the volume of each audio playback channel is lowered to a first volume, and the current audio output device of each audio playback channel is switched to the target audio output device, and each audio playback channel is controlled to maintain the first volume for a default duration.
[0015] In an optional implementation manner of the first aspect, it also includes: when a target audio output device is connected, and the target audio output device is different from the current audio output device, and the audio client corresponding to each current audio playback channel includes a target audio application, and the target audio playback channel corresponding to the target audio application is not a low-latency audio playback channel, the volume of each audio playback channel is lowered to a first volume, and the current audio output device of each audio playback channel is switched to the target audio output device, and each audio playback channel is controlled to maintain the first volume for a default duration.
[0016] According to the audio output control method provided in the embodiment of the present application, by lowering the volume of each audio playback channel to the first volume and maintaining the default duration when the target audio application is not included in the audio client corresponding to the current audio playback channel, or when the target audio playback channel corresponding to the target audio application is not a low-latency audio playback channel, not only can the possibility of the user hearing the current sound from the switched target audio output device be reduced, but also the impact of the switching of the audio output device on the audio playback can be reduced.
[0017] In an optional implementation manner of the first aspect, the target duration is obtained by multiplying the default duration by a preset multiple; the preset multiple is greater than 1.
[0018] According to the audio output control method provided in the embodiment of the present application, by setting the target duration to a preset multiple of the default duration, it can be ensured that multiple frames of audio data blocked by switching audio output devices can be muted, thereby effectively preventing the user from hearing the current sound caused by abnormal audio data in the target audio output device.
[0019] In an optional implementation manner of the first aspect, the first volume is zero.
[0020] According to the audio output control method provided in the embodiment of the present application, by setting the first volume to 0, the first few frames of audio data output by the target audio output device after switching to the target audio output device can be muted, and because the duration of the mute is longer than the default duration, the user can avoid hearing the current sound caused by abnormal audio data in the target audio output device, which is beneficial to improving the user experience of the target audio application.
[0021] In an optional implementation of the first aspect, each audio playback channel is controlled to maintain a first volume target duration, including: after the volume of each audio playback channel is lowered to the target duration after the first volume, the volume of each audio playback channel is restored to the original volume; the original volume is the volume of each audio playback channel before switching to the target audio output device.
[0022] According to the audio output control method provided in the embodiment of the present application, by adjusting the volume of each audio playback channel to the first volume target duration and then restoring the volume of each audio playback channel to the original volume, it can not only prevent the user from hearing the current sound from the switched target audio output device, but also enable the electronic device to continue to play audio through the target audio output device, thereby reducing the impact of audio output device switching on audio playback.
[0023] In an optional implementation of the first aspect, each audio playback channel is controlled to maintain a first volume default duration, including: after the volume of each audio playback channel is lowered to the first volume for a default duration, the volume of each audio playback channel is restored to the original volume; the original volume is the volume of each audio playback channel before switching to the target audio output device.
[0024] According to the audio output control method provided in the embodiment of the present application, by adjusting the volume of each audio playback channel to the first volume default duration and then restoring the volume of each audio playback channel to the original volume, the electronic device can continue to play audio through the target audio output device, thereby reducing the impact of audio output device switching on audio playback.
[0025] In a second aspect, an embodiment of the present application provides an electronic device, including: one or more processors, and a memory;
[0026] The memory is coupled to one or more processors, and the memory is used to store computer program code, the computer program code includes computer instructions, and the one or more processors call the computer instructions to enable the electronic device to execute the audio output control method of any implementation of the first aspect as described above.
[0027] In a third aspect, an embodiment of the present application provides a computer-readable storage medium, which includes instructions. When the instructions are executed on an electronic device, the electronic device executes an audio output control method as implemented in any of the above-mentioned first aspects.
[0028] In a fourth aspect, an embodiment of the present application provides a computer executable program product. When the computer executable program product runs on an electronic device, the electronic device executes the audio output control method of any implementation of the above-mentioned first aspect.
[0029] In a fifth aspect, an embodiment of the present application provides a chip system, which is applied to an electronic device. The chip system includes one or more processors, and the one or more processors are used to call computer instructions so that the electronic device executes an audio output control method such as any implementation method of the first aspect mentioned above.
[0030] It can be understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 A schematic diagram of a scenario for recording songs based on different ear-return technologies provided in an embodiment of the present application;
[0032] Figure 2 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0033] Figure 3 A schematic architecture diagram of a software system of an electronic device provided in an embodiment of the present application;
[0034] Figure 4 A schematic diagram of the interaction process between various software modules in an electronic device when the electronic device outputs an audio stream provided by an embodiment of the present application;
[0035] Figure 5 A schematic diagram of a switching scenario of an audio output device provided in an embodiment of the present application;
[0036] Figure 6 A schematic diagram of a specific workflow of a thread module provided in an embodiment of the present application;
[0037] Figure 7 A schematic flow chart of an audio output control method provided in an embodiment of the present application;
[0038] Figure 8 A schematic flow chart of an audio output control method provided in another embodiment of the present application;
[0039] Fig. 9A schematic flowchart of an audio output control method provided in yet another embodiment of the present application. DETAILED DESCRIPTION
[0040] It should be noted that the terms used in the implementation methods of the embodiments of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application. In the description of the embodiments of the present 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 the 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 the description of the embodiments of the present application, unless otherwise specified, "multiple" means two or more than two, "at least one" and "one or more" mean one, two or more than two.
[0041] In the following, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, it is defined that the "first" and "second" features may explicitly or implicitly include one or more of the features.
[0042] References to "one embodiment" or "some embodiments" etc. described in this specification mean that a particular feature, structure or characteristic described in conjunction with the embodiment is included in one or more embodiments of the present application. Thus, the phrases "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear at 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.
[0043] In-ear feedback technology is a technology that collects the user's voice (such as speaking or singing, etc.) and feeds the collected user voice back to the user through headphones, allowing the user to hear his or her own voice through the headphones.
[0044] At present, with the continuous development of Internet technology, in-ear feedback technology is not only used in traditional live singing, live broadcasting, studio recording and other scenarios, but can also be used in the scenario of recording songs through the song recording application (APP) installed on the electronic device. For example, when the user uses the song recording APP on the electronic device to record songs, the use of in-ear feedback technology can make the earphones feed back the collected user's singing voice to the user while playing the song accompaniment, so that the user can not only hear the song accompaniment, but also hear his own singing voice, which is conducive to improving the recording quality and recording experience.
[0045] The ear-return technology used in electronic devices may include hardware ear-return technology and software ear-return technology.
[0046] Hardware ear-return technology refers to the ear-return technology that relies on the hardware system of the electronic device. It is usually the ear-return technology that comes with the electronic device when it leaves the factory and is developed by the manufacturer of the electronic device. For example, Figure 1 As shown in (a), when a user uses a song recording APP on an electronic device that supports hardware ear return technology, during the song recording process, the electronic device can directly transmit the user sound (such as singing sound) collected by the microphone (such as the built-in microphone of the electronic device or the microphone on the earphone) to the earphone in the hardware system without going through the song recording APP, thereby making the user sound fed back by the earphone have a lower latency.
[0047] Software ear-return technology refers to ear-return technology that mainly relies on the software system of the electronic device to implement, which can usually be applied to electronic devices that do not support hardware ear-return technology. Figure 1 As shown in (b) in the figure, when a user uses a song recording app on an electronic device that does not support hardware ear return technology, the electronic device cannot directly transmit the user sound collected by the microphone to the earphone in the hardware system. Therefore, during the song recording process, the song recording app needs to create a low-latency recording channel and a low-latency ear return playback channel at the same time. The microphone needs to transmit the collected user sound to the song recording app in the software system through the low-latency recording channel, and then the song recording app transmits the user sound to the earphone through the low-latency ear return playback channel.
[0048] In specific applications, when a user uses a recording app to record songs on an electronic device that does not support hardware ear return technology, if the connection between the headphones (including wired headphones or Bluetooth headphones, etc.) and the electronic device is temporarily disconnected during the recording process, then when the user connects the headphones to the electronic device again, the recording app will output the multi-frame audio data that was blocked due to switching the audio output device to the headphones in an instant, causing the user to hear an electric current sound similar to a popping (POP) sound in the headphones, affecting the user's recording experience.
[0049] In view of this, an embodiment of the present application provides an audio output control method, by accessing a target audio output device, and the target audio output device is different from the current audio output device, and the audio client corresponding to each current audio playback channel includes a target audio application, and the target audio playback channel corresponding to the target audio application is a low-latency audio playback channel, the volume of each audio playback channel is lowered to a first volume, and the current audio output device of each audio playback channel is switched to the target audio output device, and each audio playback channel is controlled to maintain the first volume target duration, so that after switching to the target audio output device, the first few frames of audio data output by the target audio output device are close to silence, and because the duration of close silence is longer than the default duration, it can avoid the user from hearing the current sound caused by abnormal audio data in the target audio output device, which is beneficial to improving the user's experience of the target audio application.
[0050] The execution subject of the audio output control method provided in the embodiment of the present application may be an electronic device. The electronic device may also be referred to as a terminal, user equipment (UE), mobile station (MS) or mobile terminal (MT), etc. Exemplarily, the electronic device may include a mobile phone, a smart TV, a wearable device (such as a smart bracelet, a smart watch or smart glasses, etc.), a tablet computer (pad), an augmented reality (AR) device, a virtual reality (VR) device, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook and a personal digital assistant (PDA), etc. The embodiment of the present application does not limit the specific device form of the electronic device.
[0051] For example, see Figure 2 , is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0052] like Figure 2As shown, 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 1, an antenna 2, 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.
[0053] 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 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.
[0054] The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of instruction fetching and execution.
[0055] 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.
[0056] 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 jack 170D, and the application processor.
[0057] 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. The audio module 170 can include, for example, an audio codec, an audio digital processor, a Bluetooth chip, an intelligent power amplifier, etc.
[0058] 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.
[0059] The receiver 170B, also called a "earpiece", is used to convert audio electrical signals into sound signals. When the electronic device 100 receives a call or voice message, the voice can be received by placing the receiver 170B close to the human ear.
[0060] Microphone 170C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak by putting their mouth close to microphone 170C to input the sound signal into microphone 170C. The electronic device 100 can be provided with at least one microphone 170C. In other embodiments, the electronic device 100 can be provided with two microphones 170C, which can not only collect sound signals but also realize noise reduction function. In other embodiments, the electronic device 100 can also be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify the sound source, realize directional recording function, etc.
[0061] The earphone interface 170D is used to connect a wired earphone and can be a USB interface 130 or a 3.5 mm open mobile terminal platform (OMTP) standard interface or a cellular telecommunications industry association of the USA (CTIA) standard interface.
[0062] The above is an exemplary description of the structure of the electronic device 100. It is understood that in other embodiments, the electronic device 100 may include more or fewer components than shown in the figure, or may combine some components, or split some components, or may have a different arrangement of components. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0063] The software system of the electronic device 100 with the above hardware system can adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture, etc. The embodiment of the present application takes the Android system with a layered architecture as an example to exemplify the software system of the electronic device 100.
[0064] See also Figure 3 , which is a schematic architecture diagram of a software system of an electronic device 100 provided in an embodiment of the present application.
[0065] like Figure 3 As shown in Figure 1, the layered architecture can divide the software into several layers, each layer has a clear role and division of labor, and the layers communicate with each other through software interfaces. For example, the layered architecture can divide the Android system into five layers, from top to bottom: application (APP) layer, application framework layer, system layer, hardware abstraction layer (HAL) and kernel layer.
[0066] The application layer may include a series of application packages, such as telephone, recording, audio player, video player, podcast, song recording, etc. For ease of explanation, the application package may be referred to as application in the following.
[0067] The application framework layer provides an application programming interface (API) and a programming framework for applications in the application layer. The application framework layer may include some predefined functions.
[0068] Exemplarily, the application framework layer may include a window manager, a content provider, a view system, a telephony manager, an audio interface, an audio track (AudioTrack) module, and the like.
[0069] The audio interface can be used to provide an interface for the application to call the audio track module. The audio interface can be, for example, an open sound library for embedded systems (Open SLES) interface.
[0070] The audio track module can be used to create audio playback objects for applications in the application layer.
[0071] The system layer can include Android runtime, system libraries, etc.
[0072] The Android runtime can include a core library and a virtual machine. The Android runtime is mainly responsible for the scheduling and management of the Android system. The core library consists of two parts: one is the function that the Java language needs to call, and the other is the Android core library. The application layer and the application framework layer run in the virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform object life cycle management, stack management, thread management, security and exception management, and garbage collection.
[0073] The system library can include the audio scheduling (AudioFlinger) module, the audio policy management (AudioPolicyManager) module, the thread (Threads) module, and the track (Track) module.
[0074] Among them, the track module can be used to create an audio playback channel at the system level for electronic devices.
[0075] The audio scheduling module can be used to manage audio data processing threads.
[0076] The thread module can be used to create audio data processing threads, and each audio data processing thread can correspond to an audio playback channel.
[0077] The audio policy management module is used to manage audio playback policies, such as volume adjustment, audio playback channel selection, audio output device switching, etc.
[0078] The hardware abstraction layer may include an audio hardware abstraction layer (audioHAL) module.
[0079] The audio hardware abstraction module can be used to manage audio hardware resources in the hardware system of the electronic device, such as audio codecs, audio digital processors, Bluetooth chips, and smart amplifiers.
[0080] The kernel layer is the layer between hardware and software. The kernel layer can include display drivers, camera drivers, audio drivers, sensor drivers, etc.
[0081] It should be noted that Figure 3Only modules related to the embodiments of the present application are shown. In other embodiments, each layer may also include any other possible modules, and each module may also include one or more sub-modules, which are not limited in the present application.
[0082] The following will be combined with the accompanying drawings to exemplify the audio output control method provided by the embodiments of the present application through multiple embodiments. The audio output control method in the following embodiments can be implemented in an electronic device having the above-mentioned hardware system and software system. The hardware system diagram of the electronic device can be as follows: Figure 2 As shown, the software system can be Figure 3 As shown, but not limited to this.
[0083] For ease of understanding, the following takes the scenario where a user uses a recording app to record a song on an electronic device that does not support hardware ear return technology as an example to illustrate the specific process of the electronic device outputting an audio stream. Figure 4 , is a schematic diagram of the interaction process between various software modules in an electronic device when an electronic device outputs an audio stream provided by an embodiment of the present application.
[0084] like Figure 4 As shown, the electronic device may include a song recording APP, an audio track module, an audio scheduling module, an audio policy management module, a thread module, a track module, and an audio hardware abstraction module, etc.
[0085] The audio track module may be located in the application framework layer of the software system of the electronic device. The audio scheduling module, the audio policy management module, the track module and the thread module may be located in the system layer of the software system. The audio hardware abstraction module may be located in the hardware abstraction layer of the software system of the electronic device.
[0086] For example, when a user records a song through a song recording APP in the application layer, the song recording APP can create an audio playback object for playing the song accompaniment and an audio playback object for playing the user's voice. In specific applications, the audio playback object can also be called an audio playback channel, audio track, or audio track, etc.
[0087] It is understandable that, because when the user's voice is fed back through headphones on an electronic device that does not support hardware ear return technology, the audio transmission path corresponding to the user's voice is long, in order to reduce the delay when the electronic device feeds back the user's voice, the audio playback object created by the song recording APP for playing the user's voice can be a low-latency audio playback object. Exemplarily, the process of creating an audio playback object by the song recording APP may include the following: Figure 4 S401~S407 shown are described in detail as follows:
[0088] S401, the song recording APP calls the audio interface to send an audio playback object creation request to the audio track module.
[0089] The audio playback object creation request may carry the type identifier of the audio playback object to be created.
[0090] Exemplarily, the audio playback objects may include low-latency audio playback objects and ordinary audio playback objects, etc.
[0091] Among them, the type identifier of the low-latency audio playback object can be a low-latency identifier, and the type identifier of the ordinary audio playback object can be an ordinary identifier. Based on this, when the audio playback object to be created is a low-latency audio playback object, the audio playback object creation request can carry a low-latency identifier. When the audio playback object to be created is an ordinary audio playback object, the audio playback object creation request can carry an ordinary identifier.
[0092] Exemplarily, when a song recording APP needs to create a low-latency audio playback object, the song recording APP can call the Open SLES interface to send a playback object creation request carrying a low-latency flag to the audio track module.
[0093] It should be noted that the audio playback period of the low-latency audio playback object is shorter than the audio playback period of the ordinary audio playback object. The audio playback period may refer to the time required to play one frame of audio data. Exemplarily, the audio data playback of the ordinary audio playback object may be 20 milliseconds, and the audio playback period of the low-latency audio playback object may be 4 milliseconds.
[0094] When using a song recording APP on an electronic device that does not support hardware ear return technology, the song recording APP creates a low-latency audio playback object to play the collected user voice, which can reduce the delay in playing the user voice and improve the user's song recording experience.
[0095] S402: The audio track module creates a corresponding audio playback object for the application program.
[0096] After receiving the audio playback object creation request, the audio track module can create an application-oriented audio playback object corresponding to the audio playback object creation request, so that the song recording APP can play audio through the audio playback object.
[0097] Exemplarily, assuming that the audio playback object creation request carries a low-latency identifier, the audio track module can create a low-latency audio playback object for the application, so that the song recording APP can play the collected user voice through the low-latency audio playback object. Assuming that the audio playback object creation request carries a normal identifier, the audio track module can create a normal audio playback channel for the application, so that the song recording APP can play the song accompaniment through the normal audio playback object.
[0098] Specifically, when the audio track module creates an audio playback object, it can register an audio data callback function in the audio playback object so that the system layer can obtain the audio data to be played from the song recording APP through the audio data callback function.
[0099] It should be noted that when the application-oriented audio playback object implements the audio playback function, it needs the support of the audio service in the system layer of the electronic device. For example, it is necessary to create an audio playback channel corresponding to the audio playback object in the system layer to implement audio playback through the audio playback channel. Based on this, after creating the application-oriented audio playback object, the audio track module can notify the system layer to create an audio playback channel corresponding to the audio playback object. The process of the audio track module notifying the system layer to create the corresponding audio playback channel can include subsequent S403~S407.
[0100] S403: The audio track module sends an audio playback channel creation request to the audio scheduling module.
[0101] The audio play channel creation request may carry the type identifier of the audio play channel to be created. The type identifier of the audio play channel to be created may be the same as the type identifier of the corresponding application-oriented audio play object.
[0102] Exemplarily, assuming that the type of the created application-oriented audio playback object is a low-latency audio playback object, the audio playback channel to be created can be a low-latency audio playback channel. Based on this, the type identifier of the audio playback channel to be created can be a low-latency identifier, that is, the audio playback channel creation request can carry a low-latency identifier.
[0103] Assuming that the type of the created application-oriented audio playback object is a common audio playback object, the audio playback channel to be created can be a common audio playback channel. Based on this, the type identifier of the audio playback channel to be created can be a common identifier, that is, the audio playback channel creation request can carry a common identifier.
[0104] S404: The audio scheduling module sends an audio playback channel creation request to the audio policy management module.
[0105] S405: The audio policy management module determines the thread identifier of the target audio data processing thread according to the type identifier carried in the audio playback channel creation request, and sends the thread identifier of the target audio data processing thread to the audio scheduling module.
[0106] The audio policy management module may store thread identifiers of various audio data processing threads. The thread identifiers may be used to indicate the types of audio playback channels that the audio data processing threads can create. The thread identifiers of different audio data processing threads may be different, that is, different audio data processing threads may be used to create different types of audio playback channels.
[0107] Exemplarily, the thread identifier may include a low-latency identifier and a normal identifier. When the thread identifier of a certain audio data processing thread is a low-latency identifier, it indicates that the audio data processing thread can create a low-latency audio playback channel; when the thread identifier of a certain audio data processing thread is a normal identifier, it indicates that the audio data processing thread can create a normal audio playback channel.
[0108] After the audio policy management module receives the audio playback channel creation request, it can determine the thread identifier of the target audio data processing thread according to the type identifier carried in the audio playback channel creation request, and send the thread identifier of the target audio data processing thread to the audio scheduling module. Exemplarily, when the type identifier carried in the audio playback channel creation request is a low latency identifier, the audio policy management module can determine that the thread identifier of the target audio data processing thread is a low latency identifier. When the type identifier carried in the audio playback channel creation request is a normal identifier, the audio policy management module can determine that the thread identifier of the target audio data processing thread is a normal identifier.
[0109] S406: The audio scheduling module controls the thread module to create a corresponding audio playback channel according to the thread identifier of the target audio data processing thread.
[0110] S407, the thread module creates a corresponding audio playback channel under the target audio data processing thread.
[0111] In a specific application, the audio scheduling module may send the thread identifier of the target audio data processing thread to the thread module to instruct the thread module to create a corresponding audio playback channel under the target audio data processing thread according to the thread identifier of the target audio data processing thread.
[0112] In other embodiments of the present application, the audio scheduling module can also establish a corresponding relationship between the audio playback channel and the corresponding audio playback object after the corresponding audio playback channel is created, and return the corresponding relationship to the audio track module. In this way, the song recording APP completes the process of creating an audio playback object.
[0113] After creating the audio playback object, the song recording APP can play the audio stream through the audio playback object. The audio stream can be understood as multiple frames of audio data that are continuous in time. For example, the song recording APP can play the user's voice collected by the microphone, such as the user's singing voice, through the created low-latency audio playback object. The song recording APP can play the song accompaniment through the created ordinary audio playback object.
[0114] It is understandable that when the song recording APP plays audio data, it is necessary to transmit the audio data to be played to the corresponding audio playback channel through the audio playback object. In order to facilitate the transmission of audio data between the audio playback object and the corresponding audio playback channel, an audio data buffer can be set between the audio playback object and the corresponding audio playback channel. Exemplarily, the audio data buffer can be set in the audio playback channel created by the target audio data processing thread.
[0115] Exemplarily, the audio data buffer can be a circular buffer. The circular buffer can include an array of fixed size, a read pointer and a write pointer. The read pointer can be used to indicate the read position of the data, and the write pointer can be used to indicate the write position of the data. When the write pointer or the read pointer reaches the end of the array, it will automatically loop to the beginning of the array, thereby forming a circular data read and write area, which can improve the storage space utilization of the electronic device.
[0116] Based on this, please refer to Figure 4 The process of playing audio data through the audio player object of the song recording APP may include: Figure 4 S408~S413 in are described as follows:
[0117] S408, the audio track module obtains the audio data to be played from the song recording APP through the audio data callback function.
[0118] Optionally, when the audio playback object is a low-latency audio playback object, the audio data to be played can be, for example, the singing voice of the user collected during the song recording process. Optionally, when the audio playback object is a normal audio playback object, the audio data to be played can be the song accompaniment.
[0119] S409: The audio track module writes the audio data to be played into the audio data buffer area.
[0120] S410, the thread module reads the audio data to be played from the audio data buffer area.
[0121] S411, the thread module processes the audio data to be played.
[0122] For example, for each frame of audio data to be played, the thread module may perform mixing processing and / or sound effect processing on the frame of audio data. The embodiment of the present application does not specifically limit the audio processing method in the thread module.
[0123] S412, the thread module sends the processed audio data to the audio hardware abstraction module.
[0124] S413, the audio hardware abstraction module calls the audio output device to play the processed audio data.
[0125] Exemplarily, the audio output device may include an audio output device built into the electronic device, such as a built-in speaker; or may include an audio output device external to the electronic device, such as an external wired headset, Bluetooth headset, or speaker, etc. The embodiment of the present application does not specifically limit the type of audio output device.
[0126] In a specific application, it is assumed that the user temporarily disconnects the connection between the headset and the electronic device while recording a song using a song recording APP. Figure 5 As shown in (a) in FIG. 1 , assuming that the user disconnects the connection between the earphone and the electronic device at the first moment, the song recording APP will not pause the playing of the song accompaniment and the user's voice. Usually, the song recording APP will continue to play the song accompaniment and the collected user voice through the built-in speaker of the electronic device. Figure 5 As shown in (b), assuming that the user connects the earphone to the electronic device again at the second moment, since the audio output device of the electronic device is changed at this time, that is, from the built-in speaker to the external earphone, the electronic device will execute the switching process of the audio output device.
[0127] Exemplarily, the switching process of the audio output device may be managed by a thread module in the system layer.
[0128] Specifically, the thread module may be pre-configured with an audio event processing function. The audio event processing function may be used to manage events relevant to the audio playback channel. Exemplarily, the events relevant to the audio playback channel may include an audio output device switching event. The thread module may call the audio event processing function to notify the audio hardware abstraction module in the hardware abstraction layer of the audio output device switching event when the audio output device switching event is triggered, so that the audio hardware abstraction module switches the audio output devices of each current audio playback channel.
[0129] For example, Figure 6 As shown, the step of the thread module calling the audio event processing function to manage the audio output device switching event can be Figure 4 Before S410 in the process, that is, after the switching process of the audio output device is completed, the thread module will continue to read audio data from the audio data buffer area, so that the audio track module will continue to obtain audio data from the song recording APP and continue to write audio data to the audio data buffer area. However, since the switching process of the audio output device is a time-consuming process, it usually takes about 200 milliseconds, and the audio playback cycle of the low-latency audio playback channel is about 4 milliseconds. Therefore, the switching process of the audio output device will cause the audio event processing function to be in a waiting state for a long time, so that the subsequent S410~S412 cannot be carried out normally, and then cause multiple frames of audio data to be blocked in the song recording APP and cannot be output in time. In this way, when the audio output device is switched, the song recording APP will output all the blocked audio data to the audio output device in an instant, causing the user to hear the current sound at the moment of reconnecting the headphones.
[0130] Based on this, in order to eliminate the current sound that occurs in the earphone after the user reconnects the earphone to the electronic device during the song recording process, the audio output control method provided in the embodiment of the present application may include the following steps: Figure 7 S701~S702 shown are described in detail as follows:
[0131] S701: When a headset is connected, the headset interface or the Bluetooth chip sends a headset connection notification to the audio policy management module.
[0132] Exemplarily, the earphone may be connected to the electronic device via a wired connection or a wireless connection.
[0133] Based on this, when a headset is plugged into the headset interface, the headset interface can send a headset access notification to the audio policy management module. When a Bluetooth headset is plugged into the Bluetooth chip, the Bluetooth chip can send a headset access notification to the audio policy management module.
[0134] Exemplarily, the headphone interface or the Bluetooth chip may send a headphone access notification to the audio policy management module by calling the audio interface.
[0135] S702: The audio policy management module executes an audio playback channel update process.
[0136] It is understandable that after the user connects the earphones to the electronic device, the audio output device of the electronic device changes from the built-in speaker to the external earphones. Therefore, in order to ensure that the electronic device can output audio normally, the electronic device needs to switch the audio output devices of each current audio playback channel to the earphones.
[0137] Exemplarily, the audio policy management module in the electronic device can implement the switching of the audio output device by executing the audio playback channel update process, that is, the purpose of the audio policy management module executing the audio playback channel update process is to switch the audio output devices corresponding to the current audio playback channels, so as to switch the audio output devices corresponding to the audio playback channels to the newly connected audio output devices. Exemplarily, assuming that the headphone interface has headphones connected, the audio policy management module can switch the audio output devices of each audio playback channel from speakers to wired headphones.
[0138] Optionally, the audio playback channel update process may specifically include S702.01 to S702.11, which are described in detail as follows:
[0139] S702.01, when the current audio output device is not headphones, the audio policy management module determines whether the audio clients corresponding to the current audio playback channels include a song recording APP, and determines whether the target audio playback channel corresponding to the song recording APP is a low-latency audio playback channel.
[0140] The audio client corresponding to the audio playback channel may refer to an application that plays audio through the audio playback channel.
[0141] In a specific application, the audio policy management module may store type identifiers of various audio playback channels and identifiers of all audio clients corresponding to each audio playback channel.
[0142] Exemplarily, the identifier of the audio client may be an application package name of the audio client.
[0143] The type identifier of the audio playback channel can be used to describe the type of the audio playback channel. The type identifier of the audio playback channel can include, for example, a low-latency identifier or a normal identifier. The low-latency identifier is used to indicate that the audio playback channel is a low-latency playback channel, and the normal identifier is used to indicate that the audio playback channel is a normal playback channel.
[0144] Based on this, when the audio policy management module determines whether the audio clients corresponding to the current audio playback channels include the song recording APP, the audio policy management module can compare the identifiers of the audio clients corresponding to the current audio playback channels with the identifiers of the song recording APP. Optionally, when there are audio clients whose identifiers are the same as the identifiers of the song recording APP in the audio clients corresponding to the current audio playback channels, the audio policy management module can determine that the audio clients corresponding to the current audio playback channels include the song recording APP. When the audio clients corresponding to the current audio playback channels include the song recording APP, it means that the song recording APP is currently playing audio. Optionally, when there are no audio clients whose identifiers are the same as the identifiers of the song recording APP in the audio clients corresponding to the current audio playback channels, the audio policy management module can determine that the audio clients corresponding to the current audio playback channels do not include the song recording APP.
[0145] The audio policy management module can determine whether the target audio playback channel corresponding to the song recording APP is a low-latency audio playback channel by determining whether the type identifier of the target audio playback channel corresponding to the song recording APP is a low-latency identifier. Optionally, when the type identifier of the target audio playback channel corresponding to the song recording APP is a low-latency identifier, the audio policy management module can determine that the target audio playback channel corresponding to the song recording APP is a low-latency audio playback channel. Optionally, when the type identifier of the target audio playback channel corresponding to the song recording APP is not a low-latency identifier, the audio policy management module can determine that the target audio playback channel corresponding to the song recording APP is not a low-latency audio playback channel.
[0146] Optionally, if the audio clients corresponding to the current audio playback channels include a song recording APP, and the target audio playback channel corresponding to the song recording APP is a low-latency audio playback channel, S702.02~S702.06 can be executed.
[0147] Optionally, when the audio clients corresponding to the current audio playback channels do not include a song recording APP, or when the target audio playback channel corresponding to the song recording APP is not a low-latency audio playback channel, S702.07~S702.11 can be executed.
[0148] It should be noted that S702.02~S702.06 and S702.07~S702.11 are mutually exclusive steps, that is, the electronic device does not execute S702.07~S702.11 when executing S702.02~S702.06, and does not execute S702.02~S702.06 when executing S702.07~S702.11.
[0149] S702.02, the audio policy management module sends a first volume adjustment instruction to the audio scheduling module.
[0150] The first volume adjustment instruction may be used to instruct to restore the volume of each audio playback channel after muting it for a target time period.
[0151] The target duration may refer to the longest duration required to play all audio data blocked in the song recording APP during the switching of the audio output device. The target duration may be greater than the default duration. The default duration may refer to the default duration of the electronic device's software system to mute the audio playback channel when switching the audio output device.
[0152] Optionally, the target duration may be obtained by multiplying the default duration by a preset multiple. The preset multiple may be greater than 1. Exemplarily, assuming that the default duration is 200 milliseconds and the preset multiple is 2, the target duration may be 400 milliseconds.
[0153] Optionally, the target duration can be obtained through testing.
[0154] S702.03, the audio scheduling module transmits a first volume adjustment instruction to the thread module.
[0155] Optionally, the first volume adjustment instruction may include a first mute instruction and a first mute release instruction.
[0156] The first mute instruction may be used to instruct to set each audio playback channel to a mute mode, that is, to lower the volume of each audio playback channel to 0.
[0157] The first mute release instruction may be used to instruct that after each audio playback channel is muted for a target duration, the volume of each audio playback channel is restored to the original volume. The original volume may refer to the volume of each audio playback channel before switching to the newly connected audio output device.
[0158] Based on this, after receiving the first mute instruction and the first mute release instruction, the audio scheduling module may first transmit the first mute instruction to the thread module, and then transmit the first mute release instruction to the thread module after the target duration.
[0159] S702.04, the thread module lowers the volume of each audio playback channel to 0 according to the first volume adjustment instruction.
[0160] The thread module may lower the volume of each audio playback channel to 0 after receiving the first mute instruction.
[0161] S702.05, the audio policy management module switches the audio output device of each audio playback channel to the earphone.
[0162] The audio policy management module may switch the audio output device of each audio playback channel to the earphone after the thread module turns down the volume of each audio playback channel to 0.
[0163] S702.06, after the thread module lowers the volume of each audio playback channel to 0 for a target time, the volume of each audio playback channel is restored to the original volume.
[0164] Exemplarily, after the target time period after the thread module receives the first mute instruction, if the thread module receives the first mute release instruction, the thread module may restore the volume of each audio playback channel to the original volume.
[0165] The embodiment of the present application restores the volume of each audio playback channel to the original volume after a target duration, which can not only prevent the user from hearing the electric current sound from the headphones, but also enable the electronic device to continue playing audio through the headphones, reducing the impact of switching of audio output devices on audio playback.
[0166] S702.07, the audio policy management module sends a second volume adjustment instruction to the audio scheduling module.
[0167] The second volume adjustment instruction may be used to instruct to restore the volume of each audio playback channel after muting it for a default period of time.
[0168] S702.08, the audio scheduling module transmits a second volume adjustment instruction to the thread module.
[0169] Optionally, the second volume adjustment instruction may include a second mute instruction and a second mute release instruction.
[0170] The second mute instruction may be used to instruct to set each audio playback channel to a mute mode, that is, to lower the volume of each audio playback channel to 0.
[0171] The second mute release instruction may be used to instruct that the volume of each audio playback channel be restored to the original volume after each audio playback channel is muted for a default period of time.
[0172] Based on this, after receiving the second mute instruction and the second mute release instruction, the audio scheduling module can first transmit the second mute instruction to the thread module, and then transmit the second mute release instruction to the thread module after a default duration.
[0173] S702.09, the thread module lowers the volume of each audio playback channel to 0 according to the second volume adjustment instruction.
[0174] The thread module may lower the volume of each audio playback channel to 0 after receiving the second mute instruction.
[0175] S702.10, the audio policy management module switches the audio output device of each audio playback channel to the earphone.
[0176] The audio policy management module may switch the audio output device of each audio playback channel to the earphone after the thread module turns down the volume of each audio playback channel to 0.
[0177] S702.11, after the thread module lowers the volume of each audio playback channel to 0 for a default time period, the volume of each audio playback channel is restored to the original volume.
[0178] Exemplarily, after the default time after the thread module receives the second mute instruction, if the thread module receives the second mute release instruction, the thread module can restore the volume of each audio playback channel to the original volume.
[0179] The embodiment of the present application restores the volume of each audio playback channel to the original volume after a default duration, so that the electronic device can continue to play audio through headphones, reducing the impact of audio output device switching on audio playback.
[0180] See also Figure 8 , is a schematic flow chart of an audio output control method provided by another embodiment of the present application. Figure 8 As shown, the audio output control method may include S801-S802, which are described in detail as follows:
[0181] S801, when a target audio output device is connected and the target audio output device is different from the current audio output device, the electronic device determines whether the audio clients corresponding to each current audio playback channel include a target audio application, and determines whether the target audio playback channel corresponding to the target audio application is a low-latency audio playback channel.
[0182] For example, assuming that when an electronic device is playing audio through a speaker, the user connects headphones to the electronic device, the electronic device can determine the headphones as the target audio output device and the speaker as the current audio output device. In this case, the electronic device can determine that the target audio output device is different from the current audio output device.
[0183] The audio client corresponding to the audio playback channel may refer to an application that plays audio through the audio playback channel.
[0184] Exemplarily, the electronic device may store type identifiers of various audio playback channels and identifiers of all audio clients corresponding to each audio playback channel.
[0185] The identifier of the audio client may be an application package name of the audio client.
[0186] The type identifier of the audio playback channel can be used to describe the type of the audio playback channel. The type identifier of the audio playback channel can include, for example, a low-latency identifier or a normal identifier. The low-latency identifier is used to indicate that the audio playback channel is a low-latency playback channel, and the normal identifier is used to indicate that the audio playback channel is a normal playback channel.
[0187] The target audio application may be, for example, a song recording APP.
[0188] Based on this, when the electronic device determines whether the target audio application is included in the audio clients corresponding to the current audio playback channels, the electronic device can compare the identifier of the audio client corresponding to the current audio playback channels with the identifier of the target audio application. Optionally, in the case where there is an audio client whose identifier is the same as the identifier of the target audio application in the audio clients corresponding to the current audio playback channels, the electronic device can determine that the target audio application is included in the audio clients corresponding to the current audio playback channels. In the case where the target audio application is included in the audio clients corresponding to the current audio playback channels, it means that the target audio application is currently playing audio. Optionally, in the case where there is no audio client whose identifier is the same as the identifier of the target audio application in the audio clients corresponding to the current audio playback channels, the electronic device can determine that the target audio application is not included in the audio clients corresponding to the current audio playback channels.
[0189] The electronic device can determine whether the target audio playback channel corresponding to the target audio application is a low-latency audio playback channel by determining whether the type identifier of the target audio playback channel corresponding to the target audio application is a low-latency identifier. Optionally, in the case where the type identifier of the target audio playback channel corresponding to the target audio application is a low-latency identifier, the electronic device can determine that the target audio playback channel corresponding to the target audio application is a low-latency audio playback channel. Optionally, in the case where the type identifier of the target audio playback channel corresponding to the target audio application is not a low-latency identifier, the electronic device can determine that the target audio playback channel corresponding to the target audio application is not a low-latency audio playback channel.
[0190] It should be noted that the embodiments of the present application do not limit the order in which the electronic device determines the target audio application and the low-latency audio playback channel. That is, the electronic device can first determine whether the audio client corresponding to each current audio playback channel includes the target audio application, and then determine whether the target audio playback channel corresponding to the target audio application is a low-latency audio playback channel; it can also first determine whether the target audio playback channel corresponding to the target audio application is a low-latency audio playback channel, and then determine whether the audio client corresponding to each current audio playback channel includes the target audio application; it can also simultaneously determine whether the audio client corresponding to each current audio playback channel includes the target audio application, and whether the target audio playback channel corresponding to the target audio application is a low-latency audio playback channel.
[0191] S802, when the electronic device includes a target audio application in the audio client corresponding to each current audio playback channel, and the target audio playback channel corresponding to the target audio application is a low-latency audio playback channel, the volume of each audio playback channel is lowered to a first volume, and the current audio output device of each audio playback channel is switched to the target audio output device, and each audio playback channel is controlled to maintain the first volume target duration.
[0192] Exemplarily, the first volume may be 0.
[0193] Optionally, controlling each audio playback channel to maintain the first volume target duration may specifically include:
[0194] After the volume of each audio playback channel is lowered to the target time length after the first volume, the volume of each audio playback channel is restored to the original volume.
[0195] The original volume is the volume of each audio playback channel before switching to the target audio output device.
[0196] It should be noted that the specific implementation process of S802 can be referred to Figure 7 The relevant descriptions of parts S702.02 to S702.06 in the corresponding embodiments are not repeated here.
[0197] In another embodiment of the present application, after S801, the audio output control method may further include: Fig. 9 S803 and S804 shown are described in detail as follows:
[0198] S803, when the audio clients corresponding to the current audio playback channels do not include the target audio application, the electronic device lowers the volume of each audio playback channel to a first volume, switches the current audio output device of each audio playback channel to the target audio output device, and controls each audio playback channel to maintain the first volume for a default duration.
[0199] S804, when the audio client corresponding to each current audio playback channel of the electronic device includes a target audio application, and the target audio playback channel corresponding to the target audio application is not a low-latency audio playback channel, the volume of each audio playback channel is lowered to a first volume, and the current audio output device of each audio playback channel is switched to the target audio output device, and each audio playback channel is controlled to maintain the first volume for a default duration.
[0200] Optionally, controlling each audio playback channel to maintain a first volume for a default duration may specifically include:
[0201] After the volume of each audio playback channel is lowered to a default time length after the first volume, the volume of each audio playback channel is restored to the original volume.
[0202] It should be noted that the specific implementation process of S803 and S804 can refer to the relevant description of S702.07 to S702.11 in the above embodiment, which will not be repeated here.
[0203] The embodiment of the present application can reduce the probability of a user hearing an electric current sound from a switched target audio output device and can also reduce the impact of audio output device switching on audio playback by lowering the volume of each audio playback channel to 0 and maintaining the default duration when the target audio application is not included in the audio client or when the target audio playback channel is not a low-latency audio playback channel.
[0204] Based on the same technical concept, an embodiment of the present application also provides a computer-readable storage medium, which stores a computer-executable program. When the computer-executable program is called by a computer, the computer executes one or more steps in any of the above method embodiments.
[0205] Based on the same technical concept, the embodiment of the present application also provides a chip system, including a processor, the processor is coupled to a memory, and the processor executes a computer executable program stored in the memory to implement one or more steps in any of the above method embodiments. The chip system can be a single chip, or a chip module composed of multiple chips.
[0206] Based on the same technical concept, an embodiment of the present application also provides a computer executable program product. When the computer executable program product runs on an electronic device, the electronic device executes one or more steps in any of the above method embodiments.
[0207] In the above embodiments, the description of each embodiment has its own emphasis. For the parts not described or recorded in detail in a certain embodiment, please refer to the relevant description of other embodiments. It should be understood that the size of the sequence number of each step in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0208] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by 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 program 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 through the computer-readable storage medium. The computer instructions may be transmitted from one website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means. 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 integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid state disk (SSD)), etc.
[0209] Those skilled in the art can understand that to implement all or part of the processes in the above-mentioned embodiments, the processes can be completed by computer programs to instruct related hardware, and the programs can be stored in computer-readable storage media. When the programs are executed, they can include the processes of the above-mentioned method embodiments. The aforementioned storage media include: ROM or random access memory RAM, magnetic disk or optical disk and other media that can store program codes.
[0210] The above is only a specific implementation of the embodiment of the present application, but the protection scope of the embodiment of the present application is not limited thereto, and any changes or replacements within the technical scope disclosed in the embodiment of the present application should be included in the protection scope of the embodiment of the present application. Therefore, the protection scope of the embodiment of the present application should be based on the protection scope of the claims.
Claims
1. An audio output control method, characterized in that: include: When a target audio output device is connected, and the target audio output device is different from the current audio output device, and the audio client corresponding to each current audio playback channel includes a target audio application, and the target audio playback channel corresponding to the target audio application is a low-latency audio playback channel, the volume of each audio playback channel is lowered to a first volume, and the current audio output device of each audio playback channel is switched to the target audio output device, and each audio playback channel is controlled to maintain the first volume target duration; the target audio application is a song recording APP, and the first volume is zero; The target duration is greater than a default duration, and the default duration is a default mute duration of an audio playback channel set by the software system when switching an audio output device.
2. The audio output control method according to claim 1, characterized in that: Also includes: When a target audio output device is connected, and the target audio output device is different from the current audio output device, and the audio clients corresponding to each current audio playback channel do not include the target audio application, the volume of each audio playback channel is lowered to a first volume, the current audio output device of each audio playback channel is switched to the target audio output device, and each audio playback channel is controlled to maintain the first volume for the default duration.
3. The audio output control method according to claim 1, characterized in that: Also includes: When a target audio output device is connected, and the target audio output device is different from the current audio output device, and the audio client corresponding to each current audio playback channel includes a target audio application, and the target audio playback channel corresponding to the target audio application is not a low-latency audio playback channel, the volume of each audio playback channel is lowered to a first volume, and the current audio output device of each audio playback channel is switched to the target audio output device, and each audio playback channel is controlled to maintain the first volume for the default duration.
4. The audio output control method according to any one of claims 1 to 3, characterized in that: The target duration is obtained by multiplying the default duration by a preset multiple; the preset multiple is greater than 1.
5. The audio output control method according to any one of claims 1 to 3, characterized in that: Controlling each of the audio playback channels to maintain the first volume target duration includes: After the volume of each audio playback channel is lowered to the first volume for a target time period, the volume of each audio playback channel is restored to the original volume; the original volume is the volume of each audio playback channel before switching to the target audio output device.
6. The audio output control method according to claim 2 or 3, characterized in that: Controlling each of the audio playback channels to maintain the first volume for the default duration includes: After the volume of each audio playback channel is lowered to a first volume for a default period of time, the volume of each audio playback channel is restored to an original volume; the original volume is the volume of each audio playback channel before switching to the target audio output device.
7. An electronic device, characterized in that: include: one or more processors, and memory; The memory is coupled to the one or more processors, and the memory is used to store computer program codes, wherein the computer program codes include computer instructions, and the one or more processors call the computer instructions to enable the electronic device to perform the method as claimed in any one of claims 1 to 6.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium comprises instructions, and when the instructions are executed on an electronic device, the electronic device executes the method as claimed in any one of claims 1 to 6.
9. A chip system, characterized in that: The chip system is applied to an electronic device, and the chip system includes one or more processors, and the one or more processors are used to call computer instructions so that the electronic device executes the method as described in any one of claims 1 to 6.
