WO2020118495A1 - Audio resource allocation method, device, and electronic apparatus - Google Patents

Audio resource allocation method, device, and electronic apparatus Download PDF

Info

Publication number
WO2020118495A1
WO2020118495A1 PCT/CN2018/120137 CN2018120137W WO2020118495A1 WO 2020118495 A1 WO2020118495 A1 WO 2020118495A1 CN 2018120137 W CN2018120137 W CN 2018120137W WO 2020118495 A1 WO2020118495 A1 WO 2020118495A1
Authority
WO
WIPO (PCT)
Prior art keywords
application
audio
priority
audio resource
application program
Prior art date
Application number
PCT/CN2018/120137
Other languages
French (fr)
Chinese (zh)
Inventor
李亚军
Original Assignee
深圳市欢太科技有限公司
Oppo广东移动通信有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳市欢太科技有限公司, Oppo广东移动通信有限公司 filed Critical 深圳市欢太科技有限公司
Priority to PCT/CN2018/120137 priority Critical patent/WO2020118495A1/en
Priority to CN201880098688.8A priority patent/CN115668123A/en
Publication of WO2020118495A1 publication Critical patent/WO2020118495A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/16Sound input; Sound output

Definitions

  • This application relates to the field of information technology, and in particular, to an audio resource allocation method, device, electronic device, and computer-readable storage medium.
  • An embodiment of the present application provides an audio resource allocation method, including:
  • a split-screen mode receiving a request message for the audio resource of a second application, where the first application is on a first split-screen and the second application is on a second split-screen;
  • the first priority is less than the second priority, release the audio resources occupied by the first application, and allocate the audio resources to the second application, so that the first Two applications use the audio resources to play audio.
  • An embodiment of the present application provides an audio resource allocation device, including:
  • a first receiving module configured to receive a request message of an audio resource of the first application program
  • An audio resource allocation module configured to allocate the audio resource to the first application program, so that the first application program uses the audio resource to play audio
  • a second receiving module configured to receive a request message for the audio resource of a second application in a split-screen mode, wherein the first application is in a first split-screen and the second application is in a second split Screen;
  • An obtaining module configured to obtain the first priority of the first application and the second priority of the second application
  • a processing module configured to send an audio resource request failure response to the second application if the first priority is greater than or equal to the second priority
  • the first priority is less than the second priority, release the audio resources occupied by the first application, and allocate the audio resources to the second application, so that the first Two applications use the audio resources to play audio.
  • An embodiment of the present application further provides an electronic device, including a memory and a processor, and the memory stores a computer program, wherein when the computer program is executed by the processor, the processor is caused to execute:
  • a split-screen mode receiving a request message for the audio resource of a second application, where the first application is on a first split-screen and the second application is on a second split-screen;
  • the first priority is less than the second priority, release the audio resources occupied by the first application, and allocate the audio resources to the second application, so that the first Two applications use the audio resources to play audio.
  • Embodiments of the present application also provide a computer non-volatile readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of processing the application program as described above are realized.
  • the electronic device and the computer-readable storage medium receive the request message of the audio resource of the first application program; allocate the audio resource to the first application program, so that the first application program uses the The audio resource plays audio; in a split-screen mode, receiving a request message for the audio resource of a second application, where the first application is on a first split-screen and the second application is on a second split-screen ; Obtain the first priority of the first application and the second priority of the second application; allocate the audio resources according to the size of the first priority and the second priority, so that the first The application program or the second application program uses the audio resource to play audio, which solves the problem of audio resource conflict in the split-screen mode and improves the user experience.
  • FIG. 1 is a flowchart of an audio resource allocation method in an embodiment
  • FIG. 2 is a flowchart of adjusting application priority in an embodiment
  • FIG. 3 is a flowchart of an audio resource allocation method in another embodiment
  • FIG. 4 is a schematic structural diagram of an audio resource allocation device according to an embodiment
  • FIG. 5 is a schematic diagram of the internal structure of an electronic device in an embodiment
  • FIG. 6 is a block diagram of a partial structure of an electronic device related to a computer device provided by an embodiment of the present application.
  • first”, “second”, etc. used in this application may be used herein to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish the first element from another element.
  • the first acquisition module may be referred to as the second acquisition module, and similarly, the second acquisition module may be referred to as the first acquisition module. Both the first acquisition module and the second acquisition module are acquisition modules, but they are not the same acquisition module.
  • an embodiment of the present application provides an audio resource allocation method, which is applied to an electronic device.
  • the method includes:
  • the electronic device may be any electronic device such as a mobile terminal, a tablet computer, a PDA (Personal Digital Assistant), a POS (Point of Sales), an in-vehicle computer, a wearable device, and the like.
  • a mobile terminal such as a mobile terminal, a tablet computer, a PDA (Personal Digital Assistant), a POS (Point of Sales), an in-vehicle computer, a wearable device, and the like.
  • the audio resource request message includes audio resource request related data.
  • the data related to the audio resource request includes but is not limited to audio data and audio type.
  • the audio type includes but is not limited to music, reminder sound, alarm sound, system sound and so on.
  • S120 Assign the audio resource to the first application program, so that the first application program uses the audio resource to play audio;
  • the electronic device When receiving the audio resource request message sent by the application program, the electronic device allocates the corresponding audio resource to the application program according to the audio resource request message, so that the application program can use the audio resource to play audio.
  • the electronic device When receiving the split screen instruction, the electronic device controls the electronic device to display at least two display areas, and each display area corresponds to at least one application program.
  • the electronic device includes a first split screen and a second split screen, such as a main screen and a sub-screen
  • the size and location of the two screens are not limited.
  • the main screen is larger and is located on the front of the electronic device, while the secondary screen is smaller and is located on the back of the electronic device.
  • the first split screen may be either the main screen or the sub-screen.
  • the electronic device when the electronic device is in a portrait state, at least two display areas are sequentially arranged up and down along the length of the electronic device, for example: when the electronic device is in a portrait state and two display areas are displayed, One display area is displayed in the upper half of the electronic device, and the other display area is displayed in the lower half of the electronic device; when the electronic device is in a landscape state, the at least two display areas are sequentially along the length of the electronic device The directions are arranged side by side. For example, when the electronic device is in a landscape state and two display areas are displayed, one of the display areas is displayed on the left half of the electronic device, and the other display area is displayed on the right half of the electronic device.
  • the first priority of the first application and the second application when receiving a request message for the same audio resource from the second application in split-screen mode, the first priority of the first application and the second application’s
  • the second priority is to allocate the audio resource according to the level of the first priority and the second priority.
  • the method before acquiring the first priority of the first application and the second priority of the second application, the method further includes:
  • the priority of all application programs in the electronic device is set according to the use frequency or duration of application programs in the electronic device.
  • a corresponding priority may be preset for the audio corresponding to each application program.
  • the priority may be preset according to the frequency or duration of use of the application by the user. Specifically, an application program with a higher usage frequency corresponds to a higher priority, and an application program with a longer usage time corresponds to a higher priority.
  • the priority may be represented by the values 1, 2, 3... It can be understood that the above numerical value to identify the priority of the application is only used as a way to identify the priority of the application in the embodiments of the present application, rather than a limitation of the priority identification method. In fact, The priority of the application can be identified in other ways. For example, the characters A, B, C, D, E, etc., or the first, second, third, fourth, fifth, etc. are used to identify the priority of the application. The embodiment of the present application does not specifically limit the way of identifying the priority of the application.
  • an audio resource request failure response can be sent to the second application program through a message transmission mechanism at the application layer of the electronic device. If there are multiple second applications, the response to the failure of the frequency resource request may be sent to the second application at the same time.
  • the first priority is less than the second priority, release the audio resources occupied by the first application, and allocate the audio resources to the second application, so that all The second application uses the audio resource to play audio.
  • each application program is allocated a process for playing audio corresponding to the application program on the electronic device.
  • the electronic device includes two application programs, namely application C and application D
  • the electronic device will allocate a process X for application C to play the audio corresponding to application C, and an application D for playing application D Corresponding audio process Y.
  • only one process for playing audio can be running on the electronic device.
  • the application with the highest priority among the multiple applications is selected according to the order of the corresponding priorities of the respective applications from high to low , And assign a process for the application to play the audio corresponding to the application, so that the application can play the audio.
  • the present application by receiving a request message of an audio resource of a first application; allocating the audio resource to the first application, so that the first application uses the audio resource to play audio;
  • receiving a request message for the audio resource of a second application where the first application is on a first split-screen and the second application is on a second split-screen; acquiring the first application A first priority of the program and a second priority of the second application; if the first priority is greater than or equal to the second priority, send an audio resource request failure response to the second application ; If the first priority is less than the second priority, release the audio resources occupied by the first application, and allocate the audio resources to the second application, so that the The second application uses the audio resources to play audio, solves the problem of audio resource conflicts in the split screen mode, and improves the user experience.
  • the second application in the split-screen mode receives a request message for the same audio resource, and it can detect whether the audio resource occupied by the first application is valid. If valid, send an audio resource request failure response to the second application; if invalid, allocate the audio resource to the second application, so that the second application uses the audio resource to play audio.
  • the audio resources occupied by the first application program are analyzed within a preset time period.
  • the audio data output by the first application within a preset time period may be acquired, and the audio data may be analyzed to determine whether the audio data is invalid data.
  • the audio data is all invalid data or the proportion of invalid data is greater than a preset threshold, it is determined that the audio resource occupied by the first application is invalid, and the audio resource is allocated to the second application.
  • the invalid data in this embodiment may be audio data with a volume of 0.
  • an audio resource request failure response is sent to the second application; if it is invalid, the audio resource is allocated to the second application , So that the second application uses the audio resource to play audio, can effectively use the audio resource, and improve the utilization rate of the audio resource.
  • an audio resource request failure response is sent to the second application.
  • the audio resource allocation problem cannot be solved by the priority. It may be considered that the application program currently playing audio does not have the highest priority, the audio resource occupied by the application program cannot be preempted, and an audio resource request failure response is sent to the second application program.
  • the method can also adjust the priority of the application, including:
  • the request messages for the audio resources from the second application and the fourth application are received at 10:00 and 10:01, respectively, by comparing the first application The priority of the program, the second application, and the fourth application is obtained. If the priority of the first application is higher than the priority of the second application and the fourth application, an audio resource request failure response is sent to the first The second application and the fourth application, at this time, the second application and the fourth application are in a waiting process. Obtain the waiting time of the second application and the fourth application at 10:03, which are 3 minutes and 2 minutes respectively. If the preset threshold is 1 minute, the waiting time of the second application and the fourth application both exceed A preset threshold is used to increase the priority of the second application and the fourth application.
  • different increase ranges can be set, and different priorities correspond to different increase ranges. The higher the priority, the greater the corresponding increase range. For example, if the priority of the second application is higher than that of the fourth application, then the increase of the second application is greater than the increase of the fourth application.
  • the preset threshold may be 1 minute, 3 minutes, 5 minutes, etc.
  • the preset threshold of 1 minute is only an example in the embodiments of the present application, and is not to be understood as a Set threshold limits. In fact, the preset threshold may be determined by those skilled in the art according to actual needs, and the embodiment of the present application does not limit the preset threshold here.
  • FIG. 3 is a flowchart of an audio resource allocation method in another embodiment. As shown in FIG. 3, the method includes:
  • the second application in split-screen mode receives a request message for the same audio resource, and the electronic device may display a prompt message in the form of voice output, a pop-up dialog box, etc. , Used to prompt the user to process the second application.
  • a dialog box pops up, and the dialog box may include the following information: whether The audio resource is allocated to the second application and the corresponding yes and no buttons, and the user chooses to process the second application according to the actual situation. If it is detected that the user clicks the Yes button, the audio resource is allocated to the second application so that the second application uses the audio resource to play audio; if it is detected that the user clicks the No button, an audio resource request failure response is sent to the The second application.
  • the user is prompted to process the second application by displaying a prompt message; when a user's selection operation instruction for the prompt message is received, the audio resource can be allocated according to the selection operation instruction, and the audio resource can be allocated Reasonable allocation solves the problem of conflicting audio resources in split-screen mode and improves the user experience.
  • the first split screen further includes a third application program
  • an audio resource request failure response is sent to the third application program.
  • the first split screen includes a first application and a third application.
  • the electronic device receives a request message for the audio resource of the third application, then the The electronic device sends an audio resource request failure response to the third application program, thereby ensuring that the first application program normally plays audio.
  • the audio resource is locked to keep the audio resource occupied.
  • the first application uses audio resources to play audio
  • the audio resource is locked so that the audio resource still maintains the occupied state of the first application, Therefore, it is ensured that the audio resource is not preempted when exiting the split-screen mode, so that the first application program normally plays audio.
  • the audio resource when the electronic device exits the split screen mode, the audio resource is locked to keep the audio resource occupied, thereby improving the stability of audio output and the user experience.
  • an audio resource allocation device 40 which includes:
  • the first receiving module 41 is configured to receive a request message of the audio resource of the first application program
  • the device 40 can be applied to electronic equipment, where the electronic equipment can be any electronic device such as a mobile terminal, a tablet computer, a PDA (Personal Digital Assistant), a POS (Point of Sales), an in-vehicle computer, a wearable device, etc. equipment.
  • the electronic equipment can be any electronic device such as a mobile terminal, a tablet computer, a PDA (Personal Digital Assistant), a POS (Point of Sales), an in-vehicle computer, a wearable device, etc. equipment.
  • the audio resource request message includes audio resource request related data.
  • the data related to the audio resource request includes but is not limited to audio data and audio type.
  • the audio type includes but is not limited to music, reminder sound, alarm sound, system sound and so on.
  • the audio resource allocation module 42 is configured to allocate the audio resource to the first application program, so that the first application program uses the audio resource to play audio;
  • the audio resource allocation module 42 allocates the corresponding audio resource to the application according to the audio resource request message, so that the application can use the audio resource Play audio.
  • the second receiving module 43 is configured to receive a request message of the audio resource of a second application in a split-screen mode, wherein the first application is in a first split-screen and the second application is in a second Split Screen;
  • the electronic device When receiving the split screen instruction, the electronic device controls the electronic device to display at least two display areas, and each display area corresponds to at least one application program.
  • the electronic device includes a first split screen and a second split screen, such as a main screen and a sub-screen
  • the size and location of the two screens are not limited.
  • the main screen is larger and is located on the front of the electronic device, while the secondary screen is smaller and is located on the back of the electronic device.
  • the first split screen may be either the main screen or the sub-screen.
  • the electronic device when the electronic device is in a portrait state, at least two display areas are sequentially arranged up and down along the length of the electronic device, for example: when the electronic device is in a portrait state and two display areas are displayed, One display area is displayed in the upper half of the electronic device, and the other display area is displayed in the lower half of the electronic device; when the electronic device is in a landscape state, the at least two display areas are sequentially along the length of the electronic device The directions are arranged side by side. For example, when the electronic device is in a landscape state and two display areas are displayed, one of the display areas is displayed on the left half of the electronic device, and the other display area is displayed on the right half of the electronic device.
  • An obtaining module 44 for obtaining the first priority of the first application and the second priority of the second application
  • the obtaining module 44 obtains the first priority of the first application Level and the second priority of the second application, the audio resource is allocated according to the level of the first priority and the second priority.
  • the apparatus 40 further includes a priority setting module (not shown in the figure), which is specifically configured to set all application programs in the electronic device according to the use frequency or duration of the application programs in the electronic device priority.
  • a priority setting module (not shown in the figure), which is specifically configured to set all application programs in the electronic device according to the use frequency or duration of the application programs in the electronic device priority.
  • the priority setting module may preset a corresponding priority level for the audio corresponding to each application program.
  • the priority may be preset according to the frequency or duration of use of the application by the user. Specifically, an application program with a higher usage frequency corresponds to a higher priority, and an application program with a longer usage time corresponds to a higher priority.
  • the priority may be represented by the values 1, 2, 3... It can be understood that the above-mentioned numerical value to identify the priority of the application is only a way of identifying the priority of the application in the embodiments of the present application, rather than a limitation of the priority identification method. In fact, The priority of the application can be identified in other ways. For example, the characters A, B, C, D, E, etc., or the first, second, third, fourth, fifth, etc. are used to identify the priority of the application. The embodiment of the present application does not specifically limit the way of identifying the priority of the application.
  • the processing module 45 is configured to send an audio resource request failure response to the second application if the first priority is greater than or equal to the second priority;
  • an audio resource request failure response can be sent to the second application program through a message transmission mechanism at the application layer of the electronic device. If there are multiple second applications, the response to the failure of the frequency resource request may be sent to the second application at the same time.
  • the first priority is less than the second priority, release the audio resources occupied by the first application, and allocate the audio resources to the second application, so that the first Two applications use the audio resources to play audio.
  • each application program is allocated a process for playing audio corresponding to the application program on the electronic device.
  • the electronic device includes two applications, namely application C and application D
  • the electronic device will allocate a process X for application C to play the audio corresponding to application C, and an application D for playing application D Corresponding audio process Y.
  • only one process for playing audio can be running on the electronic device.
  • the application with the highest priority among the multiple applications is selected according to the order of the priority of the corresponding applications from high to low , And assign a process for playing audio corresponding to the application to the application so that the application can play audio.
  • the first application module 41 receives the audio resource request message of the first application program; the audio resource allocation module 42 allocates the audio resource to the first application program to enable the first application The program uses the audio resource to play audio; the second receiving module 43 receives the request message of the audio resource of the second application program in the split-screen mode, wherein the first application program is on the first split-screen, the first Two applications are in the second split screen; the obtaining module 44 obtains the first priority of the first application and the second priority of the second application; the processing module 45 according to the first priority and the second priority The size of the audio resource is allocated so that the first application or the second application uses the audio resource to play audio, which solves the problem of audio resource conflict in the split-screen mode and improves the user experience.
  • the device 40 further includes an analysis module (not shown in the figure), which is specifically configured to: when the first application plays audio, receive the second application in split-screen mode on the same audio resource The request message, the analysis module may analyze whether the audio resource occupied by the first application is valid. If valid, send an audio resource request failure response to the second application; if invalid, allocate the audio resource to the second application, so that the second application uses the audio resource to play audio.
  • an analysis module (not shown in the figure), which is specifically configured to: when the first application plays audio, receive the second application in split-screen mode on the same audio resource The request message, the analysis module may analyze whether the audio resource occupied by the first application is valid. If valid, send an audio resource request failure response to the second application; if invalid, allocate the audio resource to the second application, so that the second application uses the audio resource to play audio.
  • the analysis module analyzes the audio resources occupied by the first application within a preset time period.
  • the audio data output by the first application within a preset time period may be acquired, and the audio data may be analyzed to determine whether the audio data is invalid data.
  • the audio data is all invalid data or the proportion of invalid data is greater than a preset threshold, it is determined that the audio resource occupied by the first application is invalid, and the audio resource is allocated to the second application.
  • the invalid data in this embodiment may be audio data with a volume of 0.
  • the analysis module analyzes whether the audio resource occupied by the first application is valid. If it is valid, an audio resource request failure response is sent to the second application; if it is invalid, the audio resource is allocated to the second The application program, so that the second application program uses the audio resource to play audio, can effectively use the audio resource, and improve the utilization rate of the audio resource.
  • the acquisition module 44 if it does not acquire the first priority of the first application or the second priority of the second application, it sends an audio resource request failure response to the second application program.
  • the audio resource allocation problem cannot be solved by the priority. It may be considered that the application program currently playing audio is the highest priority, the audio resource occupied by the application program cannot be preempted, and a response to the failure of sending an audio resource request is sent to the second application program.
  • the device 40 further includes a priority adjustment module (not shown in the figure), which is specifically used for:
  • the waiting time is the time that the application program waits after sending the audio resource request message
  • the priority of the application program is increased.
  • the request messages for the audio resources from the second application and the fourth application are received at 10:00 and 10:01, respectively, by comparing the first application The priority of the program, the second application, and the fourth application is obtained. If the priority of the first application is higher than the priority of the second application and the fourth application, an audio resource request failure response is sent to the first The second application and the fourth application, at this time, the second application and the fourth application are in a waiting process. Obtain the waiting time of the second application and the fourth application at 10:03, which are 3 minutes and 2 minutes respectively. If the preset threshold is 1 minute, the waiting time of the second application and the fourth application both exceed A preset threshold is used to increase the priority of the second application and the fourth application.
  • different increase ranges can be set, and different priorities correspond to different increase ranges. The higher the priority, the greater the corresponding increase range. For example, if the priority of the second application is higher than that of the fourth application, the increase of the second application is greater than the increase of the fourth application.
  • the preset threshold may be 1 minute, 3 minutes, 5 minutes, etc.
  • the preset threshold of 1 minute is only an example in the embodiments of the present application, and is not to be understood as a Set threshold limits. In fact, the preset threshold may be determined by those skilled in the art according to actual needs. The embodiments of the present application do not limit the preset threshold here.
  • the device 40 further includes a prompt module (not shown in the figure), which is specifically used for:
  • the prompt message is used to prompt the user to process the second application program
  • the audio resource is allocated according to the selection operation instruction.
  • the second application in split-screen mode receives a request message for the same audio resource
  • the prompt module may display the prompt message in the form of voice output, pop-up dialog, etc. , Used to prompt the user to process the second application.
  • the prompting module prompts the dialog box to pop up
  • the box may include the following information: whether to allocate audio resources to the second application and corresponding yes and no buttons, and the user selects to process the second application according to actual conditions. If it is detected that the user clicks the Yes button, the audio resource is allocated to the second application so that the second application uses the audio resource to play audio; if it is detected that the user clicks the No button, an audio resource request failure response is sent to the The second application.
  • the prompt module prompts the user to process the second application by displaying a prompt message; when receiving the user's selection operation instruction for the prompt message, the audio resource is allocated according to the selection operation instruction.
  • the reasonable allocation of audio resources solves the problem of conflicting audio resources in split-screen mode and improves the user experience.
  • the first split screen further includes a third application program
  • an audio resource request failure response is sent to the third application program.
  • the first split screen includes a first application and a third application.
  • the electronic device receives a request message for the audio resource of the third application, Then, the electronic device sends an audio resource request failure response to the third application program, thereby ensuring that the first application program normally plays audio.
  • the audio resource when the electronic device exits the split-screen mode, the audio resource is locked so that the audio resource remains occupied.
  • the first application uses audio resources to play audio
  • the audio resource is locked so that the audio resource still maintains the occupied state of the first application, Therefore, it is ensured that the audio resource is not preempted when exiting the split-screen mode, so that the first application program normally plays audio.
  • the audio resource when the electronic device exits the split screen mode, the audio resource is locked to keep the audio resource occupied, thereby improving the stability of audio output and the user experience.
  • the electronic device includes a processor connected through a system bus, a non-volatile storage medium, an internal memory and a network interface, a sound collection device, a speaker, a display screen, and an input device.
  • the non-volatile storage medium of the terminal stores an operating system and computer-readable instructions.
  • the processor is used to provide computing and control capabilities to support the operation of the entire electronic device.
  • the internal memory in the electronic device provides an environment for the execution of computer-readable instructions in the non-volatile storage medium.
  • the display screen of the electronic device may be a liquid crystal display screen or an electronic ink display screen, etc.
  • the input device may be a touch layer covered on the display screen, or a button, a trackball or a touch pad provided on the casing of the electronic device, or it may be External keyboard, touchpad or mouse, etc.
  • the electronic device may be a mobile phone, a tablet computer, a personal digital assistant or a wearable device.
  • FIG. 5 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the electronic device to which the solution of the present application is applied.
  • the specific electronic device may It includes more or fewer components than shown in the figure, or some components are combined, or have a different component arrangement.
  • the above-mentioned audio resource allocation method may specifically be:
  • a split-screen mode receiving a request message for the audio resource of a second application, where the first application is on a first split-screen and the second application is on a second split-screen;
  • the first priority is less than the second priority, release the audio resources occupied by the first application, and allocate the audio resources to the second application, so that the first Two applications use the audio resources to play audio.
  • the embodiments of the present application also provide a computer non-volatile readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of processing the application program as described above are realized.
  • An embodiment of the present invention also provides a computer device. As shown in FIG. 6, for convenience of description, only parts related to the embodiments of the present invention are shown. For specific technical details not disclosed, please refer to the method part of the embodiments of the present invention.
  • the computer device may be any terminal device including an electronic device, a tablet computer, a PDA (Personal Digital Assistant), a POS (Point of Sales), an in-vehicle computer, a wearable device, etc.
  • the computer device is an electronic device For example:
  • the electronic device includes: a radio frequency (Radio Frequency) circuit 610, a memory 620, an input unit 630, a display unit 640, a sensor 650, an audio circuit 660, a wireless fidelity (WiFi) module 670, a processor 680, and power supply 690 and other components.
  • a radio frequency (Radio Frequency) circuit 610 the electronic device includes: a radio frequency (Radio Frequency) circuit 610, a memory 620, an input unit 630, a display unit 640, a sensor 650, an audio circuit 660, a wireless fidelity (WiFi) module 670, a processor 680, and power supply 690 and other components.
  • WiFi wireless fidelity
  • the RF circuit 610 can be used to receive and send signals during sending and receiving information or during a call. It can receive the downlink information of the base station and process it to the processor 680; it can also send the uplink data to the base station.
  • RF circuits include but are not limited to antennas, at least one amplifier, transceiver, coupler, low noise amplifier (Low Noise Amplifier, LNA), duplexer, and so on.
  • the RF circuit 610 can also communicate with other devices through a wireless communication network.
  • the above wireless communication can use any communication standard or protocol, including but not limited to Global System of Mobile (GSM), General Packet Radio Service (GPRS), and Code Division Multiple Access (Code Division) Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), e-mail, Short Message Service (SMS), etc.
  • GSM Global System of Mobile
  • GPRS General Packet Radio Service
  • CDMA Code Division Multiple Access
  • WCDMA Wideband Code Division Multiple Access
  • LTE Long Term Evolution
  • SMS Short Message Service
  • the memory 620 may be used to store software programs and modules.
  • the processor 680 runs the software programs and modules stored in the memory 620 to execute various functional applications and data processing of the electronic device.
  • the memory 620 may mainly include a program storage area and a data storage area, where the program storage area may store an operating system and at least one function-required application program (such as a sound playback function application program, an image playback function application program, etc.), etc.;
  • the data storage area can store data (such as audio data, address book, etc.) created according to the use of electronic devices.
  • the memory 620 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other volatile solid-state storage devices.
  • the input unit 630 may be used to receive input numeric or character information, and generate key signal input related to user settings and function control of the electronic device 600.
  • the input unit 630 may include a touch panel 631 and other input devices 632.
  • the touch panel 631 also known as a touch screen, can collect user's touch operations on or near it (for example, the user uses any suitable objects or accessories such as fingers, stylus, etc. on or near the touch panel 631 Operation), and drive the corresponding connection device according to the preset program.
  • the touch panel 631 may include a touch detection device and a touch controller.
  • the touch detection device detects the user's touch orientation, and detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives touch information from the touch detection device and converts it into contact coordinates To the processor 680, and can receive the command sent by the processor 680 and execute it.
  • the touch panel 631 may be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves.
  • the input unit 630 may also include other input devices 632.
  • the other input devices 632 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.).
  • the display unit 640 may be used to display information input by the user or information provided to the user and various menus of the electronic device.
  • the display unit 640 may include a display panel 641.
  • the display panel 641 may be configured in the form of a liquid crystal display (Liquid Crystal) (LCD), an organic light-emitting diode (Organic Light-Emitting Diode, OLED), or the like.
  • the touch panel 631 may cover the display panel 641, and when the touch panel 631 detects a touch operation on or near it, it is transmitted to the processor 680 to determine the type of touch event, and then the processor 680 according to The type of touch event provides corresponding visual output on the display panel 641.
  • the touch panel 631 and the display panel 641 are implemented as two independent components to realize the input and input functions of the electronic device, in some embodiments, the touch panel 631 and the display panel 641 may be integrated And realize the input and output functions of electronic equipment.
  • the electronic device 600 may further include at least one sensor 650, such as a light sensor, a motion sensor, and other sensors.
  • the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 641 according to the brightness of the ambient light, and the proximity sensor may close the display panel 641 and the electronic device when moving to the ear /Or backlight.
  • the motion sensor may include an acceleration sensor. The acceleration sensor can detect the magnitude of acceleration in various directions, and can detect the magnitude and direction of gravity when at rest.
  • electronic devices can be used for applications that recognize the posture of electronic devices (such as horizontal and vertical screen switching), and vibration recognition related functions ( For example, pedometer, percussion, etc.; in addition, electronic devices can also be equipped with other sensors such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc.
  • sensors such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc.
  • the audio circuit 660, the speaker 661, and the microphone 662 may provide an audio interface between the user and the electronic device.
  • the audio circuit 660 can transmit the converted electrical signal of the received audio data to the speaker 661, which converts the speaker 661 into a sound signal output; on the other hand, the microphone 662 converts the collected sound signal into an electrical signal, which is converted by the audio circuit 660 After receiving, it is converted into audio data, and then processed by the audio data output processor 680, and then sent to another electronic device via the RF circuit 610, or the audio data is output to the memory 620 for subsequent processing.
  • WiFi is a short-range wireless transmission technology. Electronic devices can help users send and receive emails, browse web pages, and access streaming media through the WiFi module 670. It provides users with wireless broadband Internet access.
  • FIG. 6 shows the WiFi module 670, it can be understood that it is not a necessary component of the electronic device 600, and may be omitted as needed.
  • the processor 680 is the control center of the electronic device, and uses various interfaces and lines to connect various parts of the entire electronic device, by running or executing the software programs and/or modules stored in the memory 620, and calling the data stored in the memory 620 , Perform various functions of electronic devices and process data, so as to monitor the electronic devices as a whole.
  • the processor 680 may include one or more processing units.
  • the processor 680 may integrate an application processor and a modem processor, where the application processor mainly processes the operating system, user interface, application programs, and the like; the modem processor mainly processes wireless communication. It can be understood that the above-mentioned modem processor may not be integrated into the processor 680.
  • the electronic device 600 further includes a power supply 690 (such as a battery) that supplies power to various components.
  • a power supply 690 (such as a battery) that supplies power to various components.
  • the power supply can be logically connected to the processor 680 through the power management system, so as to implement functions such as charging, discharging, and power management through the power management system. .
  • the electronic device 600 may further include a camera, a Bluetooth module, and the like.
  • the processor 680 included in the computer device implements the methods of the foregoing embodiments when executing the computer program stored in the memory.
  • the program may be stored in a non-volatile computer-readable storage medium
  • the storage medium may be a magnetic disk, an optical disk, a read-only memory (Read-Only Memory, ROM), etc.
  • An embodiment of the present invention also provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the methods of the foregoing embodiments.

Abstract

The present invention relates to an audio resource allocation method, comprising: receiving a request message for an audio resource from a first application program; allocating the audio resource to the first application program, such that the first application program uses the audio resource to play audio data; receiving, in a split-screen mode, a request message for the audio resource from a second application program, wherein the first application program is in a first screen partition, and the second application program is in a second screen partition; acquiring a first priority level of the first application program and a second priority level of the second application program; and allocating the audio resource according to the order of the first priority level and the second priority level, such that the first application program and the second application program use the audio resource to play audio data. Correspondingly, the present invention further provides an audio resource allocation device, an electronic apparatus, and a readable storage medium, for resolving the issue of audio resource conflicts in a split-screen mode, and improving the user experience.

Description

一种音频资源分配方法、装置和电子设备Audio resource distribution method, device and electronic equipment 技术领域Technical field
本申请涉及信息技术领域,特别是涉及一种音频资源分配方法、装置、电子设备和计算机可读存储介质。This application relates to the field of information technology, and in particular, to an audio resource allocation method, device, electronic device, and computer-readable storage medium.
背景技术Background technique
随着互联网的飞速发展,智能移动终端已经成为许多用户最常用的电子设备,例如智能手机、平板电板等。目前手机的屏幕越来越大,用户安装的应用程序越来越多,尤其是一些音视频播放软件,例如酷狗音乐、暴风影音、QQ、微信等。用户可以使用安装的应用程序进行听音乐、看视频等各种娱乐活动,给用户的生活带来了很大便利。但是,当多个应用程序处于分屏模式时,可能会存在多个音频服务,当多个音频服务同时请求音频资源时,会导致音频资源冲突的问题。With the rapid development of the Internet, smart mobile terminals have become the most commonly used electronic devices for many users, such as smart phones and flat-panel electric boards. At present, the screen of mobile phones is getting larger and larger, and users have installed more and more applications, especially some audio and video playback software, such as Kugou music, Storm video, QQ, WeChat and so on. Users can use the installed application to listen to music, watch videos and other entertainment activities, which brings great convenience to the user's life. However, when multiple applications are in split-screen mode, there may be multiple audio services. When multiple audio services request audio resources at the same time, the problem of audio resource conflicts may result.
发明内容Summary of the invention
基于此,有必要提供一种能够解决音频冲突问题的方法、装置、电子设备和计算机可读存储介质。Based on this, it is necessary to provide a method, device, electronic device, and computer-readable storage medium that can solve the audio conflict problem.
本申请实施例提供一种音频资源分配方法,包括:An embodiment of the present application provides an audio resource allocation method, including:
接收第一应用程序的音频资源的请求消息;Receiving a request message for the audio resource of the first application program;
将所述音频资源分配给所述第一应用程序,以使所述第一应用程序利用所述音频资源播放音频;Allocating the audio resource to the first application program, so that the first application program uses the audio resource to play audio;
在分屏模式下,接收第二应用程序的所述音频资源的请求消息,其中所述第一应用程序处于第一分屏,所述第二应用程序处于第二分屏;In a split-screen mode, receiving a request message for the audio resource of a second application, where the first application is on a first split-screen and the second application is on a second split-screen;
获取所述第一应用程序的第一优先级和所述第二应用程序的第二优先级;Acquiring the first priority of the first application and the second priority of the second application;
若所述第一优先级大于或等于所述第二优先级,则发送音频资源请求失败响应至所述第二应用程序;If the first priority is greater than or equal to the second priority, send an audio resource request failure response to the second application;
若所述第一优先级小于所述第二优先级,则释放所述第一应用程序占用的所述音频资源,并将所述音频资源分配给所述第二应用程序,以使所述第二应用程序利用所述音频资源播放音频。If the first priority is less than the second priority, release the audio resources occupied by the first application, and allocate the audio resources to the second application, so that the first Two applications use the audio resources to play audio.
本申请实施例提供一种音频资源分配装置,包括:An embodiment of the present application provides an audio resource allocation device, including:
第一接收模块,用于接收第一应用程序的音频资源的请求消息;A first receiving module, configured to receive a request message of an audio resource of the first application program;
音频资源分配模块,用于将所述音频资源分配给所述第一应用程序,以使所述第一应用程序利用所述音频资源播放音频;An audio resource allocation module, configured to allocate the audio resource to the first application program, so that the first application program uses the audio resource to play audio;
第二接收模块,用于在分屏模式下,接收第二应用程序的所述音频资源的请求消息,其中所述第一应用程序处于第一分屏,所述第二应用程序处于第二分屏;A second receiving module, configured to receive a request message for the audio resource of a second application in a split-screen mode, wherein the first application is in a first split-screen and the second application is in a second split Screen;
获取模块,用于获取所述第一应用程序的第一优先级和所述第二应用程序的第二优先级;An obtaining module, configured to obtain the first priority of the first application and the second priority of the second application;
处理模块,用于若所述第一优先级大于或等于所述第二优先级,则发送音频资源请求失败响应至所述第二应用程序;A processing module, configured to send an audio resource request failure response to the second application if the first priority is greater than or equal to the second priority;
若所述第一优先级小于所述第二优先级,则释放所述第一应用程序占用的所述音频资源,并将所述音频资源分配给所述第二应用程序,以使所述第二应用程序利用所述音频资源播放音频。If the first priority is less than the second priority, release the audio resources occupied by the first application, and allocate the audio resources to the second application, so that the first Two applications use the audio resources to play audio.
本申请实施例还提供一种电子设备,包括存储器及处理器,所述存储器中储存有计算机程序,其特征在于,所述计算机程序被所述处理器执行时,使得所述处理器执行:An embodiment of the present application further provides an electronic device, including a memory and a processor, and the memory stores a computer program, wherein when the computer program is executed by the processor, the processor is caused to execute:
接收第一应用程序的音频资源的请求消息;Receiving a request message for the audio resource of the first application program;
将所述音频资源分配给所述第一应用程序,以使所述第一应用程序利用所述音频资源播放音频;Allocating the audio resource to the first application program, so that the first application program uses the audio resource to play audio;
在分屏模式下,接收第二应用程序的所述音频资源的请求消息,其中所述第一应用程序处于第一分屏,所述第二应用程序处于第二分屏;In a split-screen mode, receiving a request message for the audio resource of a second application, where the first application is on a first split-screen and the second application is on a second split-screen;
获取所述第一应用程序的第一优先级和所述第二应用程序的第二优先级;Acquiring the first priority of the first application and the second priority of the second application;
若所述第一优先级大于或等于所述第二优先级,则发送音频资源请求失败响应至所述第二应用程序;If the first priority is greater than or equal to the second priority, send an audio resource request failure response to the second application;
若所述第一优先级小于所述第二优先级,则释放所述第一应用程序占用的所述音频资源,并将所述音频资源分配给所述第二应用程序,以使所述第二应用程序利用所述音频资源播放音频。If the first priority is less than the second priority, release the audio resources occupied by the first application, and allocate the audio resources to the second application, so that the first Two applications use the audio resources to play audio.
本申请实施例还提供一种计算机非易失性可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现如上述的对应用程序进行处理的步骤。Embodiments of the present application also provide a computer non-volatile readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of processing the application program as described above are realized.
电子设备和计算机可读存储介质在实现上述方法时,接收第一应用程序的音频资源的请求消息;将所述音频资源分配给所述第一应用程序,以使所述第一应用程序利用所述音频资源播放音频;在分屏模式下,接收第二应用程序的所述音频资源的请求消息,其中所述第一应用程序处于第一分屏,所述第二应用程序处于第二分屏;获取所述第一应用程序的第一优先级和所述第二应用程序的第二优先级;根据第一优先级和第二优先级的大小分配所述音频资源,以使所述第一应用程序或第二应用程序利用所述音频资源播放音 频,解决了在分屏模式下音频资源冲突问题,提升了用户体验。When implementing the above method, the electronic device and the computer-readable storage medium receive the request message of the audio resource of the first application program; allocate the audio resource to the first application program, so that the first application program uses the The audio resource plays audio; in a split-screen mode, receiving a request message for the audio resource of a second application, where the first application is on a first split-screen and the second application is on a second split-screen ; Obtain the first priority of the first application and the second priority of the second application; allocate the audio resources according to the size of the first priority and the second priority, so that the first The application program or the second application program uses the audio resource to play audio, which solves the problem of audio resource conflict in the split-screen mode and improves the user experience.
附图说明BRIEF DESCRIPTION
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他实施例的附图。In order to more clearly explain the embodiments of the present invention or the technical solutions in the prior art, the following will briefly introduce the drawings required in the embodiments or the description of the prior art. Obviously, the drawings in the following description are only These are some embodiments of the present invention. For those of ordinary skill in the art, without paying any creative labor, drawings of other embodiments can be obtained based on these drawings.
图1为一实施例中的音频资源分配方法的流程图;FIG. 1 is a flowchart of an audio resource allocation method in an embodiment;
图2为一实施例中的调整应用程序优先级的流程图;FIG. 2 is a flowchart of adjusting application priority in an embodiment;
图3为另一实施例中的音频资源分配方法的流程图;3 is a flowchart of an audio resource allocation method in another embodiment;
图4为一实施例的音频资源分配装置的结构示意图;4 is a schematic structural diagram of an audio resource allocation device according to an embodiment;
图5为一实施例中电子设备的内部结构示意图;5 is a schematic diagram of the internal structure of an electronic device in an embodiment;
图6为与本申请实施例提供的计算机设备相关的电子设备的部分结构的框图。6 is a block diagram of a partial structure of an electronic device related to a computer device provided by an embodiment of the present application.
具体实施方式detailed description
为了便于理解本发明,下面将参照相关附图对本发明进行更全面的描述。附图中给出了本发明的较佳实施例。但是,本发明可以以许多不同的形式来实现,并不限于本文所描述的实施例。相反地,提供这些实施例的目的是使对本发明的申请内容的理解更加透彻全面。In order to facilitate understanding of the present invention, the present invention will be described more fully below with reference to related drawings. The drawings show preferred embodiments of the invention. However, the present invention can be implemented in many different forms, and is not limited to the embodiments described herein. On the contrary, the purpose of providing these embodiments is to make the understanding of the application content of the present invention more thorough and comprehensive.
可以理解,本申请所使用的术语“第一”、“第二”等可在本文中用于描述各种元件,但这些元件不受这些术语限制。这些术语仅用于将第一个元件与另一个元件区分。举例来说,在不脱离本申请的范围的情况下,可以将第一获取模块称为第二获取模块,且类似地,可将第二获取模块称为第一获取模块。第一获取模块和第二获取模块两者都是获取模块,但其不是同一获取模块。It can be understood that the terms “first”, “second”, etc. used in this application may be used herein to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish the first element from another element. For example, without departing from the scope of the present application, the first acquisition module may be referred to as the second acquisition module, and similarly, the second acquisition module may be referred to as the first acquisition module. Both the first acquisition module and the second acquisition module are acquisition modules, but they are not the same acquisition module.
如图1所示,本申请实施例提供了一种音频资源分配方法,应用于电子设备,该方法包括:As shown in FIG. 1, an embodiment of the present application provides an audio resource allocation method, which is applied to an electronic device. The method includes:
S110、接收第一应用程序的音频资源的请求消息;S110: Receive a request message for the audio resource of the first application program;
本申请实施例中,电子设备可以为移动终端、平板电脑、PDA(Personal Digital Assistant,个人数字助理)、POS(Point of Sales,销售终端)、车载电脑、穿戴式设备等任意电子设备。In the embodiment of the present application, the electronic device may be any electronic device such as a mobile terminal, a tablet computer, a PDA (Personal Digital Assistant), a POS (Point of Sales), an in-vehicle computer, a wearable device, and the like.
音频资源的请求消息包括音频资源请求相关数据。The audio resource request message includes audio resource request related data.
其中,音频资源请求相关数据包括但不限于音频数据及音频类型。Wherein, the data related to the audio resource request includes but is not limited to audio data and audio type.
其中,音频类型包括但不限于音乐,提醒音,闹铃音,系统音等。Among them, the audio type includes but is not limited to music, reminder sound, alarm sound, system sound and so on.
S120、将所述音频资源分配给所述第一应用程序,以使所述第一应用程序利用所述音频资源播放音频;S120: Assign the audio resource to the first application program, so that the first application program uses the audio resource to play audio;
电子设备接收到应用程序发出的音频资源的请求消息时,根据音频资源的请求消息给该应用程序分配相应的音频资源,以使该应用程序可以利用所述音频资源播放音频。When receiving the audio resource request message sent by the application program, the electronic device allocates the corresponding audio resource to the application program according to the audio resource request message, so that the application program can use the audio resource to play audio.
S130、在分屏模式下,接收第二应用程序的所述音频资源的请求消息,其中所述第一应用程序处于第一分屏,所述第二应用程序处于第二分屏;S130. In the split-screen mode, receive a request message for the audio resource of a second application, where the first application is on the first split-screen and the second application is on the second split-screen;
电子设备在接收到分屏指令时,控制电子设备显示至少两个显示区域,每一个显示区域均对应至少一个应用程序。若电子设备包括第一分屏和第二分屏,比如一个主屏幕和一个副屏幕,对于两个屏幕的大小、部位设置不限。例如,主屏幕较大,设置在电子设备的正面,而副屏幕较小,设置在电子设备的背面。其中,第一分屏既可以是主屏幕,也可以是副屏幕。When receiving the split screen instruction, the electronic device controls the electronic device to display at least two display areas, and each display area corresponds to at least one application program. If the electronic device includes a first split screen and a second split screen, such as a main screen and a sub-screen, the size and location of the two screens are not limited. For example, the main screen is larger and is located on the front of the electronic device, while the secondary screen is smaller and is located on the back of the electronic device. Among them, the first split screen may be either the main screen or the sub-screen.
在一个实施例中,当电子设备处于竖屏状态时,至少两个显示区域依次沿所述电子设备的长度方向上下排列显示,例如:当电子设备处于竖屏状态且显示两个显示区域时,其中一个显示区域在电子设备的上半部显示、另一个显示区域在电子设备的下半部显示;当电子设备处于横屏状态时,所述至少两个显示区域依次沿所述电子设备的长度方向左右排列显示,例如:电子设备处于横屏状态且显示两个显示区域时,其中一个显示区域在电子设备的左半部显示、另一个显示区域在电子设备的右半部显示。In one embodiment, when the electronic device is in a portrait state, at least two display areas are sequentially arranged up and down along the length of the electronic device, for example: when the electronic device is in a portrait state and two display areas are displayed, One display area is displayed in the upper half of the electronic device, and the other display area is displayed in the lower half of the electronic device; when the electronic device is in a landscape state, the at least two display areas are sequentially along the length of the electronic device The directions are arranged side by side. For example, when the electronic device is in a landscape state and two display areas are displayed, one of the display areas is displayed on the left half of the electronic device, and the other display area is displayed on the right half of the electronic device.
S140、获取所述第一应用程序的第一优先级和所述第二应用程序的第二优先级;S140. Acquire the first priority of the first application and the second priority of the second application;
在第一应用程序播放音频时,接收到处于分屏模式下的第二应用程序对同一音频资源的请求消息,则获取所述第一应用程序的第一优先级和所述第二应用程序的第二优先级,根据第一优先级和第二优先级的高低分配该音频资源。When the first application plays audio, when receiving a request message for the same audio resource from the second application in split-screen mode, the first priority of the first application and the second application’s The second priority is to allocate the audio resource according to the level of the first priority and the second priority.
在一个实施例中,在获取第一应用程序的第一优先级和第二应用程序的第二优先级之前,所述方法还包括:In one embodiment, before acquiring the first priority of the first application and the second priority of the second application, the method further includes:
根据所述电子设备中应用程序的使用频率或使用时长,设置所述电子设备中所有应用程序的优先级。The priority of all application programs in the electronic device is set according to the use frequency or duration of application programs in the electronic device.
具体地,电子设备中应用程序中,可以为每一个应用程序对应的音频预设置一个对应的优先级。该优先级可以根据用户对应用程序的使用频率或使用时长预先设置。具体地,使用频率越高的应用程序对应的优先级越高,使用时长越长的应用程序对应的优先级越高。Specifically, in the application program in the electronic device, a corresponding priority may be preset for the audio corresponding to each application program. The priority may be preset according to the frequency or duration of use of the application by the user. Specifically, an application program with a higher usage frequency corresponds to a higher priority, and an application program with a longer usage time corresponds to a higher priority.
本申请实施例中,优先级可以用数值1,2,3…表示。可以理解,上述通过数值来标识应用程序的优先级,仅作为本申请实施例中对应用程序的优 先级进行标识的一种方式,而不是对优先级标识方式的一种限定,实际上,还可以通过其他方式对应用程序的优先级进行标识。例如:通过字符A、B、C、D、E等,或者通过第一,第二,第三,第四,第五等对应用程序的优先级进行标识。本申请实施例对应用程序的优先级的标识方式不做具体限定。In the embodiment of the present application, the priority may be represented by the values 1, 2, 3... It can be understood that the above numerical value to identify the priority of the application is only used as a way to identify the priority of the application in the embodiments of the present application, rather than a limitation of the priority identification method. In fact, The priority of the application can be identified in other ways. For example, the characters A, B, C, D, E, etc., or the first, second, third, fourth, fifth, etc. are used to identify the priority of the application. The embodiment of the present application does not specifically limit the way of identifying the priority of the application.
S150、若所述第一优先级大于或等于所述第二优先级,则发送音频资源请求失败响应至所述第二应用程序;S150. If the first priority is greater than or equal to the second priority, send an audio resource request failure response to the second application;
本实施例中,可以通过电子设备应用层的消息传输机制发送音频资源请求失败响应至第二应用程序。若第二应用程序为多个,则可以将频资源请求失败响应同时发送至第二应用程序。In this embodiment, an audio resource request failure response can be sent to the second application program through a message transmission mechanism at the application layer of the electronic device. If there are multiple second applications, the response to the failure of the frequency resource request may be sent to the second application at the same time.
S160、若所述第一优先级小于所述第二优先级,则释放所述第一应用程序占用的所述音频资源,并将所述音频资源分配给所述第二应用程序,以使所述第二应用程序利用所述音频资源播放音频。S160. If the first priority is less than the second priority, release the audio resources occupied by the first application, and allocate the audio resources to the second application, so that all The second application uses the audio resource to play audio.
在实际应用中,电子设备上为每一应用程序分配一个用于播放该应用程序对应的音频的进程。例如,电子设备上包括两个应用程序,分别为应用C和应用D,则电子设备将为应用C分配一个用于播放应用C对应的音频的进程X,为应用D分配一个用于播放应用D对应的音频的进程Y。在同一时间,电子设备上仅可运行一个用于播放音频的进程。本申请实施例中,若电子设备上同时有多个应用程序对应的音频需要播放,则根据各应用程序对应优先级由高到低的顺序,选择该多个应用中优先级最高的一个应用程序,并为该应用程序分配一个用于播放该应用程序对应的音频的进程,以使该应用程序播放音频。In practical applications, each application program is allocated a process for playing audio corresponding to the application program on the electronic device. For example, if the electronic device includes two application programs, namely application C and application D, the electronic device will allocate a process X for application C to play the audio corresponding to application C, and an application D for playing application D Corresponding audio process Y. At the same time, only one process for playing audio can be running on the electronic device. In the embodiment of the present application, if the audio corresponding to multiple applications needs to be played on the electronic device at the same time, the application with the highest priority among the multiple applications is selected according to the order of the corresponding priorities of the respective applications from high to low , And assign a process for the application to play the audio corresponding to the application, so that the application can play the audio.
本申请实施例中,通过接收第一应用程序的音频资源的请求消息;将所述音频资源分配给所述第一应用程序,以使所述第一应用程序利用所述音频资源播放音频;在分屏模式下,接收第二应用程序的所述音频资源的请求消息,其中所述第一应用程序处于第一分屏,所述第二应用程序处于第二分屏;获取所述第一应用程序的第一优先级和所述第二应用程序的第二优先级;若所述第一优先级大于或等于所述第二优先级,则发送音频资源请求失败响应至所述第二应用程序;若所述第一优先级小于所述第二优先级,则释放所述第一应用程序占用的所述音频资源,并将所述音频资源分配给所述第二应用程序,以使所述第二应用程序利用所述音频资源播放音频,解决了在分屏模式下音频资源冲突问题,提升了用户体验。In the embodiment of the present application, by receiving a request message of an audio resource of a first application; allocating the audio resource to the first application, so that the first application uses the audio resource to play audio; In the split-screen mode, receiving a request message for the audio resource of a second application, where the first application is on a first split-screen and the second application is on a second split-screen; acquiring the first application A first priority of the program and a second priority of the second application; if the first priority is greater than or equal to the second priority, send an audio resource request failure response to the second application ; If the first priority is less than the second priority, release the audio resources occupied by the first application, and allocate the audio resources to the second application, so that the The second application uses the audio resources to play audio, solves the problem of audio resource conflicts in the split screen mode, and improves the user experience.
在一个实施例中,在第一应用程序播放音频时,接收到处于分屏模式下的第二应用程序对同一音频资源的请求消息,可以检测第一应用程序占用该音频资源是否有效。若有效,则发送音频资源请求失败响应至所述第二应用程序;若无效,则将该音频资源分配给第二应用程序,以使第二应用程序利 用该音频资源播放音频。In one embodiment, when the first application plays audio, the second application in the split-screen mode receives a request message for the same audio resource, and it can detect whether the audio resource occupied by the first application is valid. If valid, send an audio resource request failure response to the second application; if invalid, allocate the audio resource to the second application, so that the second application uses the audio resource to play audio.
具体地,在预设时间段内对第一应用程序占用的音频资源进行分析。可以通过获取预设时间段内第一应用程序输出的音频数据,对该音频数据进行分析,判断音频数据是否为无效数据。当所述音频数据均为无效数据或无效数据所占的比例大于预设阈值,则判定第一应用程序占用该音频资源无效,将该音频资源分配给第二应用程序。本实施例中的无效数据可以是音量为0的音频数据。Specifically, the audio resources occupied by the first application program are analyzed within a preset time period. The audio data output by the first application within a preset time period may be acquired, and the audio data may be analyzed to determine whether the audio data is invalid data. When the audio data is all invalid data or the proportion of invalid data is greater than a preset threshold, it is determined that the audio resource occupied by the first application is invalid, and the audio resource is allocated to the second application. The invalid data in this embodiment may be audio data with a volume of 0.
本申请实施例,通过检测第一应用程序占用该音频资源是否有效,若有效,则发送音频资源请求失败响应至所述第二应用程序;若无效,则将该音频资源分配给第二应用程序,以使第二应用程序利用该音频资源播放音频,可以有效利用音频资源,提高音频资源利用率。In the embodiment of the present application, by detecting whether the audio resource occupied by the first application is valid, if it is valid, an audio resource request failure response is sent to the second application; if it is invalid, the audio resource is allocated to the second application , So that the second application uses the audio resource to play audio, can effectively use the audio resource, and improve the utilization rate of the audio resource.
在一个实施例中,若未获取到所述第一应用程序的第一优先级或所述第二应用程序的第二优先级,则发送音频资源请求失败响应至所述第二应用程序。In one embodiment, if the first priority of the first application or the second priority of the second application is not obtained, an audio resource request failure response is sent to the second application.
当应用程序未设置优先级,或无法获取到应用程序的优先级,则无法通过优先级解决音频资源分配问题。可以认为当前播放音频的应用程序未最高优先级,该应用程序所占用的音频资源无法被抢占,发送音频资源请求失败响应至所述第二应用程序。When the application does not set the priority, or the priority of the application cannot be obtained, the audio resource allocation problem cannot be solved by the priority. It may be considered that the application program currently playing audio does not have the highest priority, the audio resource occupied by the application program cannot be preempted, and an audio resource request failure response is sent to the second application program.
在一个实施例中,如图2所示,所述方法还可以对应用程序的优先级进行调整,包括:In one embodiment, as shown in FIG. 2, the method can also adjust the priority of the application, including:
S210、获取所述应用程序的等待时长,所述等待时长为所述应用程序发出音频资源的请求消息后所等待的时长;S210. Obtain the waiting time of the application program, where the waiting time is the time that the application program waits after sending the audio resource request message;
S220、若所述等待时长超过预设阈值,则提高所述应用程序的优先级。S220. If the waiting time exceeds a preset threshold, increase the priority of the application.
例如,在第一应用程序利用音频资源播放音频时,在10:00和10:01时刻分别接收到第二应用程序和第四应用程序发出的对该音频资源的请求消息,通过比较第一应用程序和第二应用程序、第四应用程序的优先级得出,第一应用程序的优先级高于第二应用程序、第四应用程序的优先级,则发送音频资源请求失败响应至所述第二应用程序和第四应用程序,此时第二应用程序和第四应用程序均处于等待过程。在10:03时刻获取第二应用程序和第四应用程序的等待时长,分别为3分钟和2分钟,若预设阈值为1分钟,则第二应用程序和第四应用程序的等待时长均超过预设阈值,对第二应用程序和第四应用程序的优先级进行提高。For example, when the first application uses audio resources to play audio, the request messages for the audio resources from the second application and the fourth application are received at 10:00 and 10:01, respectively, by comparing the first application The priority of the program, the second application, and the fourth application is obtained. If the priority of the first application is higher than the priority of the second application and the fourth application, an audio resource request failure response is sent to the first The second application and the fourth application, at this time, the second application and the fourth application are in a waiting process. Obtain the waiting time of the second application and the fourth application at 10:03, which are 3 minutes and 2 minutes respectively. If the preset threshold is 1 minute, the waiting time of the second application and the fourth application both exceed A preset threshold is used to increase the priority of the second application and the fourth application.
在一个实施例中,可以设置不同的提高幅度,不同的优先级对应不同的提高幅度,可以是优先级越高,对应的提高幅度越大。例如,第二应用程序的优先级高于第四应用程序的优先级,则第二应用程序的提高幅度大于第四 应用程序的提高幅度。In one embodiment, different increase ranges can be set, and different priorities correspond to different increase ranges. The higher the priority, the greater the corresponding increase range. For example, if the priority of the second application is higher than that of the fourth application, then the increase of the second application is greater than the increase of the fourth application.
需要说明的是,预设阈值可以为1分钟、3分钟、5分钟等,预设阈值为1分钟仅作为本申请实施例中的一种示例,而不理解为是对本申请实施例中对预设阈值的限定。实际上,预设阈值可以是本领域技术人员根据实际需求确定,本申请实施例在此不对预设阈值进行限定。It should be noted that the preset threshold may be 1 minute, 3 minutes, 5 minutes, etc. The preset threshold of 1 minute is only an example in the embodiments of the present application, and is not to be understood as a Set threshold limits. In fact, the preset threshold may be determined by those skilled in the art according to actual needs, and the embodiment of the present application does not limit the preset threshold here.
图3为另一实施例中的音频资源分配方法的流程图,如图3所示,所述方法包括:FIG. 3 is a flowchart of an audio resource allocation method in another embodiment. As shown in FIG. 3, the method includes:
S310、接收第一应用程序的音频资源的请求消息;S310: Receive a request message for the audio resource of the first application program;
S320、将所述音频资源分配给所述第一应用程序,以使所述第一应用程序利用所述音频资源播放音频;S320. Allocate the audio resource to the first application program, so that the first application program uses the audio resource to play audio;
S330、在分屏模式下,接收第二应用程序的所述音频资源的请求消息,其中所述第一应用程序处于第一分屏,所述第二应用程序处于第二分屏S330. In the split-screen mode, receive a request message for the audio resource of a second application, where the first application is on the first split-screen and the second application is on the second split-screen
S340、显示提示消息,所述提示消息用于提示用户对所述第二应用程序进行处理;S340. Display a prompt message, where the prompt message is used to prompt the user to process the second application program;
S350、当接收到用户针对所述提示消息的选择操作指令时,根据所述选择操作指令分配所述音频资源。S350. When receiving the user's selection operation instruction for the prompt message, allocate the audio resource according to the selection operation instruction.
在一个实施例中,当第一应用程序播放音频时,接收到处于分屏模式下的第二应用程序对同一音频资源的请求消息,电子设备可以通过语音输出、弹出对话框等形式显示提示消息,用于提示用户对第二应用程序进行处理。以弹出对话框为例,当第一应用程序播放音频时,若接收到处于分屏模式下的第二应用程序对同一音频资源的请求消息,则弹出对话框,对话框可以包括以下信息:是否将音频资源分配给第二应用程序和对应的是、否按钮,用户根据实际情况选择对第二应用程序进行处理。若检测到用户点击是按钮,则将音频资源分配给第二应用程序,以使第二应用程序利用该音频资源播放音频;若检测到用户点击否按钮,则发送音频资源请求失败响应至所述第二应用程序。In one embodiment, when the first application plays audio, the second application in split-screen mode receives a request message for the same audio resource, and the electronic device may display a prompt message in the form of voice output, a pop-up dialog box, etc. , Used to prompt the user to process the second application. Taking a pop-up dialog box as an example, when the first application plays audio, if a request message for the same audio resource from the second application in split-screen mode is received, a dialog box pops up, and the dialog box may include the following information: whether The audio resource is allocated to the second application and the corresponding yes and no buttons, and the user chooses to process the second application according to the actual situation. If it is detected that the user clicks the Yes button, the audio resource is allocated to the second application so that the second application uses the audio resource to play audio; if it is detected that the user clicks the No button, an audio resource request failure response is sent to the The second application.
本申请实施例,通过显示提示消息提示用户对第二应用程序进行处理;当接收到用户针对所述提示消息的选择操作指令时,根据所述选择操作指令分配所述音频资源,可以对音频资源合理的分配,解决了在分屏模式下音频资源冲突问题,提升了用户体验。In the embodiment of the present application, the user is prompted to process the second application by displaying a prompt message; when a user's selection operation instruction for the prompt message is received, the audio resource can be allocated according to the selection operation instruction, and the audio resource can be allocated Reasonable allocation solves the problem of conflicting audio resources in split-screen mode and improves the user experience.
在一个实施例中,若第一分屏中还包括第三应用程序,当接收到所述第三应用程序的所述音频资源的请求消息,则发送音频资源请求失败响应至所述第三应用程序。In an embodiment, if the first split screen further includes a third application program, when a request message for the audio resource of the third application program is received, an audio resource request failure response is sent to the third application program.
所述第一分屏中包括第一应用程序和第三应用程序,当第一应用程序利用音频资源播放音频时,电子设备接收到第三应用程序的所述音频资源的请 求消息,则所述电子设备发送音频资源请求失败响应至所述第三应用程序,从而保证第一应用程序正常播放音频。The first split screen includes a first application and a third application. When the first application uses audio resources to play audio, the electronic device receives a request message for the audio resource of the third application, then the The electronic device sends an audio resource request failure response to the third application program, thereby ensuring that the first application program normally plays audio.
本申请实施例,通过接收第一应用程序的音频资源的请求消息;将所述音频资源分配给所述第一应用程序,以使所述第一应用程序利用所述音频资源播放音频;在分屏模式下,接收第三应用程序的所述音频资源的请求消息,其中所述第一应用程序和第三应用程序均处于第一分屏,则发送音频资源请求失败响应至所述第三应用程序,保证在同一分屏中的应用程序不抢占音频资源,保证音频播放的有序性。In the embodiment of the present application, by receiving a request message of an audio resource of a first application; allocating the audio resource to the first application, so that the first application uses the audio resource to play audio; In the screen mode, receiving a request message for the audio resource of a third application, where the first application and the third application are on the first split screen, and sending an audio resource request failure response to the third application Programs to ensure that applications in the same split screen do not preempt audio resources and ensure orderly audio playback.
在一个实施例中,当所述电子设备退出分屏模式时,则锁定所述音频资源,以使所述音频资源保持占用状态。In one embodiment, when the electronic device exits the split-screen mode, the audio resource is locked to keep the audio resource occupied.
具体地,电子设备在分屏模式下,第一应用程序利用音频资源播放音频,当电子设备在退出分屏模式时,锁定所述音频资源,以使音频资源仍然保持第一应用程序占用状态,从而保证音频资源当在退出分屏模式时不被抢占,使第一应用程序正常播放音频。Specifically, when the electronic device is in the split-screen mode, the first application uses audio resources to play audio, and when the electronic device exits the split-screen mode, the audio resource is locked so that the audio resource still maintains the occupied state of the first application, Therefore, it is ensured that the audio resource is not preempted when exiting the split-screen mode, so that the first application program normally plays audio.
本申请实施例,在电子设备退出分屏模式时,锁定所述音频资源,以使音频资源保持占用状态,提高了音频输出的稳定性,提升了用户体验。In the embodiment of the present application, when the electronic device exits the split screen mode, the audio resource is locked to keep the audio resource occupied, thereby improving the stability of audio output and the user experience.
如图4所示,本申请实施例提供了一种音频资源分配装置40,该装置包括:As shown in FIG. 4, an embodiment of the present application provides an audio resource allocation device 40, which includes:
第一接收模块41,用于接收第一应用程序的音频资源的请求消息;The first receiving module 41 is configured to receive a request message of the audio resource of the first application program;
装置40可以应用于电子设备,其中,电子设备可以为移动终端、平板电脑、PDA(Personal Digital Assistant,个人数字助理)、POS(Point of Sales,销售终端)、车载电脑、穿戴式设备等任意电子设备。The device 40 can be applied to electronic equipment, where the electronic equipment can be any electronic device such as a mobile terminal, a tablet computer, a PDA (Personal Digital Assistant), a POS (Point of Sales), an in-vehicle computer, a wearable device, etc. equipment.
音频资源的请求消息包括音频资源请求相关数据。The audio resource request message includes audio resource request related data.
其中,音频资源请求相关数据包括但不限于音频数据及音频类型。Wherein, the data related to the audio resource request includes but is not limited to audio data and audio type.
其中,音频类型包括但不限于音乐,提醒音,闹铃音,系统音等。Among them, the audio type includes but is not limited to music, reminder sound, alarm sound, system sound and so on.
音频资源分配模块42,用于将所述音频资源分配给所述第一应用程序,以使所述第一应用程序利用所述音频资源播放音频;The audio resource allocation module 42 is configured to allocate the audio resource to the first application program, so that the first application program uses the audio resource to play audio;
第一接收模块41接收到应用程序发出的音频资源的请求消息时,音频资源分配模块42根据音频资源的请求消息给该应用程序分配相应的音频资源,以使该应用程序可以利用所述音频资源播放音频。When the first receiving module 41 receives the audio resource request message sent by the application, the audio resource allocation module 42 allocates the corresponding audio resource to the application according to the audio resource request message, so that the application can use the audio resource Play audio.
第二接收模块43,用于在分屏模式下,接收第二应用程序的所述音频资源的请求消息,其中所述第一应用程序处于第一分屏,所述第二应用程序处于第二分屏;The second receiving module 43 is configured to receive a request message of the audio resource of a second application in a split-screen mode, wherein the first application is in a first split-screen and the second application is in a second Split Screen;
电子设备在接收到分屏指令时,控制电子设备显示至少两个显示区域,每一个显示区域均对应至少一个应用程序。若电子设备包括第一分屏和第二 分屏,比如一个主屏幕和一个副屏幕,对于两个屏幕的大小、部位设置不限。例如,主屏幕较大,设置在电子设备的正面,而副屏幕较小,设置在电子设备的背面。其中,第一分屏既可以是主屏幕,也可以是副屏幕。When receiving the split screen instruction, the electronic device controls the electronic device to display at least two display areas, and each display area corresponds to at least one application program. If the electronic device includes a first split screen and a second split screen, such as a main screen and a sub-screen, the size and location of the two screens are not limited. For example, the main screen is larger and is located on the front of the electronic device, while the secondary screen is smaller and is located on the back of the electronic device. Among them, the first split screen may be either the main screen or the sub-screen.
在一个实施例中,当电子设备处于竖屏状态时,至少两个显示区域依次沿所述电子设备的长度方向上下排列显示,例如:当电子设备处于竖屏状态且显示两个显示区域时,其中一个显示区域在电子设备的上半部显示、另一个显示区域在电子设备的下半部显示;当电子设备处于横屏状态时,所述至少两个显示区域依次沿所述电子设备的长度方向左右排列显示,例如:电子设备处于横屏状态且显示两个显示区域时,其中一个显示区域在电子设备的左半部显示、另一个显示区域在电子设备的右半部显示。In one embodiment, when the electronic device is in a portrait state, at least two display areas are sequentially arranged up and down along the length of the electronic device, for example: when the electronic device is in a portrait state and two display areas are displayed, One display area is displayed in the upper half of the electronic device, and the other display area is displayed in the lower half of the electronic device; when the electronic device is in a landscape state, the at least two display areas are sequentially along the length of the electronic device The directions are arranged side by side. For example, when the electronic device is in a landscape state and two display areas are displayed, one of the display areas is displayed on the left half of the electronic device, and the other display area is displayed on the right half of the electronic device.
获取模块44,用于获取所述第一应用程序的第一优先级和所述第二应用程序的第二优先级;An obtaining module 44 for obtaining the first priority of the first application and the second priority of the second application;
在第一应用程序播放音频时,第二接收模块43接收到处于分屏模式下的第二应用程序对同一音频资源的请求消息时,获取模块44则获取所述第一应用程序的第一优先级和所述第二应用程序的第二优先级,根据第一优先级和第二优先级的高低分配该音频资源。When the first application plays audio, when the second receiving module 43 receives a request message for the same audio resource from the second application in split-screen mode, the obtaining module 44 obtains the first priority of the first application Level and the second priority of the second application, the audio resource is allocated according to the level of the first priority and the second priority.
在一个实施例中,装置40还包括优先级设置模块(图中未示出),具体用于根据所述电子设备中应用程序的使用频率或使用时长,设置所述电子设备中所有应用程序的优先级。In one embodiment, the apparatus 40 further includes a priority setting module (not shown in the figure), which is specifically configured to set all application programs in the electronic device according to the use frequency or duration of the application programs in the electronic device priority.
具体地,电子设备中应用程序中,优先级设置模块可以为每一个应用程序对应的音频预设置一个对应的优先级。该优先级可以根据用户对应用程序的使用频率或使用时长预先设置。具体地,使用频率越高的应用程序对应的优先级越高,使用时长越长的应用程序对应的优先级越高。Specifically, in the application program in the electronic device, the priority setting module may preset a corresponding priority level for the audio corresponding to each application program. The priority may be preset according to the frequency or duration of use of the application by the user. Specifically, an application program with a higher usage frequency corresponds to a higher priority, and an application program with a longer usage time corresponds to a higher priority.
本申请实施例中,优先级可以用数值1,2,3…表示。可以理解,上述通过数值来标识应用程序的优先级,仅作为本申请实施例中对应用程序的优先级进行标识的一种方式,而不是对优先级标识方式的一种限定,实际上,还可以通过其他方式对应用程序的优先级进行标识。例如:通过字符A、B、C、D、E等,或者通过第一,第二,第三,第四,第五等对应用程序的优先级进行标识。本申请实施例对应用程序的优先级的标识方式不做具体限定。In the embodiment of the present application, the priority may be represented by the values 1, 2, 3... It can be understood that the above-mentioned numerical value to identify the priority of the application is only a way of identifying the priority of the application in the embodiments of the present application, rather than a limitation of the priority identification method. In fact, The priority of the application can be identified in other ways. For example, the characters A, B, C, D, E, etc., or the first, second, third, fourth, fifth, etc. are used to identify the priority of the application. The embodiment of the present application does not specifically limit the way of identifying the priority of the application.
处理模块45,用于若所述第一优先级大于或等于所述第二优先级,则发送音频资源请求失败响应至所述第二应用程序;The processing module 45 is configured to send an audio resource request failure response to the second application if the first priority is greater than or equal to the second priority;
本实施例中,可以通过电子设备应用层的消息传输机制发送音频资源请求失败响应至第二应用程序。若第二应用程序为多个,则可以将频资源请求失败响应同时发送至第二应用程序。In this embodiment, an audio resource request failure response can be sent to the second application program through a message transmission mechanism at the application layer of the electronic device. If there are multiple second applications, the response to the failure of the frequency resource request may be sent to the second application at the same time.
若所述第一优先级小于所述第二优先级,则释放所述第一应用程序占用 的所述音频资源,并将所述音频资源分配给所述第二应用程序,以使所述第二应用程序利用所述音频资源播放音频。If the first priority is less than the second priority, release the audio resources occupied by the first application, and allocate the audio resources to the second application, so that the first Two applications use the audio resources to play audio.
在实际应用中,电子设备上为每一应用程序分配一个用于播放该应用程序对应的音频的进程。例如,电子设备上包括两个应用程序,分别为应用C和应用D,则电子设备将为应用C分配一个用于播放应用C对应的音频的进程X,为应用D分配一个用于播放应用D对应的音频的进程Y。在同一时间,电子设备上仅可运行一个用于播放音频的进程。本申请实施例中,若电子设备上同时有多个应用程序对应的音频需要播放,则根据各应用程序对应优先级由高到低的顺序,选择该多个应用中优先级最高的一个应用程序,并为该应用程序分配一个用于播放该应用程序对应的音频的进程,以使该应用程序播放音频。In practical applications, each application program is allocated a process for playing audio corresponding to the application program on the electronic device. For example, if the electronic device includes two applications, namely application C and application D, the electronic device will allocate a process X for application C to play the audio corresponding to application C, and an application D for playing application D Corresponding audio process Y. At the same time, only one process for playing audio can be running on the electronic device. In the embodiment of the present application, if the audio corresponding to multiple applications needs to be played on the electronic device at the same time, the application with the highest priority among the multiple applications is selected according to the order of the priority of the corresponding applications from high to low , And assign a process for playing audio corresponding to the application to the application so that the application can play audio.
本申请实施例中,通过第一接收模块41接收第一应用程序的音频资源的请求消息;音频资源分配模块42将所述音频资源分配给所述第一应用程序,以使所述第一应用程序利用所述音频资源播放音频;第二接收模块43在分屏模式下,接收第二应用程序的所述音频资源的请求消息,其中所述第一应用程序处于第一分屏,所述第二应用程序处于第二分屏;获取模块44获取所述第一应用程序的第一优先级和所述第二应用程序的第二优先级;处理模块45根据第一优先级和第二优先级的大小分配所述音频资源,以使所述第一应用程序或第二应用程序利用所述音频资源播放音频,解决了在分屏模式下音频资源冲突问题,提升了用户体验。In the embodiment of the present application, the first application module 41 receives the audio resource request message of the first application program; the audio resource allocation module 42 allocates the audio resource to the first application program to enable the first application The program uses the audio resource to play audio; the second receiving module 43 receives the request message of the audio resource of the second application program in the split-screen mode, wherein the first application program is on the first split-screen, the first Two applications are in the second split screen; the obtaining module 44 obtains the first priority of the first application and the second priority of the second application; the processing module 45 according to the first priority and the second priority The size of the audio resource is allocated so that the first application or the second application uses the audio resource to play audio, which solves the problem of audio resource conflict in the split-screen mode and improves the user experience.
在一个实施例中,装置40还包括分析模块(图中未示出),具体用于:在第一应用程序播放音频时,接收到处于分屏模式下的第二应用程序对同一音频资源的请求消息,分析模块可以分析第一应用程序占用该音频资源是否有效。若有效,则发送音频资源请求失败响应至所述第二应用程序;若无效,则将该音频资源分配给第二应用程序,以使第二应用程序利用该音频资源播放音频。In one embodiment, the device 40 further includes an analysis module (not shown in the figure), which is specifically configured to: when the first application plays audio, receive the second application in split-screen mode on the same audio resource The request message, the analysis module may analyze whether the audio resource occupied by the first application is valid. If valid, send an audio resource request failure response to the second application; if invalid, allocate the audio resource to the second application, so that the second application uses the audio resource to play audio.
具体地,在预设时间段内分析模块对第一应用程序占用的音频资源进行分析。可以通过获取预设时间段内第一应用程序输出的音频数据,对该音频数据进行分析,判断音频数据是否为无效数据。当所述音频数据均为无效数据或无效数据所占的比例大于预设阈值,则判定第一应用程序占用该音频资源无效,将该音频资源分配给第二应用程序。本实施例中的无效数据可以是音量为0的音频数据。Specifically, the analysis module analyzes the audio resources occupied by the first application within a preset time period. The audio data output by the first application within a preset time period may be acquired, and the audio data may be analyzed to determine whether the audio data is invalid data. When the audio data is all invalid data or the proportion of invalid data is greater than a preset threshold, it is determined that the audio resource occupied by the first application is invalid, and the audio resource is allocated to the second application. The invalid data in this embodiment may be audio data with a volume of 0.
本申请实施例,分析模块通过分析第一应用程序占用该音频资源是否有效,若有效,则发送音频资源请求失败响应至所述第二应用程序;若无效,则将该音频资源分配给第二应用程序,以使第二应用程序利用该音频资源播 放音频,可以有效利用音频资源,提高音频资源利用率。In the embodiment of the present application, the analysis module analyzes whether the audio resource occupied by the first application is valid. If it is valid, an audio resource request failure response is sent to the second application; if it is invalid, the audio resource is allocated to the second The application program, so that the second application program uses the audio resource to play audio, can effectively use the audio resource, and improve the utilization rate of the audio resource.
在一个实施例中,若获取模块44未获取到所述第一应用程序的第一优先级或所述第二应用程序的第二优先级,则发送音频资源请求失败响应至所述第二应用程序。In one embodiment, if the acquisition module 44 does not acquire the first priority of the first application or the second priority of the second application, it sends an audio resource request failure response to the second application program.
当应用程序未设置优先级,或无法获取到应用程序的优先级,则无法通过优先级解决音频资源分配问题。可以认为当前播放音频的应用程序为最高优先级,该应用程序所占用的音频资源无法被抢占,发送音频资源请求失败响应至所述第二应用程序。When the application does not set the priority, or the priority of the application cannot be obtained, the audio resource allocation problem cannot be solved by the priority. It may be considered that the application program currently playing audio is the highest priority, the audio resource occupied by the application program cannot be preempted, and a response to the failure of sending an audio resource request is sent to the second application program.
在一个实施例中,装置40还包括优先级调整模块(图中未示出),具体用于:In one embodiment, the device 40 further includes a priority adjustment module (not shown in the figure), which is specifically used for:
获取所述应用程序的等待时长,所述等待时长为所述应用程序发出音频资源的请求消息后所等待的时长;Obtain the waiting time of the application program, the waiting time is the time that the application program waits after sending the audio resource request message;
若所述等待时长超过预设阈值,则提高所述应用程序的优先级。If the waiting time exceeds a preset threshold, the priority of the application program is increased.
例如,在第一应用程序利用音频资源播放音频时,在10:00和10:01时刻分别接收到第二应用程序和第四应用程序发出的对该音频资源的请求消息,通过比较第一应用程序和第二应用程序、第四应用程序的优先级得出,第一应用程序的优先级高于第二应用程序、第四应用程序的优先级,则发送音频资源请求失败响应至所述第二应用程序和第四应用程序,此时第二应用程序和第四应用程序均处于等待过程。在10:03时刻获取第二应用程序和第四应用程序的等待时长,分别为3分钟和2分钟,若预设阈值为1分钟,则第二应用程序和第四应用程序的等待时长均超过预设阈值,对第二应用程序和第四应用程序的优先级进行提高。For example, when the first application uses audio resources to play audio, the request messages for the audio resources from the second application and the fourth application are received at 10:00 and 10:01, respectively, by comparing the first application The priority of the program, the second application, and the fourth application is obtained. If the priority of the first application is higher than the priority of the second application and the fourth application, an audio resource request failure response is sent to the first The second application and the fourth application, at this time, the second application and the fourth application are in a waiting process. Obtain the waiting time of the second application and the fourth application at 10:03, which are 3 minutes and 2 minutes respectively. If the preset threshold is 1 minute, the waiting time of the second application and the fourth application both exceed A preset threshold is used to increase the priority of the second application and the fourth application.
在一个实施例中,可以设置不同的提高幅度,不同的优先级对应不同的提高幅度,可以是优先级越高,对应的提高幅度越大。例如,第二应用程序的优先级高于第四应用程序的优先级,则第二应用程序的提高幅度大于第四应用程序的提高幅度。In one embodiment, different increase ranges can be set, and different priorities correspond to different increase ranges. The higher the priority, the greater the corresponding increase range. For example, if the priority of the second application is higher than that of the fourth application, the increase of the second application is greater than the increase of the fourth application.
需要说明的是,预设阈值可以为1分钟、3分钟、5分钟等,预设阈值为1分钟仅作为本申请实施例中的一种示例,而不理解为是对本申请实施例中对预设阈值的限定。实际上,预设阈值可以是本领域技术人员根据实际需求自行确定,本申请实施例在此不对预设阈值进行限定。It should be noted that the preset threshold may be 1 minute, 3 minutes, 5 minutes, etc. The preset threshold of 1 minute is only an example in the embodiments of the present application, and is not to be understood as a Set threshold limits. In fact, the preset threshold may be determined by those skilled in the art according to actual needs. The embodiments of the present application do not limit the preset threshold here.
在一个实施例中,装置40还包括提示模块(图中未示出),具体用于:In one embodiment, the device 40 further includes a prompt module (not shown in the figure), which is specifically used for:
显示提示消息,所述提示消息用于提示用户对所述第二应用程序进行处理;Displaying a prompt message, the prompt message is used to prompt the user to process the second application program;
当接收到用户针对所述提示消息的选择操作指令时,根据所述选择操作指令分配所述音频资源。When a user's selection operation instruction for the prompt message is received, the audio resource is allocated according to the selection operation instruction.
在一个实施例中,当第一应用程序播放音频时,接收到处于分屏模式下的第二应用程序对同一音频资源的请求消息,提示模块可以通过语音输出、弹出对话框等形式显示提示消息,用于提示用户对第二应用程序进行处理。以弹出对话框为例,当第一应用程序播放音频时,若第二接收模块43接收到处于分屏模式下的第二应用程序对同一音频资源的请求消息,则提示模块弹出对话框,对话框可以包括以下信息:是否将音频资源分配给第二应用程序和对应的是、否按钮,用户根据实际情况选择对第二应用程序进行处理。若检测到用户点击是按钮,则将音频资源分配给第二应用程序,以使第二应用程序利用该音频资源播放音频;若检测到用户点击否按钮,则发送音频资源请求失败响应至所述第二应用程序。In one embodiment, when the first application plays audio, the second application in split-screen mode receives a request message for the same audio resource, and the prompt module may display the prompt message in the form of voice output, pop-up dialog, etc. , Used to prompt the user to process the second application. Taking a pop-up dialog box as an example, when the first application plays audio, if the second receiving module 43 receives a request message for the same audio resource from the second application in split-screen mode, the prompting module prompts the dialog box to pop up The box may include the following information: whether to allocate audio resources to the second application and corresponding yes and no buttons, and the user selects to process the second application according to actual conditions. If it is detected that the user clicks the Yes button, the audio resource is allocated to the second application so that the second application uses the audio resource to play audio; if it is detected that the user clicks the No button, an audio resource request failure response is sent to the The second application.
本申请实施例,提示模块通过显示提示消息提示用户对第二应用程序进行处理;当接收到用户针对所述提示消息的选择操作指令时,根据所述选择操作指令分配所述音频资源,可以对音频资源合理的分配,解决了在分屏模式下音频资源冲突问题,提升了用户体验。In the embodiment of the present application, the prompt module prompts the user to process the second application by displaying a prompt message; when receiving the user's selection operation instruction for the prompt message, the audio resource is allocated according to the selection operation instruction. The reasonable allocation of audio resources solves the problem of conflicting audio resources in split-screen mode and improves the user experience.
在一个实施例中,若第一分屏中还包括第三应用程序,当接收到所述第三应用程序的所述音频资源的请求消息,则发送音频资源请求失败响应至所述第三应用程序。In an embodiment, if the first split screen further includes a third application program, when a request message for the audio resource of the third application program is received, an audio resource request failure response is sent to the third application program.
具体地,所述第一分屏中包括第一应用程序和第三应用程序,当第一应用程序利用音频资源播放音频时,电子设备接收到第三应用程序的所述音频资源的请求消息,则所述电子设备发送音频资源请求失败响应至所述第三应用程序,从而保证第一应用程序正常播放音频。Specifically, the first split screen includes a first application and a third application. When the first application uses audio resources to play audio, the electronic device receives a request message for the audio resource of the third application, Then, the electronic device sends an audio resource request failure response to the third application program, thereby ensuring that the first application program normally plays audio.
本申请实施例,通过接收第一应用程序的音频资源的请求消息;将所述音频资源分配给所述第一应用程序,以使所述第一应用程序利用所述音频资源播放音频;在分屏模式下,接收第三应用程序的所述音频资源的请求消息,其中所述第一应用程序和第三应用程序均处于第一分屏,则发送音频资源请求失败响应至所述第三应用程序,保证在同一分屏中的应用程序不抢占音频资源,保证音频播放的有序性。In the embodiment of the present application, by receiving a request message of an audio resource of a first application; allocating the audio resource to the first application, so that the first application uses the audio resource to play audio; In the screen mode, receiving a request message for the audio resource of a third application, where the first application and the third application are on the first split screen, and sending an audio resource request failure response to the third application Programs to ensure that applications in the same split screen do not preempt audio resources and ensure orderly audio playback.
在一个实施例中,当电子设备退出分屏模式时,锁定所述音频资源,以使所述音频资源保持占用状态。In one embodiment, when the electronic device exits the split-screen mode, the audio resource is locked so that the audio resource remains occupied.
具体地,电子设备在分屏模式下,第一应用程序利用音频资源播放音频,当电子设备在退出分屏模式时,锁定所述音频资源,以使音频资源仍然保持第一应用程序占用状态,从而保证音频资源当在退出分屏模式时不被抢占,使第一应用程序正常播放音频。Specifically, when the electronic device is in the split-screen mode, the first application uses audio resources to play audio, and when the electronic device exits the split-screen mode, the audio resource is locked so that the audio resource still maintains the occupied state of the first application, Therefore, it is ensured that the audio resource is not preempted when exiting the split-screen mode, so that the first application program normally plays audio.
本申请实施例,通过在电子设备退出分屏模式时,锁定所述音频资源,以使音频资源保持占用状态,提高了音频输出的稳定性,提升了用户体验。In the embodiment of the present application, when the electronic device exits the split screen mode, the audio resource is locked to keep the audio resource occupied, thereby improving the stability of audio output and the user experience.
图5为一实施例中电子设备的内部结构示意图。如图5所示,该电子设备包括通过系统总线连接的处理器、非易失性存储介质、内存储器和网络接口、声音采集装置、扬声器、显示屏和输入装置。其中,终端的非易失性存储介质存储有操作系统和计算机可读指令。该计算机可读指令被处理器执行时以实现一种电子设备的对应用程序进行处理的方法。该处理器用于提供计算和控制能力,支撑整个电子设备的运行。电子设备中的内存储器为非易失性存储介质中的计算机可读指令的运行提供环境。电子设备的显示屏可以是液晶显示屏或者电子墨水显示屏等,输入装置可以是显示屏上覆盖的触摸层,也可以是电子设备外壳上设置的按键、轨迹球或触控板,也可以是外接的键盘、触控板或鼠标等。该电子设备可以是手机、平板电脑或者个人数字助理或穿戴式设备等。本领域技术人员可以理解,图5中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的电子设备的限定,具体的电子设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。5 is a schematic diagram of an internal structure of an electronic device in an embodiment. As shown in FIG. 5, the electronic device includes a processor connected through a system bus, a non-volatile storage medium, an internal memory and a network interface, a sound collection device, a speaker, a display screen, and an input device. Among them, the non-volatile storage medium of the terminal stores an operating system and computer-readable instructions. When the computer-readable instructions are executed by the processor, a method for processing an application program of an electronic device is realized. The processor is used to provide computing and control capabilities to support the operation of the entire electronic device. The internal memory in the electronic device provides an environment for the execution of computer-readable instructions in the non-volatile storage medium. The display screen of the electronic device may be a liquid crystal display screen or an electronic ink display screen, etc. The input device may be a touch layer covered on the display screen, or a button, a trackball or a touch pad provided on the casing of the electronic device, or it may be External keyboard, touchpad or mouse, etc. The electronic device may be a mobile phone, a tablet computer, a personal digital assistant or a wearable device. Those skilled in the art can understand that the structure shown in FIG. 5 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the electronic device to which the solution of the present application is applied. The specific electronic device may It includes more or fewer components than shown in the figure, or some components are combined, or have a different component arrangement.
其中,上述提及的音频资源分配方法具体可以为:Among them, the above-mentioned audio resource allocation method may specifically be:
接收第一应用程序的音频资源的请求消息;Receiving a request message for the audio resource of the first application program;
将所述音频资源分配给所述第一应用程序,以使所述第一应用程序利用所述音频资源播放音频;Allocating the audio resource to the first application program, so that the first application program uses the audio resource to play audio;
在分屏模式下,接收第二应用程序的所述音频资源的请求消息,其中所述第一应用程序处于第一分屏,所述第二应用程序处于第二分屏;In a split-screen mode, receiving a request message for the audio resource of a second application, where the first application is on a first split-screen and the second application is on a second split-screen;
获取所述第一应用程序的第一优先级和所述第二应用程序的第二优先级;Acquiring the first priority of the first application and the second priority of the second application;
若所述第一优先级大于或等于所述第二优先级,则发送音频资源请求失败响应至所述第二应用程序;If the first priority is greater than or equal to the second priority, send an audio resource request failure response to the second application;
若所述第一优先级小于所述第二优先级,则释放所述第一应用程序占用的所述音频资源,并将所述音频资源分配给所述第二应用程序,以使所述第二应用程序利用所述音频资源播放音频。If the first priority is less than the second priority, release the audio resources occupied by the first application, and allocate the audio resources to the second application, so that the first Two applications use the audio resources to play audio.
此外,本申请实施例还提供了一种计算机非易失性可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现如上述对应用程序进行处理的步骤。In addition, the embodiments of the present application also provide a computer non-volatile readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of processing the application program as described above are realized.
本发明实施例还提供了一种计算机设备。如图6所示,为了便于说明,仅示出了与本发明实施例相关的部分,具体技术细节未揭示的,请参照本发明实施例方法部分。该计算机设备可以为包括电子设备、平板电脑、PDA(Personal Digital Assistant,个人数字助理)、POS(Point of Sales,销售终端)、车载电脑、穿戴式设备等任意终端设备,以计算机设备为电子设 备为例:An embodiment of the present invention also provides a computer device. As shown in FIG. 6, for convenience of description, only parts related to the embodiments of the present invention are shown. For specific technical details not disclosed, please refer to the method part of the embodiments of the present invention. The computer device may be any terminal device including an electronic device, a tablet computer, a PDA (Personal Digital Assistant), a POS (Point of Sales), an in-vehicle computer, a wearable device, etc. The computer device is an electronic device For example:
图6为与本发明实施例提供的计算机设备相关的电子设备的部分结构的框图。参考图6,电子设备包括:射频(Radio Frequency,RF)电路610、存储器620、输入单元630、显示单元640、传感器650、音频电路660、无线保真(wireless fidelity,WiFi)模块670、处理器680、以及电源690等部件。本领域技术人员可以理解,图6所示的电子设备结构并不构成对电子设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。6 is a block diagram of a partial structure of an electronic device related to a computer device provided by an embodiment of the present invention. 6, the electronic device includes: a radio frequency (Radio Frequency) circuit 610, a memory 620, an input unit 630, a display unit 640, a sensor 650, an audio circuit 660, a wireless fidelity (WiFi) module 670, a processor 680, and power supply 690 and other components. Those skilled in the art may understand that the structure of the electronic device shown in FIG. 6 does not constitute a limitation on the electronic device, and may include more or less components than those shown in the figure, or combine some components, or arrange different components.
其中,RF电路610可用于收发信息或通话过程中,信号的接收和发送,可将基站的下行信息接收后,给处理器680处理;也可以将上行的数据发送给基站。通常,RF电路包括但不限于天线、至少一个放大器、收发信机、耦合器、低噪声放大器(Low Noise Amplifier,LNA)、双工器等。此外,RF电路610还可以通过无线通信与网络和其他设备通信。上述无线通信可以使用任一通信标准或协议,包括但不限于全球移动通讯系统(Global System of Mobile communication,GSM)、通用分组无线服务(General Packet Radio Service,GPRS)、码分多址(Code Division Multiple Access,CDMA)、宽带码分多址(Wideband Code Division Multiple Access,WCDMA)、长期演进(Long Term Evolution,LTE))、电子邮件、短消息服务(Short Messaging Service,SMS)等。Among them, the RF circuit 610 can be used to receive and send signals during sending and receiving information or during a call. It can receive the downlink information of the base station and process it to the processor 680; it can also send the uplink data to the base station. Generally, RF circuits include but are not limited to antennas, at least one amplifier, transceiver, coupler, low noise amplifier (Low Noise Amplifier, LNA), duplexer, and so on. In addition, the RF circuit 610 can also communicate with other devices through a wireless communication network. The above wireless communication can use any communication standard or protocol, including but not limited to Global System of Mobile (GSM), General Packet Radio Service (GPRS), and Code Division Multiple Access (Code Division) Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), e-mail, Short Message Service (SMS), etc.
存储器620可用于存储软件程序以及模块,处理器680通过运行存储在存储器620的软件程序以及模块,从而执行电子设备的各种功能应用以及数据处理。存储器620可主要包括程序存储区和数据存储区,其中,程序存储区可存储操作系统、至少一个功能所需的应用程序(比如声音播放功能的应用程序、图像播放功能的应用程序等)等;数据存储区可存储根据电子设备的使用所创建的数据(比如音频数据、通讯录等)等。此外,存储器620可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。The memory 620 may be used to store software programs and modules. The processor 680 runs the software programs and modules stored in the memory 620 to execute various functional applications and data processing of the electronic device. The memory 620 may mainly include a program storage area and a data storage area, where the program storage area may store an operating system and at least one function-required application program (such as a sound playback function application program, an image playback function application program, etc.), etc.; The data storage area can store data (such as audio data, address book, etc.) created according to the use of electronic devices. In addition, the memory 620 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other volatile solid-state storage devices.
输入单元630可用于接收输入的数字或字符信息,以及产生与电子设备600的用户设置以及功能控制有关的键信号输入。具体地,输入单元630可包括触控面板631以及其他输入设备632。触控面板631,也可称为触摸屏,可收集用户在其上或附近的触摸操作(比如用户使用手指、触笔等任何适合的物体或附件在触控面板631上或在触控面板631附近的操作),并根据预先设定的程式驱动相应的连接装置。在一个实施例中,触控面板631可包括触摸检测装置和触摸控制器两个部分。其中,触摸检测装置检测用户的触摸方位,并检测触摸操作带来的信号,将信号传送给触摸控制 器;触摸控制器从触摸检测装置上接收触摸信息,并将它转换成触点坐标,再送给处理器680,并能接收处理器680发来的命令并加以执行。此外,可以采用电阻式、电容式、红外线以及表面声波等多种类型实现触控面板631。除了触控面板631,输入单元630还可以包括其他输入设备632。具体地,其他输入设备632可以包括但不限于物理键盘、功能键(比如音量控制按键、开关按键等)等中的一种或多种。The input unit 630 may be used to receive input numeric or character information, and generate key signal input related to user settings and function control of the electronic device 600. Specifically, the input unit 630 may include a touch panel 631 and other input devices 632. The touch panel 631, also known as a touch screen, can collect user's touch operations on or near it (for example, the user uses any suitable objects or accessories such as fingers, stylus, etc. on or near the touch panel 631 Operation), and drive the corresponding connection device according to the preset program. In one embodiment, the touch panel 631 may include a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, and detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives touch information from the touch detection device and converts it into contact coordinates To the processor 680, and can receive the command sent by the processor 680 and execute it. In addition, the touch panel 631 may be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves. In addition to the touch panel 631, the input unit 630 may also include other input devices 632. Specifically, the other input devices 632 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.).
显示单元640可用于显示由用户输入的信息或提供给用户的信息以及电子设备的各种菜单。显示单元640可包括显示面板641。在一个实施例中,可以采用液晶显示器(Liquid Crystal Display,LCD)、有机发光二极管(Organic Light-Emitting Diode,OLED)等形式来配置显示面板641。在一个实施例中,触控面板631可覆盖显示面板641,当触控面板631检测到在其上或附近的触摸操作后,传送给处理器680以确定触摸事件的类型,随后处理器680根据触摸事件的类型在显示面板641上提供相应的视觉输出。虽然在图6中,触控面板631与显示面板641是作为两个独立的部件来实现电子设备的输入和输入功能,但是在某些实施例中,可以将触控面板631与显示面板641集成而实现电子设备的输入和输出功能。The display unit 640 may be used to display information input by the user or information provided to the user and various menus of the electronic device. The display unit 640 may include a display panel 641. In one embodiment, the display panel 641 may be configured in the form of a liquid crystal display (Liquid Crystal) (LCD), an organic light-emitting diode (Organic Light-Emitting Diode, OLED), or the like. In one embodiment, the touch panel 631 may cover the display panel 641, and when the touch panel 631 detects a touch operation on or near it, it is transmitted to the processor 680 to determine the type of touch event, and then the processor 680 according to The type of touch event provides corresponding visual output on the display panel 641. Although in FIG. 6, the touch panel 631 and the display panel 641 are implemented as two independent components to realize the input and input functions of the electronic device, in some embodiments, the touch panel 631 and the display panel 641 may be integrated And realize the input and output functions of electronic equipment.
电子设备600还可包括至少一种传感器650,比如光传感器、运动传感器以及其他传感器。具体地,光传感器可包括环境光传感器及接近传感器,其中,环境光传感器可根据环境光线的明暗来调节显示面板641的亮度,接近传感器可在电子设备移动到耳边时,关闭显示面板641和/或背光。运动传感器可包括加速度传感器,通过加速度传感器可检测各个方向上加速度的大小,静止时可检测出重力的大小及方向,可用于识别电子设备姿态的应用(比如横竖屏切换)、振动识别相关功能(比如计步器、敲击)等;此外,电子设备还可配置陀螺仪、气压计、湿度计、温度计、红外线传感器等其他传感器等。The electronic device 600 may further include at least one sensor 650, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 641 according to the brightness of the ambient light, and the proximity sensor may close the display panel 641 and the electronic device when moving to the ear /Or backlight. The motion sensor may include an acceleration sensor. The acceleration sensor can detect the magnitude of acceleration in various directions, and can detect the magnitude and direction of gravity when at rest. It can be used for applications that recognize the posture of electronic devices (such as horizontal and vertical screen switching), and vibration recognition related functions ( For example, pedometer, percussion, etc.; in addition, electronic devices can also be equipped with other sensors such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc.
音频电路660、扬声器661和传声器662可提供用户与电子设备之间的音频接口。音频电路660可将接收到的音频数据转换后的电信号,传输到扬声器661,由扬声器661转换为声音信号输出;另一方面,传声器662将收集的声音信号转换为电信号,由音频电路660接收后转换为音频数据,再将音频数据输出处理器680处理后,经RF电路610可以发送给另一电子设备,或者将音频数据输出至存储器620以便后续处理。The audio circuit 660, the speaker 661, and the microphone 662 may provide an audio interface between the user and the electronic device. The audio circuit 660 can transmit the converted electrical signal of the received audio data to the speaker 661, which converts the speaker 661 into a sound signal output; on the other hand, the microphone 662 converts the collected sound signal into an electrical signal, which is converted by the audio circuit 660 After receiving, it is converted into audio data, and then processed by the audio data output processor 680, and then sent to another electronic device via the RF circuit 610, or the audio data is output to the memory 620 for subsequent processing.
WiFi属于短距离无线传输技术,电子设备通过WiFi模块670可以帮助用户收发电子邮件、浏览网页和访问流式媒体等,它为用户提供了无线的宽带互联网访问。虽然图6示出了WiFi模块670,但是可以理解的是,其并不属于电子设备600的必须构成,可以根据需要而省略。WiFi is a short-range wireless transmission technology. Electronic devices can help users send and receive emails, browse web pages, and access streaming media through the WiFi module 670. It provides users with wireless broadband Internet access. Although FIG. 6 shows the WiFi module 670, it can be understood that it is not a necessary component of the electronic device 600, and may be omitted as needed.
处理器680是电子设备的控制中心,利用各种接口和线路连接整个电子设备的各个部分,通过运行或执行存储在存储器620内的软件程序和/或模块,以及调用存储在存储器620内的数据,执行电子设备的各种功能和处理数据,从而对电子设备进行整体监控。在一个实施例中,处理器680可包括一个或多个处理单元。在一个实施例中,处理器680可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作系统、用户界面和应用程序等;调制解调处理器主要处理无线通信。可以理解的是,上述调制解调处理器也可以不集成到处理器680中。The processor 680 is the control center of the electronic device, and uses various interfaces and lines to connect various parts of the entire electronic device, by running or executing the software programs and/or modules stored in the memory 620, and calling the data stored in the memory 620 , Perform various functions of electronic devices and process data, so as to monitor the electronic devices as a whole. In one embodiment, the processor 680 may include one or more processing units. In one embodiment, the processor 680 may integrate an application processor and a modem processor, where the application processor mainly processes the operating system, user interface, application programs, and the like; the modem processor mainly processes wireless communication. It can be understood that the above-mentioned modem processor may not be integrated into the processor 680.
电子设备600还包括给各个部件供电的电源690(比如电池),优选的,电源可以通过电源管理系统与处理器680逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。The electronic device 600 further includes a power supply 690 (such as a battery) that supplies power to various components. Preferably, the power supply can be logically connected to the processor 680 through the power management system, so as to implement functions such as charging, discharging, and power management through the power management system. .
在一个实施例中,电子设备600还可以包括摄像头、蓝牙模块等。In one embodiment, the electronic device 600 may further include a camera, a Bluetooth module, and the like.
在本发明实施例中,该计算机设备所包括的处理器680执行存储在存储器上的计算机程序时实现上述各实施例的方法。In the embodiments of the present invention, the processor 680 included in the computer device implements the methods of the foregoing embodiments when executing the computer program stored in the memory.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一非易失性计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)等。本发明实施例还提供了一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时上述各实施例的方法。Those of ordinary skill in the art may understand that all or part of the processes in the method of the above embodiments may be completed by instructing relevant hardware through a computer program, and the program may be stored in a non-volatile computer-readable storage medium In this case, when the program is executed, it may include the flow of the above method embodiments. Wherein, the storage medium may be a magnetic disk, an optical disk, a read-only memory (Read-Only Memory, ROM), etc. An embodiment of the present invention also provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the methods of the foregoing embodiments.
以上所述实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。The technical features of the above-mentioned embodiments can be arbitrarily combined. To simplify the description, all possible combinations of the technical features in the above-mentioned embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, All should be considered within the scope of this description.
以上所述实施例仅表达了本发明的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本发明构思的前提下,还可以做出若干变形和改进,这些都属于本发明的保护范围。因此,本发明专利的保护范围应以所附权利要求为准。The above-mentioned embodiments only express several embodiments of the present invention, and their descriptions are more specific and detailed, but they should not be construed as limiting the scope of the invention patent. It should be noted that, for a person of ordinary skill in the art, without departing from the concept of the present invention, several modifications and improvements can also be made, which all fall within the protection scope of the present invention. Therefore, the protection scope of the invention patent shall be subject to the appended claims.

Claims (10)

  1. 一种音频资源分配方法,应用于电子设备,其特征在于,包括:An audio resource allocation method, applied to electronic equipment, is characterized by comprising:
    接收第一应用程序的音频资源的请求消息;Receiving a request message for the audio resource of the first application program;
    将所述音频资源分配给所述第一应用程序,以使所述第一应用程序利用所述音频资源播放音频;Allocating the audio resource to the first application program, so that the first application program uses the audio resource to play audio;
    在分屏模式下,接收第二应用程序的所述音频资源的请求消息,其中所述第一应用程序处于第一分屏,所述第二应用程序处于第二分屏;In a split-screen mode, receiving a request message for the audio resource of a second application, where the first application is on a first split-screen and the second application is on a second split-screen;
    获取所述第一应用程序的第一优先级和所述第二应用程序的第二优先级;Acquiring the first priority of the first application and the second priority of the second application;
    若所述第一优先级大于或等于所述第二优先级,则发送音频资源请求失败响应至所述第二应用程序;If the first priority is greater than or equal to the second priority, send an audio resource request failure response to the second application;
    若所述第一优先级小于所述第二优先级,则释放所述第一应用程序占用的所述音频资源,并将所述音频资源分配给所述第二应用程序,以使所述第二应用程序利用所述音频资源播放音频。If the first priority is less than the second priority, release the audio resources occupied by the first application, and allocate the audio resources to the second application, so that the first Two applications use the audio resources to play audio.
  2. 根据权利要求1所述的方法,其特征在于,在所述获取所述第一应用程序的第一优先级和所述第二应用程序的第二优先级之前,所述方法还包括:The method according to claim 1, wherein before the acquiring the first priority of the first application and the second priority of the second application, the method further comprises:
    根据所述电子设备中应用程序的使用频率或使用时长,设置所述电子设备中所有应用程序的优先级。The priority of all application programs in the electronic device is set according to the use frequency or duration of application programs in the electronic device.
  3. 根据权利要求1所述的方法,其特征在于,所述方法还包括:The method according to claim 1, wherein the method further comprises:
    若未获取到所述第一应用程序的第一优先级或所述第二应用程序的第二优先级,则发送音频资源请求失败响应至所述第二应用程序。If the first priority of the first application or the second priority of the second application is not obtained, an audio resource request failure response is sent to the second application.
  4. 根据权利要求1所述的方法,其特征在于,所述方法还包括:The method according to claim 1, wherein the method further comprises:
    获取所述应用程序的等待时长,所述等待时长为所述应用程序发出音频资源的请求消息后所等待的时长;Obtain the waiting time of the application program, the waiting time is the time that the application program waits after sending the audio resource request message;
    判断所述等待时长是否超过预设阈值;Determine whether the waiting time exceeds a preset threshold;
    若所述等待时长超过预设阈值,则提高所述应用程序的优先级。If the waiting time exceeds a preset threshold, the priority of the application program is increased.
  5. 根据权利要求1所述的方法,其特征在于,所述方法还包括:The method according to claim 1, wherein the method further comprises:
    显示提示消息,所述提示消息用于提示用户对所述第二应用程序进行处理;Displaying a prompt message, the prompt message is used to prompt the user to process the second application program;
    当接收到用户针对所述提示消息的选择操作指令时,根据所述选择操作指令分配所述音频资源。When a user's selection operation instruction for the prompt message is received, the audio resource is allocated according to the selection operation instruction.
  6. 根据权利要求1所述的方法,其特征在于,所述方法还包括:The method according to claim 1, wherein the method further comprises:
    所述第一分屏中还包括第三应用程序,若接收到所述第三应用程序的所述音频资源的请求消息,则发送音频资源请求失败响应至所述第三应用程序。The first split screen further includes a third application program, and if a request message for the audio resource of the third application program is received, an audio resource request failure response is sent to the third application program.
  7. 根据权利要求1所述的方法,其特征在于,所述方法还包括:The method according to claim 1, wherein the method further comprises:
    当所述电子设备退出分屏模式时,锁定所述音频资源,以使所述音频资源保持占用状态。When the electronic device exits the split-screen mode, the audio resource is locked to keep the audio resource occupied.
  8. 一种音频资源分配装置,应用于电子设备,其特征在于,包括:An audio resource distribution device, applied to electronic equipment, is characterized by comprising:
    第一接收模块,用于接收第一应用程序的音频资源的请求消息;A first receiving module, configured to receive a request message of an audio resource of the first application program;
    音频资源分配模块,用于将所述音频资源分配给所述第一应用程序,以使所述第一应用程序利用所述音频资源播放音频;An audio resource allocation module, configured to allocate the audio resource to the first application program, so that the first application program uses the audio resource to play audio;
    第二接收模块,用于在分屏模式下,接收第二应用程序的所述音频资源的请求消息,其中所述第一应用程序处于第一分屏,所述第二应用程序处于第二分屏;A second receiving module, configured to receive a request message for the audio resource of a second application in a split-screen mode, wherein the first application is in a first split-screen and the second application is in a second split Screen;
    获取模块,用于获取所述第一应用程序的第一优先级和所述第二应用程序的第二优先级;An obtaining module, configured to obtain the first priority of the first application and the second priority of the second application;
    处理模块,用于若所述第一优先级大于或等于所述第二优先级,则发送音频资源请求失败响应至所述第二应用程序;A processing module, configured to send an audio resource request failure response to the second application if the first priority is greater than or equal to the second priority;
    若所述第一优先级小于所述第二优先级,则释放所述第一应用程序占用的所述音频资源,并将所述音频资源分配给所述第二应用程序,以使所述第二应用程序利用所述音频资源播放音频。If the first priority is less than the second priority, release the audio resources occupied by the first application, and allocate the audio resources to the second application, so that the first Two applications use the audio resources to play audio.
  9. 一种电子设备,包括存储器及处理器,所述存储器中储存有计算机程序,所述计算机程序被所述处理器执行时,使得所述处理器执行如权利要求1至7中任一项所述的音频资源分配方法的步骤。An electronic device includes a memory and a processor, and the memory stores a computer program, and when the computer program is executed by the processor, the processor is caused to execute the computer program according to any one of claims 1 to 7. Steps of the audio resource allocation method.
  10. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1至7中任一项所述的方法的步骤。A computer-readable storage medium on which a computer program is stored, characterized in that when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are realized.
PCT/CN2018/120137 2018-12-10 2018-12-10 Audio resource allocation method, device, and electronic apparatus WO2020118495A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2018/120137 WO2020118495A1 (en) 2018-12-10 2018-12-10 Audio resource allocation method, device, and electronic apparatus
CN201880098688.8A CN115668123A (en) 2018-12-10 2018-12-10 Audio resource allocation method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2018/120137 WO2020118495A1 (en) 2018-12-10 2018-12-10 Audio resource allocation method, device, and electronic apparatus

Publications (1)

Publication Number Publication Date
WO2020118495A1 true WO2020118495A1 (en) 2020-06-18

Family

ID=71076176

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/120137 WO2020118495A1 (en) 2018-12-10 2018-12-10 Audio resource allocation method, device, and electronic apparatus

Country Status (2)

Country Link
CN (1) CN115668123A (en)
WO (1) WO2020118495A1 (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112416290A (en) * 2020-11-27 2021-02-26 扬州航盛科技有限公司 Audio management method based on audio focus
CN114666613A (en) * 2020-12-22 2022-06-24 华为终端有限公司 Network live broadcast method and electronic equipment
CN115250310A (en) * 2021-04-26 2022-10-28 深圳市万普拉斯科技有限公司 Mobile terminal control method and device and mobile terminal
WO2024041328A1 (en) * 2022-08-22 2024-02-29 华为技术有限公司 Resource allocation method, apparatus, and carrier

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103617803A (en) * 2013-11-08 2014-03-05 中标软件有限公司 Multi-sound-source automatic switching method and system on vehicle-mounted system
CN104202649A (en) * 2014-08-27 2014-12-10 四川长虹电器股份有限公司 Method for operating multiple applications of intelligent television synchronously
CN108958695A (en) * 2018-06-28 2018-12-07 努比亚技术有限公司 Audio-frequency inputting method, device and computer readable storage medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103617803A (en) * 2013-11-08 2014-03-05 中标软件有限公司 Multi-sound-source automatic switching method and system on vehicle-mounted system
CN104202649A (en) * 2014-08-27 2014-12-10 四川长虹电器股份有限公司 Method for operating multiple applications of intelligent television synchronously
CN108958695A (en) * 2018-06-28 2018-12-07 努比亚技术有限公司 Audio-frequency inputting method, device and computer readable storage medium

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112416290A (en) * 2020-11-27 2021-02-26 扬州航盛科技有限公司 Audio management method based on audio focus
CN114666613A (en) * 2020-12-22 2022-06-24 华为终端有限公司 Network live broadcast method and electronic equipment
CN114666613B (en) * 2020-12-22 2024-01-05 华为终端有限公司 Network live broadcast method and electronic equipment
CN115250310A (en) * 2021-04-26 2022-10-28 深圳市万普拉斯科技有限公司 Mobile terminal control method and device and mobile terminal
WO2024041328A1 (en) * 2022-08-22 2024-02-29 华为技术有限公司 Resource allocation method, apparatus, and carrier

Also Published As

Publication number Publication date
CN115668123A (en) 2023-01-31

Similar Documents

Publication Publication Date Title
US10057627B2 (en) Method, apparatus and system for displaying bullet screen information
CN110752980B (en) Message sending method and electronic equipment
CN107391259B (en) Resource processing method and device, computer readable storage medium and mobile terminal
WO2020118495A1 (en) Audio resource allocation method, device, and electronic apparatus
WO2017008569A1 (en) Message updating method, apparatus, and terminal
CN106454404A (en) Live video playing method, device and system
US20170147187A1 (en) To-be-shared interface processing method, and terminal
CN106371964B (en) Method and device for prompting message
CN106254910B (en) Method and device for recording image
US9497565B1 (en) Interface display method, device, terminal, server and system
WO2018095130A1 (en) Method and system for determining duration of live streaming
CN107634962B (en) The management method and Related product of network bandwidth
WO2020103070A1 (en) Method and apparatus for processing application program, and electronic device
CN110475020B (en) Equipment control method and related product
EP3742769A1 (en) Service processing method and mobile communication terminal
CN111124345A (en) Audio source processing method and mobile terminal
TW201541337A (en) Method, device and system for displaying messages in mobile terminal
WO2019076250A1 (en) Push message management method and related products
CN108322602B (en) Method, terminal and computer readable storage medium for processing application no response
CN113039774B (en) Method and device for processing application program, electronic equipment and storage medium
CN108601048B (en) Flow control method and mobile terminal
KR101876394B1 (en) Method and device for playing media data on a terminal
WO2015078349A1 (en) Microphone sound-reception status switching method and apparatus
CN113039517B (en) Audio resource calling method and device and electronic equipment
CN110891262A (en) Bluetooth pairing method, system and terminal equipment

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18942699

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 15.10.2021)

122 Ep: pct application non-entry in european phase

Ref document number: 18942699

Country of ref document: EP

Kind code of ref document: A1