CN113039517B - Method, device and electronic equipment for invoking audio resources - Google Patents
Method, device and electronic equipment for invoking audio resources Download PDFInfo
- Publication number
- CN113039517B CN113039517B CN201880098446.9A CN201880098446A CN113039517B CN 113039517 B CN113039517 B CN 113039517B CN 201880098446 A CN201880098446 A CN 201880098446A CN 113039517 B CN113039517 B CN 113039517B
- Authority
- CN
- China
- Prior art keywords
- audio resource
- audio
- occupier
- application
- resource
- Prior art date
- Legal status (The legal status 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 status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input 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/16—Sound input; Sound output
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Health & Medical Sciences (AREA)
- Audiology, Speech & Language Pathology (AREA)
- General Health & Medical Sciences (AREA)
- Human Computer Interaction (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Telephone Function (AREA)
Abstract
本发明涉及一种音频资源调用的方法,包括:接收应用程序的音频资源调用请求;对所述音频资源状态进行监测,若所述音频资源状态为已占用状态,查询所述音频资源对应的占用方信息;若所述占用方信息为空,则释放所述音频资源,以使所述应用程序对所述释放后的音频资源进行调用。相应地,本发明提供了一种音频资源调用的装置及电子设备,提高了系统的稳定性,提升了用户体验。
The present invention relates to a method for invoking audio resources, comprising: receiving an audio resource invocation request from an application program; monitoring the state of the audio resource, and inquiring about the occupancy corresponding to the audio resource if the state of the audio resource is occupied Party information; if the occupier information is empty, release the audio resource, so that the application program calls the released audio resource. Correspondingly, the present invention provides an audio resource calling device and electronic equipment, which improves system stability and user experience.
Description
技术领域technical field
本发明涉及信息技术领域,特别是涉及一种音频资源调用的方法、装置及电子设备。The present invention relates to the field of information technology, in particular to a method, device and electronic equipment for invoking audio resources.
背景技术Background technique
目前的移动终端中,其音频资源可通过不同的应用程序调用,例如,可通过音乐应用软件调用移动终端的音频资源以实现音乐的播放,可通过通话软件实现铃声的播放,也可通过录音软件实现麦克风等资源的调用。In the current mobile terminal, its audio resources can be called by different application programs. For example, the audio resources of the mobile terminal can be called through the music application software to realize the playback of music, the ringtone can be played through the call software, and it can also be realized through the recording software. Realize the calling of resources such as microphones.
然而,音频资源由于其独特性及唯一性,在使用过程中通常只能被一个应用程序占用而无法实现共用。以录音为例,当一个录音程序正在使用该录音资源时,另一个录音程序则无法同一时刻对该录音资源进行使用。However, due to its uniqueness and uniqueness, audio resources can usually only be occupied by one application program during use and cannot be shared. Taking recording as an example, when one recording program is using the recording resource, another recording program cannot use the recording resource at the same time.
在现有技术中,当一方需要使用音频资源时需要等到正在使用方使用完该音频资源并全部释放后才可以使用,而若当前使用方无限期使用该资源或异常占用该音频资源没有得到相应地释放时,任何新的应用程序均不能调用该音频资源,造成使用异常,导致系统稳定性差,用户体验差。In the prior art, when a party needs to use the audio resource, it needs to wait until the user has finished using the audio resource and releases it before it can be used. However, if the current user uses the resource indefinitely or abnormally occupies the audio resource, no corresponding When released, any new application program cannot call the audio resource, resulting in abnormal use, resulting in poor system stability and poor user experience.
发明内容Contents of the invention
本申请实施例提供一种音频资源调用的方法,包括:An embodiment of the present application provides a method for invoking audio resources, including:
接收应用程序的音频资源调用请求;Receive the application's audio resource call request;
对所述音频资源状态进行监测,若所述音频资源状态为已占用状态,查询所述音频资源对应的占用方信息;Monitor the state of the audio resource, and if the state of the audio resource is occupied, query the occupier information corresponding to the audio resource;
若所述占用方信息为空,则释放所述音频资源,以使所述应用程序对所述释放后的音频资源进行调用。If the occupier information is empty, the audio resource is released, so that the application program calls the released audio resource.
本申请实施例还提供一种音频资源调用的方法,包括:The embodiment of the present application also provides a method for invoking audio resources, including:
为应用程序分配对应的音频资源;Allocate corresponding audio resources for the application;
在所述应用程序调用所述音频资源时,对所述音频资源状态进行监测;When the application calls the audio resource, monitor the state of the audio resource;
若所述音频资源状态异常,则释放所述音频资源,以使所述应用程序对所述释放后的音频资源进行调用。If the state of the audio resource is abnormal, the audio resource is released, so that the application program calls the released audio resource.
本申请实施例还提供一种音频资源调用的装置,所述装置包括:The embodiment of the present application also provides a device for invoking audio resources, the device comprising:
接收模块,用于接收应用程序的音频资源调用请求;The receiving module is used to receive the audio resource calling request of the application;
监测模块,用于对所述音频资源状态进行监测,若所述音频资源状态为已占用状态,查询所述音频资源对应的占用方信息;A monitoring module, configured to monitor the state of the audio resource, and query the occupier information corresponding to the audio resource if the state of the audio resource is occupied;
释放模块,用于若所述占用方信息为空,则释放所述音频资源,以使所述应用程序对所述音频资源进行调用。A release module, configured to release the audio resource if the occupier information is empty, so that the application program calls the audio resource.
本申请实施例还提供一种音频资源调用的装置,所述装置包括:The embodiment of the present application also provides a device for invoking audio resources, the device comprising:
分配模块,用于为应用程序分配对应的音频资源;An allocation module, configured to allocate corresponding audio resources for the application;
监测模块,用于在所述应用程序调用所述音频资源时,对所述音频资源状态进行监测;A monitoring module, configured to monitor the state of the audio resource when the application calls the audio resource;
释放模块,用于在所述音频资源状态异常时,则释放所述音频资源,以使所述应用程序对所述释放后的音频资源进行调用。The release module is configured to release the audio resource when the state of the audio resource is abnormal, so that the application program calls the released audio resource.
本申请实施例还提供一种电子设备,包括存储器及处理器,所述存储器中储存有计算机程序,所述计算机程序被所述处理器执行时,使得所述处理器执行:The embodiment of the present application also provides an electronic device, including a memory and a processor, where a computer program is stored in the memory, and when the computer program is executed by the processor, the processor executes:
接收应用程序的音频资源调用请求;Receive the application's audio resource call request;
对所述音频资源状态进行监测,若所述音频资源状态为已占用状态,查询所述音频资源对应的占用方信息;Monitor the state of the audio resource, and if the state of the audio resource is occupied, query the occupier information corresponding to the audio resource;
若所述占用方信息为空,则释放所述音频资源,以使所述应用程序对所述释放后的音频资源进行调用。If the occupier information is empty, the audio resource is released, so that the application program calls the released audio resource.
本申请实施例还提供一种电子设备,包括存储器及处理器,所述存储器中储存有计算机程序,所述计算机程序被所述处理器执行时,使得所述处理器执行:The embodiment of the present application also provides an electronic device, including a memory and a processor, where a computer program is stored in the memory, and when the computer program is executed by the processor, the processor executes:
为应用程序分配对应的音频资源;Allocate corresponding audio resources for the application;
在所述应用程序调用所述音频资源时,对所述音频资源状态进行监测;When the application calls the audio resource, monitor the state of the audio resource;
若所述音频资源状态异常,则释放所述音频资源,以使所述应用程序对所述释放后的音频资源进行调用。If the state of the audio resource is abnormal, the audio resource is released, so that the application program calls the released audio resource.
本申请实施例还提供一种计算机非易失性可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现如上述的音频资源调用的步骤。The embodiment of the present application also provides 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 invoking the audio resource as described above are implemented.
电子设备和计算机可读存储介质在实现上述方法时,对音频资源占用方进行监测,若占用方信息为空则立即释放该音频资源,为需要调用该音频资源的应用程序进行进一步调用。提高了系统的稳定性,提升了用户体验。When the electronic device and the computer-readable storage medium implement the above method, monitor the occupier of the audio resource, if the information of the occupier is empty, release the audio resource immediately, and make further calls for the application program that needs to call the audio resource. Improved system stability and improved user experience.
附图说明Description of drawings
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他实施例的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only These are some embodiments of the present invention. Those skilled in the art can also obtain the drawings of other embodiments according to these drawings without creative work.
图1为一实施例的音频资源调用方法流程图;Fig. 1 is a flowchart of an audio resource calling method of an embodiment;
图2为另一实施例的音频资源调用方法流程图;Fig. 2 is a flowchart of a method for invoking audio resources in another embodiment;
图3为一实施例的音频资源调用装置结构示意图;FIG. 3 is a schematic structural diagram of an audio resource calling device according to an embodiment;
图4为另一实施例的音频资源调用装置结构示意图;FIG. 4 is a schematic structural diagram of an audio resource calling device according to another embodiment;
图5为一实施例中电子设备的内部结构示意图;5 is a schematic diagram of the internal structure of an electronic device in an embodiment;
图6为与本发明实施例提供的计算机设备相关的电子设备的部分结构的框图。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 invention.
具体实施方式detailed description
为了便于理解本发明,下面将参照相关附图对本发明进行更全面的描述。附图中给出了本发明的较佳实施例。但是,本发明可以以许多不同的形式来实现,并不限于本文所描述的实施例。相反地,提供这些实施例的目的是使对本发明的公开内容的理解更加透彻全面。In order to facilitate the understanding of the present invention, the present invention will be described more fully below with reference to the associated drawings. Preferred embodiments of the invention are shown in the accompanying drawings. However, the present invention can be embodied in many different forms and is not limited to the embodiments described herein. On the contrary, these embodiments are provided to make the understanding of the disclosure of the present invention more thorough and comprehensive.
如图1所示,本申请实施例提供了一种音频资源调用的方法,该方法包括:As shown in Figure 1, the embodiment of the present application provides a method for invoking audio resources, the method including:
S110、接收应用程序的音频资源调用请求;S110. Receive an audio resource call request from the application;
音频资源在本申请实施例中,可以是播放音频所需要的资源,例如扬声器、声道、音频文件等,也可以是进行录音时所需要的资源,例如麦克风、音频电路、录制数据存储器、音频录制处理器等,本申请实施例对此并无限制。其中,可通过电子设备实现对应用程序的音频资源调用,对音频资源调用可以通过电子设备内置的处理函数进行,以安装了安卓系统的电子设备为例,在安卓系统中定义了不同种类的函数以实现不同方式的音频资源调用,包括音频的输入输出操作,如音乐播放、通话、语音提示、录音等操作,因此,音频资源调用只需要在使用对应的音频调用函数即可实现该操作。In this embodiment of the application, audio resources may be resources required for playing audio, such as speakers, channels, audio files, etc., or resources required for recording, such as microphones, audio circuits, recording data storage, audio The recording processor and the like are not limited in this embodiment of the present application. Among them, the audio resource call to the application program can be realized through the electronic device, and the audio resource call can be made through the built-in processing function of the electronic device. Taking the electronic device installed with the Android system as an example, different types of functions are defined in the Android system. To implement different ways of calling audio resources, including audio input and output operations, such as music playback, calls, voice prompts, recording, etc., therefore, audio resource calls only need to use the corresponding audio call function to realize the operation.
在本申请实施例中,一个或多个应用程序在使用音频资源之前需要先发送调用请求,电子设备在接收到该应用程序的调用请求后会进行权限确认,若该应用程序具备调用音频资源的权限这允许调用,否则调用失败。现有技术中,在确认可以调用音频资源时,若该音频资源没有被占用,则直接调用该音频资源,若该音频资源已经被占用则自动进行等待,直到上一个应用程序(即音频资源的占用方)已经释放掉该音频资源,因此,现有技术缺少对上一个应用程序使用音频资源的监测机制,导致上一应用程序发生异常占用该音乐资源时不能及时发现及释放音频资源。In this embodiment of the application, one or more applications need to send a calling request before using the audio resource, and the electronic device will confirm the permission after receiving the calling request of the application. If the application has the ability to call the audio resource Permissions This allows the call, otherwise the call fails. In the prior art, when it is confirmed that the audio resource can be called, if the audio resource is not occupied, then the audio resource is directly called, and if the audio resource is already occupied, it will automatically wait until the last application (i.e. the audio resource) Occupier) has released the audio resource. Therefore, the prior art lacks a monitoring mechanism for the audio resource used by the previous application, which leads to the inability to find and release the audio resource in time when the previous application abnormally occupies the music resource.
S120、对所述音频资源状态进行监测,若所述音频资源状态为已占用状态,查询所述音频资源对应的占用方信息;S120. Monitor the state of the audio resource, and if the state of the audio resource is occupied, query the occupier information corresponding to the audio resource;
在本申请实施例中,创造性地提出了一种全新的监测机制,即:在系统框架层创建系统级的监测模块,通过所述监测模块对所述音频资源状态进行监测,或,独立创建监听进程,通过消息传输机制监测所述应用程序的音频资源状态。具体地,电子设备可通过内置的监听函数对应用程序的音频资源调用进行监听,以安卓系统的电子设备为例,可在系统框架层(native/framework层)创建系统级的监听模块,通过所述监听模块对所述应用程序的音频模式进行监听,或,独立创建监听进程,通过消息传输机制监听所述应用程序的音频模式。例如,可在框架层设立监听模块并运行在系统服务程序(system_server)中,由于该监听模块设立在系统级的服务框架层中,可方便与其他系统服务进行交互,同时无需担心系统调用时的权限问题。此外,也可以创建独立的监听进程,在该进程中设立并调用单独的监听函数,可设置为开机自启动,并实时对其他任何一个应用程序的音频资源调用进行监控,具体地,可实时抓取当前调用的音频资源对应应用程序的ID信息、状态信息和/或优先权信息等,以此确定当前调用行为对应的应用程序及其状态,可独立开发,不与系统进行耦合,方便后续的开发和升级。进一步地,还可以监测当前调用音频资源的应用程序状态是否正常,若状态异常,或ID信息为空,则认定该应用程序异常占用音频资源,需要对该异常占用的音频资源进行处理。In the embodiment of this application, a brand-new monitoring mechanism is creatively proposed, namely: create a system-level monitoring module at the system framework layer, monitor the status of the audio resource through the monitoring module, or create a monitoring module independently The process monitors the audio resource status of the application program through a message transmission mechanism. Specifically, the electronic device can monitor the audio resource call of the application program through the built-in monitoring function. Taking the electronic device of the Android system as an example, a system-level monitoring module can be created at the system framework layer (native/framework layer). The monitoring module monitors the audio mode of the application program, or creates a monitoring process independently, and monitors the audio mode of the application program through a message transmission mechanism. For example, a monitoring module can be set up at the framework layer and run in the system service program (system_server). Since the monitoring module is set up in the system-level service framework layer, it is convenient to interact with other system services, and at the same time, there is no need to worry about system calls. Permissions issue. In addition, an independent monitoring process can also be created, and a separate monitoring function can be set up and called in this process, which can be set to start automatically at startup, and monitor the audio resource calls of any other application program in real time. Specifically, real-time capture Get the ID information, status information and/or priority information of the application program corresponding to the currently called audio resource, so as to determine the application program and its status corresponding to the current calling behavior, which can be developed independently without coupling with the system, which is convenient for subsequent Development and upgrades. Furthermore, it is also possible to monitor whether the status of the application program currently calling the audio resource is normal. If the status is abnormal, or the ID information is empty, it is determined that the application program occupies the audio resource abnormally, and the audio resource occupied abnormally needs to be processed.
S130、若所述占用方信息为空,则释放所述音频资源,以使所述应用程序对所述释放后的音频资源进行调用。S130. If the occupier information is empty, release the audio resource, so that the application program calls the released audio resource.
占用方即为当前占用了音频资源的一个或多个应用程序,占用方信息即为当前占用方的状态信息或ID信息,若占用方信息为空,即表示当前的占用方状态异常,则输出为空(Null或Error),或没有监测到占用方的信息,输出为空(Null),此时确定该占用方出现异常,即异常占用该音频资源,因此,需要释放该音频资源,以使所述应用程序对所述释放后的音频资源进行调用。其中,可通过重启(Reset)操作来释放该音频资源,例如,重启音频管理器以释放所述音频资源,或通过音频释放接口对所述音频资源进行释放,或重启音频系统以释放所述音频资源。另,若所述占用方信息不为空,则确定占用方正常占用了该音频资源,则发送音频资源调用失败响应消息至发送请求的应用程序,禁止该应用程序对所述音频资源进行调用直到该音频资源被正常释放,可选地,此时可生成冲突提示消息并显示,供用户查看,并可根据用户的进一步操作,对占用方进行强制关闭或重启,以释放掉该音频资源并供该发送请求的应用程序使用。The occupier is one or more applications currently occupying audio resources, and the occupier information is the status information or ID information of the current occupier. If the occupier information is empty, it means that the current occupant status is abnormal, and output It is empty (Null or Error), or the information of the occupier is not monitored, and the output is empty (Null). At this time, it is determined that the occupier is abnormal, that is, the audio resource is abnormally occupied. Therefore, the audio resource needs to be released so that The application program calls the released audio resource. Wherein, the audio resource can be released through a restart (Reset) operation, for example, restart the audio manager to release the audio resource, or release the audio resource through the audio release interface, or restart the audio system to release the audio resource. resource. In addition, if the occupier information is not empty, it is determined that the occupier has normally occupied the audio resource, and then sends an audio resource call failure response message to the application that sent the request, and prohibits the application from calling the audio resource until The audio resource is normally released. Optionally, a conflict prompt message can be generated and displayed at this time for the user to view, and the occupant can be forced to close or restart according to the user's further operations, so as to release the audio resource and provide The application that sends the request uses.
此外,在本申请实施例中,还可以根据应用程序之间的优先级进行音频资源的释放与否。具体地,In addition, in the embodiment of the present application, it is also possible to release or not to release the audio resources according to the priorities among the application programs. specifically,
若所述占用方信息不为空,确定所述占用方及所述应用程序的优先级;If the occupier information is not empty, determine the priorities of the occupier and the application;
若所述应用程序的优先级高于所述占用方优先级,则释放所述音频资源,以供所述应用程序对所述释放后的音频资源进行调用;If the priority of the application is higher than the priority of the occupier, releasing the audio resource so that the application can call the released audio resource;
若所述应用程序的优先级低于所述占用方优先级,或与所述占用方优先级相同,则禁止所述应用程序对所述音频资源进行调用。If the priority of the application is lower than the priority of the occupier, or the same as the priority of the occupier, the application is prohibited from calling the audio resource.
需要说明的是,在所述应用程序对所述音频资源进行调用之后,该发送请求的应用程序通过所述音频资源进行录音操作,或通过所述音频资源进行播放操作。It should be noted that after the application program calls the audio resource, the application program that sends the request performs a recording operation through the audio resource, or performs a playback operation through the audio resource.
本申请实施例中,通过对音频资源占用方进行监测,若占用方信息为空则立即释放该音频资源,为需要调用该音频资源的应用程序进行进一步调用。若占用方信息不为空,可根据优先权信息确定音频资源决定是否调用该音频资源,从而提高了系统的稳定性,提升了用户体验。In the embodiment of the present application, by monitoring the occupier of the audio resource, if the occupier information is empty, the audio resource is immediately released, and further calls are made for the application program that needs to call the audio resource. If the occupier information is not empty, the audio resource can be determined according to the priority information to determine whether to call the audio resource, thereby improving system stability and user experience.
如图2所示,本申请实施例还提供了一种音频资源调用的方法,包括:As shown in Figure 2, the embodiment of the present application also provides a method for invoking audio resources, including:
S210、为应用程序分配对应的音频资源;S210. Allocate corresponding audio resources for the application program;
与S110的依据请求再进行分配的机制不同,在S210中,电子设备主动为需要使用该音频资源的应用程序分配或预分配对应的音频资源,该音频资源可以是随机分配,也可以是按照固定阈值进行音频资源的分配。Different from the mechanism of allocating according to the request in S110, in S210, the electronic device actively allocates or pre-allocates the corresponding audio resource for the application program that needs to use the audio resource. The audio resource can be randomly allocated or fixed. Threshold for allocation of audio resources.
S220、在所述应用程序调用所述音频资源时,对所述音频资源状态进行监测;S220. When the application calls the audio resource, monitor the state of the audio resource;
为该应用程序分配了音频资源之后,在应用程序需要调用或开始调用该分配的音频资源时,对该音频资源状态进行监测。其监测过程具体如S120所述,本申请实施例中对此不再累述。After the audio resource is allocated to the application, when the application needs to call or starts to call the allocated audio resource, the state of the audio resource is monitored. The monitoring process is specifically as described in S120, which will not be repeated in this embodiment of the application.
S230、若所述音频资源状态异常,则释放所述音频资源,以使所述应用程序对所述释放后的音频资源进行调用。S230. If the state of the audio resource is abnormal, release the audio resource, so that the application program calls the released audio resource.
音频资源状态异常,即当前音频资源已经被异常占用。在本申请实施例中,若当前音频资源在调用之前已经被占用,且占用方信息为空或异常,则确定当前音频资源状态异常。The status of the audio resource is abnormal, that is, the current audio resource has been abnormally occupied. In the embodiment of the present application, if the current audio resource has been occupied before the call, and the occupier information is empty or abnormal, it is determined that the state of the current audio resource is abnormal.
占用方即为当前占用了音频资源的一个或多个应用程序,占用方信息即为当前占用方的状态信息或ID信息,若占用方信息为空,即表示当前的占用方状态异常,则输出为空(Null或Error),或没有监测到占用方的信息,输出为空(Null),此时确定该占用方出现异常,即异常占用该音频资源,因此,需要释放该音频资源,以使所述应用程序对所述释放后的音频资源进行调用。其中,可通过重启(Reset)操作来释放该音频资源,例如,重启音频管理器以释放所述音频资源,或通过音频释放接口对所述音频资源进行释放,或重启音频系统以释放所述音频资源。另,若所述占用方信息不为空,则确定占用方正常占用了该音频资源,则发送音频资源调用失败响应消息至发送请求的应用程序,禁止该应用程序对所述音频资源进行调用直到该音频资源被正常释放,可选地,此时可生成冲突提示消息并显示,供用户查看,并可根据用户的进一步操作,对占用方进行强制关闭或重启,以释放掉该音频资源并供该发送请求的应用程序使用。The occupier is one or more applications currently occupying audio resources, and the occupier information is the status information or ID information of the current occupier. If the occupier information is empty, it means that the current occupant status is abnormal, and output It is empty (Null or Error), or the information of the occupier is not monitored, and the output is empty (Null). At this time, it is determined that the occupier is abnormal, that is, the audio resource is abnormally occupied. Therefore, the audio resource needs to be released so that The application program calls the released audio resource. Wherein, the audio resource can be released through a restart (Reset) operation, for example, restart the audio manager to release the audio resource, or release the audio resource through the audio release interface, or restart the audio system to release the audio resource. resource. In addition, if the occupier information is not empty, it is determined that the occupier has normally occupied the audio resource, and then sends an audio resource call failure response message to the application that sent the request, and prohibits the application from calling the audio resource until The audio resource is normally released. Optionally, a conflict prompt message can be generated and displayed at this time for the user to view, and the occupant can be forced to close or restart according to the user's further operations, so as to release the audio resource and provide The application that sends the request uses.
其中,释放音频资源,具体可以通过重启音频管理器以释放所述音频资源,或通过音频释放接口对所述音频资源进行释放,或重启音频系统以释放所述音频资源。Wherein, releasing the audio resource may specifically release the audio resource by restarting the audio manager, release the audio resource through an audio release interface, or restart the audio system to release the audio resource.
可选地,若所述音频资源状态为已占用,且占用方信息为空,则重启音频系统以释放所述音频资源,或,Optionally, if the audio resource status is occupied and the occupier information is empty, restart the audio system to release the audio resource, or,
若所述音频资源状态为已占用,且占用方信息不为空,则分别获取所述应用程序及所述占用方的优先级,若所述应用程序的优先级高于所述占用方优先级,则释放所述音频资源,以供所述应用程序对所述释放后的音频资源进行调用;若所述应用程序的优先级低于所述占用方优先级,或与所述占用方优先级相同,则禁止所述应用程序对所述音频资源进行调用。If the state of the audio resource is occupied and the occupier information is not empty, obtain the priority of the application and the occupier respectively, if the priority of the application is higher than the priority of the occupier , then release the audio resource for the application to call the released audio resource; if the priority of the application is lower than the priority of the occupier, or the priority of the occupier If they are the same, the application is prohibited from calling the audio resource.
在所述应用程序对所述音频资源进行调用之后,可通过所述音频资源进行录音操作。After the application program calls the audio resource, a recording operation can be performed through the audio resource.
本申请实施例中,通过监测调用已分配的音频资源状态,若该状态异常,则及时释放该音频资源,供应用程序进行后续调用。进一步地,若状态正常,还可以根据优先权决定是否供应用程序进行后续调用,提升了电子设备的稳定性,提高了用户体验。In the embodiment of the present application, by monitoring the state of the allocated audio resource, if the state is abnormal, the audio resource is released in time for subsequent calls by the application program. Furthermore, if the state is normal, it may also be determined according to the priority whether to provide the application program for subsequent calls, which improves the stability of the electronic device and improves user experience.
如图3所示,本申请实施例还提供一种音频资源调用的装置30,该装置30包括:As shown in Figure 3, the embodiment of the present application also provides an audio
接收模块31,用于接收应用程序的音频资源调用请求;A receiving
音频资源在本申请实施例中,可以是播放音频所需要的资源,例如扬声器、声道、音频文件等,也可以是进行录音时所需要的资源,例如麦克风、音频电路、录制数据存储器、音频录制处理器等,本申请实施例对此并无限制。其中,可通过音频资源调用装置实现对应用程序的音频资源调用,对音频资源调用可以通过音频资源调用装置内置的处理函数进行,以安装了安卓系统的音频资源调用装置为例,在安卓系统中定义了不同种类的函数以实现不同方式的音频资源调用,包括音频的输入输出操作,如音乐播放、通话、语音提示、录音等操作,因此,音频资源调用只需要在使用对应的音频调用函数即可实现该操作。In this embodiment of the application, audio resources may be resources required for playing audio, such as speakers, channels, audio files, etc., or resources required for recording, such as microphones, audio circuits, recording data storage, audio The recording processor and the like are not limited in this embodiment of the present application. Among them, the audio resource call to the application program can be realized through the audio resource call device, and the audio resource call can be performed through the built-in processing function of the audio resource call device. Taking the audio resource call device installed with the Android system as an example, in the Android system Different types of functions are defined to implement different ways of calling audio resources, including audio input and output operations, such as music playback, calls, voice prompts, recording, etc. Therefore, audio resource calls only need to use the corresponding audio call function that is This can be done.
在本申请实施例中,一个或多个应用程序在使用音频资源之前需要先发送调用请求,音频资源调用装置在接收到该应用程序的调用请求后会进行权限确认,若该应用程序具备调用音频资源的权限这允许调用,否则调用失败。现有技术中,在确认可以调用音频资源时,若该音频资源没有被占用,则直接调用该音频资源,若该音频资源已经被占用则自动进行等待,直到上一个应用程序(即音频资源的占用方)已经释放掉该音频资源,因此,现有技术缺少对上一个应用程序使用音频资源的监测机制,导致上一应用程序发生异常占用该音乐资源时不能及时发现及释放音频资源。In this embodiment of the application, one or more applications need to send a calling request before using the audio resource, and the audio resource calling device will confirm the permission after receiving the calling request of the application. Permissions for the resource that allow the call, otherwise the call fails. In the prior art, when it is confirmed that the audio resource can be called, if the audio resource is not occupied, then the audio resource is directly called, and if the audio resource is already occupied, it will automatically wait until the last application (i.e. the audio resource) Occupier) has released the audio resource. Therefore, the prior art lacks a monitoring mechanism for the audio resource used by the previous application, which leads to the inability to find and release the audio resource in time when the previous application abnormally occupies the music resource.
监测模块32,用于对所述音频资源状态进行监测,若所述音频资源状态为已占用状态,查询所述音频资源对应的占用方信息;The
在本申请实施例中,创造性地提出了一种全新的监测机制,即:在系统框架层创建监测模块32,通过所述监测模块对所述音频资源状态进行监测,或,监测模块32独立创建监听进程,通过消息传输机制监测所述应用程序的音频资源状态。具体地,监测模块32可通过内置的监听函数对应用程序的音频资源调用进行监听,以安卓系统的音频资源调用装置为例,可在系统框架层(native/framework层)创建监听模块32,通过监听模块32对所述应用程序的音频模式进行监听,或,监听模块32独立创建监听进程,通过消息传输机制监听所述应用程序的音频模式。例如,可在框架层设立监听模块32并运行在系统服务程序(system_server)中,由于该监听模块32设立在系统级的服务框架层中,可方便与其他系统服务进行交互,同时无需担心系统调用时的权限问题。此外,也可以创建独立的监听进程,在该进程中设立并调用单独的监听函数,可设置为开机自启动,并实时对其他任何一个应用程序的音频资源调用进行监控,具体地,可实时抓取当前调用的音频资源对应应用程序的ID信息、状态信息和/或优先权信息等,以此确定当前调用行为对应的应用程序及其状态,可独立开发,不与系统进行耦合,方便后续的开发和升级。进一步地,监测模块32还可以监测当前调用音频资源的应用程序状态是否正常,若状态异常,或ID信息为空,则认定该应用程序异常占用音频资源,需要对该异常占用的音频资源进行处理。In the embodiment of this application, a brand-new monitoring mechanism is creatively proposed, that is, a
释放模块33,用于若所述占用方信息为空,则释放所述音频资源,以使所述应用程序对所述释放后的音频资源进行调用。The
占用方即为当前占用了音频资源的一个或多个应用程序,占用方信息即为当前占用方的状态信息或ID信息,若占用方信息为空,即表示当前的占用方状态异常,则输出为空(Null或Error),或没有监测到占用方的信息,输出为空(Null),此时确定该占用方出现异常,即异常占用该音频资源,因此,需要释放模块33释放该音频资源,以使所述应用程序对所述释放后的音频资源进行调用。其中,可通过重启(Reset)操作来释放该音频资源,例如,重启音频管理器以释放所述音频资源,或通过音频释放接口对所述音频资源进行释放,或重启音频系统以释放所述音频资源。另,若所述占用方信息不为空,则确定占用方正常占用了该音频资源,则发送音频资源调用失败响应消息至发送请求的应用程序,禁止该应用程序对所述音频资源进行调用直到该音频资源被正常释放,可选地,此时音频资源调用装置可生成冲突提示消息并显示,供用户查看,并可根据用户的进一步操作,对占用方进行强制关闭或重启,以释放掉该音频资源并供该发送请求的应用程序使用。The occupier is one or more applications currently occupying audio resources, and the occupier information is the status information or ID information of the current occupier. If the occupier information is empty, it means that the current occupant status is abnormal, and output Empty (Null or Error), or do not monitor the information of the occupier, the output is empty (Null), this time it is determined that the occupier is abnormal, that is, the audio resource is abnormally occupied, therefore, the audio resource needs to be released by the
此外,在本申请实施例中,释放模块33还可以根据应用程序之间的优先级进行音频资源的释放与否。具体地,In addition, in the embodiment of the present application, the
若所述占用方信息不为空,确定所述占用方及所述应用程序的优先级;If the occupier information is not empty, determine the priorities of the occupier and the application;
若所述应用程序的优先级高于所述占用方优先级,则释放所述音频资源,以供所述应用程序对所述释放后的音频资源进行调用;If the priority of the application is higher than the priority of the occupier, releasing the audio resource so that the application can call the released audio resource;
若所述应用程序的优先级低于所述占用方优先级,或与所述占用方优先级相同,则禁止所述应用程序对所述音频资源进行调用。If the priority of the application is lower than the priority of the occupier, or the same as the priority of the occupier, the application is prohibited from calling the audio resource.
需要说明的是,在所述应用程序对所述音频资源进行调用之后,该发送请求的应用程序通过所述音频资源进行录音操作,或通过所述音频资源进行播放操作。It should be noted that after the application program calls the audio resource, the application program that sends the request performs a recording operation through the audio resource, or performs a playback operation through the audio resource.
本申请实施例中,监测模块32通过对音频资源占用方进行监测,若占用方信息为空则通过释放模块33立即释放该音频资源,为需要调用该音频资源的应用程序进行进一步调用。若占用方信息不为空,可根据优先权信息确定音频资源决定是否调用该音频资源,从而提高了系统的稳定性,提升了用户体验。In the embodiment of the present application, the
如图4所示,本申请实施例还提供了一种音频资源调用的装置40,包括:As shown in Figure 4, the embodiment of the present application also provides an audio
分配模块41,用于为应用程序分配对应的音频资源;An
分配模块41与上述实施例中的接收模块31不同,分配模块41主动为需要使用该音频资源的应用程序分配或预分配对应的音频资源,该音频资源可以是随机分配,也可以是按照固定阈值进行音频资源的分配。The
监测模块42,用于在所述应用程序调用所述音频资源时,对所述音频资源状态进行监测;A
为该应用程序分配了音频资源之后,在应用程序需要调用或开始调用该分配的音频资源时,对该音频资源状态进行监测。其监测过程与上述实施例中监测模块32的监测过程相同,本申请实施例中对此不再累述。After the audio resource is allocated to the application, when the application needs to call or starts to call the allocated audio resource, the state of the audio resource is monitored. The monitoring process is the same as the monitoring process of the
释放模块43,用于若所述音频资源状态异常,则释放所述音频资源,以使所述应用程序对所述释放后的音频资源进行调用。The
音频资源状态异常,即当前音频资源已经被异常占用。在本申请实施例中,若当前音频资源在调用之前已经被占用,且占用方信息为空或异常,则确定当前音频资源状态异常。The status of the audio resource is abnormal, that is, the current audio resource has been abnormally occupied. In the embodiment of the present application, if the current audio resource has been occupied before the call, and the occupier information is empty or abnormal, it is determined that the state of the current audio resource is abnormal.
占用方即为当前占用了音频资源的一个或多个应用程序,占用方信息即为当前占用方的状态信息或ID信息,若占用方信息为空,即表示当前的占用方状态异常,则输出为空(Null或Error),或没有监测到占用方的信息,输出为空(Null),此时确定该占用方出现异常,即异常占用该音频资源,因此,需要释放模块43释放该音频资源,以使所述应用程序对所述释放后的音频资源进行调用。其中,可通过重启(Reset)操作来释放该音频资源,例如,重启音频管理器以释放所述音频资源,或通过音频释放接口对所述音频资源进行释放,或重启音频系统以释放所述音频资源。另,若所述占用方信息不为空,则确定占用方正常占用了该音频资源,则发送音频资源调用失败响应消息至发送请求的应用程序,禁止该应用程序对所述音频资源进行调用直到该音频资源被正常释放,可选地,此时可生成冲突提示消息并显示,供用户查看,并可根据用户的进一步操作,对占用方进行强制关闭或重启,以释放掉该音频资源并供该发送请求的应用程序使用。The occupier is one or more applications currently occupying audio resources, and the occupier information is the status information or ID information of the current occupier. If the occupier information is empty, it means that the current occupant status is abnormal, and output Is empty (Null or Error), or does not monitor the information of the occupier, and the output is empty (Null), and at this time, it is determined that the occupier is abnormal, that is, the audio resource is abnormally occupied, and therefore, the audio resource needs to be released by the
其中,释放音频资源,具体可以通过重启音频管理器以释放所述音频资源,或通过音频释放接口对所述音频资源进行释放,或重启音频系统以释放所述音频资源。Wherein, releasing the audio resource may specifically release the audio resource by restarting the audio manager, release the audio resource through an audio release interface, or restart the audio system to release the audio resource.
可选地,若所述音频资源状态为已占用,且占用方信息为空,则释放模块33重启音频系统以释放所述音频资源,或,Optionally, if the state of the audio resource is occupied and the occupier information is empty, the
若所述音频资源状态为已占用,且占用方信息不为空,则分别获取所述应用程序及所述占用方的优先级,若所述应用程序的优先级高于所述占用方优先级,则释放所述音频资源,以供所述应用程序对所述释放后的音频资源进行调用;若所述应用程序的优先级低于所述占用方优先级,或与所述占用方优先级相同,则禁止所述应用程序对所述音频资源进行调用。If the state of the audio resource is occupied and the occupier information is not empty, obtain the priority of the application and the occupier respectively, if the priority of the application is higher than the priority of the occupier , then release the audio resource for the application to call the released audio resource; if the priority of the application is lower than the priority of the occupier, or the priority of the occupier If they are the same, the application is prohibited from calling the audio resource.
在所述应用程序对所述音频资源进行调用之后,可通过所述音频资源进行录音操作。After the application program calls the audio resource, a recording operation can be performed through the audio resource.
本申请实施例中,通过监测模块42调用已分配的音频资源状态,若该状态异常,则通过释放模块43及时释放该音频资源,供应用程序进行后续调用。进一步地,若状态正常,还可以根据优先权决定是否供应用程序进行后续调用,提升了电子设备的稳定性,提高了用户体验。In the embodiment of the present application, the status of the allocated audio resources is invoked through the
图5为一实施例中电子设备的内部结构示意图。如图5所示,该电子设备包括通过系统总线连接的处理器、非易失性存储介质、内存储器和网络接口、声音采集装置、扬声器、显示屏和输入装置。其中,终端的非易失性存储介质存储有操作系统和计算机可读指令。该计算机可读指令被处理器执行时以实现一种电子设备的音频资源调用方法。该处理器用于提供计算和控制能力,支撑整个电子设备的运行。电子设备中的内存储器为非易失性存储介质中的计算机可读指令的运行提供环境。电子设备的显示屏可以是液晶显示屏或者电子墨水显示屏等,输入装置可以是显示屏上覆盖的触摸层,也可以是电子设备外壳上设置的按键、轨迹球或触控板,也可以是外接的键盘、触控板或鼠标等。该电子设备可以是手机、平板电脑或者个人数字助理或穿戴式设备等。本领域技术人员可以理解,图5中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的电子设备的限定,具体的电子设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。FIG. 5 is a schematic diagram of the 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 loudspeaker, a display screen and an input device. Wherein, 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, an audio resource calling method of the electronic device is realized. The processor is used to provide computing and control capabilities to support the operation of the entire electronic device. Internal memory in an electronic device provides an environment for the execution of computer-readable instructions stored in a 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., and 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 a 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 Figure 5 is only a block diagram of a part of the structure related to the solution of this application, and does not constitute a limitation on the electronic equipment to which the solution of this application is applied. The specific electronic equipment can be More or fewer components than shown in the figures may be included, or some components may be combined, or have a different arrangement of components.
其中,上述提及的音频资源调用方法具体可以为:Among them, the audio resource calling method mentioned above can specifically be:
接收应用程序的音频资源调用请求;Receive the application's audio resource call request;
对所述音频资源状态进行监测,若所述音频资源状态为已占用状态,查询所述音频资源对应的占用方信息;Monitor the state of the audio resource, and if the state of the audio resource is occupied, query the occupier information corresponding to the audio resource;
若所述占用方信息为空,则释放所述音频资源,以使所述应用程序对所述释放后的音频资源进行调用。If the occupier information is empty, the audio resource is released, so that the application program calls the released audio resource.
在其中的一个实施例中,对所述音频资源状态进行监测,具体可以为:在系统框架层创建系统级的监测模块,通过所述监测模块对所述音频资源状态进行监测,或,独立创建监听进程,通过消息传输机制监测所述应用程序的音频资源状态。In one of the embodiments, monitoring the state of the audio resource may specifically be: creating a system-level monitoring module at the system framework layer, and monitoring the state of the audio resource through the monitoring module, or creating an independent The monitoring process monitors the audio resource status of the application program through a message transmission mechanism.
在其中的一个实施例中,释放所述音频资源,具体可以为:重启音频管理器以释放所述音频资源,或通过音频释放接口对所述音频资源进行释放,或重启音频系统以释放所述音频资源。In one of the embodiments, releasing the audio resource may specifically be: restarting the audio manager to release the audio resource, or releasing the audio resource through an audio release interface, or restarting the audio system to release the audio resource Audio resources.
在其中的一个实施例中,所述处理器还用于执行:In one of the embodiments, the processor is also used to execute:
若所述占用方信息不为空,发送音频资源调用失败响应消息至所述应用程序,禁止所述应用程序对所述音频资源进行调用。If the occupier information is not empty, send an audio resource call failure response message to the application program, and prohibit the application program from calling the audio resource.
在其中的一个实施例中,所述处理器还用于执行:生成冲突提示消息并显示。In one of the embodiments, the processor is further configured to: generate and display a conflict prompt message.
在其中的一个实施例中,所述处理器还用于执行:In one of the embodiments, the processor is also used to execute:
若所述占用方信息不为空,确定所述占用方及所述应用程序的优先级;If the occupier information is not empty, determine the priorities of the occupier and the application;
若所述应用程序的优先级高于所述占用方优先级,则释放所述音频资源,以供所述应用程序对所述释放后的音频资源进行调用;If the priority of the application is higher than the priority of the occupier, releasing the audio resource so that the application can call the released audio resource;
若所述应用程序的优先级低于所述占用方优先级,或与所述占用方优先级相同,则禁止所述应用程序对所述音频资源进行调用。If the priority of the application is lower than the priority of the occupier, or the same as the priority of the occupier, the application is prohibited from calling the audio resource.
在其中的一个实施例中,在所述应用程序对所述音频资源进行调用之后,所述处理器通过所述音频资源进行录音操作或播放操作。In one of the embodiments, after the application program calls the audio resource, the processor performs a recording operation or a playback operation through the audio resource.
此外,上述提及的音频资源调用方法具体还可以为:In addition, the audio resource calling method mentioned above can also be:
为应用程序分配对应的音频资源;Allocate corresponding audio resources for the application;
在所述应用程序调用所述音频资源时,对所述音频资源状态进行监测;When the application calls the audio resource, monitor the state of the audio resource;
若所述音频资源状态异常,则释放所述音频资源,以使所述应用程序对所述释放后的音频资源进行调用。If the state of the audio resource is abnormal, the audio resource is released, so that the application program calls the released audio resource.
在其中的一个实施例中,所述对所述音频资源状态进行监测,具体可以为:In one of the embodiments, the monitoring of the status of the audio resource may specifically be:
在系统框架层创建系统级的监测模块,通过所述监测模块对所述音频资源状态进行监测,或,独立创建监听进程,通过消息传输机制监测所述应用程序的音频资源状态。Create a system-level monitoring module at the system framework layer to monitor the audio resource status through the monitoring module, or create a monitoring process independently to monitor the audio resource status of the application program through a message transmission mechanism.
在其中的一个实施例中,所述释放所述音频资源,具体可以为:重启音频管理器以释放所述音频资源,或通过音频释放接口对所述音频资源进行释放,或重启音频系统以释放所述音频资源。In one of the embodiments, the release of the audio resource may specifically be: restarting the audio manager to release the audio resource, or releasing the audio resource through the audio release interface, or restarting the audio system to release the audio resource The audio resource.
在其中的一个实施例中,若所述音频资源状态异常,则释放所述音频资源,具体可以为:In one of the embodiments, if the state of the audio resource is abnormal, the audio resource is released, which may specifically be:
若所述音频资源状态为已占用,且占用方信息为空,则重启音频系统以释放所述音频资源,或,If the state of the audio resource is occupied and the occupant information is empty, restart the audio system to release the audio resource, or,
若所述音频资源状态为已占用,且占用方信息不为空,则分别获取所述应用程序及所述占用方的优先级,若所述应用程序的优先级高于所述占用方优先级,则释放所述音频资源,以供所述应用程序对所述释放后的音频资源进行调用;若所述应用程序的优先级低于所述占用方优先级,或与所述占用方优先级相同,则禁止所述应用程序对所述音频资源进行调用。If the state of the audio resource is occupied and the occupier information is not empty, obtain the priority of the application and the occupier respectively, if the priority of the application is higher than the priority of the occupier , then release the audio resource for the application to call the released audio resource; if the priority of the application is lower than the priority of the occupier, or the priority of the occupier If they are the same, the application is prohibited from calling the audio resource.
其中,在所述应用程序对所述音频资源进行调用之后,该处理器还用于执行:通过所述音频资源进行录音操作。Wherein, after the application program calls the audio resource, the processor is further configured to: perform a recording operation through the audio resource.
此外,本申请实施例还提供了一种计算机非易失性可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现如上述音频资源调用的步骤。In addition, an embodiment of the present application also provides 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 above-mentioned audio resource calling steps are implemented.
本发明实施例还提供了一种计算机设备。如图6所示,为了便于说明,仅示出了与本发明实施例相关的部分,具体技术细节未揭示的,请参照本发明实施例方法部分。该计算机设备可以为包括电子设备、平板电脑、PDA(Personal Digital Assistant,个人数字助理)、POS(Point of Sales,销售终端)、车载电脑、穿戴式设备等任意终端设备,以计算机设备为电子设备为例:The embodiment of the invention also provides a computer device. As shown in FIG. 6 , for ease of description, only the parts related to the embodiment of the present invention are shown, and for specific technical details not disclosed, please refer to the method part of the embodiment of the present invention. The computer device can be any terminal device including electronic device, tablet computer, PDA (Personal Digital Assistant, personal digital assistant), POS (Point of Sales, sales terminal), vehicle-mounted computer, wearable device, etc. For example:
图6为与本发明实施例提供的计算机设备相关的电子设备的部分结构的框图。参考图6,电子设备包括:射频(Radio Frequency,RF)电路610、存储器620、输入单元630、显示单元640、传感器650、音频电路660、无线保真(wireless fidelity,WiFi)模块670、处理器680、以及电源690等部件。本领域技术人员可以理解,图6所示的电子设备结构并不构成对电子设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。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 invention. Referring to FIG. 6, the electronic device includes: a radio frequency (Radio Frequency, RF)
其中,RF电路610可用于收发信息或通话过程中,信号的接收和发送,可将基站的下行信息接收后,给处理器680处理;也可以将上行的数据发送给基站。通常,RF电路包括但不限于天线、至少一个放大器、收发信机、耦合器、低噪声放大器(Low Noise Amplifier,LNA)、双工器等。此外,RF电路610还可以通过无线通信与网络和其他设备通信。上述无线通信可以使用任一通信标准或协议,包括但不限于全球移动通讯系统(Global SystemofMobile communication,GSM)、通用分组无线服务(General Packet Radio Service,GPRS)、码分多址(Code Division Multiple Access,CDMA)、宽带码分多址(Wideband CodeDivision Multiple Access,WCDMA)、长期演进(Long Term Evolution,LTE))、电子邮件、短消息服务(Short Messaging Service,SMS)等。Among them, the
存储器620可用于存储软件程序以及模块,处理器680通过运行存储在存储器620的软件程序以及模块,从而执行电子设备的各种功能应用以及数据处理。存储器620可主要包括程序存储区和数据存储区,其中,程序存储区可存储操作系统、至少一个功能所需的应用程序(比如声音播放功能的应用程序、图像播放功能的应用程序等)等;数据存储区可存储根据电子设备的使用所创建的数据(比如音频数据、通讯录等)等。此外,存储器620可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。The
输入单元630可用于接收输入的数字或字符信息,以及产生与电子设备600的用户设置以及功能控制有关的键信号输入。具体地,输入单元630可包括触控面板631以及其他输入设备632。触控面板631,也可称为触摸屏,可收集用户在其上或附近的触摸操作(比如用户使用手指、触笔等任何适合的物体或附件在触控面板631上或在触控面板631附近的操作),并根据预先设定的程式驱动相应的连接装置。在一个实施例中,触控面板631可包括触摸监测装置和触摸控制器两个部分。其中,触摸监测装置监测用户的触摸方位,并监测触摸操作带来的信号,将信号传送给触摸控制器;触摸控制器从触摸监测装置上接收触摸信息,并将它转换成触点坐标,再送给处理器680,并能接收处理器680发来的命令并加以执行。此外,可以采用电阻式、电容式、红外线以及表面声波等多种类型实现触控面板631。除了触控面板631,输入单元630还可以包括其他输入设备632。具体地,其他输入设备632可以包括但不限于物理键盘、功能键(比如音量控制按键、开关按键等)等中的一种或多种。The
显示单元640可用于显示由用户输入的信息或提供给用户的信息以及电子设备的各种菜单。显示单元640可包括显示面板641。在一个实施例中,可以采用液晶显示器(Liquid Crystal Display,LCD)、有机发光二极管(Organic Light-Emitting Diode,OLED)等形式来配置显示面板641。在一个实施例中,触控面板631可覆盖显示面板641,当触控面板431监测到在其上或附近的触摸操作后,传送给处理器680以确定触摸事件的类型,随后处理器680根据触摸事件的类型在显示面板641上提供相应的视觉输出。虽然在图6中,触控面板631与显示面板641是作为两个独立的部件来实现电子设备的输入和输入功能,但是在某些实施例中,可以将触控面板631与显示面板641集成而实现电子设备的输入和输出功能。The
电子设备600还可包括至少一种传感器650,比如光传感器、运动传感器以及其他传感器。具体地,光传感器可包括环境光传感器及接近传感器,其中,环境光传感器可根据环境光线的明暗来调节显示面板661的亮度,接近传感器可在电子设备移动到耳边时,关闭显示面板661和/或背光。运动传感器可包括加速度传感器,通过加速度传感器可监测各个方向上加速度的大小,静止时可监测出重力的大小及方向,可用于识别电子设备姿态的应用(比如横竖屏切换)、振动识别相关功能(比如计步器、敲击)等;此外,电子设备还可配置陀螺仪、气压计、湿度计、温度计、红外线传感器等其他传感器等。The
音频电路660、扬声器661和传声器662可提供用户与电子设备之间的音频接口。音频电路660可将接收到的音频数据转换后的电信号,传输到扬声器661,由扬声器661转换为声音信号输出;另一方面,传声器662将收集的声音信号转换为电信号,由音频电路660接收后转换为音频数据,再将音频数据输出处理器680处理后,经RF电路610可以发送给另一电子设备,或者将音频数据输出至存储器620以便后续处理。
WiFi属于短距离无线传输技术,电子设备通过WiFi模块670可以帮助用户收发电子邮件、浏览网页和访问流式媒体等,它为用户提供了无线的宽带互联网访问。虽然图6示出了WiFi模块670,但是可以理解的是,其并不属于电子设备600的必须构成,可以根据需要而省略。WiFi is a short-distance wireless transmission technology. Electronic devices can help users send and receive emails, browse web pages, and access streaming media through the
处理器680是电子设备的控制中心,利用各种接口和线路连接整个电子设备的各个部分,通过运行或执行存储在存储器620内的软件程序和/或模块,以及调用存储在存储器620内的数据,执行电子设备的各种功能和处理数据,从而对电子设备进行整体监控。在一个实施例中,处理器680可包括一个或多个处理单元。在一个实施例中,处理器680可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作系统、用户界面和应用程序等;调制解调处理器主要处理无线通信。可以理解的是,上述调制解调处理器也可以不集成到处理器680中。The
电子设备600还包括给各个部件供电的电源690(比如电池),优选的,电源可以通过电源管理系统与处理器680逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。The
在一个实施例中,电子设备600还可以包括摄像头、蓝牙模块等。In an embodiment, the
在本发明实施例中,该计算机设备所包括的处理器680执行存储在存储器上的计算机程序时实现上述各实施例的方法,例如,包括图1或图2所示的音频资源调用的方法。In the embodiment of the present invention, the
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一非易失性计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)等。本发明实施例还提供了一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时上述各实施例的方法。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be realized through computer programs to instruct related hardware, and the programs can be stored in a non-volatile computer-readable storage medium When the program is executed, it may include the processes of the embodiments of the above-mentioned methods. Wherein, the storage medium may be a magnetic disk, an optical disk, a read-only memory (Read-Only Memory, ROM) and the like. 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 above-mentioned embodiments are used.
以上所述实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。The technical features of the above-mentioned embodiments can be combined arbitrarily. To make the description concise, 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, should be considered as within the scope of this specification.
以上所述实施例仅表达了本发明的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本发明构思的前提下,还可以做出若干变形和改进,这些都属于本发明的保护范围。因此,本发明专利的保护范围应以所附权利要求为准。The above-mentioned embodiments only express several implementation modes of the present invention, and the descriptions thereof are relatively specific and detailed, but should not be construed as limiting the patent scope of the invention. It should be pointed out that those skilled in the art can make several modifications and improvements without departing from the concept of the present invention, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the patent for the present invention should be based on the appended claims.
Claims (16)
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| PCT/CN2018/117523 WO2020107177A1 (en) | 2018-11-26 | 2018-11-26 | Audio resource invoking method and apparatus, and electronic device |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN113039517A CN113039517A (en) | 2021-06-25 |
| CN113039517B true CN113039517B (en) | 2022-12-13 |
Family
ID=70853378
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201880098446.9A Active CN113039517B (en) | 2018-11-26 | 2018-11-26 | Method, device and electronic equipment for invoking audio resources |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN113039517B (en) |
| WO (1) | WO2020107177A1 (en) |
Families Citing this family (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN114764378B (en) * | 2021-01-11 | 2025-07-22 | 广州汽车集团股份有限公司 | Recovery method and equipment for abnormal crash of vehicle-mounted sound source management program |
| CN113434222B (en) * | 2021-06-30 | 2023-06-09 | 青岛海尔科技有限公司 | Control method and device of application program, storage medium and electronic device |
| CN114071212B (en) * | 2021-11-15 | 2024-07-16 | 北京字节跳动网络技术有限公司 | Information display processing method and device and electronic equipment |
Family Cites Families (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN103294553A (en) * | 2012-02-24 | 2013-09-11 | 中兴通讯股份有限公司 | Method and device for managing multimedia resources of mobile terminal |
| US8990168B1 (en) * | 2012-06-21 | 2015-03-24 | Emc Corporation | Efficient conflict resolution among stateless processes |
| CN105550037B (en) * | 2015-12-11 | 2019-07-12 | 北京元心科技有限公司 | Method and device for allocating audio resources in multiple systems |
| CN106101367B (en) * | 2016-05-26 | 2019-03-22 | Oppo广东移动通信有限公司 | Recording processing method and system |
| CN108958692A (en) * | 2017-05-17 | 2018-12-07 | 中兴通讯股份有限公司 | A kind of audio occupancy treating method and apparatus |
-
2018
- 2018-11-26 CN CN201880098446.9A patent/CN113039517B/en active Active
- 2018-11-26 WO PCT/CN2018/117523 patent/WO2020107177A1/en not_active Ceased
Also Published As
| Publication number | Publication date |
|---|---|
| CN113039517A (en) | 2021-06-25 |
| WO2020107177A1 (en) | 2020-06-04 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US10437631B2 (en) | Operating system hot-switching method and apparatus and mobile terminal | |
| CN108924817A (en) | A kind of SIM card state switching method and mobile terminal | |
| CN106776036A (en) | A resource allocation method and device | |
| CN113039516B (en) | Method and device for processing application program and electronic equipment | |
| CN107634962A (en) | Network Bandwidth Management Method and Related Products | |
| CN110958710B (en) | Channel access method, configuration method, terminal and network side equipment | |
| WO2020118495A1 (en) | Audio resource allocation method, device, and electronic apparatus | |
| CN107562539A (en) | Applied program processing method and device, computer equipment, storage medium | |
| CN113039517B (en) | Method, device and electronic equipment for invoking audio resources | |
| CN106446111A (en) | Data migration method and terminal | |
| WO2017206901A1 (en) | Process control method and related device | |
| CN113039774B (en) | Method and device for processing application program, electronic equipment and storage medium | |
| WO2015081880A1 (en) | Method, device and system for processing cluster service attribute | |
| CN108334345A (en) | Applied program processing method, device, readable storage medium storing program for executing and mobile terminal | |
| CN107066324A (en) | Method and device for controlling fingerprint processing resources | |
| CN106502833A (en) | Data back up method and device | |
| US20210286588A1 (en) | Method and apparatus for playing alarm and electronic device | |
| CN111966425A (en) | Process cleaning method and device, storage medium and mobile terminal | |
| CN112799857A (en) | Application access method and device | |
| CN117407133A (en) | Task processing method and device and computer readable storage medium | |
| CN110891262A (en) | Bluetooth pairing method, system and terminal equipment | |
| CN106487649A (en) | Group message prompt control method and terminal device | |
| WO2020097787A1 (en) | Method, apparatus, and electronic device for audio resource release | |
| CN106210325A (en) | A kind of the method for social networking application incoming ring tone, device and terminal are set | |
| CN106506623A (en) | A data transmission method and device |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |