Method, device, equipment and storage medium for allocating audio processing channels
By determining the main audio type and backup audio type of the application on the vehicle terminal, if the main audio type is occupied, the unoccupied channel of the backup audio type is allocated, which solves the problem of audio focus application delay and improves the allocation efficiency of audio processing channels.
Patent Information
- Application Number
- CN202211643644.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-20
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2042-12-20
AI Technical Summary
In the automotive field, when an application installed on a vehicle terminal applies for audio focus, the application currently occupying the audio focus delays releasing the audio processing channel notification, causing the application applying for audio focus to delay audio output.
By determining the primary audio type and the backup audio type corresponding to the first application, if the primary audio type is occupied, the unoccupied audio processing channel corresponding to the backup audio type is allocated to the first application, ensuring timely allocation of the audio processing channel.
This reduces the possibility of delayed audio output by the first application, improves the efficiency of allocating audio processing channels, and avoids audio delay problems caused by delays.
Smart Images

Figure CN116017238B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, apparatus, device, and storage medium for allocating audio processing channels. Background Art
[0002] In the automotive field, many types of applications are installed on vehicle terminals, such as navigation, communication, audio and video, and games. When using these applications, audio output is sometimes required. Before outputting audio, the application needs to apply for audio focus from the system to obtain the right to use the audio processing channel and then output audio. In some systems, the audio processing channel can be divided into multiple independent audio processing channels based on the audio type. One audio type corresponds to one audio processing channel, and an audio processing channel can only be occupied by one application at the same time. Among them, audio types can include call audio type, game audio type, and music audio type.
[0003] If the audio type corresponding to the application currently requesting audio focus is the same as that of the application currently occupying audio focus, the system sends a notification to the application currently occupying audio focus to exit the audio processing channel it occupies. After the application currently occupying audio focus exits the audio processing channel it occupies, the application currently requesting audio focus can occupy the corresponding audio processing channel.
[0004] However, sometimes the application currently occupying the audio focus may delay receiving the notification of exiting the audio processing channel, which means that the application currently applying for audio focus cannot occupy the corresponding audio processing channel in time, further causing the application currently applying for audio focus to delay audio output. Summary of the Invention
[0005] The embodiments of the present application provide a method, apparatus, device, and storage medium for allocating audio processing channels, which can solve the problems of related technologies. The technical solution is as follows:
[0006] In a first aspect, a method for allocating audio processing channels is provided, the method comprising:
[0007] receiving an audio focus request sent by a first application;
[0008] Determining a primary audio type corresponding to the first application;
[0009] If the audio processing channel corresponding to the primary audio type is occupied, determining a backup audio type corresponding to the first application, wherein the playback priority corresponding to the backup audio type is equal to the playback priority corresponding to the primary audio type;
[0010] Allocate unoccupied audio processing channels among the audio processing channels corresponding to the backup audio type to the first application.
[0011] In a possible implementation, determining the primary audio type corresponding to the first application includes:
[0012] Determining a first application type corresponding to the first application;
[0013] Determining, based on a pre-stored correspondence between application types and primary audio types, the primary audio type corresponding to the first application type as the primary audio type corresponding to the first application program;
[0014] The determining the backup audio type corresponding to the first application includes:
[0015] Based on a pre-stored correspondence between application types and backup audio types, the backup audio type corresponding to the first application type is determined as the backup audio type corresponding to the first application program.
[0016] In a possible implementation, in the correspondence between the application type and the primary audio type, the primary audio type corresponding to the application type to which each application belongs is the type of audio played by the application;
[0017] In the correspondence between the application type and the backup audio type, the backup audio type corresponding to the application type to which each application belongs is not the type of the audio played by the application.
[0018] In a possible implementation, the method further includes:
[0019] Determining, based on a pre-stored correspondence between the overall application type, application type, and audio type, an audio type corresponding to the second application type, and determining an audio type corresponding to a third application type corresponding to the same overall application type as the second application type, wherein, in the correspondence between the overall application type, application type, and audio type, audio types corresponding to the same overall application type have the same playback priority;
[0020] The second application type and the corresponding audio type are added to the correspondence between the application type and the main audio type, and the second application type and the audio type corresponding to the third application type are added to the correspondence between the application type and the backup audio type.
[0021] In a possible implementation, the first application corresponds to multiple backup audio types, and the multiple backup audio types have different usage orders;
[0022] Allocating an unoccupied audio processing channel among the audio processing channels corresponding to the backup audio type to the first application includes:
[0023] Acquire backup audio types in the order of use. Each time a backup audio type is acquired, if the audio processing channel corresponding to the currently acquired backup audio type is occupied, continue to acquire the next backup audio type. If the audio processing channel corresponding to the currently acquired backup audio type is not occupied, allocate the audio processing channel corresponding to the currently acquired backup audio type to the first application.
[0024] In a possible implementation, after receiving the audio focus request sent by the first application, the method further includes:
[0025] Obtaining a setting requirement for applying for audio focus corresponding to the first application, wherein the setting requirement includes a mute release setting requirement and / or a mixed playback setting requirement, wherein the mute release setting requirement is used to indicate whether to release the mute state if the system is in a muted state, and the mixed playback setting requirement is used to indicate whether to mix the audio with the audio of other audio processing channels for playback;
[0026] Based on the setting requirements, the audio of the first application is played.
[0027] In a possible implementation, after determining the primary audio type corresponding to the first application, the method further includes:
[0028] If the audio processing channel corresponding to the primary audio type is not occupied, the audio processing channel corresponding to the primary audio type is allocated to the first application.
[0029] In a second aspect, a device for allocating audio processing channels is provided, the device comprising:
[0030] A receiving module, configured to receive an audio focus request sent by a first application;
[0031] a determination module, configured to determine a primary audio type corresponding to the first application; and if the audio processing channel corresponding to the primary audio type is occupied, determining a backup audio type corresponding to the first application, wherein the playback priority corresponding to the backup audio type is equal to the playback priority corresponding to the primary audio type;
[0032] An allocating module is used to allocate unoccupied audio processing channels among the audio processing channels corresponding to the backup audio type to the first application.
[0033] In a possible implementation, the determining module is configured to:
[0034] Determining a first application type corresponding to the first application;
[0035] Determining, based on a pre-stored correspondence between application types and primary audio types, the primary audio type corresponding to the first application type as the primary audio type corresponding to the first application program;
[0036] Based on a pre-stored correspondence between application types and backup audio types, the backup audio type corresponding to the first application type is determined as the backup audio type corresponding to the first application program.
[0037] In a possible implementation, in the correspondence between the application type and the primary audio type, the primary audio type corresponding to the application type to which each application belongs is the type of audio played by the application;
[0038] In the correspondence between the application type and the backup audio type, the backup audio type corresponding to the application type to which each application belongs is not the type of the audio played by the application.
[0039] In a possible implementation, the determining module is further configured to:
[0040] Determining, based on a pre-stored correspondence between the overall application type, application type, and audio type, an audio type corresponding to the second application type, and determining an audio type corresponding to a third application type corresponding to the same overall application type as the second application type, wherein, in the correspondence between the overall application type, application type, and audio type, audio types corresponding to the same overall application type have the same playback priority;
[0041] The second application type and the corresponding audio type are added to the correspondence between the application type and the main audio type, and the second application type and the audio type corresponding to the third application type are added to the correspondence between the application type and the backup audio type.
[0042] In a possible implementation, the first application corresponds to multiple backup audio types, and the multiple backup audio types have different usage orders;
[0043] The allocation module is used to:
[0044] Acquire backup audio types in the order of use. Each time a backup audio type is acquired, if the audio processing channel corresponding to the currently acquired backup audio type is occupied, continue to acquire the next backup audio type. If the audio processing channel corresponding to the currently acquired backup audio type is not occupied, allocate the audio processing channel corresponding to the currently acquired backup audio type to the first application.
[0045] In a possible implementation, the receiving module is further configured to:
[0046] Obtaining a setting requirement for applying for audio focus corresponding to the first application, wherein the setting requirement includes a mute release setting requirement and / or a mixed playback setting requirement, wherein the mute release setting requirement is used to indicate whether to release the mute state if the system is in a muted state, and the mixed playback setting requirement is used to indicate whether to mix the audio with the audio of other audio processing channels for playback;
[0047] Based on the setting requirements, the audio of the first application is played.
[0048] In a possible implementation, the determining module is further configured to:
[0049] If the audio processing channel corresponding to the primary audio type is not occupied, the audio processing channel corresponding to the primary audio type is allocated to the first application.
[0050] In a third aspect, a computer device is provided, comprising a memory and a processor, wherein the memory is used to store computer instructions; the processor executes the computer instructions stored in the memory so that the computer device executes the method of the first aspect and its possible implementation methods.
[0051] In a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer program code. In response to the computer program code being executed by a computer device, the computer device executes the method of the first aspect and possible implementations thereof.
[0052] In a fifth aspect, a computer program product is provided, the computer program product comprising computer program code. In response to the computer program code being executed by a computer device, the computer device executes the method of the first aspect and possible implementations thereof.
[0053] The technical solutions provided by the embodiments of the present application may have the following beneficial effects:
[0054] Through the method provided in the embodiment of the present application, after the first application sends an audio focus request to the system program, the system program determines whether the audio processing channel corresponding to the primary audio type corresponding to the first application is occupied. If so, the system program determines the backup audio type corresponding to the first application and allocates the audio processing channel corresponding to the backup audio type to the first application. In this way, when the audio processing channel corresponding to the primary audio type is occupied, an unoccupied audio processing channel is selected from the audio processing channel corresponding to the backup audio type. In this way, the first application will not delay outputting audio due to the delay in releasing the audio processing channel, thereby reducing the possibility of the first application delaying outputting audio. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0056] Figure 1 This is a schematic diagram of the structure of a terminal provided in an embodiment of the present application;
[0057] Figure 2 1 is a flow chart of a method for allocating audio processing channels provided in an embodiment of the present application;
[0058] Figure 3 is a schematic diagram of an audio processing channel provided in an embodiment of the present application;
[0059] Figure 4 1 is a flow chart of a method for allocating audio processing channels provided in an embodiment of the present application;
[0060] Figure 5 This is a structural diagram of a device for allocating audio processing channels provided in an embodiment of the present application;
[0061] Figure 6 This is a structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0062] An embodiment of the present application provides a method for allocating audio processing channels, which is used to allocate audio processing channels to applications that apply for audio focus based on audio types, so that the terminal can play the audio corresponding to the application. The method is applied to terminals, such as vehicle-mounted terminals, mobile phones, computers, tablet computers, wearable devices, etc. The execution subject of the method can be a system program of the terminal, a functional plug-in of the system program, or an application for assisting the system program, etc. The embodiment of the present application takes the execution subject as the system program as an example to provide a detailed description of the solution, and other similar situations will not be repeated here.
[0063] From the perspective of hardware composition, the structure of the terminal can be as follows Figure 1 As shown, it includes a processor 110 , a memory 120 , a display component 130 and an audio output component 140 .
[0064] The processor 110 may be a CPU (central processing unit) or a SoC (system on chip), etc. The processor 110 may be configured to execute various instructions involved in the method.
[0065] The memory 120 may include various volatile or non-volatile memories, such as an SSD (solid state disk) or a DRAM (dynamic random access memory). The memory 120 may be used to store pre-stored data, intermediate data, and result data in the process of determining the primary audio type corresponding to the first application, such as the correspondence between the application type and the primary audio type.
[0066] The display component 130 may be an independent screen, or a screen integrated with the terminal body, a projector, etc. The screen may be a touch screen or a non-touch screen. The display component is used to display the interface corresponding to the application, etc.
[0067] The audio output component 140 can be a speaker, earphones, etc., for playing audio.
[0068] In addition to the processor and memory, the terminal may also include communication components, audio acquisition components, etc.
[0069] The communication component may be a wired network connector, a WiFi (wireless fidelity) module, a Bluetooth module, a cellular network communication module, etc. The communication component may be used to transmit data with other devices, such as servers or other terminals.
[0070] The audio collection component may be a microphone, which is used to collect the user's voice.
[0071] A large number of applications that require audio playback can run on the terminal, such as media playback applications, navigation applications, voice assistant applications, calling applications, etc. Some applications may play the same type of audio, while some applications may play different types of audio. Multiple audio processing channels are established in the system program, and each audio processing channel processes one type of audio. When using the terminal, users will run different applications. When an application that requires audio playback is running, it may request an audio processing channel from the system program for audio playback. When requesting an audio processing channel, the audio processing channel requested may or may not be occupied by other applications. In this case, a corresponding method is needed to allocate audio processing channels.
[0072] A skilled person can write a function code package for executing the method of allocating audio processing channels.
[0073] The function code package may include a resource file and a code framework. The resource file stores the correspondence between the system identifier, parameter identifier and parameter value string. Each parameter identifier corresponds to a parameter involved in the method of executing the allocation of audio processing channels. These parameters may include indication information of the need to release mute, indication information of not needing to release mute, indication information of accepting mixed playback, indication information of not accepting mixed playback, file name of the correspondence between application type and main audio type, file name of the correspondence between application type and backup audio type, file name of the correspondence between application type, application type and audio type, etc. The code framework consists of multiple statements, among which parameter identifiers are located at specific positions of some statements. By replacing the parameter identifiers in the code framework with corresponding parameter value strings, the execution code can be obtained. The correspondence between the system identifier, parameter identifier and parameter value string can be shown in Table 1.
[0074] Table 1
[0075]
[0076]
[0077] Before executing the method for allocating audio processing channels, the function code package can generate execution code based on the resource file and code framework. The execution code is used to directly execute the method for allocating audio processing channels. The process of generating the execution code can be as follows:
[0078] Obtain the system identifier of the system program currently installed on the terminal. Based on the currently obtained system identifier, retrieve all corresponding parameter identifiers and corresponding parameter value strings from the resource file. For each parameter identifier, determine the location of the parameter identifier in the code frame and replace the parameter identifier with the corresponding parameter value string at each location. After replacing all parameter identifiers in the code frame, the executable code is obtained.
[0079] The embodiment of the present application provides a method for allocating audio processing channels for the above application scenarios. The processing flow of the method can be as follows: Figure 2 As shown, the following processing steps are included:
[0080] 201: Receive an audio focus request sent by a first application.
[0081] The audio focus request carries identification information of the first application, and the identification information may be the name and / or application type of the first application.
[0082] In implementation, the first application sends an audio focus request to the system program in response to a preset trigger event. The preset trigger event may be an operation behavior of the user. For example, the user enters a page of the first application by clicking, or clicks an operation button on a page of the first application. The first application may send an audio focus request to the system program based on these click operations. The preset trigger event may also be a local trigger event of the first application, such as a timer alarm. The first application sends an audio focus request to the system program at a preset time point. The preset trigger event may also be that the first application receives a notification message from the network side. For example, the first program sends an audio focus request to the system program after receiving an incoming call notification or a text message notification. After receiving the audio focus request, the system program may obtain the name of the first application, the application type, etc. from the audio focus request.
[0083] 202. Obtain the setting requirements for applying for audio focus corresponding to the first application.
[0084] The setting requirements may include a mute release setting requirement and / or a mixed playback setting requirement. The mute release setting requirement indicates whether to release the system if it is in a muted state. The mixed playback setting requirement indicates whether to mix and play audio with audio from other audio processing channels.
[0085] In implementation, after receiving the audio focus request, the system program obtains whether the first application has a need to unmute the audio or to mix and play the audio with other audio processing channels.
[0086] 203. Determine the primary audio type corresponding to the first application.
[0087] In implementation, the system program may determine the primary audio type corresponding to the first application based on the identification information carried in the audio focus request sent by the first application.
[0088] The processing steps for determining the primary audio type corresponding to the first application may be as follows.
[0089] Step 1: Determine a first application type corresponding to the first application program.
[0090] The first application type may be a music application type, a game application type, a call application type, or the like.
[0091] In the case where the identification information is the name of the first application, a correspondence table between application names and application types may be stored in the system program, and the first application type of the first application may be determined by looking up the table based on the obtained identification information of the first application.
[0092] In the case where the identification information is the application type of the first application, the system program can directly obtain the first application type of the first application from the audio focus request sent by the application.
[0093] The identification information is a combination of the name and application type of the first application. The system program can read the contents of a fixed field in the identification information to determine the application type of the first application. For example, if the identification information is "abc001," where "abc" represents the name of the first application and "001" represents the application type of the first application, the system program can determine from the "001" in the identification information that the application type of the first application is music.
[0094] Step 2: Based on the pre-stored correspondence between application types and primary audio types, determine the primary audio type corresponding to the first application type as the primary audio type corresponding to the first application program.
[0095] Among them, in the correspondence between the application type and the main audio type, the main audio type corresponding to the application type to which each application belongs is the actual type of the audio played by the application.
[0096] The correspondence between application types and main audio types may be shown in Table 2.
[0097] Table 2
[0098]
[0099]
[0100] For example, the first application type is a music type, and it can be determined from Table 2 that the main audio type corresponding to the first application program is a music audio type.
[0101] 204 , determining whether the audio processing channel corresponding to the primary audio type is occupied. If the audio processing channel corresponding to the primary audio type is occupied, executing steps 205 to 206 ; if the audio processing channel corresponding to the primary audio type is not occupied, executing step 207 .
[0102] 205 : Determine the backup audio type corresponding to the first application.
[0103] The playback priority corresponding to the backup audio type is equal to the playback priority corresponding to the primary audio type. The playback priority is used to indicate which audio type can be played first. The playback priority can be represented by a numerical value. The larger the numerical value, the greater the playback priority, and the smaller the numerical value, the lower the playback priority. The playback priority can also be represented by a level identifier, such as "high", "medium", "low", etc. The corresponding relationship table between audio type and priority can be shown in Table 3.
[0104] Table 3
[0105] Main audio type Playback priority Music audio type 1 Game Audio Type 1 Video and audio type 1 Navigation audio type 2 Road Trip Audio Type 2 Call Audio Type 3 Memo Audio Type 3 …… ……
[0106] During implementation, after the system program determines the main audio type corresponding to the first application, it determines whether the audio processing channel corresponding to the main audio type is occupied by other applications. If the audio processing channel corresponding to the main audio type is occupied, then the backup audio type corresponding to the first application type can be determined based on the pre-stored correspondence between the application type and the backup audio type, as the backup audio type corresponding to the first application. In the correspondence between the application type and the backup audio type, the backup audio type corresponding to the application type to which each application belongs is not the actual type of audio played by the application. The first application can correspond to multiple backup audio types, and the multiple backup audio types have different usage orders.
[0107] The correspondence between application types and backup audio types may be shown in Table 4.
[0108] Table 4
[0109] Application Type Backup audio type Music Genre Game audio type, video audio type Game Type Music audio type, video audio type Navigation Type Road Trip Audio Type Self-driving tour type Navigation audio type Video Type Music audio type, game audio type Call Type Memo Type Memo Type Call Type …… ……
[0110] For example, the first application type is a music type, and it can be determined from Table 4 that the backup audio types corresponding to the first application program are a game audio type and a video audio type.
[0111] The correspondence table between application type and primary audio type and the correspondence table between application type and backup audio type can be one correspondence table, that is, the correspondence between application type, primary audio type and backup audio type can be as shown in Table 5.
[0112] Table 5
[0113] Application Type Main audio type Backup audio type Music Genre Music audio type Game audio type, video audio type Game Type Game Audio Type Music audio type, video audio type Navigation Type Navigation audio type Road Trip Audio Type Self-driving tour type Road Trip Audio Type Navigation audio type Video Type Video and audio type Music audio type, game audio type Call Type Call Audio Type Memo Audio Type Memo Type Memo Audio Type Call Audio Type …… …… ……
[0114] 206 : Allocate an unoccupied audio processing channel among the audio processing channels corresponding to the backup audio type to the first application.
[0115] In implementation, after determining the backup audio type corresponding to the first application, the occupancy of each audio processing channel corresponding to the backup audio type is determined, and the audio processing channel is allocated to the first application based on the occupancy. The specific processing method can be as follows.
[0116] Method 1: Obtain backup audio types in the order of use. Each time a backup audio type is obtained, if the audio processing channel corresponding to the currently obtained backup audio type is occupied, continue to obtain the next backup audio type. If the audio processing channel corresponding to the currently obtained backup audio type is not occupied, the audio processing channel corresponding to the currently obtained backup audio type is allocated to the first application.
[0117] Among them, the order of use can be determined by the system program based on the order of the backup audio types in Table 3 or Table 4, and can be from front to back or from back to front. Taking the backup audio types corresponding to the music types in Table 3 as an example, the order of the backup audio is game audio type and video audio type. The order of use can be game audio type first, then video audio type, or video audio type first, then game audio type. The order of use can also be randomly determined by the system program after determining the backup audio type.
[0118] For example, the application type of the first application is music, and the backup audio types corresponding to the music type are game audio and video audio. The order of use is game audio first, then video audio. The system program first obtains the game audio type and determines whether the audio processing channel corresponding to the game audio type is occupied. If the audio processing channel corresponding to the game audio type is not occupied, the audio processing channel corresponding to the game audio type is allocated to the first application. If the audio processing channel corresponding to the game audio type is occupied, the video audio type is obtained to determine whether the audio processing channel corresponding to the video audio type is occupied.
[0119] In a second method, the system program may determine the occupancy status of audio processing channels corresponding to all backup audio types of the first application program to identify all unoccupied audio processing channels. The system program may select an audio processing channel from among all unoccupied audio processing channels, using a random selection method or other selection method. The system program may assign the selected audio processing channel to the first application program.
[0120] If the audio processing channels corresponding to the backup audio type are all occupied, the audio processing channel corresponding to the primary audio type may be allocated to the first application.
[0121] like Figure 3 As shown, the audio processing channel corresponding to the primary audio type corresponding to the first application is occupied, and the audio processing channels corresponding to the backup audio types are not occupied. Based on the above-mentioned method 1 or method 2, the game audio processing channel corresponding to the game audio type in the backup audio type can be allocated to the first application.
[0122] 207 : Allocate the audio processing channel corresponding to the primary audio type to the first application.
[0123] 208 : Play the audio of the first application based on the setting requirements.
[0124] During implementation, after allocating an audio processing channel to the first application, the setting requirements for applying for audio focus corresponding to the first application are obtained. When the mute release requirement in the setting requirements requires unmute, it is determined whether the system is currently in a mute state. If the system is currently in a mute state, the system is unmuted.
[0125] If there are currently occupied audio processing channels other than those assigned to the first application, determine whether the first application accepts mixed playback with audio from other audio processing channels. If so, play the audio corresponding to the first application, and keep playing the audio in other audio processing channels, that is, mix and play these audios. If not, determine the playback priority of the audio type of the first application and the playback priority of the audio type of the application occupying other audio processing channels, and compare them. Based on the playback priority rules preset by the system program, determine whether to play the audio of the first application. If yes, stop playing the audio corresponding to the application occupying other audio processing channels. If not, do not play the audio corresponding to the first application. Among them, the playback priority rules preset by the system program can be that the audio corresponding to the application with a larger audio type playback priority is played, and the audio corresponding to the application with a smaller audio type playback priority is not played.
[0126] The processing flow for determining the correspondence table between application type and main audio type and the correspondence table between application type and backup audio type can be as follows: Figure 4 As shown, the processing steps may include:
[0127] 401. Determine an audio type corresponding to a second application type based on a pre-stored correspondence between an overall application type, an application type, and an audio type, and determine an audio type corresponding to a third application type corresponding to the same overall application type as the second application type.
[0128] Among them, in the correspondence between the application general type, application type and audio type, each audio type corresponding to the same application general type has the same playback priority. An application general type can include multiple application types, and one application type corresponds to one audio type.
[0129] The correspondence between the application type, application type, and audio type may be shown in Table 6.
[0130] Table 6
[0131]
[0132] Among them, the playback priority of the audio type of the voice general type is the largest, the playback priority of the audio type of the navigation general type is second, and the playback priority of the audio type of the media general type is the smallest.
[0133] 402. Add the second application type and the corresponding audio type to the correspondence between the application type and the primary audio type, and add the second application type and the audio type corresponding to the third application type to the correspondence between the application type and the backup audio type.
[0134] For example, the second application type is music, and its corresponding audio type is music audio. The third application type, which corresponds to the same application type as the second application type, is game and video. The audio type corresponding to the game type is game audio, and the audio type corresponding to the video type is video audio. The music type and music audio type are added to the correspondence between application type and primary audio type, as shown in the second row of Table 2 or Table 5. The music type, game audio type, and video audio type are added to the correspondence between application type and backup audio type, as shown in the second row of Table 4 or Table 5.
[0135] Through the method provided in the embodiment of the present application, after the first application sends an audio focus request to the system program, the system program determines whether the audio processing channel corresponding to the primary audio type corresponding to the first application is occupied. If so, the system program determines the backup audio type corresponding to the first application and allocates the audio processing channel corresponding to the backup audio type to the first application. In this way, when the audio processing channel corresponding to the primary audio type is occupied, an unoccupied audio processing channel is selected from the audio processing channel corresponding to the backup audio type. In this way, the first application will not delay outputting audio due to the delay in releasing the audio processing channel, thereby reducing the possibility of the first application delaying outputting audio.
[0136] Based on the same technical concept, the embodiment of the present application also provides a device for allocating audio processing channels, which can be the terminal in the above embodiment, such as Figure 5 As shown, the device includes:
[0137] The receiving module 510 is configured to receive an audio focus request sent by a first application program;
[0138] a determination module 520 configured to determine a primary audio type corresponding to the first application; and if the audio processing channel corresponding to the primary audio type is occupied, determining a backup audio type corresponding to the first application, wherein the playback priority corresponding to the backup audio type is equal to the playback priority corresponding to the primary audio type;
[0139] The allocating module 530 is configured to allocate unoccupied audio processing channels among the audio processing channels corresponding to the backup audio type to the first application.
[0140] In a possible implementation, the determining module 520 is configured to:
[0141] Determining a first application type corresponding to the first application;
[0142] Determining, based on a pre-stored correspondence between application types and primary audio types, the primary audio type corresponding to the first application type as the primary audio type corresponding to the first application program;
[0143] Based on a pre-stored correspondence between application types and backup audio types, the backup audio type corresponding to the first application type is determined as the backup audio type corresponding to the first application program.
[0144] In a possible implementation, in the correspondence between the application type and the primary audio type, the primary audio type corresponding to the application type to which each application belongs is the type of audio played by the application;
[0145] In the correspondence between the application type and the backup audio type, the backup audio type corresponding to the application type to which each application belongs is not the type of the audio played by the application.
[0146] In a possible implementation, the determining module 520 is further configured to:
[0147] Determining, based on a pre-stored correspondence between the overall application type, application type, and audio type, an audio type corresponding to the second application type, and determining an audio type corresponding to a third application type corresponding to the same overall application type as the second application type, wherein, in the correspondence between the overall application type, application type, and audio type, audio types corresponding to the same overall application type have the same playback priority;
[0148] The second application type and the corresponding audio type are added to the correspondence between the application type and the main audio type, and the second application type and the audio type corresponding to the third application type are added to the correspondence between the application type and the backup audio type.
[0149] In a possible implementation, the first application corresponds to multiple backup audio types, and the multiple backup audio types have different usage orders;
[0150] The allocation module 530 is configured to:
[0151] Acquire backup audio types in the order of use. Each time a backup audio type is acquired, if the audio processing channel corresponding to the currently acquired backup audio type is occupied, continue to acquire the next backup audio type. If the audio processing channel corresponding to the currently acquired backup audio type is not occupied, allocate the audio processing channel corresponding to the currently acquired backup audio type to the first application.
[0152] In a possible implementation, the receiving module 510 is further configured to:
[0153] Obtaining a setting requirement for applying for audio focus corresponding to the first application, wherein the setting requirement includes a mute release setting requirement and / or a mixed playback setting requirement, wherein the mute release setting requirement is used to indicate whether to release the mute state if the system is in a muted state, and the mixed playback setting requirement is used to indicate whether to mix the audio with the audio of other audio processing channels for playback;
[0154] Based on the setting requirements, the audio of the first application is played.
[0155] In a possible implementation, the determining module 520 is further configured to:
[0156] If the audio processing channel corresponding to the primary audio type is not occupied, the audio processing channel corresponding to the primary audio type is allocated to the first application.
[0157] Through the device provided by the embodiment of the present application, after the first application sends an audio focus request to the system program, the system program determines whether the audio processing channel corresponding to the primary audio type corresponding to the first application is occupied. If so, the system program determines the backup audio type corresponding to the first application and allocates the audio processing channel corresponding to the backup audio type to the first application. In this way, when the audio processing channel corresponding to the primary audio type is occupied, an unoccupied audio processing channel is selected from the audio processing channel corresponding to the backup audio type. In this way, the first application will not delay outputting audio due to the delay in releasing the audio processing channel, thereby reducing the possibility of the first application delaying outputting audio.
[0158] It should be noted that the apparatus for allocating audio processing channels provided in the above embodiment only uses the division of the above-mentioned functional modules as an example to illustrate the allocation of audio processing channels. In actual applications, the above-mentioned functional allocation can be completed by different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the apparatus for allocating audio processing channels provided in the above embodiment and the method embodiment for allocating audio processing channels are based on the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0159] Figure 6 The following is a block diagram of the structure of an electronic device 600 provided in an embodiment of the present application. The electronic device may be a terminal in the above-mentioned embodiment. The electronic device 600 may be a portable mobile terminal, such as a smartphone, a tablet computer, an MP3 player (moving picture experts group audio layer III), an MP4 player (moving picture experts group audio layer IV), a laptop computer, or a desktop computer. The electronic device 600 may also be referred to as a user device, a portable terminal, a laptop terminal, a desktop terminal, or other names.
[0160] Typically, the electronic device 600 includes a processor 601 and a memory 602 .
[0161] The processor 601 may include one or more processing cores, such as a 4-core processor, a 6-core processor, etc. The processor 601 may be implemented in at least one hardware form of DSP (digital signal processing), FPGA (field-programmable gate array), or PLA (programmable logic array). The processor 601 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (central processing unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 601 may be integrated with a GPU (graphics processing unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 601 may also include an AI (artificial intelligence) processor, which is used to process computing operations related to machine learning.
[0162] The memory 602 may include one or more computer-readable storage media, which may be non-transitory. The memory 602 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices and flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 602 is used to store at least one instruction, which is executed by the processor 601 to implement the method provided in the embodiment of the present application.
[0163] In some embodiments, electronic device 600 may optionally include a peripheral device interface 603 and at least one peripheral device. Processor 601, memory 602, and peripheral device interface 603 may be connected via a bus or signal lines. Each peripheral device may be connected to peripheral device interface 603 via a bus, signal lines, or circuit boards. Specifically, the peripheral device may include at least one of a radio frequency circuit 604, a display screen 605, a camera assembly 606, an audio circuit 607, a positioning assembly 608, and a power supply 609.
[0164] The peripheral device interface 603 can be used to connect at least one I / O (input / output)-related peripheral device to the processor 601 and the memory 602. In some embodiments, the processor 601, the memory 602, and the peripheral device interface 603 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 601, the memory 602, and the peripheral device interface 603 can be implemented on separate chips or circuit boards, which is not limited in this embodiment.
[0165] The radio frequency circuit 604 is used to receive and transmit RF (radio frequency) signals, also known as electromagnetic signals. The radio frequency circuit 604 communicates with communication networks and other communication devices via electromagnetic signals. The radio frequency circuit 604 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals into electrical signals. Optionally, the radio frequency circuit 604 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, etc. The radio frequency circuit 604 can communicate with other terminals via at least one wireless communication protocol. Such wireless communication protocols include, but are not limited to, the World Wide Web, a metropolitan area network, an intranet, various generations of mobile communication networks (2G, 3G, 4G, and 5G), a wireless local area network, and / or a WiFi (wireless fidelity) network. In some embodiments, the radio frequency circuit 604 may also include circuits related to NFC (near field communication), which is not limited in this application.
[0166] Display screen 605 is used to display a user interface (UI). This UI can include graphics, text, icons, videos, or any combination thereof. If display screen 605 is a touchscreen display, it can also capture touch signals on or above the surface of display screen 605. These touch signals can be input as control signals to processor 601 for processing. Display screen 605 can also be used to provide virtual buttons and / or a virtual keyboard, also known as soft buttons and / or a soft keyboard. In some embodiments, there can be a single display screen 605, located on the front panel of electronic device 600. In other embodiments, there can be at least two display screens 605, located on different surfaces of electronic device 600 or in a foldable design. In still other embodiments, display screen 605 can be a flexible display, located on a curved or foldable surface of electronic device 600. Display screen 605 can also be configured as a non-rectangular, irregular shape, also known as a special-shaped screen. Display screen 605 can be made of materials such as LCD (liquid crystal display) and OLED (organic light-emitting diode).
[0167] The camera assembly 606 is used to capture images or videos. Optionally, the camera assembly 606 includes a front camera and a rear camera. Typically, the front camera is arranged on the front panel of the terminal, and the rear camera is arranged on the back of the terminal. In some embodiments, there are at least two rear cameras, which are any one of a main camera, a depth of field camera, a wide-angle camera, and a telephoto camera, so as to realize the fusion of the main camera and the depth of field camera to realize the background blur function, the fusion of the main camera and the wide-angle camera to realize panoramic shooting and VR (virtual reality) shooting function or other fusion shooting functions. In some embodiments, the camera assembly 606 may also include a flash. The flash can be a single-color temperature flash or a dual-color temperature flash. A dual-color temperature flash refers to a combination of a warm light flash and a cold light flash, which can be used for light compensation at different color temperatures.
[0168] The audio circuit 607 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, and convert the sound waves into electrical signals to be input into the processor 601 for processing, or input into the radio frequency circuit 604 to achieve voice communication. For the purpose of stereo sound collection or noise reduction, there can be multiple microphones, which are respectively arranged in different parts of the electronic device 600. The microphone can also be an array microphone or an omnidirectional collection microphone. The speaker is used to convert the electrical signals from the processor 601 or the radio frequency circuit 604 into sound waves. The speaker can be a traditional thin film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can not only convert the electrical signals into sound waves audible to humans, but also convert the electrical signals into sound waves inaudible to humans for purposes such as ranging. In some embodiments, the audio circuit 607 may also include a headphone jack.
[0169] The positioning component 608 is used to locate the current geographic location of the electronic device 600 to implement navigation or LBS (location-based service). The positioning component 608 can be a positioning component based on the GPS (global positioning system), Beidou system or Galileo system.
[0170] Power supply 609 is used to power the various components in electronic device 600. Power supply 609 can be AC power, DC power, a disposable battery, or a rechargeable battery. When power supply 609 includes a rechargeable battery, the rechargeable battery can be a wired rechargeable battery or a wireless rechargeable battery. A wired rechargeable battery is a battery that is charged via a wired line, while a wireless rechargeable battery is a battery that is charged via a wireless coil. The rechargeable battery can also be used to support fast charging technology.
[0171] In some embodiments, the electronic device 600 further includes one or more sensors 610 , including but not limited to: an acceleration sensor 611 , a gyroscope sensor 612 , a pressure sensor 613 , a fingerprint sensor 614 , an optical sensor 615 , and a proximity sensor 616 .
[0172] The accelerometer 611 can detect the magnitude of acceleration along the three coordinate axes of the coordinate system established by the electronic device 600. For example, the accelerometer 611 can be used to detect the components of gravity acceleration along the three coordinate axes. The processor 601 can control the display screen 605 to display the user interface in a landscape or portrait view based on the gravity acceleration signal collected by the accelerometer 611. The accelerometer 611 can also be used to collect game or user motion data.
[0173] The gyroscope sensor 612 can detect the orientation and rotation angle of the electronic device 600. It can work in conjunction with the accelerometer 611 to collect the user's 3D movements of the electronic device 600. Based on the data collected by the gyroscope sensor 612, the processor 601 can implement the following functions: motion sensing (for example, changing the UI based on the user's tilt operation), image stabilization during shooting, game control, and inertial navigation.
[0174] The pressure sensor 613 can be set on the side frame of the electronic device 600 and / or the lower layer of the display screen 605. When the pressure sensor 613 is set on the side frame of the electronic device 600, it can detect the user's grip signal of the electronic device 600, and the processor 601 performs left and right hand recognition or shortcut operations based on the grip signal collected by the pressure sensor 613. When the pressure sensor 613 is set on the lower layer of the display screen 605, the processor 601 controls the operable controls on the UI interface based on the user's pressure operation on the display screen 605. The operable controls include at least one of a button control, a scroll bar control, an icon control, and a menu control.
[0175] The fingerprint sensor 614 is used to collect the user's fingerprint. The processor 601 identifies the user's identity based on the fingerprint collected by the fingerprint sensor 614, or the fingerprint sensor 614 identifies the user's identity based on the collected fingerprint. When the user's identity is recognized as a trusted identity, the processor 601 authorizes the user to perform relevant sensitive operations, such as unlocking the screen, viewing encrypted information, downloading software, making payments, and changing settings. The fingerprint sensor 614 can be set on the front, back, or side of the electronic device 600. When a physical button or manufacturer logo is set on the electronic device 600, the fingerprint sensor 614 can be integrated with the physical button or manufacturer logo.
[0176] Optical sensor 615 is used to detect ambient light intensity. In one embodiment, processor 601 can control the display brightness of display screen 605 based on the ambient light intensity detected by optical sensor 615. Specifically, when the ambient light intensity is high, the display brightness of display screen 605 is increased; when the ambient light intensity is low, the display brightness of display screen 605 is decreased. In another embodiment, processor 601 can also dynamically adjust the shooting parameters of camera assembly 606 based on the ambient light intensity detected by optical sensor 615.
[0177] Proximity sensor 616, also known as a distance sensor, is typically located on the front panel of electronic device 600. Proximity sensor 616 is used to detect the distance between the user and the front of electronic device 600. In one embodiment, when proximity sensor 616 detects that the distance between the user and the front of electronic device 600 is gradually decreasing, processor 601 controls display screen 605 to switch from the screen-on state to the screen-off state. When proximity sensor 616 detects that the distance between the user and the front of electronic device 600 is gradually increasing, processor 601 controls display screen 605 to switch from the screen-off state to the screen-on state.
[0178] Those skilled in the art will understand that Figure 6 The structure shown in the figure does not constitute a limitation on the electronic device 600, and the electronic device 600 may include more or fewer components than shown in the figure, or combine certain components, or adopt a different component arrangement.
[0179] In an embodiment of the present application, a computer-readable storage medium is further provided, such as a memory including instructions, wherein the instructions can be executed by a processor in a terminal to perform the method for performing interactive operations in the above embodiment. The computer-readable storage medium can be non-transitory. For example, the computer-readable storage medium can be a ROM (read-only memory), a RAM (random access memory), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0180] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.) and signals (including but not limited to signals transmitted between user terminals and other devices, etc.) involved in this application are all authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.
[0181] Those skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware, or by a program to instruct the relevant hardware, and the program may be stored in a computer-readable storage medium, which may be a read-only memory, a disk, or an optical disk, etc.
[0182] The above descriptions are only some possible embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.
Claims
1. A method for allocating audio processing channels, characterized in that: The method comprises: receiving an audio focus request sent by a first application; Determining a primary audio type corresponding to the first application; If the audio processing channel corresponding to the primary audio type is occupied, determining a backup audio type corresponding to the first application, wherein the playback priority corresponding to the backup audio type is equal to the playback priority corresponding to the primary audio type; Allocate unoccupied audio processing channels among the audio processing channels corresponding to the backup audio type to the first application.
2. The method according to claim 1, characterized in that The determining the primary audio type corresponding to the first application includes: Determining a first application type corresponding to the first application; Determining, based on a pre-stored correspondence between application types and primary audio types, the primary audio type corresponding to the first application type as the primary audio type corresponding to the first application program; The determining the backup audio type corresponding to the first application includes: Based on a pre-stored correspondence between application types and backup audio types, the backup audio type corresponding to the first application type is determined as the backup audio type corresponding to the first application program.
3. The method according to claim 2, characterized in that In the correspondence between the application type and the primary audio type, the primary audio type corresponding to the application type to which each application belongs is the actual type of audio played by the application; In the correspondence between application types and backup audio types, the backup audio type corresponding to the application type to which each application belongs is not the actual type of the audio played by the application.
4. The method according to claim 2, characterized in that The method further comprises: Determining, based on a pre-stored correspondence between the overall application type, application type, and audio type, an audio type corresponding to the second application type, and determining an audio type corresponding to a third application type corresponding to the same overall application type as the second application type, wherein, in the correspondence between the overall application type, application type, and audio type, audio types corresponding to the same overall application type have the same playback priority; The second application type and the corresponding audio type are added to the correspondence between the application type and the main audio type, and the second application type and the audio type corresponding to the third application type are added to the correspondence between the application type and the backup audio type.
5. The method according to any one of claims 1 to 4, characterized in that The first application corresponds to a plurality of backup audio types, and the plurality of backup audio types have different usage orders; Allocating an unoccupied audio processing channel among the audio processing channels corresponding to the backup audio type to the first application includes: Acquire backup audio types in the order of use. Each time a backup audio type is acquired, if the audio processing channel corresponding to the currently acquired backup audio type is occupied, continue to acquire the next backup audio type. If the audio processing channel corresponding to the currently acquired backup audio type is not occupied, allocate the audio processing channel corresponding to the currently acquired backup audio type to the first application.
6. The method according to any one of claims 1 to 4, characterized in that After receiving the audio focus request sent by the first application, the method further includes: Obtaining a setting requirement for applying for audio focus corresponding to the first application, wherein the setting requirement includes a mute release setting requirement and / or a mixed playback setting requirement, wherein the mute release setting requirement is used to indicate whether to release the mute state if the system is in a muted state, and the mixed playback setting requirement is used to indicate whether to mix the audio with the audio of other audio processing channels for playback; Based on the setting requirements, the audio of the first application is played.
7. The method according to any one of claims 1 to 4, characterized in that After determining the primary audio type corresponding to the first application, the method further includes: If the audio processing channel corresponding to the primary audio type is not occupied, the audio processing channel corresponding to the primary audio type is allocated to the first application.
8. A device for allocating audio processing channels, characterized in that: The device comprises: A receiving module, configured to receive an audio focus request sent by a first application; a determination module, configured to determine a primary audio type corresponding to the first application; and if the audio processing channel corresponding to the primary audio type is occupied, determining a backup audio type corresponding to the first application, wherein the playback priority corresponding to the backup audio type is equal to the playback priority corresponding to the primary audio type; An allocating module is used to allocate unoccupied audio processing channels among the audio processing channels corresponding to the backup audio type to the first application.
9. A computer device, characterized in that: The computer device includes a memory and a processor, wherein the memory is used to store computer instructions; The processor executes the computer instructions stored in the memory to enable the computer device to perform the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program code. In response to the computer program code being executed by a computer device, the computer device executes the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Method and apparatus for playing instant message sound on vehicle-mounted terminal
CN105530171A
Vehicle-mounted audio playing control method, device and equipment and storage medium
CN112235063A