Volume adjustment method, electronic device and computer readable storage medium

By determining the focus application in the electronic device and calculating the target volume, the problem that the user cannot independently adjust the volume of one of the multiple audio streams is solved, and the volume of the output audio stream of a certain application is accurately adjusted.

CN118175228BActive Publication Date: 2025-01-21HONOR DEVICE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410473723.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-04-19
Publication Date
2025-01-21
Estimated Expiration
2044-04-19

AI Technical Summary

Technical Problem

In an electronic device, when multiple audio streams of the same audio stream type are played simultaneously, the user cannot adjust the volume of one of the audio streams separately, resulting in the inability to adjust the volume according to the user's needs.

Method used

By determining the focus application, calculating the target volume based on the audio stream type, audio output device, and user's volume adjustment operation, and adjusting the volume of the focus application to the target volume, the volume of an application's output audio stream can be individually adjusted.

Benefits of technology

It is realized that when multiple audio streams of the same audio stream type are simultaneously output in an electronic device, the volume of a certain application can be individually adjusted according to the user's volume adjustment operation to meet the user's personalized volume requirements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118175228B_ABST
    Figure CN118175228B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a volume adjustment method, an electronic device and a computer-readable storage medium, the method comprising: determining a focus application in response to a volume adjustment operation input by a user; determining the original volume of the audio output by the focus application according to the audio stream type and the audio output device of the audio output by the focus application; determining the relative adjustment volume of the audio output by the focus application according to the volume adjustment operation; determining the target volume according to the original volume and the relative adjustment volume; and adjusting the volume of the audio output by the focus application to the target volume. When the electronic device simultaneously outputs multiple audio streams of the same audio stream type and receives a volume adjustment operation from the user, the target volume of the focus application can be determined according to the audio stream type, the audio output device and the focus application, and the volume of the output audio of the focus application can be adjusted based on the determined target volume, thereby achieving the individual adjustment of the volume of the audio stream output by a certain application.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of terminal technology, and in particular to a volume adjustment method, an electronic device, and a computer-readable storage medium. Background Art

[0002] Electronic devices can play audio from different applications based on audio streams. Specifically, when an application outputs an audio stream, the audio system of the electronic device can output the decoded audio stream to the audio system engine (AudioFlinger) through the audio track (Audio Track) corresponding to the application. AudioFlinger can load the original volume corresponding to the audio stream type according to the audio stream type of the audio stream, and the possible audio output devices such as the speaker and earpiece of the electronic device can play the audio of the application based on the original volume loaded by AudioFlinger.

[0003] When the electronic device plays audio, the user can adjust the playing volume of the electronic device. Specifically, the playing volume of the electronic device is adjusted mainly based on the audio stream type.

[0004] When an electronic device simultaneously plays multiple audio streams of the same audio stream type, the user often has no way to adjust the volume of one of the audio streams individually, that is, the volumes of multiple audio streams of the same audio stream type can only be adjusted uniformly, and cannot be adjusted to different volumes according to user needs. Summary of the invention

[0005] The embodiments of the present application provide a volume adjustment method, an electronic device, and a computer-readable storage medium, which can individually adjust the volume of an audio stream output by a certain application.

[0006] In a first aspect, a volume adjustment method is provided, the method comprising: determining a focus application in response to a volume adjustment operation input by a user; determining an original volume of audio output by the focus application according to an audio stream type and an audio output device of the audio output by the focus application; determining a relative adjustment volume of the audio output by the focus application according to the volume adjustment operation; determining a target volume according to the original volume and the relative adjustment volume; and adjusting the volume of the audio output by the focus application to the target volume.

[0007] Here, the user can set the focus application according to the usage habits. For example, the application running in the foreground can be set as the focus application, and in the case of running multiple applications in split screen, the application in the focus window can be set as the focus application.

[0008] Here, the volume adjustment operation may be that the user presses a mechanical volume button, or that the user slides a volume progress bar.

[0009] The user can place the application whose volume needs to be adjusted in the running scene of the focus application, and then adjust the playback volume of the focus application by inputting the volume adjustment operation without affecting the playback volume of other applications, thereby achieving the volume adjustment of the output audio stream of a certain application separately.

[0010] In this way, when the electronic device simultaneously outputs multiple audio streams of the same audio stream type and receives a volume adjustment operation from the user, it can determine the target volume of the focus application based on the audio stream type, the audio output device and the focus application, and adjust the volume of the output audio of the focus application based on the determined target volume, thereby achieving the individual adjustment of the volume of the audio stream output by a certain application.

[0011] In a possible implementation, determining the target volume based on the original volume and the relative adjusted volume includes: obtaining an application identifier of the focus application; constructing a key-value pair of the relative adjusted volume of the focus application using the application identifier as a key and the relative adjusted volume as a value; and calculating the original volume based on the key-value pair of the relative adjusted volume to obtain the target volume.

[0012] Here, the application identifier of the focus application may be an application package name.

[0013] The original volume is determined by the audio stream type and audio output device of the audio output by the focus application. According to the volume adjustment operation input by the user, a key-value pair is added with the sports health package name as the key and the relative adjustment volume (that is, the volume level that needs to be adjusted corresponding to the volume adjustment operation) as the value. The key-value pair is created according to the situation that the current application is running in the foreground or in the focus window, and the electronic device receives the mechanical volume button pressed by the user to adjust the volume, or adjusts the volume by sliding the volume progress dial. The key-value pair corresponds to the focus application and the volume adjustment operation input by the user. Assume that after the electronic device is turned on, the volume level of the original volume corresponding to the media stream and the speaker is 8. At this time, when the focus application is in the foreground, the user presses the volume increase area of ​​the mechanical volume button once, the electronic device will store 1 in the value of the key-value pair with the focus application package name as key, that is, the value of the key-value pair with the focus application package name as key is 1, and the volume level of the output audio of the focus application in the current scene is adjusted to 9, that is, the volume level of the original volume of 8 plus the value; if at this time, when the user presses the volume decrease area of ​​the mechanical volume button twice in succession, the relative adjustment volume becomes 1-1-1=-1, that is, the value of the key-value pair with the focus application package name as key becomes -1, and the volume level of the output audio of the focus application in the current scene is adjusted to 7.

[0014] In this way, the volume of the output audio of the focus application can be adjusted individually through the key-value pair method, which can simplify the implementation process.

[0015] In a possible implementation, after determining the focus application in response to the volume adjustment operation input by the user, the method further includes:

[0016] If the focus application is not an application in the first set and / or the focus application is an application in the second set, determining the target volume of the audio output by all audio output applications according to the audio stream type, the audio output device, and the volume adjustment operation of the audio output by the electronic device; wherein the first set is a set of applications that support independent volume adjustment, and the second set is a set of applications that do not support independent volume adjustment;

[0017] Adjust the volume of the audio output from all audio output applications to the target volume.

[0018] Here, the user can add a set of applications that can support independent volume adjustment (i.e., a white list, hereinafter referred to as the first set) and a set of applications that do not support independent volume adjustment (i.e., a black list, hereinafter referred to as the second set) in the application management option in the system setting application. The applications in the first set can achieve independent volume adjustment through the volume adjustment method provided in the embodiment of the present application, while the applications in the second set still use the original volume adjustment method to achieve volume adjustment (i.e., volume adjustment is achieved by adjusting the volume by the audio stream type and the audio output device).

[0019] In some embodiments, the first set and the second set may further limit the type of audio stream output by the application. For example, a game scene involves multiple audio streams such as voice calls, game background music, and game skill sound effects, which require personalized volume adjustment, so these scenes in the game application can be added to the first set, while the message notification tone of the game application does not require personalized volume adjustment, so the relevant scenes of the message notification tone in the game application can be added to the second set.

[0020] Of course, the user may also choose other methods to set the first set, such as adding the application to the first set through a setting interface of the application.

[0021] It can be understood that the first set may be a set of applications that support independent volume adjustment, and the second set may be a set of applications that do not support independent volume adjustment.

[0022] In this way, by setting a first set that supports independent volume adjustment and / or a second set that does not support independent volume adjustment, and selecting a corresponding volume adjustment strategy according to whether the focus application belongs to the first set or the second set, applications that require separate volume adjustment can be adjusted more accurately, which is more in line with the user's adjustment needs.

[0023] In one possible implementation, the user can place the application that needs to adjust the volume in the running scene of the focus application, and then adjust the playback volume of the focus application by inputting a volume adjustment operation without affecting the playback volume of other applications, thereby achieving the method of separately adjusting the volume of the audio stream output by a certain application. The method also includes initializing a key-value pair for relative volume adjustment after the electronic device is restarted.

[0024] In a possible implementation, an electronic device runs an application in the foreground, and in response to a volume adjustment operation input by a user, determines a focus application, including:

[0025] When the audio stream type of the audio output by the application running in the foreground of the electronic device is the same as the audio stream type of the audio output by the application running in the background of the electronic device, the application running in the foreground is determined as the focus application.

[0026] In a possible implementation, the electronic device runs multiple applications in the foreground, and in response to a volume adjustment operation input by a user, determines a focus application, including:

[0027] When the audio stream types of the audio output by multiple applications running in the foreground of the electronic device are the same, the application corresponding to the focus window is determined as the focus application.

[0028] In a possible implementation, after adjusting the volume of the audio output by the focus application to a target volume, the method further includes:

[0029] After mixing the adjusted focused application output audio with audio of the same type simultaneously output by other applications, the mixed audio data is output to the audio output device.

[0030] In a possible implementation, after the adjusted focus application output audio is mixed with the audio of the same type output by other applications at the same time, the mixed audio data is output to the audio output device, including:

[0031] Mix all audio data in the mixer;

[0032] The audio driver corresponding to the audio output device is called to drive the audio output device to output the mixed audio data.

[0033] In a second aspect, an embodiment of the present application provides an electronic device, one or more processors, and a memory, wherein the memory is coupled to the one or more processors, 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 a method as described in any one of the first aspects above.

[0034] In a third aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium includes instructions, and when the instructions are executed on an electronic device, the electronic device executes any method as described in the first aspect above.

[0035] In a fourth aspect, an embodiment of the present application provides a chip system, which 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 any method as in the first aspect.

[0036] In a fifth aspect, an embodiment of the present application provides a computer program product. When the computer program product is run on an electronic device, the electronic device executes any one of the above methods in the first aspect.

[0037] 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

[0038] Figure 1 is a schematic diagram of an exemplary process of determining the original volume;

[0039] Figure 2 A schematic diagram of a possible application scenario is shown below;

[0040] Figure 3 A schematic diagram of another possible application scenario;

[0041] Figure 4 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;

[0042] Figure 5 A schematic diagram of a software architecture of an electronic device provided in an embodiment of the present application;

[0043] Figure 6 A schematic diagram of a graphical user interface involved in some application scenarios provided in the embodiments of the present application;

[0044] Figure 7 Schematic diagrams of graphical user interfaces involved in other application scenarios provided in embodiments of the present application;

[0045] Figure 8 A schematic diagram of determining a focus window for possible split-screen display of an electronic device provided in an embodiment of the present application;

[0046] Fig. 9 A flow chart of a volume adjustment method according to an embodiment of the present invention;

[0047] Fig.10 A schematic diagram of a process for determining a target volume in a volume adjustment method provided in an embodiment of the present application;

[0048] Fig.11 A schematic diagram of another implementation flow of a volume adjustment method provided in an embodiment of the present application;

[0049] Fig.12 A schematic diagram of a process for determining a target volume provided in an embodiment of the present application;

[0050] Fig.13 A schematic diagram of a flow chart of another volume adjustment method provided in an embodiment of the present application;

[0051] Fig.14 A schematic diagram of a flow chart of another volume adjustment method provided in an embodiment of the present application;

[0052] Fig.15 A schematic diagram of the structure of a chip provided in an embodiment of the present application. DETAILED DESCRIPTION

[0053] In the embodiments of the present application, words such as "first" and "second" are used to distinguish the same or similar items with substantially the same functions and effects. For example, the first chip and the second chip are only used to distinguish different chips, and their order is not limited. 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.

[0054] 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.

[0055] 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: the existence of A alone, the existence of A and B at the same time, and the existence of B 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, and c can be single or multiple.

[0056] Electronic devices can play audio from different applications based on audio streams. Specifically, when an application outputs an audio stream, the audio system of the electronic device can output the decoded audio stream to the audio system engine (AudioFlinger) through the audio track (Audio Track) corresponding to the application. AudioFlinger can load the original volume corresponding to the audio stream type according to the audio stream type of the audio stream, and the possible audio output devices such as the speaker and earpiece of the electronic device can play the audio of the application based on the original volume loaded by AudioFlinger.

[0057] Specifically, the audio stream output by the application can be divided into different audio stream types, for example, the audio stream types may include: call stream (STREAM_VOICE_CALL), ring tone stream (STREAM_RING), media stream (STREAM_MUSIC), and notification stream (STREAM_NOTIFICATION).

[0058] It is understandable that each audio stream type may correspond to a playback volume, and the playback volume of each audio stream type may be set by the user, and the electronic device may determine the playback volume of the audio stream according to the audio stream type output by the application.

[0059] Exemplarily, assume that the playback volume of the audio stream of the electronic device is set to 15 volume levels, where volume level 0 corresponds to "mute", volume level 15 is the highest volume level, and the volume levels of audio streams of different audio stream types may be different, for example, the volume level of the media stream is 8, the volume level of the call stream is 10, and the volume level of the ringtone stream is 12. That is, when the electronic device plays an audio stream whose audio stream type is a media stream, the volume level of the playback volume is 8, when the electronic device plays an audio stream whose audio stream type is a call stream, the volume level of the playback volume is 10, and when the electronic device plays an audio stream whose audio stream type is a ringtone stream, the volume level of the playback volume is 12.

[0060] In addition, there may be volume differences at the audio output device level when the audio stream is output, that is, audio streams of the same audio stream type may use different volumes when outputted by different audio output devices.

[0061] For example, Figure 1 As shown, taking the audio stream type as media stream as an example, in the scenario where the audio is played using a speaker, the original volume of the audio output by the speaker of the electronic device can be volume 1, in the scenario where the audio is played using wired headphones, the original volume of the audio output by the wired headphones can be volume 2, and in the scenario where the audio is played using wireless headphones, the original volume of the audio output by the wireless headphones can be volume 3, wherein volume 1, volume 2, and volume 3 can be the same or different.

[0062] Exemplarily, Table 1 shows a comparison table of original volumes of different audio stream types corresponding to different audio output devices.

[0063] Table 1:

[0064]

[0065] It is understandable that the above original volume comparison table is only an example, and the original volume can be set according to actual application requirements, and this application does not impose any specific restrictions on this.

[0066] It is understandable that different audio stream types may correspond to different application scenarios, that is, audio streams of one audio stream type may come from different application programs.

[0067] For example, the incoming ringtone of the voice call of the instant messaging application and the incoming ringtone of the call application (i.e., the system call) both belong to the ringtone stream, the audio stream generated when the user uses the instant messaging application to make a call and the audio stream generated when the user uses the call application to make a call both belong to the call stream, the game background sound played by the game application, the songs played by the music playback application, and the audio stream generated when the video playback application plays a video all belong to the media stream.

[0068] In addition, the same application can output audio streams of different audio stream types. For example, the audio stream output when playing a video using an instant messaging application belongs to the media stream, and the audio stream output when making a voice call or video call using an instant messaging application belongs to the call stream.

[0069] Multiple different applications (applications, Apps) on an electronic device may output multiple different audio streams at the same time. For example, when a user is exercising, he can use a sports health application to play a sports training video. At this time, the electronic device can play the audio corresponding to the sports training video. At the same time, if the user likes to play more dynamic music during exercise, he can use a music playback application to play his favorite dynamic music. That is, while the electronic device outputs the audio stream corresponding to the sports training video, it will also synchronously output the audio stream played by the music playback application.

[0070] When multiple different audio streams are outputted simultaneously on an electronic device, the audio system engine AudioFlinger can be used to mix the multiple different audio streams, and then the mixed audio data is outputted to the audio hardware abstraction layer (Audio HAL). The Audio HAL can receive the mixed audio data and select the audio driver of the output audio output device. The Audio HAL can further access the driver corresponding to the audio output device, thereby driving the audio output devices such as speakers and receivers of the electronic device to play the sounds of the multiple applications at the same time, or driving the connected external audio output devices, such as wired headphones and wireless headphones, to play the sounds of multiple applications at the same time.

[0071] When the electronic device plays audio, the user can adjust the playing volume of the electronic device. Specifically, the playing volume of the electronic device is adjusted mainly based on the audio stream type.

[0072] For example, when a user uses a speaker of an electronic device to play the audio stream of a video application, it is assumed that the volume level of the playback volume corresponding to the media stream is level 8; at this time, a call is connected, the video application is paused and the user uses the handset to answer the voice of the other end user. The audio stream type of the voice of the other end user played by the handset at this time belongs to the call stream. It is assumed that the volume level of the playback volume corresponding to the call stream is level 10, then the volume level of the voice of the other end user output by the handset is level 10. If the user feels that the voice of the other end user is a bit low at this time, the volume increase area of ​​the mechanical volume button of the electronic device can be pressed to increase the volume. It can be understood that each time the user presses the volume increase area of ​​the mechanical volume button once, the volume level can be increased by one level. For example, if the original volume level of the voice of the other end user played by the handset is level 10, if the user presses the volume increase area of ​​the mechanical volume button twice during the process of answering the call, the volume level of the voice of the other end user played by the handset becomes level 12. After the user ends the call, the electronic device can resume the original video application playback, and the volume level of the sound output by the video application of the electronic device is still the original level 8.

[0073] From the above example, we can see that each audio stream type can correspond to a volume level. The volume levels corresponding to different audio stream types will not affect each other. The user can adjust the volume levels of different audio stream types separately. When the user adjusts the volume level of one audio stream type, the volume level of another type of audio stream type will not be changed.

[0074] However, when an electronic device simultaneously plays multiple audio streams of the same audio stream type, the user often has no way to adjust the volume of one of the audio streams individually, that is, the volumes of multiple audio streams of the same audio stream type can only be adjusted uniformly, and cannot be adjusted to different volumes according to user needs.

[0075] In the following, in combination with possible scenarios, the problem that when multiple audio streams of the same audio stream type are played simultaneously in the volume adjustment process of the current electronic device, the volume can only be adjusted uniformly, and the volume output by a certain application cannot be adjusted separately is explained.

[0076] See also Figure 2 , Figure 2 A schematic diagram of a possible scenario is shown.

[0077] In one possible scenario, Figure 2 The scenario shown in Figure 1 is that a user uses the front and back applications of a mobile phone to play audio at the same time. Figure 2As shown in (a) in the figure, the user uses the sports health app to play a spinning bike training video. The user can adjust the riding speed, climbing slope, etc. according to the prompts of the training video. At the same time, the user uses the music player app to play his favorite dynamic music to stimulate his sports enthusiasm. The user can run the music player app in the system background (in Figure 2 The icon 23 of the music player application can be displayed above the display interface of (a) in the figure), and the main interface of the electronic device can display the application interface of the sports health application. When the user wants to increase the volume of the music, the user can increase the volume by pressing the volume increase area 211 of the mechanical volume button 21, such as Figure 2 As shown in (b) in the figure, when the user presses the volume increase area 211 of the mechanical volume button 21, the display interface of the mobile phone can display the volume adjustment area 22. The volume adjustment area 22 can include a media stream volume progress bar 221 and volume adjustment thumbnails 222 of other audio types. The user can determine the current volume level through the volume progress bar 221, and the user can also slide the volume progress bar 221 to adjust the volume.

[0078] Since the audio stream type of the audio stream corresponding to the follow-up video played by the sports health application is a media stream, and the audio stream type of the song played by the music playback application is also a media stream, when the user presses the volume increase area 211 of the mechanical volume button 21 to increase the volume of the song played by the music playback application, or slides the volume progress bar 221 to increase the volume of the song played by the music playback application, the sound of the follow-up video played by the sports health application will also increase. The user only wants to increase the sound of the music, and the sound of the follow-up video does not need to be changed. That is, the effect expected by the user is that the background music is played at a louder volume and the user only needs to listen to the instructions clearly during exercise (riding speed adjustment instructions, climbing slope adjustment instructions, rest instructions, etc.).

[0079] It can be seen from the above examples that the user cannot adjust the volume of the video played by the sports health application alone, nor can the user adjust the volume of the song played by the music application alone, and the desired effect cannot be achieved.

[0080] See also Figure 3 , Figure 3 A schematic diagram of a possible scenario is shown.

[0081] In another possible scenario, Figure 3 The user uses two split-screen apps on a mobile phone to play audio at the same time. Figure 3As shown in (a) of FIG. 1 , the first split screen 31 of the user's mobile phone displays the video playback interface of the video playback application, and the second split screen 32 displays the display interface of the video playback application. When the user wants to reduce the volume of the video played by the video playback application, the volume can be reduced by pressing the volume reduction area 212 of the mechanical volume button 21, as shown in FIG. Figure 3 As shown in (b) in the figure, when the user presses the volume reduction area 212 of the mechanical volume button 21, the display interface of the mobile phone may display the volume adjustment area 22. The volume adjustment area 22 may include a media stream volume progress bar 221 and volume adjustment thumbnails 222 of other audio types. The user may determine the current volume through the volume progress bar 221, and the user may also slide the volume progress bar 221 to adjust the volume.

[0082] Since the audio stream type of the audio stream corresponding to the video played by the video playback application is a media stream, the audio stream type of the audio stream corresponding to the video played by the instant messaging application is also a media stream. Therefore, when the user presses the volume reduction area 212 of the mechanical volume button 21 to reduce the volume of the video played by the video playback application, or slides the volume progress bar 221 to reduce the volume of the video played by the video playback application, the volume of the video played by the instant messaging application will also be reduced. The user only wants to reduce the volume of the video played by the video playback application, but does not like to change the volume of the video played by the instant messaging application, so that he can hear the sound of the video played by the instant messaging application without pausing the video played by the video playback application.

[0083] It is understandable that the volume progress bar 221 is Figure 2 or Figure 3 The volume progress bar corresponding to the media stream in the scene shown.

[0084] It can be seen from the above examples that the user cannot adjust the volume of the video played by the video playback application alone, nor can the user adjust the volume of the video played by the instant messaging application alone, that is, the desired effect of the user cannot be achieved.

[0085] It should be noted that the simultaneous playback of multiple audio streams of the same audio stream type can also occur in other scenarios. For example, for mobile phones that support multi-window display functions such as floating windows and picture-in-picture, two applications can be run simultaneously through picture-in-picture, floating windows, etc., and audio streams of the same audio stream type can be played simultaneously.

[0086] It should also be noted that the above method of adjusting the volume by using the mechanical volume button of the electronic device is only an example, and the user can also choose the method of adjusting the volume according to the actual application scenario, for example, for a car-mounted device that can adjust the playback volume by voice, the user can input the command of adjusting the volume by voice to adjust the volume.

[0087] It is understandable that if the electronic device is connected to an external audio output device, such as wireless headphones or wired headphones, then based on the current volume adjustment method of adjusting the volume according to the audio stream type, the volume of multiple audio streams of the same audio stream type output to the wireless headphones or wired headphones can only be adjusted uniformly and cannot be adjusted individually.

[0088] It can be understood that the above example only illustrates the volume adjustment process of multiple audio streams that are playing media streams at the same time. When the electronic device simultaneously outputs multiple audio streams that are all call streams, or simultaneously outputs multiple audio streams that are all notification streams, the volume can only be adjusted uniformly. That is, when the electronic device simultaneously outputs multiple audio streams of the same audio stream type, the user cannot individually adjust the volume of the audio stream output by a certain application.

[0089] Based on this, an embodiment of the present application provides a volume adjustment method. When an electronic device simultaneously outputs multiple audio streams of the same audio stream type and receives a volume adjustment operation from a user, the target volume of the focus application can be determined based on the audio stream type, the audio output device and the focus application, and the volume of the output audio of the focus application is adjusted based on the determined target volume, thereby realizing the individual adjustment of the volume of the audio stream output by a certain application.

[0090] The volume adjustment method provided in the embodiment of the present application will be described in detail below in conjunction with the accompanying drawings. In the following description, for the purpose of illustration rather than limitation, specific details such as specific system structures and technologies are proposed to facilitate a thorough understanding of the embodiment of the present application.

[0091] In some embodiments, the execution subject of the above-mentioned volume adjustment method can be an electronic device. The above-mentioned electronic device can also be called a terminal, a user equipment (UE), a mobile station (MS), a mobile terminal (MT), etc. The electronic device can be a mobile phone, a smart TV, a wearable device (such as a smart bracelet, a smart watch, smart glasses, etc.), a tablet computer (Pad), a computer with wireless transceiver function, a virtual reality (VR) electronic device, an augmented reality (AR) electronic device, a wireless terminal in industrial control, a wireless terminal in self-driving, a wireless terminal in remote medical surgery, a wireless terminal in transportation safety, a wireless terminal in a smart city, a cloud server, and other devices that can perform the task of generating a training plan. The embodiments of the present application do not limit the specific technology and specific device form adopted by the electronic device.

[0092] In order to better understand the embodiments of the present application, the structure of the electronic device in the embodiments of the present application is introduced below:

[0093] Figure 4 1 shows a schematic diagram of the structure of the electronic device 100. Figure 4As 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. 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.

[0094] It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0095] 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.

[0096] 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.

[0097] In some embodiments, the processor 110 is implemented by a system on chip (SOC), that is, the processor 110 mentioned in some embodiments of the present application may specifically refer to a SOC chip.

[0098] 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 called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0099] In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuits sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.

[0100] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present application is a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.

[0101] In some embodiments, the antenna 1 of the electronic device is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), Bluetooth (BT), global navigation satellite system (GNSS), wireless local area network (WLAN), near field communication (NFC), and / or infrared (IR) technology, etc. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and / or a satellite based augmentation system (SBAS).

[0102] The electronic device 100 implements audio functions such as music playing, audio collection, and recording through the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.

[0103] 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.

[0104] 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.

[0105] For example, the earpiece of the electronic device can simultaneously play the voices of other teammates from the game application and the voice of the other end user during the voice call from the WeChat application.

[0106] 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 approaching the microphone 170C with his mouth to input the sound signal into the microphone 170C. The electronic device 100 can be provided with at least one microphone 170C.

[0107] In other embodiments, the electronic device 100 may be provided with two microphones 170C, which can not only collect sound signals but also realize noise reduction function.

[0108] In other embodiments, the electronic device 100 may also be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify the sound source, implement directional recording functions, etc.

[0109] For example, in addition to simultaneously answering the voices of other teammates in the game application and the voices of family members in the WeChat application during the voice call through the handset, the microphone 170C can also obtain the user's voice signal, convert it into an electrical signal, and transmit it to the other device.

[0110] 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.

[0111] Exemplarily, the audio system of the electronic device 100 can select a suitable output device or playback device according to the type of audio stream output by each application. When the user connects a wired headset through the headset interface 170D, the media stream (STREAM_MUSIC) will only be output to the wired headset through the headset interface 170D, and if a call comes in at this time, the phone ringtone (STREAM_RING) will be output to the wired headset and the speaker 170A through the headset interface 170D at the same time, which will not be repeated here.

[0112] The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.

[0113] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.

[0114] The pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A can be set on the display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. The capacitive pressure sensor can be a parallel plate including at least two conductive materials. When a force acts on the pressure sensor 180A, the capacitance between the electrodes changes. The electronic device determines the intensity of the pressure based on the change in capacitance. When a touch operation acts on the display screen 194, the electronic device detects the touch operation intensity according to the pressure sensor 180A. The electronic device can also calculate the touch position according to the detection signal of the pressure sensor 180A. In some embodiments, touch operations acting on the same touch position but with different touch operation intensities can correspond to different operation instructions. For example: when a touch operation with a touch operation intensity less than the first pressure threshold acts on the short message application icon, an instruction to view the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the first pressure threshold acts on the short message application icon, an instruction to create a new short message is executed.

[0115] The gyro sensor 180B can be used to determine the motion posture of the electronic device 100. In some embodiments, the angular velocity of the electronic device 100 around three axes (i.e., x, y, and z axes) can be determined by the gyro sensor 180B. Exemplarily, the motion posture of the user during motion can be obtained based on the gyro sensor 180B. The gyro sensor 180B can also be used for navigation and somatosensory game scenes.

[0116] The acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in various directions (generally three axes). When the electronic device 100 is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of the electronic device and is applied to applications such as horizontal and vertical screen switching and pedometers.

[0117] The key 190 includes a power key, a volume key, etc. The key 190 may be a mechanical key or a touch key. The electronic device 100 may receive key inputs and generate key signal inputs related to user settings and function control of the electronic device 100.

[0118] Exemplarily, in an embodiment of the present application, the button 190 may include a mechanical volume button on the side frame of the mobile phone, or other touch-type volume adjustment buttons.

[0119] Optionally, the user can trigger the process of adjusting the volume by pressing the mechanical volume button on the side frame of the mobile phone. For example, when it is detected that the user presses the volume increase area (i.e., the area for increasing the volume) on the mechanical volume button (or presses the volume decrease area (i.e., the area for decreasing the volume) on the mechanical volume button, the electronic device can automatically display the volume adjustment window on the current interface, and specifically can display the volume progress bar. The user can determine the current volume through the volume progress bar, or slide the volume progress bar to adjust the volume.

[0120] The electronic device 100 having the above hardware structure can have a software system that adopts 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 of the layered architecture as an example to exemplify the software structure of the electronic device 100.

[0121] Figure 5 1 is a software structure block diagram of the electronic device 100 according to an embodiment of the present application.

[0122] The layered architecture divides the software into several layers, each with a clear role and division of labor. The layers communicate with each other through software interfaces. Figure 5The audio system architecture diagram of the Android@ system of the electronic device is shown. It should be understood that the audio system architecture can be divided into four layers, from top to bottom, namely the application layer, the application framework layer, the audio hardware abstraction layer (Audio HAL) and the kernel layer.

[0123] In the embodiment of the present application, the audio system architecture based on the Android@ system is referred to as the audio system. The audio system can be responsible for functions such as audio data collection and output, audio stream control, audio device management, and volume adjustment.

[0124] The application layer may include a series of application packages. Figure 5 As shown, the application package may include applications such as camera, gallery, calendar, call, map, music, sports health, Bluetooth, video, instant chat, reading, etc.

[0125] It should be understood that each application that can output audio can construct an audio track (Audio Track) in the application framework layer (framework), that is, each application has its corresponding audio track (Audio Track). After each application constructs the corresponding audio track (Audio Track), the application can write audio data to the corresponding audio track (Audio Track), and each audio track (Audio Track) can further output the decoded audio stream to the audio system engine (AudioFlinger).

[0126] The application framework layer provides an application programming interface (API) and a programming framework for the applications of the application layer. The application framework layer includes some predefined functions. In an embodiment of the present application, the above-mentioned application framework layer may include a media player (MediaPlayer) interface class, a sound pool (SoundPool) interface class, an Audio Track interface class, and an audio service (Audio server).

[0127] When the audio system is started, the Audio server can load AudioFlinger. During audio playback, the Audio server can call AudioFlinger and Audio Policy Service respectively and initialize AudioFlinger and Audio Policy Service.

[0128] It should be understood that Audio Policy Service and AudioFlinger are the two basic services of the audio system. Among them, Audio Policy Service is the maker of audio system policies, responsible for the policy selection of audio device switching, volume adjustment policy, etc. For example, Audio Policy Service can play a routing role, and it has the right to decide which audio playback device the audio stream generated by a certain Audio Track will eventually be transmitted to.

[0129] AudioFlinger is the executor of the audio system's audio playback strategy, responsible for managing the input audio stream device, managing the output audio stream device, as well as switching audio modes, loading audio parameters, processing and transmitting audio stream data, etc. During the initialization process of AudioFlinger, the original volume parameters of the initialization of the Audio system can be obtained, for example, the volume levels corresponding to the call stream, ringtone stream, notification stream, media stream, etc. listed in Table 1 can be obtained.

[0130] It should be understood that during the initialization of the Audio Policy Service, the audio configuration in the settings can be parsed, and the entire audio system deployment is completed using the interface provided by AudioFlinger, thereby providing underlying support for the subsequent upper-layer applications to use audio devices.

[0131] It should also be understood that Audio Policy Service is the place where AudioFlinger is actually called. AduioPolicy Service can call the functions in AudioFlinger through the Binder mechanism, that is, call the AudioFlinger interface.

[0132] Exemplarily, in an embodiment of the present application, when an application starts audio stream output, the audio data included in the audio stream can be identified as a certain audio stream type, and the decoded audio stream data is output to AudioFlinger through the Audio Track corresponding to the application. AudioFlinger can load the original volume corresponding to the audio stream type and the audio output device according to the audio stream type and the audio output device. When receiving the user's volume adjustment instruction, AudioFlinger can determine the original volume according to the audio stream type and the audio output device, and determine the relative volume according to the focus application and the user's volume adjustment instruction, and finally determine the target volume of the focus application, and load the target volume for output.

[0133] Optionally, AudioFlinger may further include an audio mixer (Audio Mixer). AudioFlinger's AudioMixer may mix audio streams output by multiple different applications, and AudioFlinger outputs the mixed audio data (Audio data).

[0134] In an embodiment of the present application, AudioFlinger can determine the target volume of the focus application and load the target volume of the focus application, while the output volume of the non-focus application remains unchanged and is mixed, and AudioFlinger outputs the mixed audio data, thereby achieving the effect of adjusting the volume of the focus application alone.

[0135] In an embodiment of the present application, the Audio HAL may be responsible for interaction with an audio output device, and the Audio HAL may be directly called by AudioFlinger, including an audio hardware abstraction layer implementation.

[0136] The kernel layer is the layer between hardware and software. The kernel layer contains at least display driver, camera driver, audio driver, and sensor driver.

[0137] Exemplarily, the Audio HAL can receive the mixed audio data and select an audio output device to output, and further access the driver corresponding to the audio output device in the kernel layer, thereby driving the audio output device to play audio of multiple applications simultaneously.

[0138] In addition, the Audio system may also include an audio output device of the electronic device 100, which may be called by a corresponding driver of the kernel layer. The hardware devices such as speakers and receivers of the electronic device play based on the volume loaded by AudioFlinger.

[0139] The kernel layer is the layer between hardware and software. The kernel layer contains at least audio drivers, etc.

[0140] For example, Figure 5 As shown, the Audio HAL in the embodiment of the present application can be responsible for the interaction with the audio output device, and the AudioFlinger can directly call the Audio HAL. The Audio HAL can select the audio output device of the audio stream of the audio stream type, and access the driver of the audio output device of the kernel layer, thereby driving the audio output device to play according to the volume corresponding to the audio stream type and the audio output device loaded by AudioFlinger.

[0141] The audio output device of the electronic device 100 may include Figure 4The speaker 170A, earpiece (receiver) 170B, wired headphones connected through the headphone interface 170D, wireless headphones connected wirelessly, and other playback devices capable of playing audio are not limited to this embodiment of the present application.

[0142] The following will be combined with the accompanying drawings to illustrate the volume adjustment method provided by the embodiment of the present application through the following multiple exemplary embodiments. The methods in the following embodiments can be implemented in an electronic device with the above hardware structure and software architecture. The hardware structure diagram of the electronic device can be as follows: Figure 4 As shown, the software structure diagram of the electronic device can be as follows Figure 5 For the sake of convenience, the embodiments of the present application are all based on electronic devices as shown in FIG. Figure 4 Take the mobile phone shown as an example.

[0143] Figure 6 This is a schematic diagram of a graphical user interface involved in an application scenario of adjusting the volume provided in an embodiment of the present application.

[0144] For example, Figure 6 As shown, the mobile phone is currently running the sports health application in the foreground, and the sports health application is playing a spinning bike training video. The mobile phone displays Figure 6 The video playback interface of the follow-up exercise is shown in (a) in the figure. At the same time, the music player application is running in the background of the mobile phone, and the music player application is playing a song, that is, Figure 6 In the scenario shown in (a), the mobile phone's speaker plays the prompt sound and song of the practice video at the same time.

[0145] Assume that during exercise, the user feels that the volume of the song is too low and wants to increase the volume of the song, but also hopes that the prompt sound of the exercise video can maintain the original volume. Assume that the user sets the application running in the foreground as the focus application, the user can put the music playback application in the foreground by inputting an application window display operation. The above application window display application can specifically be a swipe up operation on the mobile phone screen. After receiving the swipe up operation input by the user, the mobile phone can display the following Figure 6 The display interface shown in (b) is as follows: Figure 6 As shown in (b) of FIG. 1 , the mobile phone is running a sports health application, a music player application, and an instant messaging application. Since the user wants to adjust the volume of the song, the user can click on the application window 61 of the music player application, so that the display interface of the electronic device jumps to the display interface of the music player application (such as Figure 6As shown in (c) in the figure), the music player application is running in the foreground. At this time, the user can adjust the volume of the song played by the music player application by pressing the mechanical volume button on the side of the mobile phone. Specifically, the mobile phone responds to the user pressing the mechanical volume button 21 on the side of the mobile phone, and the display interface of the mobile phone jumps to Figure 6 The interface shown in (d) in the figure shows a volume adjustment area 22 in the display interface of the mobile phone. The volume adjustment area 22 may include a volume progress bar 223 of the music player application and volume adjustment thumbnails 222 of other audio types.

[0146] It is understandable that the volume progress bar 223 is Figure 6 The volume progress bar corresponding to the music playback application in the scene shown.

[0147] It is understandable that the user can increase the volume of the song played by the music playback application by pressing the volume increase area 211 of the mechanical volume button 21.

[0148] Exemplarily, each time the user presses the volume increase area 211 of the mechanical volume button 21 once, the volume of the song played by the music playback application can be increased by one volume level. Assuming that before adjusting the volume, the volume level of the song played by the music playback application and the volume level of the video played by the sports and health application are both level 8, after the user presses the volume increase area 211 of the mechanical volume button 21 twice, the volume level of the song played by the music playback application can be adjusted to level 10, and the volume level of the video played by the sports and health application is still level 8, that is, this embodiment can only adjust the volume of the audio stream output by the music playback application.

[0149] It is understandable that the user can also long press the volume increase area 211 of the mechanical volume button 21 to adjust the volume of the song played by the music playback application, and the mobile phone can determine the increased volume level according to the length of time the user presses the volume increase area 211 of the mechanical volume button 21.

[0150] It is understandable that the user can also adjust the volume of the music playing application through the volume progress bar 223 of the music playing application, and the mobile phone can determine the volume of the music playing application according to the progress of the user dragging the volume progress bar 223 of the music playing application.

[0151] As another example, assuming that the application running in the foreground of the mobile phone is a music player application, the user no longer needs to put the music player application in the foreground. When the volume of the songs played by the music player application needs to be increased, the user only needs to press the volume increase area 211 of the mechanical volume button 21 to achieve the technical effect of only increasing the volume of the songs played by the music player application while keeping the playback volume of the follow-up video of the sports health application unchanged.

[0152] Figure 7 This is a schematic diagram of a graphical user interface involved in another application scenario of adjusting the volume provided in an embodiment of the present application.

[0153] For example, Figure 7 As shown, the user uses the mobile phone split screen to run two applications in the foreground at the same time, such as Figure 7 As shown in (a) of FIG. 1 , the first split screen 31 of the mobile phone displays the video playback interface of the video playback application, and the second split screen 32 displays the playback interface of the video in the instant messaging application. Figure 7 In the scenario shown in (a), the speaker of the mobile phone simultaneously plays the sound of the video played by the video player application and the sound of the video played by the instant messaging application.

[0154] Assume that the user wants to lower the volume of the video played by the video playback application, and the user sets multiple applications to run in the foreground at the same time, and the application running in the first split screen is the focus application, then the user can directly press the volume reduction area 212 of the mechanical volume button 21 on the side of the mobile phone to adjust the volume of the video played by the video playback application. Specifically, the mobile phone responds to the user pressing the mechanical volume button 21 on the side of the mobile phone, and the display interface jumps to the following Figure 7 The interface shown in (b) in the figure shows a volume adjustment area 22 in the display interface of the mobile phone. The volume adjustment area 22 may include a volume progress bar 224 of the video playback application and volume adjustment thumbnails 222 of other audio types.

[0155] It is understandable that the volume progress bar 224 is Figure 7 The volume progress bar corresponding to the video playback application in the scene shown.

[0156] It is understandable that the user can reduce the volume of the video played by the video playback application by pressing the volume reduction area 212 of the mechanical volume button 21.

[0157] Exemplarily, each time the user presses the volume reduction area 212 of the mechanical volume button 21 once, the volume of the video played by the video playback application can be reduced by one volume level. Assuming that before adjusting the volume, the volume level of the video played by the video playback application and the volume level of the video played by the instant messaging application are both level 6, then after the user presses the volume reduction area 212 of the mechanical volume button 21 6 times, the volume level of the video played by the video playback application is adjusted to level 0, while the volume level of the video played by the instant messaging application remains unchanged at level 6.

[0158] Assuming that the user feels that the volume of the video played by the instant messaging application is still a little low, and wants to increase the volume level to 8, the user can press and hold the application interface of the instant messaging application and drag the instant messaging application to the display area of ​​the first split screen, as shown in FIG. Figure 7 As shown in (c) in the figure, the first split screen 31 of the mobile phone displays the playback interface of the video in the instant messaging application, and the second split screen 32 displays the video playback interface of the video playback application. Then the user can press the volume increase area 211 of the mechanical volume button 21 on the side of the mobile phone again to make the display interface of the mobile phone jump to the following figure: Figure 7 The interface shown in (d) in the figure, that is, the volume adjustment area 22 is displayed again in the display interface of the mobile phone. At this time, the user can press the volume increase area 211 of the mechanical volume button 21 twice to adjust the volume of the video played by the instant messaging application to the volume corresponding to the volume level 8, or the user can drag the volume progress bar 225 of the instant messaging application in the volume adjustment area 22 to the corresponding position of the volume level 8, thereby adjusting the volume of the video played by the instant messaging application to the volume corresponding to the volume level 8.

[0159] It is understandable that the volume progress bar 225 is Figure 7 The volume progress bar corresponding to the instant messaging application in the scenario shown.

[0160] It should be noted that the mobile phone can not only run two applications at the same time, but also run more than two applications at the same time. The mobile phone can display the running interfaces of multiple applications in the display interface at the same time through split screen, floating ball, picture-in-picture, etc. This application does not make any specific restrictions on this.

[0161] It can be understood that the above embodiments are only illustrative of the speaker as the audio output device. The audio output device can also be wireless headphones, wired headphones, wireless speakers, wired speakers and other devices, and this application does not make specific limitations on this.

[0162] It should be noted that, in the embodiment of the present application, the user can set the focus application according to the user's usage habits. The process of setting the focus application is exemplarily described as follows:

[0163] Case 1: When only one application is running in the electronic device, it can be determined that the application is the focus application.

[0164] Case 2: When there are multiple applications running simultaneously in the foreground and background in the electronic device, and the multiple applications output audio streams of the same audio stream type simultaneously, but there is only one application running in the foreground, the application running in the foreground can be set as the focus application.

[0165] Case 3: When multiple applications are running in split-screen mode on an electronic device, and multiple applications are outputting audio streams of the same audio stream type at the same time, the application running in the focus window can be set as the focus application.

[0166] It should be noted that after the application of the electronic device is split, one of the windows can be determined as the focus window. Figure 8 In the case of the upper and lower split screens shown in (a) of FIG. 1 , the upper split screen window can be determined as the focus window, that is, the application running in the upper split screen window 81 is the focus application. Figure 8 In the case of left and right split screens as shown in (b) of FIG. 1 , the left split screen window 84 can be determined as the focus window, that is, the application running in the left split screen window is the focus application. Figure 8 In the case of three-screen splitting as shown in (c), the middle split-screen window 86 may be determined as the focus window, that is, the application running in the middle split-screen window is the focus application.

[0167] It can be understood that the above-mentioned split-screen method is only an example. The user can divide the display screen of the mobile phone into multiple split-screen windows according to actual application needs. The position of the split-screen window and the distribution format of the split-screen window can be set according to actual needs. This application does not impose specific restrictions on this. As for which split-screen window is set as the focus window, it can be set according to the user's usage habits, and this application also does not impose specific restrictions on this.

[0168] Case 4: When an electronic device has an application running in the foreground and runs another application in the form of a floating ball, and different applications output audio streams of the same audio stream type at the same time, the foreground application displayed on the main screen can be set as the focus application.

[0169] It is understandable that other applications can be run in the background of the electronic device, and the audio stream type of the audio stream output by the application can also be the same as the audio stream type of the audio stream output by the above two applications. In this case, after receiving the volume adjustment operation, the electronic device will only adjust the playback volume of the focus application, that is, the playback volume of the application running in the foreground displayed on the main screen will be adjusted, while the playback volume of the application running in the floating ball form and the application running in the background will remain unchanged.

[0170] It should be noted that the above four situations are only explanations of how to set the focus application and are not restrictions. In other situations, such as running different applications in "picture-in-picture", the application running in the center window of the screen can be determined as the focus application, etc. The user can also determine the application running in the floating ball as the focus application.

[0171] In the above process, the user can place the application whose volume needs to be adjusted in the running scene of the focus application, and then adjust the playback volume of the focus application by inputting the volume adjustment operation without affecting the playback volume of other applications, thereby realizing the individual adjustment of the volume of the audio stream output by a certain application.

[0172] For different application scenarios, the above embodiments are combined with Figures 6 to 8 , the implementation process and possible implementation methods of adjusting the volume are introduced from the user interaction level. The following will introduce the underlying implementation process of the volume adjustment method provided in the embodiment of the present application from the underlying implementation strategy level.

[0173] See also Fig. 9 , Fig. 9 A flow chart of a volume adjustment method according to an embodiment of the present invention is provided. Figure 6 Taking the scenario shown in the figure where a sports health application is running in the foreground and a music player application is running in the background as an example, the speaker of the mobile phone simultaneously outputs the audio stream of the sports health application and the audio stream of the music player application.

[0174] S901: The sports health application at the application layer outputs an audio stream, the audio stream type of the audio stream is marked as a media stream, and the audio output device of the audio stream is marked as a speaker.

[0175] S902: The music playing application at the application layer outputs an audio stream, the audio stream type of the audio stream is marked as a media stream, and the audio output device of the audio stream is marked as a speaker.

[0176] In specific applications, the sports and health application and the music playback application at the application layer can specify that the audio stream type corresponding to the audio data contained in the output audio is "media stream" through Attribute.usage.

[0177] S903: The sports health application calls the API of the sports health application and creates an Audio Track corresponding to the sports health application in the application framework layer.

[0178] The Audio Track corresponding to the sports health application can output the decoded media stream corresponding to the sports health application.

[0179] S904: The music player application calls the API of the music player application and creates an Audio Track corresponding to the music player application in the application framework layer.

[0180] The Audio Track corresponding to the music playback application outputs the decoded media stream corresponding to the music playback application.

[0181] S905: The Audio Track corresponding to the sports and health application and the Audio Track corresponding to the music playback application call the AudioFlinger of the Audio system and transfer the decoded audio data to AudioFlinger. AudioFlinger loads the corresponding volume according to the media stream and the audio output device, that is, the original volume of the audio stream output by the sports and health application and the original volume of the audio stream output by the music playback application.

[0182] S906: The application layer receives the volume adjustment operation of the user, and sends the key event to the application framework layer.

[0183] In specific applications, the volume adjustment operation input by the user can refer to Figure 6 or Figure 7 The relevant descriptions in the illustrated scenario are not repeated in this application.

[0184] In a specific application, a key event may include key type, pressing duration, pressing times, and other related content.

[0185] S907: After receiving the key event, AudioFlinger determines a volume adjustment instruction according to the key event, and determines a relative adjustment volume of the audio stream output by the music playback application according to the volume adjustment instruction and the application identifier of the music playback application.

[0186] Here, the user can set the music player application as the focus application in advance, that is, the music player application can be set to run in the foreground. Figure 6 to set the music player app to run in the foreground.

[0187] In specific applications, the music adjustment instruction corresponds to a key event, and determines the relevant instructions for determining the volume adjustment method and the adjusted volume level of the music playback application. That is, if the user presses the volume increase area of ​​the mechanical volume button once, it can be determined that the volume adjustment method is to increase the volume, and the adjusted volume level is level 1. At this time, the volume adjustment instruction is to increase the volume of the music playback application from the original volume by one level.

[0188] S908: Determine a target volume of the audio stream output by the music playing application according to the original volume of the audio stream output by the music playing application and the relatively adjusted volume of the audio stream output by the music playing application.

[0189] In a specific application, the target volume (FinalVolumeIndex) of the audio stream output by the music playback application may be the sum of the original volume and the relatively adjusted volume.

[0190] For example, see Fig.10 , Fig.10The figure shows a process of determining a target volume in a volume adjustment method provided in an embodiment of the present application.

[0191] like Fig.10 As shown, the original volume is determined according to the audio stream type corresponding to the audio stream output by the music playback application and the audio output device of the audio stream, the relative adjustment volume is determined according to the volume adjustment instruction, and the target volume is determined according to the original volume and the relative adjustment volume.

[0192] S909: AudioFlinger obtains the audio data included in each audio stream after audio decoding in the music playback application and the sports and health application, mixes the audio data of the sports and health application and the music playback application in the Audio Mixer of AudioFlinger, and AudioFlinger outputs the mixed audio data (Audiodata).

[0193] S910: The Audio HAL layer selects a corresponding audio output device, and drives the corresponding audio output device to output the mixed audio data through the audio driver in the kernel layer.

[0194] In a specific application, after the above process, the mobile phone can simultaneously output the audio data of the sports health application and the audio data of the music playback application, and the playback volume of the audio data of the music playback application is the volume adjusted according to the volume adjustment operation input by the user.

[0195] Through the method provided in the embodiment of the present application, when an electronic device can simultaneously output multiple audio streams of the same audio stream type and receive a volume adjustment operation from a user, the target volume of the focus application can be determined based on the audio stream type, the audio output device and the focus application, and the volume of the output audio of the focus application can be adjusted based on the determined target volume, thereby realizing the individual adjustment of the volume of the audio stream output by a certain application, which is more in line with the user's playback needs.

[0196] The above describes the underlying implementation process of the present application. The following describes the specific implementation process of the volume adjustment method provided in the embodiment of the present application.

[0197] See also Fig.11 , Fig.11 A schematic flow chart of another implementation of the volume adjustment method provided in an embodiment of the present application is shown.

[0198] S1101: In response to a volume adjustment operation by a user, obtaining an application identifier of a focus application.

[0199] In a specific application, the volume adjustment operation is used to adjust the volume of audio played by an electronic device.

[0200] It should be noted that when the user inputs the volume adjustment operation, the audio output device is simultaneously outputting multiple audio streams of the same audio stream type.

[0201] For the relevant description of the above-mentioned focus application, please refer to the relevant description of the focus application setting process, which will not be repeated in this application.

[0202] The application identifier of the focus application may specifically be an application package name, that is, an APK package name.

[0203] S1102: Determine the original volume of the audio output by the focus application according to the audio stream type and the audio output device of the audio output by the focus application.

[0204] S1103: Determine a relative adjustment volume of the audio output by the focus application according to the volume adjustment operation.

[0205] In an embodiment of the present application, in the process of adjusting the volume of the output audio of an application, in addition to considering the audio stream type and the audio output device of the output audio, the dimension of application type is additionally added, that is, the target volume of a certain application is determined by comprehensively considering the audio stream type, audio output device and application type.

[0206] For example, Fig.12 As shown, taking the audio stream type as media stream as an example, assuming that the audio output device is a speaker, the playback volume (i.e., the original volume) corresponding to the speaker and the media stream can be determined first, and when the focus application is the video playback application 1, the relative adjustment volume can be determined according to the volume adjustment operation input by the user, so that the target volume of the audio stream output by the video playback application 1 can be finally determined to be volume 4; for another example, if the audio stream type is media stream and the audio output device is a wireless headset, the playback volume (i.e., the original volume) corresponding to the wireless headset and the media stream can be determined first, and when the focus application is the music playback application 2, the relative adjustment volume can be determined according to the volume adjustment operation input by the user, so that the target volume of the audio stream output by the music playback application 2 can be finally determined to be volume 5; for another example, if the audio stream type is media stream and the audio output device is a wired headset, the playback volume (i.e., the original volume) corresponding to the wired headset and the media stream can be determined first, and when the focus application is the instant messaging application 3, the relative adjustment volume can be determined according to the volume adjustment operation input by the user, so that the target volume of the audio stream output by the instant messaging application 3 can be finally determined to be volume 6.

[0207] S1104: Determine a target volume of the audio output by the focus application according to the original volume and the relatively adjusted volume of the audio output by the focus application.

[0208] In an embodiment of the present application, the above S1104 may specifically include the following steps:

[0209] Using the application ID of the focus application as the key and the relative volume adjustment as the value, a key-value pair of the relative volume adjustment of the focus application is constructed;

[0210] The target volume is obtained by calculating the original volume according to the key-value pair for relatively adjusting the volume.

[0211] S1105: Adjust the volume of the audio output by the focus application to a target volume.

[0212] For example, we take the sports health application as the focus application and explain the specific implementation of the sports health application generating its own volume as follows:

[0213] The original volume is determined by the audio stream type and audio output device of the sports health application output audio. According to the volume adjustment operation input by the user, a key-value pair is added with the sports health package name as the key and the relative adjustment volume (that is, the volume level that needs to be adjusted corresponding to the volume adjustment operation) as the value. The key-value pair is created according to the situation that the current application is running in the foreground or in the focus window, and the electronic device receives the mechanical volume button pressed by the user to adjust the volume or adjusts the volume by sliding the volume progress dial. The key-value pair corresponds to the focus application and the volume adjustment operation input by the user. Assume that after the electronic device is turned on, the volume level of the original volume corresponding to the media stream and the speaker is 8. At this time, when the sports health application is in the foreground, the user presses the volume increase area of ​​the mechanical volume button once, the electronic device will store 1 in the value of the key-value pair with the sports health application package name key, that is, the value of the key-value pair with the sports health application package name key is 1, and the volume level of the output audio of the sports health application in the current scene is adjusted to 9, that is, the volume level of the original volume of 8 plus the value; if at this time, when the user presses the volume decrease area of ​​the mechanical volume button twice in succession, the relative adjustment volume becomes 1-1-1=-1, that is, the value of the key-value pair with the sports health application package name key becomes -1, and the volume level of the output audio of the sports health application in the current scene is adjusted to 7.

[0214] In a specific application, the above key-value pair can be sent through the AudioManager.setParameter() function to adjust the volume of the focus application.

[0215] In one embodiment of the present application, after the electronic device is restarted, the key-value pair of the application identifier and the relative volume adjustment will be initialized, that is, the value of the key-value pair will be restored to 0.

[0216] From the above, it can be seen that a volume adjustment method provided in an embodiment of the present application can determine the target volume of the focus application according to the audio stream type, the audio output device and the focus application when the electronic device simultaneously outputs multiple audio streams of the same audio stream type and receives a volume adjustment operation from the user, and adjust the volume of the output audio of the focus application based on the determined target volume, thereby realizing the individual adjustment of the volume of the audio stream output by a certain application.

[0217] In some embodiments of the present application, users can also set black and white lists according to their needs.

[0218] Specifically, the user can add a set of applications that can support independent volume adjustment (i.e., a white list, hereinafter referred to as the first set) and a set of applications that do not support independent volume adjustment (i.e., a black list, hereinafter referred to as the second set) in the application management option in the system setting application. The applications in the first set can achieve independent volume adjustment through the volume adjustment method provided in the embodiment of the present application, while the applications in the second set still use the original volume adjustment method to achieve volume adjustment (i.e., volume adjustment is achieved by adjusting the volume by the audio stream type and the audio output device).

[0219] In some embodiments, the first set and the second set may further limit the type of audio stream output by the application. For example, a game scene involves multiple audio streams such as voice calls, game background music, and game skill sound effects, which require personalized volume adjustment, so these scenes in the game application can be added to the first set, while the message notification tone of the game application does not require personalized volume adjustment, so the relevant scenes of the message notification tone in the game application can be added to the second set.

[0220] Of course, the user may also choose other methods to set the first set, such as adding the application to the first set through a setting interface of the application.

[0221] It can be understood that the first set may be a set of applications that support independent volume adjustment, and the second set may be a set of applications that do not support independent volume adjustment.

[0222] See also Fig.13 In some embodiments of the present invention, the volume adjustment method may include the following steps:

[0223] S1301: In response to a volume adjustment operation by a user, obtaining an application identifier of a focus application.

[0224] The implementation of S1301 may refer to the relevant description of S1101, and this application will not elaborate on it here.

[0225] S1302: Determine whether the focus application is an application in the first set according to the application identifier of the focus application, if so, execute S1303, otherwise execute S1307.

[0226] In a specific application, the electronic device may determine the application identifiers of the applications in the first set, and compare the application identifier of the focus application with the application identifiers of the applications in the first set to determine whether the focus application is an application in the first set.

[0227] S1303: Determine the original volume of the audio output by the focus application according to the audio stream type and the audio output device of the audio output by the focus application.

[0228] S1304: Determine a relative adjustment volume of the audio output by the focus application according to the volume adjustment operation.

[0229] S1305: Determine a target volume of the audio output by the focus application according to the original volume and the relatively adjusted volume of the audio output by the focus application.

[0230] S1306: Adjust the volume of the audio output by the focus application to a target volume.

[0231] The implementation of S1303 to S1306 can refer to the relevant description of S1102 to S1105, and this application will not elaborate on it here.

[0232] S1307: Determine the target volume of the output audio of all audio output applications according to the audio stream type of the output audio, the audio output device, and the volume adjustment operation.

[0233] S1308: Adjust the volume of the audio output by all audio output applications to the target volume.

[0234] In a specific application, since the focus application does not belong to the first set, that is, it is not an application in the first set, the volume will be adjusted according to the existing volume adjustment scheme, that is, after determining the original volume based on the two dimensions of audio stream type and audio output device, the volume adjustment level is determined based on the volume adjustment operation input by the user, and then the target volume of the audio output by all audio output applications is determined.

[0235] It is understandable that all the above-mentioned audio output applications refer to the corresponding applications that simultaneously output multiple audios of the same audio stream type in the current scene. If an application running in the background does not output any audio in the current scene, the volume adjustment operation will not do anything to the application. For example, assuming that in the current scene, a total of 3 applications are running in the foreground and background, of which application 1 and application 2 output audio, and the audio stream type of the output audio is the same, and application 3 does not output audio, then in the current scene, all audio output applications include application 1 and application 2.

[0236] From the above, it can be seen that the volume adjustment method provided in the embodiment of the present application, by setting a first set that supports independent volume adjustment, and when the focus application is an application in the first set, realizes the individual adjustment of the output volume of the focus application, and when it does not belong to the first set, the original volume adjustment method is adopted to adjust the volume of all audio output applications, so that applications that need to be adjusted individually can be adjusted more accurately, which is more in line with the user's adjustment needs.

[0237] See also Fig.14 In some other embodiments of the application, the volume adjustment method may include the following steps:

[0238] S1401: In response to a volume adjustment operation by a user, obtaining an application identifier of a focus application.

[0239] The implementation of S1401 can refer to the relevant description of S1101, and this application will not elaborate on it here.

[0240] S1402: Determine whether the focus application is an application in the second set according to the application identifier of the focus application, if not, execute S1403, if yes, execute S1408.

[0241] In a specific application, the electronic device may determine the application identifiers of the applications in the first set, and compare the application identifier of the focus application with the application identifiers of the applications in the first set to determine whether the focus application is an application in the first set.

[0242] S1403: Determine whether the focus application is an application in the first set according to the application identifier of the focus application, if so, execute S1404, otherwise execute S1408.

[0243] S1404: Determine the original volume of the audio output by the focus application according to the audio stream type and the audio output device of the audio output by the focus application.

[0244] S1405: Determine a relative adjustment volume of the audio output by the focus application according to the volume adjustment operation.

[0245] S1406: Determine a target volume of the audio output by the focus application according to the original volume and the relatively adjusted volume of the audio output by the focus application.

[0246] S1407: Adjust the volume of the audio output by the focus application to a target volume.

[0247] The implementation of S1404 to S1408 may refer to the relevant description of S1102 to S1105, and this application will not elaborate on it here.

[0248] S1408: Determine the target volume of the output audio of all audio output applications according to the audio stream type of the output audio, the audio output device, and the volume adjustment operation.

[0249] S1409: Adjust the volume of the audio output by all audio output applications to the target volume.

[0250] In a specific application, since the focus application belongs to the second set, that is, it is an application in the second set, or does not belong to the first set, that is, it is not an application in the first set, the electronic device will determine the original volume based on the two dimensions of audio stream type and audio output device, and then determine the volume adjustment level based on the volume adjustment operation input by the user, and then determine the target volume of the audio output by all audio output applications.

[0251] It is understandable that the above-mentioned all audio output applications refer to the corresponding applications that simultaneously output multiple audios of the same audio stream type in the current scene. If an application running in the background does not output any audio in the current scene, the volume adjustment operation will not perform any operation on the application.

[0252] From the above, it can be seen that the volume adjustment method provided in the embodiment of the present application, by setting a second set that does not support independent volume adjustment, and when the focus application is an application in the second set, the original volume adjustment method is adopted to adjust the volume of all audio output applications. This can more accurately adjust applications that require separate volume adjustment, which is more in line with the user's adjustment needs.

[0253] The above mainly introduces the solution provided by the embodiment of the present application from the perspective of the method. In order to realize the above functions, it includes hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should be easily aware that, in conjunction with the method steps of each example described in the embodiment provided herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain 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 exceed the scope of the present application.

[0254] The embodiment of the present application can divide the functional modules of the device of the audio channel switching method according to the above method example. For example, each functional module can be divided corresponding to each function, or two or more functions can be integrated into one processing module. The above 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.

[0255] Fig.15 A schematic diagram of the structure of a chip provided in an embodiment of the present application. Fig.15 As shown, chip 1500 includes one or more (including two) processors 1501 , a communication line 1502 , a communication interface 1503 , and a memory 1504 .

[0256] In some implementations, the memory 1504 stores the following elements: executable modules or data structures, or a subset thereof, or an extended set thereof.

[0257] The method described in the above embodiment of the present application can be applied to the processor 1501, or implemented by the processor 1501. The processor 1501 may be an integrated circuit chip with signal processing capabilities. In the implementation process, the steps of the execution method of the above first device or second device can be completed by the hardware integrated logic circuit in the processor 1501 or the instructions in the form of software. The above processor 1501 can be a general 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 1501 can implement or execute the various methods, steps and logic block diagrams provided in the embodiments of the present application.

[0258] The steps of the method provided in conjunction with the embodiment of the present application can be directly embodied as being executed by a hardware decoding processor, or can be 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 art 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 1504, and the processor 1501 reads the information in the memory 1504 and completes the steps of the above method in conjunction with its hardware.

[0259] The processor 1501 , the memory 1504 , and the communication interface 1503 may communicate with each other via the communication line 1502 .

[0260] 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.

[0261] The embodiment of the present application 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, computer, server or data center to another website, 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.

[0262] 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.

[0263] 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 technologies such as infrared, radio and microwave, the coaxial cable, fiber optic cable, twisted pair, DSL or wireless technologies 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 discs reproduce data optically using lasers.

[0264] The above combinations should also be included in the scope of computer-readable media. The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or replacements within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.

Claims

1. A volume adjustment method, characterized in that: Applied to an electronic device, when the electronic device simultaneously outputs multiple audio streams of the same audio stream type and receives a volume adjustment operation input by a user, the volume adjustment method includes: In response to a volume adjustment operation input by a user, in a split-screen scenario, a focus window is determined according to the split-screen scenario, and an application running in the focus window is determined as a focus application; Determining the original volume of the audio output by the focus application according to the audio stream type and the audio output device of the audio output by the focus application; Determining, according to the volume adjustment operation, a relative adjustment volume of the audio output by the focus application; Obtaining the application package name of the focus application; Using the application package name as a key and the relative volume adjustment as a value, a key-value pair for relative volume adjustment of the focus application is constructed; Determine a target volume of the audio output by the focus application according to the key-value pair and the original volume; The volume of the audio output by the focus application is adjusted to the target volume.

2. The method according to claim 1, characterized in that After determining the focus application in response to the volume adjustment operation input by the user, the method further includes: If the focus application is not an application in the first set and / or the focus application is an application in the second set, determining the target volume of the audio output by all audio output applications according to the audio stream type of the audio output by the electronic device, the audio output device, and the volume adjustment operation; wherein the first set is a set of applications that support independent volume adjustment, and the second set is a set of applications that do not support independent volume adjustment; The volume of the audio output by all the audio output applications is adjusted to the target volume.

3. The method according to claim 1, characterized in that The method further comprises: After the electronic device is restarted, the key-value pair for relatively adjusting the volume is initialized.

4. The method according to any one of claims 1 to 3, characterized in that: An application is running in the foreground of the electronic device, and the step of determining the focus application in response to a volume adjustment operation input by a user includes: When the audio stream type of the audio output by the application running in the foreground of the electronic device is the same as the audio stream type of the audio output by the application running in the background of the electronic device, the application running in the foreground is determined as the focus application.

5. The method according to claim 4, characterized in that The electronic device runs multiple application programs in the foreground, and the step of determining the focus application in response to a volume adjustment operation input by a user includes: When the audio stream types of the audio output by multiple applications running in the foreground of the electronic device are the same, the application corresponding to the focus window is determined as the focus application.

6. The method according to claim 1, characterized in that The step of adjusting the volume of the output audio of the focus application to the target volume further includes: After mixing the adjusted focus application output audio with the audio of the same type output simultaneously by other application programs, the mixed audio data is output to the audio output device.

7. The method according to claim 6, characterized in that The step of mixing the adjusted focus application output audio with the audio of the same type output by other application programs simultaneously, and outputting the mixed audio data to the audio output device comprises: Mix all audio data in the mixer; The audio driver corresponding to the audio output device is called to drive the audio output device to output the mixed audio data.

8. An electronic device, characterized in that: The electronic device comprises a processor and a memory, wherein the processor and the memory are coupled, and the memory is used to store a computer program. When the processor executes the computer program, the electronic device executes the method according to any one of claims 1 to 7.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium comprises a computer program, and when the computer program is executed on an electronic device, the electronic device executes the method according to any one of claims 1 to 7.

10. A chip system, characterized in that: The chip system is applied to an electronic device, the chip system includes one or more processors, the processor is coupled to a memory, the memory is used to store computer program instructions, and the one or more processors are used to call computer instructions so that the electronic device executes the method described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Volume adjusting method and display equipment

    CN112073797A

  • Audio playback method, and electronic device

    WO2023029967A1