Audio focus management method and apparatus, electronic device, and readable storage medium
By comparing the priority and number of requests for audio components, the audio focus of high-priority audio components is cleared, which solves the problem that high-priority audio components occupying the focus and causing low-priority components to become unusable, and enables normal playback of multiple audio components.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-30
- Publication Date
- 2026-03-20
AI Technical Summary
In in-vehicle systems, if a high-priority audio component occupies audio focus and fails to release it, low-priority audio components will be unable to request focus, resulting in entertainment media not functioning properly.
By obtaining the priorities of high-priority audio components and low-priority audio components, comparing the priorities, and when the number of requests for high-priority components reaches a threshold and the usage status is unused, the audio focus of the high-priority components is cleared, and focus is assigned to the low-priority components.
This avoids the problem of low-priority components failing to function properly due to high-priority audio components occupying audio focus for extended periods, ensuring that multiple audio components can play audio simultaneously or sequentially.
Smart Images

Figure CN115543598B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of audio management, and in particular to an audio focus management method and device, an electronic device, and a readable storage medium. BACKGROUND
[0002] With the increasing development of technology, vehicle-mounted systems are becoming more and more intelligent. To meet the various needs of users, multiple media programs, such as navigation, music, and vehicle radio, are usually installed in vehicle-mounted systems. When audio is played through incoming calls, voice, navigation, music, and vehicle radio media applications, the corresponding type of audio focus needs to be applied. For example, playing navigation audio or playing music both require the application of corresponding audio focus.
[0003] In vehicle-mounted systems, the priority of telephone applications and voice control modules is high, while the priority of navigation, music, and other media applications is low. When the voice control module or the telephone application applies for audio focus, other media applications cannot apply for audio focus. In some complex business scenarios, there may be a situation where a high-priority media application ends audio playback without releasing the audio focus. At this time, other media applications cannot apply for audio focus, which leads to the failure of entertainment media in the vehicle-mounted system to function normally. SUMMARY
[0004] One purpose of the present application is to provide an audio focus management method. By combining the number of times that a low-priority audio component applies for audio focus when a high-priority audio component occupies audio focus, the use state of the audio focus occupied by the high-priority audio component is recalled in a timely manner. When the use state is an unused state, the audio focus occupied by the high-priority audio component is cleared from the audio focus stack in a timely manner. This can avoid the problem that other audio components cannot function normally due to the failure of the audio focus to be released.
[0005] Another purpose of the present application is to provide an audio focus management method. When the priority of an audio component currently occupying audio focus is less than or equal to the priority of an audio component applying for audio focus, the audio focus is allocated to a second audio component, and the audio focus occupied by a first audio component is cleared. This can achieve the purpose of high-priority audio components occupying audio focus first.
[0006] Another purpose of the present application is to provide an audio focus management method. When the priority of an audio component currently occupying audio focus is less than or equal to the priority of an audio component applying for audio focus, the audio focus is allocated to a second audio component. This can achieve the purpose of multiple audio components occupying audio focus simultaneously.
[0007] Another object of the present application is to provide an audio focus management method, which sets different audio focus application times threshold values for audio components with a set focus expiration length and an unlimited focus expiration length, so as to avoid the problem that the audio component with a set focus expiration length occupies the audio focus even when it is not in use, and avoid the problem that the audio component with an unlimited focus expiration length needs the electronic device to frequently obtain the use state of the currently occupied audio focus when it occupies the audio focus.
[0008] Another object of the present application is to provide an audio focus management method, which, after removing the occupied audio focus from the audio focus stack, allocates the audio focus to the audio component when the audio component applies for the audio focus, so as to timely allocate the audio focus to the other audio components and play the audio normally.
[0009] Another object of the present application is to provide an audio focus management method, which, after detecting the shutdown operation of the user on the vehicle-mounted terminal, removes all the audio focuses in the audio focus stack, so as to timely remove all the audio focuses in the audio focus stack.
[0010] According to an aspect of the present application, an audio focus management method is provided, which comprises the following steps:
[0011] obtaining a first priority of a first audio component currently occupying an audio focus;
[0012] obtaining a second priority of a second audio component applying for the audio focus;
[0013] comparing the first priority with the second priority;
[0014] when the first priority is higher than the second priority, obtaining an application times of the second audio component applying for the audio focus;
[0015] when the application times reaches a threshold value of the application times corresponding to the first audio component, obtaining a use state of the currently occupied audio focus;
[0016] when the use state is an unused state, removing the currently occupied audio focus in the audio focus stack.
[0017] According to another aspect of the present application, an audio focus management device is provided, which comprises an electronic device and an audio playing device, wherein the electronic device is in communication connection with the audio playing device,
[0018] the electronic device,
[0019] obtaining a first priority of a first audio component currently occupying an audio focus;
[0020] obtaining a second priority of a second audio component applying for an audio focus;
[0021] comparing the first priority and the second priority;
[0022] in a case where the first priority is higher than the second priority, obtaining an application number of the second audio component applying for the audio focus;
[0023] in a case where the application number reaches a threshold of the application number corresponding to the first audio component, obtaining a usage state of the current occupied audio focus;
[0024] in a case where the usage state is an unused state, clearing the current occupied audio focus in an audio focus stack;
[0025] sending audio focus release information of the first audio component to the audio playing device;
[0026] the audio playing device, stopping playing audio of the first audio component.
[0027] According to another aspect of the present application, an electronic device is provided, comprising:
[0028] a memory, a processor, and a computer program stored in the memory and executable on the processor, when the computer program is executed by the processor, the audio focus management method is implemented.
[0029] According to another aspect of the present application, a readable storage medium is provided, when instructions in the readable storage medium are executed by a processor of an electronic device, the electronic device can execute the audio focus management method.
[0030] The above description is only a summary of the technical solutions of the present application, in order to more clearly understand the technical means of the present application, the content of the specification can be implemented, and in order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the following specific embodiments of the present application will be described. BRIEF DESCRIPTION OF DRAWINGS
[0031] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the description of the embodiments of the present application. Obviously, the drawings in the following description are only some embodiments of the present application, and those skilled in the art can obtain other drawings according to these drawings without creating any creative labor.
[0032] Figure 1 A step flow chart of an audio focus management method provided by the embodiments of the present application;
[0033] Figure 2 A step flowchart of an application number threshold acquisition method provided for an embodiment of the present application is provided.
[0034] Figure 3 A step flowchart of an application number acquisition method provided for an embodiment of the present application is provided.
[0035] Figure 4 A step flowchart of an audio focus allocation method provided for an embodiment of the present application is provided.
[0036] Figure 5 A structural schematic diagram of an audio focus management apparatus provided for an embodiment of the present application is provided.
[0037] Figure 6 A structural schematic diagram of an electronic device provided for an embodiment of the present application is provided. DETAILED DESCRIPTION
[0038] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without any creative work fall within the scope of protection of the present application.
[0039] Embodiment One
[0040] Referring to Figure 1 , a step flowchart of an audio focus management method provided for an embodiment of the present application is shown, as shown in Figure 1 , the audio focus management method can include the following steps:
[0041] Step 101: Acquire a first priority of a first audio component currently occupying an audio focus.
[0042] The embodiments of the present application can be applied to a scenario of managing audio focus in an audio focus stack.
[0043] An audio component refers to a component for playing audio. In the present example, the audio component can be an application program, such as a call application program, a navigation application program, a music application program, a video application program, etc.
[0044] The first audio component refers to a component currently occupying an audio focus.
[0045] The current occupied audio focus refers to an audio focus currently occupied by the first audio component, that is, the audio focus can be applied by the first audio component when the audio is played through the first audio component, and after the audio focus matching the component type of the first audio component is allocated to the first audio component, the allocated audio focus can be added to the audio focus stack.
[0046] The first priority refers to the priority of the first audio component. In specific implementation, the corresponding priority can be pre-set for different audio components, and the priority of the audio component can be used to indicate the order of occupying the audio focus by the audio component, that is, the audio component with higher priority can preferentially occupy the audio component.
[0047] When the first audio component occupies the audio focus, the first priority of the first audio component can be obtained.
[0048] After the first priority of the first audio component currently occupying the audio focus is obtained, step 102 is performed.
[0049] Step 102: Obtain the second priority of the second audio component applying for the audio focus.
[0050] The second audio component refers to an audio component applying for the audio focus in the process of the first audio component occupying the audio focus. In this example, the second audio component can be one audio component or multiple audio components, and specifically, it can be determined according to actual conditions, which is not limited in the embodiment.
[0051] The second priority refers to the priority of the second audio component applying for the audio focus.
[0052] In the process of the first audio component occupying the audio focus, when the second audio component applies for the audio focus, the second priority of the second audio component can be obtained.
[0053] After the second priority of the second audio component applying for the audio focus is obtained, step 103 is performed.
[0054] Step 103: Compare the first priority and the second priority.
[0055] After the first priority and the second priority are obtained, the first priority and the second priority can be compared, that is, the size relationship of the first priority and the second priority is compared.
[0056] When the first priority is less than or equal to the second priority, the audio focus can be allocated to the second audio component, and specifically, the following two cases can be divided:
[0057] 1. If the first priority is less than or equal to the second priority, the first audio focus (the first audio focus is the audio focus that matches the component type of the second audio component) is assigned to the second audio component. The currently occupied audio focus of the first audio component is cleared from the audio focus stack, and the first audio focus is added to the audio focus stack. That is, the second audio component occupies the audio focus, and the first audio component releases the audio focus so that the second audio component can play audio normally. For example, when a music application is playing audio, if a message is received from an incoming call application requesting audio focus, the music application stops playing audio, and the incoming call application plays the audio instead.
[0058] 2. If the first priority is less than or equal to the second priority, the second audio focus is assigned to the second audio component and added to the audio focus stack. That is, the first audio component and the second audio component play audio at the same time. For example, when a music application is playing audio and receives a message from a navigation application requesting audio focus, the navigation application and the music application can play audio at the same time.
[0059] If the first priority is higher than the second priority, then proceed to step 104.
[0060] Step 104: If the first priority is higher than the second priority, obtain the number of times the second audio component requests audio focus.
[0061] The number of requests refers to the number of times the second audio component requests audio focus.
[0062] When the first priority is higher than the second priority, the number of times the second audio component requests audio focus can be obtained, i.e., the request count. Understandably, if the same audio component in the second audio component requests audio focus multiple times, the request count can be recorded as multiple times. For example, if a navigation application in the second audio component requests audio focus three times, the request count is incremented by 3, etc.
[0063] It is understood that the above examples are merely examples listed to better understand the technical solutions of the embodiments of this application, and are not intended to be the only limitation on the embodiments.
[0064] Of course, in practical applications, a threshold for the number of requests can be preset for the audio component. Specifically, this can be combined with... Figure 2 The following is a detailed description.
[0065] Reference Figure 2 The flowchart illustrates the steps of a method for obtaining an application count threshold according to an embodiment of this application. Figure 2 As shown, the method for obtaining the application number threshold may include steps 201, 202 and 203.
[0066] Step 201: Obtain the focus expiration duration of the first audio component.
[0067] In the embodiment, the application number threshold refers to a pre-set number threshold of the second audio component applying for the audio focus for judging whether to call back the first audio component to use the audio focus, that is, when the number of times of the second audio component applying for the audio focus reaches the application number threshold, the use state of the audio focus occupied by the first audio component is obtained.
[0068] In the example, the application number threshold of the first audio component can include a first application number threshold of the first audio component and a second application number threshold of the first audio component.
[0069] The focus expiration duration refers to a pre-evaluated duration of the audio component occupying the audio focus. The focus expiration duration of the audio component can include a set duration and an unlimited duration. For the audio component capable of evaluating the duration of occupying the audio focus, the focus expiration duration of the audio component can be set as the set duration. For example, for the navigation application, the duration of the navigation application playing the navigation audio at similar intersections or road segments is usually fixed, which is usually several seconds or tens of seconds. When setting the focus expiration duration of the navigation application, the historical data of the navigation application playing the audio can be combined to select a maximum duration of playing time as the focus expiration duration. For the audio component incapable of evaluating the duration of occupying the audio focus, the focus expiration duration of the audio component can be set as the unlimited duration. For example, for the incoming call application, the specific duration of the user's call cannot be evaluated in general. At this time, the focus expiration duration of the incoming call application can be set as the unlimited duration.
[0070] It can be understood that the above examples are only examples for better understanding the technical solutions of the embodiments of the present application, and are not the only limitation of the embodiments. In the specific implementation, the specific value of the focus expiration duration of the audio component can be determined according to the business demand, which is not limited by the embodiments.
[0071] When the first priority of the first audio component is greater than the second priority of the second audio component, the focus expiration duration of the first audio component can be obtained.
[0072] After obtaining the focus expiration duration of the first audio component, step 202 is executed, or step 203 is executed.
[0073] Step 202: If the focus expiration duration is a set duration, a first application number threshold of the first audio component is obtained.
[0074] Step 203: if the focus expiration time length is an unlimited time length, obtaining a second application number threshold of the first audio component.
[0075] After obtaining the focus expiration time length of the first audio component, it can be determined whether the focus expiration time length is a set time length or an unlimited time length. If the focus expiration time length is a set time length, a first application number threshold of the first audio component can be obtained. If the focus expiration time length is an unlimited time length, a second application number threshold of the first audio component can be obtained, and the second application number threshold is greater than the first application number threshold.
[0076] The embodiments of the present application can set different audio focus application number thresholds for audio components with a set time length and an unlimited time length for the focus expiration time length. On the one hand, the problem that an audio component with a set time length for the focus expiration time length still occupies an audio focus when the audio focus is not used can be avoided. On the other hand, the problem that an audio component with an unlimited time length for the focus expiration time length frequently obtains the use state of an audio focus occupied by the audio component when the audio focus is occupied can be avoided.
[0077] For the above process of obtaining the application number of the audio component applying for the audio focus, the judgment of the focus expiration time length needs to be performed first. Specifically, the use state of the current occupied audio focus can be obtained in combination with the focus expiration time length of the first audio component. Figure 3 The following will be described in detail.
[0078] Referring to Figure 3 , a step flowchart of an application number obtaining method provided by an embodiment of the present application is shown. As shown in Figure 3 , the application number obtaining method can include steps 301 and 302.
[0079] Step 301: determining whether the time length for which the first audio component uses the current occupied audio focus is greater than or equal to the focus expiration time length.
[0080] In the embodiment, after obtaining the focus expiration time length of the first audio component, it can be determined whether the time length for which the first audio component uses the current occupied audio focus is greater than or equal to the focus expiration time length.
[0081] Step 302: obtaining the application number of the second audio component applying for the audio focus.
[0082] If the time length for which the first audio component uses the current occupied audio focus is greater than or equal to the focus expiration time length of the first audio component, the counting of the application number can be started, that is, the number of times of the second audio component applying for the audio focus starts to be counted.
[0083] If the duration of the first audio component currently occupying the audio focus is less than the focus expiration duration of the first audio component, the counting continues until the duration of the first audio component currently occupying the audio focus is greater than or equal to the focus expiration duration of the first audio component, and then the number of applications of the second audio component for the audio focus is obtained.
[0084] After obtaining the number of applications of the second audio component for the audio focus, step 105 is performed.
[0085] Step 105: If the number of applications reaches the application number threshold corresponding to the first audio component, the use state of the current audio focus is obtained.
[0086] After obtaining the number of applications of the second audio component for the audio focus, the size relationship between the number of applications and the application number threshold can be compared.
[0087] If the number of applications is less than the application number threshold, the counting continues until the number of applications of all second audio components (i.e., the total number of applications of all second audio components for the audio focus) is equal to the application number threshold.
[0088] If the number of applications is equal to the application number threshold (i.e., the number of applications reaches the application number threshold of the first audio component), the use state of the current audio focus, i.e., the state of the first audio component using the current audio focus, can be obtained. In this example, the use state of the current audio focus can include a using state and a non-using state.
[0089] After obtaining the use state of the current audio focus corresponding to the first audio component, step 106 is performed.
[0090] Step 106: If the use state is a non-using state, the current audio focus in the audio focus stack is cleared.
[0091] After obtaining the use state of the current audio focus corresponding to the first audio component, if the use state of the current audio focus is a non-using state, it indicates that the first audio component no longer uses the current audio focus. At this time, the current audio focus can be cleared from the audio focus stack to not affect the normal use of other audio components.
[0092] If the use state of the current audio focus is a using state, the counting starts again, i.e., the counting of the number of applications of other audio components for the audio focus starts again until the number of applications reaches the application number threshold, and then the use state of the current audio focus is obtained. The cycle is repeated until the use state of the current audio focus is a non-using state.
[0093] The embodiment of the present application can avoid the problem that the high-priority audio component cannot normally use the audio focus due to long-time occupation of the audio focus by the high-priority audio component.
[0094] In the embodiment, after the currently occupied audio focus is removed from the audio focus stack, the audio focus can be allocated to the other audio component in time when the other audio component applies for the audio focus. Specifically, the audio focus can be allocated to the other audio component in combination with Figure 4 The following is a detailed description.
[0095] Referring to Figure 4 , a step flowchart of an audio focus allocation method provided by the embodiment of the present application is shown, as shown in Figure 4 , the audio focus allocation method can include steps 401 and 402.
[0096] Step 401: Obtain application information of a third audio component applying for an audio focus.
[0097] In the embodiment, the third audio component refers to an audio component applying for an audio focus after the currently occupied audio focus in the audio focus stack is removed.
[0098] After the currently occupied audio focus is removed from the audio focus stack, the application information of the third audio component applying for the audio focus can be obtained.
[0099] After the application information of the third audio component applying for the audio focus is obtained, step 402 is performed.
[0100] Step 402: Allocate a third audio focus to the third audio component, and add the third audio focus to the audio focus stack.
[0101] The third audio focus refers to an audio focus matching the component type of the third audio component.
[0102] After the application information of the third audio component applying for the audio focus is obtained, the third audio focus can be allocated to the third audio component, and the third audio focus can be added to the audio focus stack.
[0103] The embodiment of the present application can allocate the audio focus to the other audio component in time after the occupied audio focus is removed from the audio focus stack, so as to achieve the purpose of allocating the audio focus to the other audio component in time and playing the audio normally.
[0104] In the embodiment, a cleaning strategy of the audio focus in the audio focus stack can also be set for the vehicle terminal. Specifically, after detecting the shutdown operation of the vehicle terminal by the user, all the audio focuses in the audio focus stack can be cleared. Through the strategy, all the audio focuses in the audio focus stack can be cleared in time, and the normal use of the media application after the vehicle terminal is started is not affected.
[0105] The audio focus management method provided in the embodiment of the application includes the following steps: obtaining a first priority of a first audio component currently occupying an audio focus; obtaining a second priority of a second audio component applying for the audio focus; comparing the first priority and the second priority; obtaining an application number of the second audio component applying for the audio focus in a case where the first priority is higher than the second priority; obtaining a use state of the audio focus currently occupied in a case where the application number reaches a threshold value of the application number corresponding to the first audio component; and clearing the audio focus currently occupied in the audio focus stack in a case where the use state is an unused state. In the embodiment of the application, when the audio focus occupied by the high-priority audio component is recalled, the use state of the audio focus is combined with the number of times of applying for the audio focus by the low-priority audio component, and the use state of the audio focus occupied by the high-priority audio component is cleared from the audio focus stack in a case where the use state is the unused state. Therefore, the problem that other audio components cannot be normally used due to the failure of releasing the audio focus can be avoided.
[0106] Embodiment two
[0107] Reference Figure 5 Fig. 1 shows a structural schematic diagram of an audio focus management device provided in an embodiment of the application. As shown in Fig. 1, the audio focus management device 500 can include an electronic device 510 and an audio playing device 520, and the electronic device 510 is in communication connection with the audio playing device 520. Figure 5
[0108] The electronic device 510,
[0109] obtains a first priority of a first audio component currently occupying an audio focus.
[0110] In the embodiment, the first audio component refers to a component currently occupying the audio focus.
[0111] The audio focus currently occupied refers to the audio focus currently occupied by the first audio component, that is, the audio focus can be applied by the first audio component when the audio is played through the first audio component. After the audio focus matching the component type of the first audio component is allocated to the first audio component, the allocated audio focus can be added to the audio focus stack.
[0112] The first priority refers to the priority of the first audio component. In a specific implementation, different audio components can be pre-configured with corresponding priorities. The priority of an audio component can be used to indicate the order in which the audio component occupies the audio focus, that is, an audio component with a higher priority can occupy the audio focus first.
[0113] When the first audio component occupies the audio focus, the first priority of the first audio component can be obtained.
[0114] After the electronic device 510 obtains the first priority of the first audio component, the electronic device 510 can perform the next step.
[0115] The second priority of a second audio component that applies for the audio focus is obtained.
[0116] The second audio component refers to an audio component that applies for the audio focus in the process in which the first audio component occupies the audio focus. In this example, the second audio component can be one audio component or multiple audio components. Specifically, this can be determined according to actual conditions, and the present embodiment does not limit this.
[0117] The second priority refers to the priority of the second audio component that applies for the audio focus.
[0118] In the process in which the first audio component occupies the audio focus, when there is a second audio component that applies for the audio focus, the electronic device 510 can obtain the second priority of the second audio component.
[0119] After the electronic device 510 obtains the second priority of the second audio component, the electronic device 510 can perform the next step.
[0120] The first priority and the second priority are compared.
[0121] After the electronic device 510 obtains the first priority of the first audio component and the second priority of the second audio component, the electronic device 510 can compare the size relationship between the first priority and the second priority.
[0122] If the first priority is less than or equal to the second priority, the electronic device 510 can assign the audio focus to the second audio component. Specifically, this can be divided into the following two cases:
[0123] 1. In a case where the first priority is less than or equal to the second priority, the first audio focus (the first audio focus is an audio focus matching a component type of the second audio component) is assigned to the second audio component, the current occupied audio focus of the first audio component in the audio focus stack is cleared, and the first audio focus is added to the audio focus stack, that is, the second audio component occupies the audio focus, and the first audio component releases the audio focus, so that the second audio component normally plays audio. For example, when a music application plays audio, information of an incoming call application applying for an audio focus is received, the music application stops playing audio, and the incoming call application plays audio.
[0124] 2. In a case where the first priority is less than or equal to the second priority, the second audio focus is assigned to the second audio component, and the second audio focus is added to the audio focus stack, that is, the first audio component and the second audio component play audio at the same time. For example, when a music application plays audio, information of a navigation application applying for an audio focus is received, at this time, the navigation application and the music application can play audio at the same time.
[0125] In a case where the first priority is higher than the second priority, the electronic device 510 can perform the next step.
[0126] In a case where the first priority is higher than the second priority, the number of times of applying for an audio focus by the second audio component is obtained.
[0127] The number of times of applying for an audio focus refers to the number of times of applying for an audio focus by the second audio component.
[0128] In a case where the first priority is higher than the second priority, the electronic device 510 can obtain the number of times of applying for an audio focus by the second audio component, that is, the number of times of applying.
[0129] After the electronic device 510 obtains the number of times of applying for an audio focus by the second audio component, the electronic device 510 can perform the next step.
[0130] In a case where the number of times of applying reaches a number of times of applying threshold corresponding to the first audio component, a use state of the current occupied audio focus is obtained.
[0131] After the electronic device 510 obtains the number of times of applying for an audio focus by the second audio component, the electronic device 510 can compare the number of times of applying and the number of times of applying threshold.
[0132] If the number of times of applying is less than the number of times of applying threshold, the electronic device 510 can continue counting until the number of times of applying of all the second audio components (that is, the total number of times of applying for an audio focus by all the second audio components) is equal to the number of times of applying threshold.
[0133] If the application times is equal to the application times threshold (i.e., the application times reaches the application times threshold of the first audio component), the electronic device 510 can obtain the use state of the current audio focus, i.e., the state in which the first audio component uses the current audio focus. In this example, the use state of the current audio focus can include a use state and a non-use state.
[0134] After the electronic device 510 obtains the use state of the current audio focus, the electronic device 510 can perform the next step.
[0135] In the case where the use state is the non-use state, the current audio focus in the audio focus stack is cleared.
[0136] After the electronic device 510 obtains the use state of the current audio focus corresponding to the first audio component, when the use state of the current audio focus is the non-use state, it indicates that the first audio component no longer uses the current audio focus. At this time, the electronic device 510 can clear the current audio focus from the audio focus stack to avoid affecting the normal use of other audio components.
[0137] If the use state of the current audio focus is the use state, the electronic device 510 can restart counting, i.e., start counting the application times of the other audio components applying for the audio focus again, until the application times reaches the application times threshold, and then obtain the use state of the current audio focus, and sequentially cycle until the use state of the current audio focus is the non-use state.
[0138] The embodiments of the present application can timely call back the use state of the audio focus occupied by the high-priority audio focus. When the use state is the non-use state, the audio focus occupied by the high-priority audio component is cleared from the audio focus stack in a timely manner, which can avoid the problem that the high-priority audio component occupies the audio focus for a long time, causing other audio components to be unable to be normally used.
[0139] The audio focus release information of the first audio component is sent to the audio playback device 520.
[0140] After the electronic device 510 clears the current audio focus from the audio focus stack, the electronic device 510 can generate the audio focus release information of the first audio component, and send the audio focus release information of the first audio component to the audio playback device 520, where the audio playback device 520 can be a speaker, a loudspeaker, or the like.
[0141] The audio playback device 520 stops playing the audio of the first audio component.
[0142] After the audio playback device 520 receives the audio focus release information of the first audio component sent by the electronic device 510, the audio playback device 520 can stop playing the audio of the first audio component.
[0143] The embodiments of the present application can avoid the problem that the high-priority audio component occupies the audio focus for a long time, causing other audio components to be unable to normally use the audio focus, by timely recalling the use state of the audio focus occupied by the high-priority audio focus, and clearing the audio focus occupied by the high-priority audio component from the audio focus stack when the use state is the unused state.
[0144] The audio focus management apparatus provided by the embodiments of the present application can avoid the problem that the audio focus is not released, causing other audio components to be unable to normally use the audio focus, by obtaining, by an electronic device, a first priority of a first audio component currently occupying an audio focus, obtaining a second priority of a second audio component applying for the audio focus, comparing the first priority and the second priority, obtaining an application number of the second audio component applying for the audio focus in the case that the first priority is higher than the second priority, obtaining a use state of the audio focus currently occupied in the case that the application number reaches a threshold value of the application number corresponding to the first audio component, clearing the audio focus currently occupied in the audio focus stack in the case that the use state is an unused state, and sending audio focus release information of the first audio component to an audio playback device, and the audio playback device stops playing the audio of the first audio component.
[0145] Embodiment Three
[0146] The embodiments of the present application provide an electronic device, which comprises a memory, a processor, and a computer program stored in the memory and capable of running on the processor, and the computer program is executed by the processor to implement the audio focus management method.
[0147] Figure 6 A structural schematic diagram of an electronic device 600 is shown. Figure 6As shown, the electronic device 600 includes a central processing unit (CPU) 601 that can perform various appropriate actions and processes in accordance with computer program instructions stored in a read-only memory (ROM) 602 or loaded from a storage unit 608 into a random access memory (RAM) 603. Various programs and data required for operation of the electronic device 600 can also be stored in the RAM 603. The CPU 601, ROM 602, and RAM 603 are connected to each other by a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0148] A plurality of components in the electronic device 600 are connected to the I / O interface 605, including an input unit 606 such as a keyboard, mouse, microphone, etc., an output unit 607 such as various types of displays, speakers, etc., a storage unit 608 such as a magnetic disk, optical disk, etc., and a communication unit 609 such as a network card, modem, wireless communication transceiver, etc. The communication unit 609 allows the electronic device 600 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0149] The various processes and processes described above can be performed by the CPU 601. For example, the method of any of the embodiments described above can be implemented as a computer software program that is tangibly embodied in a computer readable medium such as the storage unit 608. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 600 via the ROM 602 and / or the communication unit 609. When the computer program is loaded into the RAM 603 and executed by the CPU 601, one or more actions of the method described above can be performed.
[0150] Embodiment Four
[0151] The embodiments of the present application also provide a computer readable storage medium, and the computer readable storage medium stores a computer program. The computer program is executed by a processor to implement various processes of the above-mentioned audio focus management method embodiments, and can achieve the same technical effects. To avoid repetition, details are not described here. The computer readable storage medium includes, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0152] It should be noted that, in the present document, the terms "comprises", "comprising", or any other variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can also include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element preceded by "comprises... a" does not, without more constraints, foreclose the existence of additional identical elements in the process, method, article, or apparatus that comprises the element.
[0153] Those skilled in the art can clearly understand that the above-mentioned embodiment method can be realized by means of software and necessary general hardware platform, of course, it can also be realized by hardware, but in many cases, the former is a better embodiment. Based on such understanding, the technical solutions of the present application can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, or optical disc) and includes a plurality of instructions for causing a terminal (which can be a mobile phone, computer, server, air conditioner, or network device) to execute the methods described in various embodiments of the present application.
[0154] The embodiments of the present application are described above in combination with the drawings, but the present application is not limited to the above-mentioned specific embodiments, and the above-mentioned specific embodiments are only illustrative, not restrictive. Those skilled in the art can make many forms under the inspiration of the present application without departing from the scope of the present application and the protection scope of the claims.
[0155] Those skilled in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed in the embodiments of the present application can be realized by electronic hardware or a combination of computer software and electronic hardware. Whether the functions are executed in hardware or software depends on the specific application and design constraints of the technical solutions. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.
[0156] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described system, device, and unit can refer to the corresponding processes in the foregoing method embodiments, which will not be described here.
[0157] In the embodiments of the present application, it should be understood that the disclosed apparatus and method can be implemented in other manners. For example, the described embodiments of the apparatus are merely schematic. The units as divided can or can not be physically reallocated, and can or can not be components independent of each other. In some embodiments, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections can be indirect couplings or communication connections through some interfaces, devices or units, and can be in electric, mechanical or other forms.
[0158] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, i.e., can be located in one place, or can be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purposes of the embodiments.
[0159] In addition, each functional unit in the various embodiments of the present application can be integrated into a processing unit, or each unit can be a physically independent unit, or two or more units can be integrated into a unit.
[0160] If the functions are realized in the form of software function units and sold or used as independent products, they can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application can be embodied in the form of a software product, and the computer software product is stored in a storage medium, and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, ROM, RAM, magnetic disk or optical disk, and various program codes that can be stored in the medium.
[0161] The above description is merely specific embodiments of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art can easily think of changes or replacements within the technical scope disclosed in the present application, which should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. An audio focus management method, characterized in that, The method includes the following steps: Get the first priority of the first audio component currently holding audio focus; The second priority of the second audio component that requests audio focus; Compare the first priority and the second priority; If the first priority is higher than the second priority, obtain the number of times the second audio component requests audio focus; If the number of requests reaches the request threshold corresponding to the first audio component, the current usage status of the audio focus is obtained; If the usage state is unused, clear the currently occupied audio focus from the audio focus stack.
2. The method according to claim 1, further comprising the following step after comparing the first priority and the second priority: If the first priority is less than or equal to the second priority, the first audio focus is assigned to the second audio component, the currently occupied audio focus is cleared from the audio focus stack, and the first audio focus is added to the audio focus stack. The first audio focus is the audio focus that matches the component type of the second audio component.
3. The method according to claim 1, further comprising the following step after comparing the first priority and the second priority: If the first priority is less than or equal to the second priority, the second audio focus is assigned to the second audio component, and the second audio focus is added to the audio focus stack; The second audio focus is the audio focus that matches the component type of the second audio component.
4. The method according to claim 1, wherein the application count threshold corresponding to the first audio component includes: The first application count threshold and the second application count threshold of the first audio component. Before obtaining the number of times the second audio component requests audio focus, the following steps are also included: Get the focus expiration duration of the first audio component; If the focus expiration time is a set time, then obtain the first application count threshold of the first audio component; If the focus expiration time is unlimited, then obtain the second application count threshold of the first audio component; Wherein, the first application number threshold is less than the second application number threshold.
5. The method according to claim 4, wherein obtaining the number of times the second audio component requests audio focus includes the following steps: Determine whether the duration for which the first audio component uses the currently occupied audio focus is greater than or equal to the focus expiration duration; If so, then obtain the number of times the second audio component requests audio focus.
6. The method according to claim 1, after clearing the currently occupied audio focus in the audio focus stack, further comprising the following step: Obtain the application information for the third audio component to apply for audio focus; Assign the third audio focus to the third audio component and add the third audio focus to the audio focus stack; The third audio focus is an audio focus that matches the component type of the third audio component.
7. The method according to claim 1, further comprising the following steps: After detecting that the user has turned off the vehicle terminal, all audio focuses in the audio focus stack are cleared.
8. An audio focus management device, characterized in that, The audio focus management device includes an electronic device and an audio playback device, wherein the electronic device is communicatively connected to the audio playback device. The electronic device, Get the first priority of the first audio component currently holding audio focus; The second priority of the second audio component that requests audio focus; Compare the first priority and the second priority; If the first priority is higher than the second priority, obtain the number of times the second audio component requests audio focus; If the number of requests reaches the request threshold corresponding to the first audio component, the current usage status of the audio focus is obtained; When the usage state is unused, the currently occupied audio focus is cleared from the audio focus stack; Send the audio focus release information of the first audio component to the audio playback device; The audio playback device stops playing the audio from the first audio component.
9. An electronic device, characterized in that, include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the audio focus management method as described in any one of claims 1 to 7.
10. A readable storage medium, characterized in that, When the instructions in the readable storage medium are executed by the processor of the electronic device, the electronic device is able to perform the audio focus management method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Audio focus control method and system of vehicle-mounted system and vehicle-mounted system
CN109996099A
Audio control method, electronic equipment and computer readable storage medium
CN111694536A