Sound playing method and related device
By intercepting the volume after the sound mode changes at the application framework layer of the terminal device, the volume stability is ensured, and the problem of music volume difference when the user changes the sound mode is solved and the user experience is improved.
Patent Information
- Application Number
- CN202310899539.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-20
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2043-07-20
AI Technical Summary
When the terminal device changes the sound mode, the volume of the music is prone to differentiation, affecting the user experience.
By intercepting the changed volume at the application framework layer so that it cannot be passed to the hardware layer, ensuring the volume stability of the music, and using a cascading sound processing method to improve the stability of the speaker's sound playback.
It effectively reduces the impact of sound mode changes on music volume, improving the stability and user experience of volume.
Smart Images

Figure CN117707463B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of terminal technology, and in particular to a sound playing method and related devices. Background Art
[0002] The terminal device can play sound through a speaker. Currently, when the terminal device plays music through a speaker, if the user changes the sound mode of the terminal device, for example, the user changes the sound mode from ringing to vibrating or silent, or the user changes the sound mode from vibrating or silent to ringing, the volume of the music will be different, affecting the user experience. Summary of the invention
[0003] The present application provides a sound playing method and related apparatus, which are applied in the field of terminal technology and are helpful to improve the stability of the volume when the user changes the sound mode of the terminal device.
[0004] In a first aspect, the present application provides a sound playing method, which can be applied to a terminal device. The method includes: at a first moment, playing the sound in a first application of the terminal device; the volume of the first application is the first volume, the volume managed by the second application of the terminal device is the second volume, and the hardware abstraction layer of the terminal device has an identification of the second volume; at a second moment, the sound in the first application continues to play, and an operation of setting the volume managed by the second application to a third volume is received by the user, and the third volume is different from the second volume, and the second moment is after the first moment; at a third moment, the sound in the first application continues to play, the volume of the first application is the first volume, and the hardware abstraction layer does not have an identification of the third volume, and the third moment is after the second moment; at a fourth moment, playing the sound managed by the second application, the sound in the first application stops playing, the volume managed by the second application is the third volume, and the hardware abstraction layer has an identification of the third volume, and the fourth moment is after the third moment.
[0005] The volume managed by the second application can be the volume of the sound mode of the terminal device, or the volume managed by the second application can be the volume of other applications such as an alarm clock, which is not limited in this application. The third volume is different from the second volume, which means that the third volume can be greater than the second volume or less than the second volume, which is not limited in this application.
[0006] At the second moment, the sound in the first application continues to play, and the user's operation of setting the volume managed by the second application to the third volume is received, which can indicate that the terminal device receives the user's operation of changing the volume managed by the second application when playing the sound in the first application. At the third moment after the second moment, the terminal device still plays the sound in the first application at the first volume, which can indicate that the user's operation of setting the volume managed by the second application to the third volume does not affect the volume of the sound in the first application. At this time, the hardware abstraction layer does not have the third volume mark, which can indicate that the third volume is not passed to the hardware abstraction layer. Since the user sets the sound managed by the second application from the second volume to the third volume at the second moment, at the fourth moment after the second moment, when the terminal device plays the sound managed by the second application, it can play the sound managed by the second application at the third volume. The hardware abstraction layer has the third volume mark, which can indicate that the third volume is passed to the hardware abstraction layer.
[0007] At the second moment, when the sound of the first application is playing, the user receives an operation to set the volume managed by the second application from the second volume to the third volume. At the third moment, the sound of the first application continues to play, and the hardware abstraction layer does not have the third volume mark, which can indicate that the third volume has not been passed to the hardware abstraction layer. The third volume is intercepted before the hardware abstraction layer, so that the third volume cannot affect the volume of the first application, which is conducive to improving the volume stability. In addition, at the fourth moment, the terminal device plays the sound managed by the second application, and the hardware abstraction layer has the third volume mark, which can indicate that when the audio managed by the second application needs to be played, the third volume is not intercepted before the hardware abstraction layer, which meets the user's need to set the volume, which is conducive to improving the user experience.
[0008] In one possible implementation, when an operation is received by the user to set the volume managed by the second application to a third volume, the method further includes: the second application indicates an identifier of the third volume to an application framework layer of the terminal device; and the application framework layer intercepts the identifier of the third volume so that the identifier of the third volume is not passed to the hardware abstraction layer.
[0009] When the second application receives an operation by the user to set the volume managed by the second application to the third volume, the second application can indicate the identifier of the third volume to the application framework layer of the terminal device; the application framework layer intercepts the identifier of the third volume so that the identifier of the third volume is not passed to the hardware abstraction layer, so that the third volume cannot affect the volume of the first application, which is conducive to improving the stability of the volume.
[0010] In one possible implementation, the method also includes: the application framework layer determines whether the sound of the first application is being played through the speaker of the terminal device; the application framework layer intercepts the identification of the third volume, including: if the sound of the first application is being played through the speaker, the application framework layer intercepts the identification of the third volume.
[0011] Before the application framework layer intercepts the third volume identifier, it can determine whether the sound of the first application is being played through the speaker of the terminal device. The application framework layer can intercept the third volume identifier when the sound of the first application is being played through the speaker. In this way, when the speaker is playing sound, intercepting the third volume identifier is conducive to improving the stability of the speaker playing sound.
[0012] In a possible implementation, the application framework layer intercepts the identifier of the third volume, including: the application framework layer calls the setStreamVolume() interface to intercept the identifier of the third volume. In this way, the identifier of the third volume is intercepted by using the setStreamVolume() interface, and the existing interface is improved to intercept the identifier of the third volume, with minimal changes to the existing method.
[0013] In one possible implementation, before playing the sound managed by the second application, the method also includes: the second application indicates the audio managed by the second application to the application framework layer; the application framework layer transmits the identifier of the third volume and the audio managed by the second application to the hardware abstraction layer; playing the sound managed by the second application includes: playing the audio managed by the second application at the third volume through the speaker of the terminal device.
[0014] The second application detects an instruction to play the audio managed by the second application, and can indicate the audio managed by the second application to the application framework layer. The application framework layer can pass the third volume identifier and the audio managed by the second application to the hardware abstraction layer for transmission to the hardware layer through the hardware abstraction layer for playback, so that the audio managed by the second application is played at the third volume through the speaker of the terminal device.
[0015] In this way, the identifier of the third volume is transmitted from the application framework layer to the hardware abstraction layer along with the audio managed by the second application, which is conducive to playing the audio managed by the second application at the third volume and meeting the user's demand for adjusting the volume.
[0016] In one possible implementation, receiving an operation by a user to set the volume managed by a second application to a third volume includes: in response to a pull-down operation by the user, displaying a first interface, the first interface including a first control, the first control being used to change the sound mode of the terminal device; wherein, before a second moment, the sound mode of the terminal device is the first sound mode, and the volume of the first sound mode is the second volume; receiving a first operation by the user on the first control, the first operation being used to set the sound mode of the terminal device to the second sound mode, and the volume of the second sound mode to the third volume.
[0017] The first sound mode can be ringing, vibration or silent. If the first sound mode is ringing, the second sound mode can be vibration or silent. If the second sound mode is vibration or silent, the second sound mode can be ringing.
[0018] In this way, the terminal device can support the user to set the volume managed by the second application to the third volume through the human-computer interaction interface, which is simple and convenient and is conducive to improving the user experience.
[0019] In a possible implementation, receiving an operation of setting the volume managed by the second application to a third volume by the user includes: in response to the second operation of the user on the setting application, displaying a second interface, the second interface including a second control, the second control being used to adjust the volume of the alarm clock; wherein before the second moment, the volume of the alarm clock is the second volume; receiving a third operation of the user on the second control, the third operation being used to set the volume of the alarm clock to the third volume. In this way, the terminal device can support the user to set the volume managed by the second application to the third volume through the human-computer interaction interface, which is conducive to improving the user experience.
[0020] In one possible implementation, playing the sound in the first application of a terminal device includes: the application framework layer of the terminal device processes the audio in the first application to obtain processed audio; the advanced digital signal processor (ADSP) module of the terminal device processes the processed audio to obtain re-processed audio; and playing the re-processed audio through a speaker of the terminal device.
[0021] The application framework layer of the terminal device can be deployed with a sound effect processing method such as DTS sound effect to process the audio in the first application, and the advanced digital signal processing ADSP module of the terminal device can be deployed with another sound effect processing method such as Histen sound effect to process the processed audio to obtain the reprocessed audio; and play the reprocessed audio through the speaker of the terminal device. The application framework layer of the terminal device and the advanced digital signal processing ADSP module of the terminal device both process the audio, which belongs to the cascade sound effect scenario. The present application can be applied to the cascade sound effect scenario, which is conducive to improving the stability of the volume in the cascade sound effect scenario.
[0022] In a second aspect, an embodiment of the present application provides a terminal device, including a processor and a memory, the memory being used to store code instructions, and the processor being used to run the code instructions to execute a method executed by the terminal device described in any possible implementation of the first aspect.
[0023] In a third aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the method executed by the terminal device as described in any possible implementation manner of the first aspect is implemented.
[0024] In a fourth aspect, an embodiment of the present application provides a computer program product, which includes a computer program. When the computer program is run, the computer executes the method executed by the terminal device described in any possible implementation of the first aspect.
[0025] In a fifth aspect, the present application provides a chip or a chip system, which includes at least one processor and a communication interface, the communication interface and the at least one processor are interconnected by a line, and the at least one processor is used to run a computer program or instruction to execute the method performed by the terminal device described in any possible implementation of the first aspect. Among them, the communication interface in the chip can be an input / output interface, a pin or a circuit, etc.
[0026] In a possible implementation, the chip or chip system described above in the present application further includes at least one memory, in which instructions are stored. The memory may be a storage unit inside the chip, such as a register, a cache, etc., or a storage unit of the chip (e.g., a read-only memory, a random access memory, etc.).
[0027] It should be understood that the second to fifth aspects of the present application correspond to the technical solutions of the first aspect of the present application, and the beneficial effects achieved by each aspect and the corresponding feasible implementation methods are similar and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 A schematic diagram of a sound mode change;
[0029] Figure 2 A schematic diagram of the hardware structure of a terminal device provided in an embodiment of the present application;
[0030] Figure 3 A schematic diagram of a software architecture of a terminal device provided in an embodiment of the present application;
[0031] Figure 4 A schematic diagram of module interaction of a sound playing method provided in an embodiment of the present application;
[0032] Figure 5 This is a schematic diagram of an interface for volume settings;
[0033] Figure 6 A schematic flow chart of a sound playing method provided in an embodiment of the present application;
[0034] Figure 7 A schematic diagram of the structure of a chip provided in an embodiment of the present application. DETAILED DESCRIPTION
[0035] In order to clearly describe the technical solutions of the embodiments of the present application, some terms and technologies involved in the embodiments of the present application are briefly introduced below:
[0036] 1. Sound effect processing method
[0037] 1) DTS sound effects
[0038] DTS sound is a high-quality digital audio encoding technology that can compress multi-channel audio data into a digital stream to provide audio performance that exceeds CD standards in movies, games and other media, thereby providing users with a better sound experience. DTS sound encoding technology can provide a higher dynamic range, a higher compression ratio, more channel conversions, etc., thereby providing users with a better sound experience.
[0039] 2) Dolby Audio
[0040] Dolby sound effect refers to Dolby directional logic surround sound, which can synthesize four-channel stereo into two channels through specific encoding means during recording, that is, the original four signals of left channel (L), right channel (R), center channel (C), and surround channel (S) are encoded and synthesized into LT, RT composite two-channel signals. During playback, the encoded two-channel composite signals LT and RT are restored through the decoder to four independent signals of left, right, center, and surround that do not interfere with each other. After amplification, they are input into the left speaker, right speaker, center speaker and surround speakers respectively.
[0041] 3) Histen sound effects
[0042] Histen sound effects use the latest and most advanced audio processing algorithms, combined with psychoacoustic models and auditory perception models, to maximize the performance of the audio systems of various mobile devices, restore the texture and clarity of high-quality sound, and expand the sense of space and direction of sound through three-dimensional (three dimensions) 3D sound field technology, providing users with a perfect heavenly sound quality experience.
[0043] The embodiments of the present application introduce three sound effect processing methods: DTS sound effect, Dolby sound effect and Histen sound effect, but the embodiments of the present application are not limited to these three sound effect processing methods.
[0044] 2. Cascading sound effects
[0045] Cascading audio refers to processing audio using at least two audio processing methods.
[0046] Exemplarily, the application framework layer of the terminal device includes a first sound effect processing method, and the ADSP chip in the hardware layer of the terminal device is deployed with a second sound effect processing method, and the second sound effect processing method can make up for the defects of the first sound effect processing method. When the terminal device detects audio, the audio can be processed by the first sound effect processing method in the application framework layer to obtain processed audio, and the processed audio can be processed again by the second sound effect processing method in the hardware layer to obtain reprocessed audio. The first sound effect processing method and the second sound effect processing method can be any two of the above three sound effect processing methods.
[0047] 3. Other terms
[0048] In the embodiments of the present application, words such as "first" and "second" are used to distinguish the same items or similar items with substantially the same functions and effects. For example, the first volume and the second volume are only used to distinguish different volumes, and do not limit their order. Those skilled in the art can understand that words such as "first" and "second" do not limit the quantity and execution order, and words such as "first" and "second" do not necessarily limit them to be different.
[0049] It should be noted that in the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0050] In the embodiments of the present application, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can represent: a, b, c, ab, a--c, bc, or abc, where a, b, c can be single or multiple.
[0051] It should be noted that the "at..." in the embodiment of the present application can be the instant when a certain situation occurs, or can be a period of time before or after a certain situation occurs, and the embodiment of the present application does not specifically limit this. In addition, the display interface provided in the embodiment of the present application is only an example, and the display interface can also include more or less content.
[0052] The terminal device can play sound through a speaker. Currently, when the terminal device plays music through a speaker, if the user changes the sound mode of the terminal device, for example, the user changes the sound mode from ringing to vibrating or silent, or the user changes the sound mode from vibrating or silent to ringing, the volume of the music will be different, affecting the user experience.
[0053] For example, Figure 1 A schematic diagram of a sound mode change is shown. Figure 1 As shown, the terminal device may be a mobile phone. When the user performs a pull-down operation from the upper end of the mobile phone, the mobile phone may display a control center interface, which includes a card 110, and the card 110 is used to display the music playing status. The control center interface also includes a control 120, which is used to change the sound mode of the terminal device, and the control 120 may include an icon of the current sound mode. The sound mode may be ringing, vibrating, or silent. The user may click the control 120 to change the sound mode of the terminal device.
[0054] In one example, if the current sound mode of the mobile phone is ringing and music is playing through the speaker, the mobile phone can display Figure 1 In the a interface, such as Figure 1 As shown in the interface a of FIG. 1 , the control center interface includes a card 110 showing that music is playing, and the song being played is "Song 1", and a control 120 showing a ringing icon, indicating that the current sound mode is ringing. If the mobile phone detects that the user has changed the sound mode from ringing to vibrating, in response to the user's operation of changing the sound mode from ringing to vibrating, the mobile phone can display Figure 1 In the b interface, such as Figure 1 As shown in interface b in FIG. 1 , the control 120 displays a vibration icon, indicating that the current sound mode is vibration. When a user changes the sound mode from ringing to vibration, the volume of the music may be different, for example, the volume of the music may be significantly reduced, which may affect the user experience.
[0055] In another example, if the current sound mode of the mobile phone is vibrate and music is playing through the speaker, the mobile phone can display Figure 1 In the b interface, such as Figure 1As shown in interface b in the figure, the control center interface includes a card 110 showing that music is playing, and the song being played is "Song 1". The control 120 shows a vibration icon, indicating that the current sound mode is vibration. If the mobile phone detects that the user changes the sound mode from vibration to silent to ringing (the user first changes the sound mode from vibration to silent, and then changes the sound mode from silent to ringing), in response to the user changing the sound mode from vibration to silent to ringing, the mobile phone can display Figure 1 In the a interface, such as Figure 1 As shown in the interface a in FIG, the control 120 displays a ringing icon, indicating that the current sound mode is ringing. When the user changes the sound mode from vibration to silent to ringing, the volume of the music will be different, for example, the volume of the music will be significantly increased, affecting the user experience.
[0056] In another example, if the current sound mode of the mobile phone is ringing and music is playing through the speaker, the mobile phone can display Figure 1 In the a interface, such as Figure 1 As shown in the interface a of FIG, the control center interface includes a card 110 showing that music is playing, and the song being played is "Song 1", and a control 120 showing a ringing icon, indicating that the current sound mode is ringing. If the mobile phone detects that the user has changed the sound mode from ringing to silent via vibration (the user first changes the sound mode from ringing to vibration, and then changes the sound mode from vibration to silent), in response to the user's operation of changing the sound mode from ringing to silent via vibration, the mobile phone can display Figure 1 In the c interface, such as Figure 1 As shown in the c interface, the control 120 displays a mute icon, indicating that the current sound mode is mute. When the user changes the sound mode from ringing to silent via vibration, the volume of the music will be different, for example, the volume of the music will be significantly reduced, affecting the user experience.
[0057] In another example, if the current sound mode of the mobile phone is silent and music is playing through the speaker, the mobile phone can display Figure 1 In the c interface, such as Figure 1 As shown in the c interface in the control center interface, the card 110 includes a display showing that music is playing, and the song being played is "Song 1", and the control 120 displays a mute icon, indicating that the current sound mode is mute. If the mobile phone detects that the user has changed the sound mode from mute to ringing, in response to the user's operation of changing the sound mode from mute to ringing, the mobile phone can display Figure 1 In the a interface, such as Figure 1 As shown in the interface a in FIG. 1 , the control 120 displays a ringing icon, indicating that the current sound mode is ringing. When the user changes the sound mode from silent to ringing, the volume of the music may be different, for example, the volume of the music may be significantly increased, which may affect the user experience.
[0058] When the terminal device plays music through the speaker, the user changes the sound mode of the terminal device, which causes a difference in the volume of the music. This is because the change in the sound mode will cause a change in the volume, and the terminal device is deployed with cascaded sound effects. For example, the application framework of the terminal device is deployed with a sound effect processing method, and the ADSP chip of the hardware layer of the terminal device is deployed with another sound effect processing method. The sound effect processing method deployed by the ADSP chip of the terminal device is at the bottom layer of the software architecture of the terminal device and cannot obtain much information, making the ADSP chip unable to distinguish between the volume of the music and the volume of the sound mode, and will mix them, causing the volume of the music to increase or decrease, thereby making the volume of the music different, affecting the user experience.
[0059] In view of this, an embodiment of the present application provides a sound playback method and related devices. In the case of music playback, when the volume of the sound mode changes, the changed volume is intercepted at the application framework layer, so that the changed volume cannot be transmitted to the hardware layer of the terminal device. The ADSP chip will not mix the changed volume and the volume of the music, and will not cause the volume of the music to increase or decrease, which is beneficial to reduce the impact of the volume change of the sound mode on the volume of the music, and is beneficial to improve the stability of the volume.
[0060] In order to better understand the method provided in the embodiment of the present application, the hardware structure of the terminal device is first described.
[0061] For example, Figure 2 A schematic diagram of the hardware structure of a terminal device provided in an embodiment of the present application. Figure 2As shown, the terminal device includes: 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. 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.
[0062] It is to be understood that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the terminal device. In other embodiments of the present application, the terminal device may include more or fewer components than shown in the figure, or combine certain components, or split certain 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.
[0063] The processor 110 may include one or more processing units, for example: the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), a controller, a video codec, a digital signal processor (digital signal processor, DSP), a baseband processor, and / or a neural-network processing unit (neural-network processing unit, NPU), etc. Among them, different processing units can be independent devices or integrated in one or more processors. In an embodiment of the present application, the processor 110 can execute the sound playback method provided in an embodiment of the present application.
[0064] The terminal device implements the display function through the GPU, the display screen 194, and the application processor. The GPU is a microprocessor for image processing, which is connected to 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, which execute program instructions to generate or change display information. In the embodiment of the present application, the terminal device can implement the display of the above through the GPU, the display screen 194, and the application processor. Figure 1 Functions of the interface shown.
[0065] 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 terminal device may include 1 or N display screens 194, where N is a positive integer greater than 1.
[0066] The internal memory 121 can be used to store computer executable program codes, and the executable program codes include instructions. The internal memory 121 can include a program storage area and a data storage area. In the embodiment of the present application, the internal memory 121 can store codes for implementing the sound playing method provided in the embodiment of the present application.
[0067] The terminal device can implement audio functions through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone interface 170D, and the application processor, etc. In the embodiment of the present application, the terminal device can implement functions such as music playback through the speaker 170A.
[0068] In addition, on top of the above components, the device also runs an operating system, such as an iOS operating system, an Android operating system, or a Windows operating system, etc. Applications can be installed and run on the operating system.
[0069] The software system of the terminal device can adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture, etc., which will not be described in detail here. The embodiment of the present application takes the Android system of the layered architecture as an example to exemplify the software architecture of the terminal device.
[0070] Figure 3 Schematic diagram of a software architecture of a terminal device provided in an embodiment of the present application. The layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system can be divided into five layers, namely, application layer, application framework layer, hardware abstraction layer (HAL), kernel layer, and hardware layer from top to bottom.
[0071] The application layer can include a series of application packages. The application layer runs applications by calling the application programming interface (API) provided by the application framework layer. Figure 3 As shown, the application package may include applications such as music, video, games, calendar, settings, and playback control. Among them, the playback control application is used to support users to change the sound mode of the terminal device, that is, it can support users to change the sound mode of the terminal device from ringing to vibration or silent, and can also support users to change the sound mode from vibration or silent to ringing. The settings application is used to support users to change the sound mode of the terminal device, and is also used to support users to change the volume of other applications such as alarm clocks, phone calls, messages, etc.
[0072] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined functions.
[0073] like Figure 3As shown, the application framework layer may include a java layer and a native layer. The java layer is used to provide a programming framework for the java language, and the native layer is used to provide a programming framework for the C language or C++. Among them, the java layer may include an audio acquisition module 1 (AudioTrack_1), an audio system module 1 (AudioSystem_1), an audio service module (AudioService) and an audio management module (AudioManager). The native layer includes an audio acquisition module 2 (AudioTrack_2), an audio system module 2 (AudioSystem_2), an audio delivery module (Audioflinger) and an audio policy management module (Audiopolicymanager). The audio delivery module includes DTS sound effects, and the audio policy management module includes a volume delivery interception module. It should be noted that the audio delivery module including DTS sound effects is only an example, and the embodiment of the present application does not limit the specific sound effect processing method included in the audio delivery module.
[0074] The audio acquisition module 1 is used to acquire the audio of at least one application in music, video or game, and pass it to the audio acquisition module 2. The audio acquisition module 2 is used to obtain the audio from the audio acquisition module 1 and pass it to the audio delivery module. The audio delivery module is used to obtain the audio from the audio acquisition module 2, and can process the audio through the DTS sound effect to obtain the processed audio, and is also used to pass the status of the audio playback to the audio policy management module.
[0075] The audio management module is used to obtain the adjusted volume of other applications or the changed volume of the sound mode when the user adjusts the volume of other applications or the user changes the sound mode. The adjusted volume of other applications or the changed volume of the sound mode can be referred to as the changed volume. The audio management module is also used to pass the changed volume to the audio service module. The audio service module is used to obtain the changed volume from the audio management module and pass the changed volume to the audio system module 1. The audio system module 1 is used to obtain the changed volume from the audio service module and pass the changed volume to the audio system module 2. The audio system module 2 is used to obtain the changed volume from the audio system module 1 and pass the changed volume to the audio policy management module. The audio policy management module is used to obtain the state of playing audio from the audio delivery module, and when the speaker plays audio, the changed volume is intercepted by the volume downlink interception module, that is, the changed volume is not passed to the audio delivery module; when the speaker plays the sound of other applications or the ringtone (the ringtone represents the sound controlled by the sound mode), the changed volume can be passed to the audio delivery module. The audio delivery module is also used to obtain the changed volume from the audio policy management module when the speaker plays the sound of other applications or ringtones. It is understandable that the change of the sound mode can affect the volume of the ringtone, so when the speaker plays the ringtone, the audio policy management module can transmit the changed volume to the audio delivery module.
[0076] The purpose of the HAL layer is to abstract the hardware and provide a unified interface for querying hardware devices for upper-layer applications, or to provide data storage services for upper-layer applications. Figure 3 As shown, the HAL layer may include an audio output module (audio_stream_out) and a sensor hardware abstraction (sensor hidl). The audio output module is used to obtain the audio processed by the DTS sound effect from the audio delivery module, and is also used to obtain the changed volume from the audio delivery module when the speaker plays the sound of other applications or ringtones.
[0077] The kernel layer is the layer between hardware and software. Figure 3 As shown, the kernel layer may include one or more of the following: sensor driver and display driver. There is also a module in the kernel layer, which is used to obtain the audio processed by DTS sound effects from the audio output module, and is also used to obtain the changed volume from the audio output module when the speaker plays the sound of other applications or ringtones. Figure 3 Not shown in the figure, the embodiment of the present application does not limit this module.
[0078] like Figure 3As shown, the hardware layer may include: ADSP module, camera, display screen, etc. The ADSP module can be deployed in the ADSP chip, and the ADSP module includes XSITEN sound effect. XSITEN sound effect is the name of a sound effect processing method, which can represent Histen sound effect, but the embodiments of the present application are not limited to this. The ADSP module is used to obtain audio processed by DTS sound effect from the kernel layer, and is also used to obtain the changed volume from the kernel layer when the speaker plays sounds or ringtones of other applications. The ADSP module is also used to re-process the audio processed by DTS sound effect through XSITEN sound effect to obtain the re-processed sound effect, and play the re-processed sound effect through the speaker. The speaker can be the above Figure 2 The speaker 170A is shown in the figure, but this embodiment of the present application is not limited to this.
[0079] Combine the following Figure 4 For the above Figure 3 The specific interactions of the modules in are described.
[0080] Figure 4 A schematic diagram of module interaction of a sound playing method provided in an embodiment of the present application. The method can be applied to the above Figure 1 The scenario shown in FIG. 1 is not limited to this in the present embodiment of the application. Figure 4 As shown, the method may include the following steps:
[0081] S401. The audio acquisition module 1 of the application framework layer detects the audio of music, video or game.
[0082] When a user plays sound through an application such as music, video or game, the audio acquisition module 1 can detect the audio of the music, video or game. The stream type of the audio of the music, video or game can be media audio (AUDIO_STREAM_MUSIC). The audio acquisition module 1 can also transmit stream type 1 (AUDIO_STREAM_MUSIC) during the audio transmission process.
[0083] Exemplarily, the audio acquisition module 1 can detect the audio and stream type 1 of music, video or game through the start() interface.
[0084] S402 , the audio acquisition module 1 passes the audio and stream type 1 to the audio acquisition module 2 of the application framework layer. Correspondingly, the audio acquisition module 2 obtains the audio from the audio and stream type 1 acquisition module 1 .
[0085] Exemplarily, the audio acquisition module 2 can obtain the audio and stream type 1 of music, video or game from the audio acquisition module 1 through the start() interface.
[0086] S403 , the acquisition module 2 passes the audio and stream type 1 to the audio delivery module of the application framework layer. Correspondingly, the audio delivery module obtains the audio and stream type 1 from the audio acquisition module 2 .
[0087] Exemplarily, the audio delivery module can obtain the audio and stream type 1 of music, video or game from the audio acquisition module 2 through the openoutput() interface.
[0088] S404: The audio delivery module processes the audio through the DTS sound effect to obtain the processed audio.
[0089] The audio delivery module can process the audio through the deployed audio processing method such as DTS sound effect to obtain the processed audio.
[0090] S405. The audio delivery module transmits the processed audio to the audio output module of the HAL layer. Correspondingly, the audio output module obtains the processed audio from the audio delivery module.
[0091] Exemplarily, the audio output module may obtain the processed audio from the audio delivery module through the adev_set_parameters() interface.
[0092] S406. The audio delivery module transmits the audio being played message and stream type 1 to the audio policy management module of the application framework layer. Correspondingly, the audio policy management module obtains the audio being played message and stream type 1 from the audio delivery module.
[0093] S407. The audio output module transmits the processed audio to the ADSP module of the hardware layer. Correspondingly, the ADSP module obtains the processed audio from the audio output module.
[0094] S408, the ADSP module re-processes the processed audio stream through the XSITEN sound effect to obtain re-processed audio.
[0095] S409, the ADSP module plays the reprocessed audio through the speaker.
[0096] S410: The audio management module of the application framework layer detects that the sound mode of the terminal device or the volume setting of other applications has changed.
[0097] During the process of the speaker playing audio, the user can set the sound mode of the terminal device or other applications such as the volume of the alarm clock or call. Figure 1 The interface shown sets the sound mode of the terminal device. In another example, the user can set the volume of other applications in the sound and vibration interface in the settings.
[0098] For example, Figure 5 A schematic diagram of a volume setting interface is shown. Figure 5 As shown, the terminal device is a mobile phone. In response to the user selecting the sound and vibration option in the settings, a sound and vibration interface can be displayed, such as Figure 5 The interface shown in . Figure 5 As shown in the interface in , the sound and vibration interface includes controls 510, 520, 530, 540, and 550. Control 510 is used to set the volume of incoming calls, messages, and notifications, control 520 is used to set the volume of the alarm, control 530 is used to set the volume of music, videos, and games, control 540 is used to set the volume of calls, and control 550 is used to set the volume of smart voice. The user can set the volume of the alarm through control 520, and the mobile phone can detect the user's operation of adjusting the volume of the alarm, and in response to the user's operation of adjusting the volume of the alarm, detect that the volume of the alarm has changed.
[0099] In response to the user changing the sound mode of the terminal device or setting the volume of other applications, the audio management module can detect the change in the volume of the sound mode or the volume of other applications, and obtain the changed volume. In an example, the sound controlled by the sound mode can be called a ringtone, and the volume of the sound mode can also be called the volume of the ringtone. The change of the sound mode can change the volume of the ringtone. If the sound mode is silent or vibrate, the volume of the ringtone is 0. If the sound mode is ringing, the volume of the ringtone is the volume set by the user, which is greater than 0.
[0100] Exemplarily, the audio management module may detect changes in the sound mode of the terminal device or the volume of other applications through the setStreamVolume() interface, and obtain the changed volume.
[0101] The change in sound mode of the terminal device causes the volume to change. The stream type can be represented by the symbol AUDIO_STREAM_RING, and AUDIO_STREAM_RING indicates that the stream type is a ringtone. If the other application is an alarm clock, the volume of the alarm clock is set, and the stream type can be represented by the symbol AUDIO_STREAM_ALARM, and AUDIO_STREAM_ALARM indicates that the stream type is an alarm clock. In the process of transmitting the changed volume, the audio management module can also transmit stream type 2 (AUDIO_STREAM_RING or AUDIO_STREAM_ALARM). In the embodiment of the present application, other applications are illustrated by taking an alarm clock as an example.
[0102] S411. The audio management module transmits the changed volume and stream type 2 to the audio service module. Correspondingly, the audio service module obtains the changed volume and stream type 2 from the audio management module.
[0103] Exemplarily, the audio service module can obtain the changed volume and stream type 2 from the audio management module through the setStreamVolume() interface.
[0104] S412: The audio service module transmits the changed volume and stream type 2 to the audio system module 1. Correspondingly, the audio system module 1 obtains the changed volume and stream type 2 from the audio service module.
[0105] Exemplarily, the audio system module 1 may obtain the changed volume and stream type 2 from the audio service module through the setStreamVolumeindex() interface.
[0106] S413 . Audio system module 1 transmits the changed volume and stream type 2 to audio system module 2 . Correspondingly, audio system module 2 obtains the changed volume and stream type 2 from audio system module 1 .
[0107] Exemplarily, the audio system module 2 may obtain the changed volume and stream type 2 from the audio system module 1 through the setStreamVolumeindex() interface.
[0108] S414 . The audio system module 2 transmits the changed volume and stream type 2 to the audio policy management module. Correspondingly, the audio policy management module obtains the changed volume and stream type 2 from the audio system module 2 .
[0109] Exemplarily, the audio system module 2 may first obtain the service of the audio policy management module through the get_audiopplicy_service() interface, and then transmit the changed volume and stream type to the audio policy management module through the setStreamVolumeindex() interface.
[0110] S415: The audio policy management module determines whether the stream type of the currently played audio is a media sound, an alarm or a ringtone, and determines whether the playing mode is external playback, where external playback refers to playing through a speaker.
[0111] The speaker can only play one of the following at the same time: media sound, alarm, or ringtone. For example, if the speaker is playing media sound and receives an alarm, it stops playing the media sound and plays the alarm. Since the speaker can only play one of the following at the same time: media sound, alarm, or ringtone, the stream type of the currently playing audio is media sound, alarm, or ringtone at the same time.
[0112] In the above S406, the audio policy management module obtains the message that the audio is being played from the audio delivery module, and the stream type 1 is AUDIO_STREAM_MUSIC, then the stream type of the currently played audio, that is, stream type 1, is media audio.
[0113] If the stream type of the currently played audio is one of media sound, alarm or ringtone, and the playback mode is external, it can be said that the speaker is playing media sound, alarm or ringtone, and the audio policy management module can determine whether the stream type 2 corresponding to the changed volume is an alarm or ringtone, and determine whether the alarm or ringtone is in an unplayed state, that is, execute subsequent S416. If the stream type of the currently played audio is not one of media sound, alarm or ringtone, or the playback mode is not external, it can be said that the speaker has neither media sound nor alarm or ringtone, or the playback mode of media sound, alarm or ringtone is not external, then the method can be terminated, and the embodiments of the present application do not limit the subsequent specific implementation methods.
[0114] S416: If the stream type of the currently played audio is one of media audio, alarm or ringtone, and the play mode is external, the audio policy management module determines whether stream type 2 is an alarm or ringtone, and determines whether the alarm or ringtone is not being played.
[0115] If the stream type of the currently playing audio is media audio, the alarm or ringtone is not playing; if the stream type of the currently playing audio is alarm, the alarm is playing; if the stream type of the currently playing audio is ringtone, the ringtone is playing.
[0116] In the above S414, the audio policy management module obtains from the audio system module 2 that the stream type 2 is AUDIO_STREAM_RING or AUDIO_STREAM_ALARM, and the stream type 2 is an alarm or a ringtone.
[0117] When the stream type of the currently playing audio is one of media sound, alarm or ringtone, and the playback mode is external, it is determined whether the alarm or ringtone is in an unplayed state. This is to avoid intercepting the changed volume when the stream type of the currently playing audio is an alarm or ringtone, so that the volume of the played alarm or ringtone is the changed volume.
[0118] If the stream type of the currently played audio is media sound, and stream type 2 is an alarm or ringtone, it can be explained that the alarm or ringtone is in an unplayed state, and the volume of the alarm or ringtone changes, and the audio policy management module can intercept the changed volume, so that the audio policy management module does not transmit the changed volume, that is, execute S417, to reduce the impact of the changed volume on the volume of the media sound. If the stream type of the currently played audio is an alarm, and stream type 2 is an alarm, it can be explained that the alarm is in a playing state, and the volume of the alarm changes, and the audio policy management module can pass the changed volume to the audio delivery module to play the alarm through the changed volume. If the stream type of the currently played audio is a ringtone, and stream type 2 is a ringtone, it can be explained that the ringtone is in a playing state, and the volume of the ringtone changes, and the audio policy management module can pass the changed volume to the audio delivery module to play the ringtone through the changed volume. If the stream type of the currently played audio is a media sound, and stream type 2 is not an alarm or ringtone, the method can be terminated, and the embodiment of the present application does not limit the subsequent specific implementation.
[0119] S417: If the stream type 2 is an alarm or a ringtone, and the alarm or the ringtone is not being played, the audio policy management module intercepts the changed volume.
[0120] The audio policy management module can intercept the changed volume through the volume transmission interception module, so that the audio policy management module does not transmit the changed volume to the audio delivery module. The audio policy management module does not transmit the changed volume to the audio delivery module, which is conducive to reducing the impact on the above S404 to S409, and further reducing the impact on the audio played by the speaker.
[0121] S418: If the alarm or ringtone is in the playing state, the audio policy management module transmits the changed volume to the audio delivery module, and correspondingly, the audio delivery module obtains the changed volume from the audio policy management module.
[0122] In one example, when the terminal device does not execute the above S401 to S409, if the alarm or ringtone is in the playing state, and the user changes the volume of the alarm or ringtone, the audio policy management module can pass the changed volume to the audio delivery module. In another example, when the terminal device executes the above S401 to S409, if the alarm or ringtone is in the playing state, it can be said that the media sound stops playing and the alarm or ringtone is playing. Before the alarm or ringtone plays, the terminal device can detect the audio of the alarm or ringtone, and the terminal device can send down the audio of the alarm or ringtone and the intercepted changed volume together, and play the alarm or ringtone at the changed volume.
[0123] Exemplarily, if the audio management module of the application framework layer detects the audio of a ringtone or an alarm, the audio management module may pass the audio of the ringtone or the alarm to the audio service module, the audio service module may pass the audio of the ringtone or the alarm to the audio system module 1, the audio system module 1 may pass the audio of the ringtone or the alarm to the audio system module 2, the audio system module 2 may pass the audio of the ringtone or the alarm to the audio policy management module, the audio policy management module may pass the audio of the ringtone or the alarm and the changed volume to the audio delivery module, the audio delivery module may pass the audio of the ringtone or the alarm and the changed volume to the audio output module, the audio output module may pass the audio of the ringtone or the alarm and the changed volume to the ADSP module, and the ADSP module may play the audio of the ringtone or the alarm at the changed volume.
[0124] It should be noted that if stream type 2 is not an alarm or a ringtone, the method can be terminated, and the embodiment of the present application does not limit the subsequent specific implementation method.
[0125] S419: The audio delivery module transmits the changed volume to the audio output module. Correspondingly, the audio output module obtains the changed volume from the audio delivery module.
[0126] S420: The audio output module transmits the changed volume to the ADSP module. Correspondingly, the ADSP module obtains the changed volume from the audio output module.
[0127] exist Figure 4 In the method shown, S401 to S409 are used to represent the process of playing the media sound, and S410 to S417 can be executed during the process of the speaker playing the media sound, or can be executed outside the process of the speaker playing the media sound, which is not limited in the embodiment of the present application.
[0128] exist Figure 4 In the method shown, in order to avoid the volume difference of media sound (audio, video or game) caused by the sound mode of the terminal device or the volume change of other applications such as the alarm clock, if the media sound is being played through the speaker and the sound mode or the volume of the alarm clock changes, the audio policy management module does not transmit the changed volume to the audio delivery module, and thus does not affect the volume of the media sound, which is conducive to reducing the probability of the volume difference of the media sound caused by the sound mode of the terminal device or the volume change of the alarm clock. If the ringtone (or alarm clock) is being played through the speaker and the volume of the ringtone (or alarm clock) changes, the audio policy management module can transmit the changed volume to the audio delivery module, which is conducive to meeting the user's demand for adjusting the volume.
[0129] It should be noted that the module names involved in the embodiments of the present application can be defined as other names as long as the functions of each module can be achieved, and there is no specific restriction on the names of the modules.
[0130] The above describes the method provided in the embodiment of the present application from the perspective of the interaction between the various modules in the terminal device. The following describes the method provided in the embodiment of the present application in detail from the perspective of the terminal device.
[0131] For example, Figure 6 A schematic flow chart of a sound playing method is shown. The method is applied to a terminal device, and the hardware structure diagram of the terminal device can be as described above. Figure 2 As shown, the software architecture diagram of the terminal device can be as described above Figure 3 As shown, but the embodiments of the present application are not limited thereto. Figure 6 As shown, the method may include the following steps:
[0132] S601. At a first moment, play the sound of a first application of a terminal device; the volume of the first application is a first volume, the volume managed by a second application of the terminal device is a second volume, and the hardware abstraction layer of the terminal device has an identifier of the second volume.
[0133] The first application can be as described above Figure 3 The music, video or game application shown in the figure, but the embodiment of the present application is not limited to this. The volume of the first application is the first volume, which can indicate that the terminal device plays the sound of the first application at the first volume. The second application can be as described above Figure 3 The settings and playback controls shown in the figure are not limited to this. The volume managed by the second application can be the volume of the sound mode or the volume of other applications such as an alarm clock. The second volume identifier is used to indicate the second volume. The hardware abstraction layer of the terminal device has the second volume identifier, which can indicate that the second volume is passed to the hardware abstraction layer.
[0134] The terminal device plays the sound of the first application, and the specific implementation method can be as described above Figure 4 S401 to S409 in the above will not be repeated here.
[0135] S602, at a second moment, the sound in the first application continues to play, and an operation is received by the user to set the volume managed by the second application to a third volume, the third volume is different from the second volume, and the second moment is after the first moment.
[0136] If the volume managed by the second application is the volume of the sound mode of the terminal device, the user can Figure 1 The interface shown in FIG. 1 sets the volume managed by the second application. The user can also Figure 5The interface shown in the figure sets the volume managed by the second application, which is not limited in the present embodiment. If the volume managed by the second application is the volume of other applications such as an alarm clock, the user can adjust the volume based on the above Figure 5 The interface shown in sets the volume managed by the second application.
[0137] The third volume is different from the second volume, which means that the third volume may be greater than or less than the second volume, and this is not limited in the embodiment of the present application.
[0138] At the second moment, the sound in the first application continues to play, and the user's operation of setting the volume managed by the second application to the third volume is received. This can indicate that the terminal device receives the user's operation of changing the volume managed by the second application while playing the sound in the first application.
[0139] S603: At a third moment, the sound in the first application continues to play, the volume of the first application is the first volume, the hardware abstraction layer has no identifier for the third volume, and the third moment is after the second moment.
[0140] At a third moment after the second moment, the terminal device still plays the sound in the first application at the first volume, which indicates that the user's operation of setting the volume managed by the second application to the third volume does not affect the volume of the sound in the first application. At this time, the hardware abstraction layer does not have an identifier for the third volume, which indicates that the third volume is not passed to the hardware abstraction layer.
[0141] S604, at a fourth moment, the sound managed by the second application is played, the sound in the first application stops playing, the volume managed by the second application is the third volume, the hardware abstraction layer has an identifier of the third volume, and the fourth moment is after the third moment.
[0142] Since the user sets the sound managed by the second application from the second volume to the third volume at the second moment, when the terminal device plays the sound managed by the second application at the fourth moment after the second moment, the sound managed by the second application can be played at the third volume. The hardware abstraction layer has an identifier of the third volume, which indicates that the third volume is transmitted to the hardware abstraction layer.
[0143] At the second moment, when the sound of the first application is playing, the user receives an operation to set the volume managed by the second application from the second volume to the third volume. At the third moment, the sound of the first application continues to play, and the hardware abstraction layer does not have the third volume mark, which can indicate that the third volume has not been passed to the hardware abstraction layer. The third volume is intercepted before the hardware abstraction layer, so that the third volume cannot affect the volume of the first application, which is conducive to improving the volume stability. In addition, at the fourth moment, the terminal device plays the sound managed by the second application, and the hardware abstraction layer has the third volume mark, which can indicate that when the audio managed by the second application needs to be played, the third volume is not intercepted before the hardware abstraction layer, which meets the user's need to set the volume, which is conducive to improving the user experience.
[0144] Optionally, when receiving an operation by the user to set the volume managed by the second application to a third volume, the method further includes: the second application indicates an identifier of the third volume to an application framework layer of the terminal device; and the application framework layer intercepts the identifier of the third volume so that the identifier of the third volume is not passed to the hardware abstraction layer.
[0145] When the second application receives an operation by the user to set the volume managed by the second application to the third volume, the second application can indicate the identifier of the third volume to the application framework layer of the terminal device; the application framework layer intercepts the identifier of the third volume so that the identifier of the third volume is not passed to the hardware abstraction layer, so that the third volume cannot affect the volume of the first application, which is conducive to improving the stability of the volume.
[0146] Optionally, the method also includes: the application framework layer determines whether the sound of the first application is being played through the speaker of the terminal device; the application framework layer intercepts the identification of the third volume, including: if the sound of the first application is being played through the speaker, the application framework layer intercepts the identification of the third volume.
[0147] Before the application framework layer intercepts the third volume identifier, it can determine whether the sound of the first application is being played through the speaker of the terminal device. The application framework layer can intercept the third volume identifier when the sound of the first application is being played through the speaker. In this way, when the speaker is playing sound, intercepting the third volume identifier is conducive to improving the stability of the speaker playing sound.
[0148] Optionally, the application framework layer intercepts the identifier of the third volume, including: the application framework layer calls the setStreamVolume() interface to intercept the identifier of the third volume. In this way, the setStreamVolume() interface is used to intercept the identifier of the third volume, and the existing interface is improved to intercept the identifier of the third volume, with minimal changes to the existing method.
[0149] Optionally, before playing the sound managed by the second application, the method also includes: the second application indicates the audio managed by the second application to the application framework layer; the application framework layer transmits the identifier of the third volume and the audio managed by the second application to the hardware abstraction layer; playing the sound managed by the second application includes: playing the audio managed by the second application at the third volume through the speaker of the terminal device.
[0150] The second application detects an instruction to play the audio managed by the second application, and can indicate the audio managed by the second application to the application framework layer. The application framework layer can pass the third volume identifier and the audio managed by the second application to the hardware abstraction layer for transmission to the hardware layer through the hardware abstraction layer for playback, so that the audio managed by the second application is played at the third volume through the speaker of the terminal device.
[0151] In this way, the identifier of the third volume is transmitted from the application framework layer to the hardware abstraction layer along with the audio managed by the second application, which is conducive to playing the audio managed by the second application at the third volume and meeting the user's demand for adjusting the volume.
[0152] Optionally, receiving an operation by the user to set the volume managed by the second application to a third volume includes: in response to a pull-down operation by the user, displaying a first interface, the first interface including a first control, the first control being used to change the sound mode of the terminal device; wherein, before the second moment, the sound mode of the terminal device is the first sound mode, and the volume of the first sound mode is the second volume; receiving a first operation by the user on the first control, the first operation being used to set the sound mode of the terminal device to the second sound mode, and the volume of the second sound mode to the third volume.
[0153] The first interface can be as described above Figure 1 The a interface shown in Figure 1 The b interface shown in or as mentioned above Figure 1 The first control can be Figure 1 The control 120 shown in FIG. 1 can be ringing, vibrating, or silent. If the first sound mode is ringing, the second sound mode can be vibrating or silent. If the second sound mode is vibrating or silent, the second sound mode can be ringing.
[0154] In this way, the terminal device can support the user to set the volume managed by the second application to the third volume through the human-computer interaction interface, which is simple and convenient and is conducive to improving the user experience.
[0155] Optionally, receiving an operation by the user to set the volume managed by the second application to a third volume includes: in response to a second operation by the user on the setting application, displaying a second interface, the second interface including a second control, and the second control is used to adjust the volume of the alarm clock; wherein, before the second moment, the volume of the alarm clock is the second volume; receiving a third operation by the user on the second control, the third operation is used to set the volume of the alarm clock to the third volume.
[0156] The second interface can be as described above Figure 5 In the interface shown, the second control may be control 520. In this way, the terminal device may support the user to set the volume managed by the second application to the third volume through the human-computer interaction interface, which is beneficial to improving the user experience.
[0157] Optionally, playing the sound in the first application of the terminal device includes: the application framework layer of the terminal device processes the audio in the first application to obtain processed audio; the advanced digital signal processing ADSP module of the terminal device processes the processed audio to obtain re-processed audio; and playing the re-processed audio through the speaker of the terminal device.
[0158] The application framework layer of the terminal device can be deployed with a sound effect processing method such as DTS sound effect to process the audio in the first application, and the advanced digital signal processing ADSP module of the terminal device can be deployed with another sound effect processing method such as Histen sound effect to process the processed audio to obtain the reprocessed audio; and play the reprocessed audio through the speaker of the terminal device. The application framework layer of the terminal device and the advanced digital signal processing ADSP module of the terminal device both process the audio, which belongs to the cascade sound effect scenario. The present application can be applied to the cascade sound effect scenario, which is conducive to improving the stability of the volume in the cascade sound effect scenario.
[0159] The method of the embodiment of the present application has been described above, and the device for executing the above method provided by the embodiment of the present application is described below. Those skilled in the art can understand that the method and the device can be combined and referenced with each other, and the relevant device provided by the embodiment of the present application can execute the steps in the above method.
[0160] In order to achieve the above functions, the device for implementing the above display method includes hardware structures and / or software modules corresponding to the execution of each function. It should be easily appreciated by those skilled in the art that, in combination with the method steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0161] The embodiment of the present application can divide the functional modules of the device for implementing the display method according to the above method example. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one processing module. The integrated module can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation.
[0162] like Figure 7 A schematic diagram of the structure of a chip provided in an embodiment of the present application. The chip 70 includes one or more (including two) processors 701 , a communication line 702 , a communication interface 703 and a memory 704 .
[0163] In some implementations, the memory 704 stores the following elements: executable modules or data structures, or a subset thereof, or an extended set thereof.
[0164] The method described in the above embodiment of the present application can be applied to the processor 701, or implemented by the processor 701. The processor 701 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware or software instructions in the processor 701. The above processor 701 can be a general-purpose processor (for example, a microprocessor or a conventional processor), a digital signal processor (digital signal processing, DSP), an application specific integrated circuit (application specific integrated circuit, ASIC), a field-programmable gate array (field-programmable gate array, FPGA) or other programmable logic devices, discrete gates, transistor logic devices or discrete hardware components. The processor 701 can implement or execute the methods, steps and logic block diagrams related to each processing disclosed in the embodiment of the present application.
[0165] The steps of the method disclosed in the embodiment of the present application can be directly embodied as being executed by a hardware decoding processor, or being executed by a combination of hardware and software modules in the decoding processor. Among them, the software module can be located in a mature storage medium in the field such as a random access memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable read only memory (EEPROM). The storage medium is located in the memory 704, and the processor 701 reads the information in the memory 704 and completes the steps of the above method in combination with its hardware.
[0166] The processor 701 , the memory 704 , and the communication interface 703 may communicate with each other via the communication line 702 .
[0167] In the above embodiments, the instructions stored in the memory for execution by the processor may be implemented in the form of a computer program product, wherein the computer program product may be pre-written in the memory, or may be downloaded and installed in the memory in the form of software.
[0168] The present application embodiment also provides a computer program product including one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to 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 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 (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a server or data center that includes one or more available media integrated. For example, the available medium may include a magnetic medium (e.g., a floppy disk, a hard disk or a tape), an optical medium (e.g., a digital versatile disc (DVD)), or a semiconductor medium (e.g., a solid state disk (SSD)), etc.
[0169] The present application also provides a computer-readable storage medium. The methods described in the above embodiments can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. Computer-readable media may include computer storage media and communication media, and may also include any medium that can transfer a computer program from one place to another. The storage medium may be any target medium that can be accessed by a computer.
[0170] As a possible design, the computer readable medium may include a compact disc read-only memory (CD-ROM), RAM, ROM, EEPROM or other optical disc storage; the computer readable medium may include a magnetic disk storage or other magnetic disk storage device. Moreover, any connection line may also be appropriately referred to as a computer readable medium. For example, if the software is transmitted from a website, server or other remote source using a coaxial cable, fiber optic cable, twisted pair, DSL or wireless technology (such as infrared, radio and microwave), the coaxial cable, fiber optic cable, twisted pair, DSL or wireless technology such as infrared, radio and microwave are included in the definition of medium. Disk and disc as used herein include compact disc (CD), laser disc, optical disc, digital versatile disc (DVD), floppy disk and Blu-ray disc, where disks usually reproduce data magnetically, while optical discs reproduce data optically using lasers.
[0171] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processing unit of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
Claims
1. A sound playing method, characterized in that: Applied to terminal equipment, including: At a first moment, a sound in a first application of the terminal device is played, and a sound managed by the second application is in an unplayed state; the volume of the first application is a first volume, the volume managed by the second application of the terminal device is a second volume, and the hardware abstraction layer of the terminal device has an identifier of the second volume; At the second moment, the sound in the first application continues to play, and the sound managed by the second application is not played; An operation of setting the volume managed by the second application to a third volume by the user is received, and the second application indicates an identifier of the third volume to the application framework layer of the terminal device; the application framework layer intercepts the identifier of the third volume, so that the identifier of the third volume is not transmitted to the hardware abstraction layer; the third volume is different from the second volume, and the second moment is after the first moment; at a third moment, the sound in the first application continues to play, the sound managed by the second application is in an unplayed state, the volume of the first application is the first volume, the hardware abstraction layer does not have the identifier of the third volume, and the third moment is after the second moment; At a fourth moment, the sound managed by the second application is played, the sound in the first application stops playing, the volume managed by the second application is the third volume, and the fourth moment is after the third moment; wherein, before playing the sound managed by the second application, the second application indicates the audio managed by the second application to the application framework layer; the application framework layer passes the identifier of the third volume and the audio managed by the second application to the hardware abstraction layer.
2. The method according to claim 1, characterized in that The method further comprises: The application framework layer determines whether the sound of the first application is being played through the speaker of the terminal device; The application framework layer intercepts the identifier of the third volume, including: if the sound of the first application is being played through the speaker, the application framework layer intercepts the identifier of the third volume.
3. The method according to claim 1 or 2, characterized in that: The application framework layer intercepts the identifier of the third volume, including: The application framework layer calls the setStreamVolume() interface to intercept the identifier of the third volume.
4. The method according to any one of claims 1 to 3, characterized in that The playing of the sound managed by the second application includes: playing the audio managed by the second application at the third volume through a speaker of the terminal device.
5. The method according to any one of claims 1 to 4, characterized in that The receiving an operation of setting the volume managed by the second application to a third volume by the user includes: In response to the pull-down operation of the user, a first interface is displayed, the first interface includes a first control, and the first control is used to change the sound mode of the terminal device; wherein before the second moment, the sound mode of the terminal device is a first sound mode, and the volume of the first sound mode is the second volume; A first operation of the user on the first control is received, where the first operation is used to set the sound mode of the terminal device to a second sound mode, and the volume of the second sound mode is the third volume.
6. The method according to any one of claims 1 to 4, characterized in that The receiving an operation of setting the volume managed by the second application to a third volume by the user includes: In response to the second operation of the user on the setting application, displaying a second interface, the second interface including a second control, the second control being used to adjust the volume of the alarm clock; wherein before the second moment, the volume of the alarm clock is the second volume; A third operation of the user on the second control is received, where the third operation is used to set the volume of the alarm clock to the third volume.
7. The method according to any one of claims 1 to 6, characterized in that The playing of the sound in the first application of the terminal device includes: The application framework layer of the terminal device processes the audio in the first application to obtain processed audio; The advanced digital signal processing ADSP module of the terminal device processes the processed audio to obtain re-processed audio; The reprocessed audio is played through the speaker of the terminal device.
8. A terminal device, characterized in that: include: Processor and memory; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the terminal device executes the method according to any one of claims 1 to 7.
9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
10. A computer program product, characterized in that The method comprises a computer program, which, when being executed, enables a computer to execute the method according to any one of claims 1 to 7.
