METHOD FOR ACTIVATING AN AUDIO DEVICE, END DEVICE, AND COMPUTER-READABLE STORAGE MEDIUM
Patent Information
- Authority / Receiving Office
- DE · DE
- Patent Type
- Patents
- Current Assignee / Owner
- Filing Date
- 2021-08-25
- Publication Date
- 2026-03-11
AI Technical Summary
Users experience poor user experience and complicated operations when switching audio devices on terminal devices due to the need to manually select suitable audio devices for different applications, as they often do not know which device is most suitable for the audio being played.
A method and terminal device that utilize an audio device switching routing table to automatically map attributes of audio applications to corresponding audio device IDs, allowing for intelligent activation of appropriate audio devices based on attributes such as package name and codec, and support simultaneous output of multiple applications.
Enables seamless and intelligent selection of audio devices for different applications, improving user experience by automating the device switching process and ensuring optimal audio playback.
Description
TECHNICAL FIELD
[0001] Embodiments of the present disclosure relate to, but are not limited to, the field of communications, and more particularly, relate to, but are not limited to, a method for activating an audio device, a terminal device and a computer-readable storage medium.BACKGROUND
[0002] As more applications are installed on terminal devices, it has become a general trend for a terminal device to be connected to multiple playback devices. Currently, a terminal device may be connected to multiple audio playback devices, but only one device is active and outputs audio by default at a time. In the face of multiple applications with different audio effects, a user needs to manually switch the audio device to play the audio. However, the user may not know which audio device is more suitable for which audio, so that the user's experience in playing the audio on the terminal device is poor, and the operation of switching the audio device is complex.
[0003] US2012054613A1 relates to a method and apparatus of processing an audio signal, and more particularly, to an audio signal processing method and apparatus of allocating audio sources to a plurality of audio output devices.US20180324486A1 relates to a method for communicating data by an electronic device. The method includes transmitting a signal including audio / video (A / V) data to a first external electronic device through a first communication module, while connected with the first external electronic device, generating data or a signal unrelated to the A / V data or receiving the data or signal unrelated to the A / V data from an external electronic device other than the first external electronic device, and providing an audio or a video through a display or an embedded sound device based on at least a portion of the data or the signal unrelated to the A / V data or transmitting the at least a portion of the data or the signal unrelated to the A / V data to a second external electronic device through a second communication module.
[0004] CN109857364A relates to the technical field of audio processing, in particular to an audio playing method, an audio playing device, a computer readable medium and a communication terminal. The methodcomprises the following steps: in response to an audio playing request, judging whether a first audio source which is being played exists or not; when judging that the first audio source exists, reading a current playing path of the first audio source and a currently available idle playing path; configuring a playing path for the first audio source and a second audio source corresponding to the audio playing request according to the audio playing request, and establishing a mapping relationship between the audio source and the playing path; and calling a corresponding playing path according to the mapping relationship so as to play audio data corresponding to the audio source.
[0005] CN108632448A relates to an electronic device for controlling output of audio data, and an operation method thereof. The electronic device includes a display, a communication interface, at leastone processor, and a memory electrically connected to the processor, wherein the memory is configured to store instructions, and when executed, the instructions enable the at least one processor to perform setting the electronic device and at least one other electronic device as audio output devices of different applications, based on a user input, detecting a connection to the at least one other electronic device via the communication interface, and controlling the display to display information indicating that the electronic device and the at least one other electronic device are set as theaudio output devices of different applications.
[0006] CN108781236A relates to an audio playing method and an electronic device, which relate to the technical field of electronic devices. The method comprises: when an electronic device is connected to an external audio device, the electronic device obtains an audio to be played; when the audio to be played is associated with the electronic device, the electronic device plays the audio to be played; and when the audio to be played is associated with the external audio device, the electronic device sends the audio to be played to the external audio device through an established connection, so that the external audio device plays the audio to be played.
[0007] CN110764730A relates to a method and device for playing audio data, and belongs to the technical field of multimedia. The method is applied to a terminal, the terminal is connected with at least two audio devices, and the method comprises the following steps: acquiring current audio playing information; determining a first audio device corresponding to the current audio playing information in the at least two audio devices according to a pre-stored corresponding relationship between the audio playing information and the audio devices; and playing audio data through the first audio device.SUMMARY
[0008] The invention is set out in the appended set of claims.
[0009] Embodiments of the present disclosure provide a method for activating an audio device, a terminal device and a computer-readable storage medium to solve, at least to some extent, the technical problems of poor user experience in terminal device audio playing and complicated operation of audio device switching.
[0010] In view of the above, an embodiment of the present disclosure provides a method for activating an audio device. The method includes: acquiring an attribute of an audio application; acquiring an audio device identification (ID) mapped to the attribute from a preset audio device switching routing table according to the attribute, where the audio device ID mapped to the attribute includes an audio device ID of an audio device codec corresponding to the attribute; and activating an audio device corresponding to the audio device ID.
[0011] An embodiment of the present disclosure further provides a terminal device. The device includes a first acquisition module, a second acquisition module, and an activation module, where the first acquisition module is configured for acquiring an attribute of an audio application; the second acquisition module is configured for acquiring an audio device identification (ID) mapped to the attribute from a preset audio device switching routing table according to the attribute, where the audio device ID mapped to the attribute includes an audio device ID of an audio device codec corresponding to the attribute; and the activation module is configured for activating an audio device corresponding to the audio device ID.
[0012] An embodiment of the present disclosure further provides a terminal device. The terminal device includes a processor, a memory, and a communication bus, where the communication bus is configured for implementing connection and communication between the processor and the memory; and the processor is configured for executing one or more computer programs stored in the memory to implement the above method for activating an audio device.
[0013] An embodiment of the present disclosure further provides a computer-readable storage medium storing one or more computer programs which, when executed by one or more processors, cause the one or more processors to implement the above method for activating an audio device.
[0014] Additional features and advantages of the present disclosure will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by the practice of the present disclosure.BRIEF DESCRIPTION OF DRAWINGS
[0015] FIG. 1 is a basic flowchart of a method for activating an audio device according to Embodiment One of the present disclosure; FIG. 2 is a detailed flowchart of a method for activating an audio device according to Embodiment Two of the present disclosure; FIG. 3 is a detailed flowchart of a method for activating an audio device according to Embodiment Three of the present disclosure; FIG. 4 is a schematic structural diagram of a terminal device according to Embodiment Four of the present disclosure; and FIG. 5 is a schematic structural diagram of a terminal device according to Embodiment Five of the present disclosure. DETAILED DESCRIPTION
[0016] Objects, technical schemes and advantages of the present disclosure will be clear from a detailed description of embodiments of the present disclosure in conjunction with the drawings. It should be understood that the embodiments described herein are merely used for illustrating the present disclosure, and are not intended to limit the present disclosure.Embodiment One
[0017] To solve the technical problems of poor user experience in terminal device audio playing and complicated operation of audio device switching, the present disclosure provides a method for activating an audio device, which will be described below in connection with this embodiment.
[0018] Referring to FIG. 1, FIG. 1 is a basic flowchart of a method for activating an audio device according to Embodiment One of the present disclosure. The method includes the following steps S101 to S103.
[0019] At S101, an attribute of an audio application is acquired.
[0020] In this embodiment, the attribute of the audio application may be acquired before the audio application is opened, or may be acquired during or after the opening of the audio application. When there is one audio application, the opening of the audio application may include: opening an audio application for the first time or switching from a first audio application to a second audio application. For example, Tencent Meeting is opened for the first time; or switching from NetEase Cloud Music to a WeChat call is performed. The above examples are for description purposes only and are not intended to limit the specific audio application type.
[0021] In some embodiments, in a case where there are at least two audio applications, when the audio applications are opened, the acquiring an attribute of an audio application includes: when the at least two audio applications are opened successively, acquiring attributes of the at least two audio applications respectively. For example, a user opens QQ Music, Romance of the Three Kingdoms, Himalaya, etc., successively; or the user opens Tencent Meeting and NetEase Cloud Music, and then switches from NetEase Cloud Music to WeChat, etc. The above examples are for description purposes only and are not intended to limit the specific audio application type. In addition, the opening sequence of the at least two audio applications is not limited herein.
[0022] The attribute of the audio application includes: a package name of the application and an audio parameter of the application.
[0023] In some examples, acquiring an attribute of an audio application may be acquiring an attribute of an audio application when the audio application is opened.
[0024] In some embodiments, before acquiring an attribute of an audio application, the method may further include: if an instruction of selecting an audio device ID is received, acquiring the audio device ID selected by the instruction, and activating an audio device corresponding to the selected audio device ID. Before activating the audio device corresponding to the selected audio device ID, the method may further include: acquiring an attribute of the audio application, establishing a mapping relationship between the attribute of the audio application and the selected audio device ID, and updating the audio device ID mapped to the attribute of the audio application in a preset audio device switching routing table. Updating the routing table may be performed before, after or during the activation of the audio device corresponding to the selected audio device ID. If the instruction of selecting the audio device ID is not received from the user, the attribute of the audio application is acquired, an audio device ID of an audio device codec corresponding to the attribute is found in the preset audio device switching routing table, and an audio device corresponding to the audio device ID is activated. "Not receiving the instruction of selecting the audio device ID" may be receiving a selection of the user to automatically acquire the audio device ID or automatically jump to acquire the attribute of the audio application when a preset time is reached. A user selection instruction or a voice selection instruction may be received on a display of a terminal device.
[0025] At S102, an audio device ID mapped to the attribute of the audio application is acquired from a preset audio device switching routing table according to the attribute of the audio application.
[0026] The audio device ID mapped to the attribute includes: an audio device ID of an audio device codec corresponding to the attribute. The audio device ID may be a serial number or a label corresponding to the audio device.
[0027] In some embodiments, the audio device may be a wired audio playback device or a wireless audio playback device. The wireless audio playback device includes a Bluetooth playback device. The description of the above audio devices is given by way of example only, and the present disclosure is not limited to the above audio devices.
[0028] In some embodiments, the preset audio device switching routing table includes: the attribute of the audio application, the codec of the audio device, and the audio device ID. The audio device ID may further include: a user-preset audio device ID corresponding to the attribute of the audio application. The acquiring the audio device ID mapped to the attribute of the audio application may further include: acquiring the audio device ID mapped to the attribute from the preset audio device switching routing table according to the attribute of the audio application, and selecting the audio device ID according to a preset audio device priority.
[0029] In some embodiments, when there is one audio application, the acquiring an audio device ID mapped to the attribute of the audio application from a preset audio device switching routing table according to the attribute includes: acquiring one or at least two audio device IDs mapped to the attribute of the audio application from the preset audio device switching routing table according to the attribute.
[0030] When one audio device ID mapped to the attribute is acquired, an audio device corresponding to the audio device ID is activated.
[0031] When at least two audio device IDs mapped to the attribute are acquired, a preset number of target audio device IDs are acquired from the at least two audio device IDs, and audio devices corresponding to the target audio device IDs are activated, where the preset number includes one or at least two. When at least two audio device IDs mapped to the attribute of the audio application are acquired and it is detected that the terminal device supports playing one audio application through at least two audio devices simultaneously, a preset number of audio device IDs supported by the terminal device are acquired according to preset priorities.
[0032] In some embodiments, when there is one audio application, the opening of the audio application may include: opening or downloading an audio application for the first time or switching from a first audio application to a second audio application. When switching is performed from the first audio application to the second audio application, an attribute of the second audio application is acquired.
[0033] In some embodiments, when there are at least two audio applications, the acquiring an attribute of an audio application includes: when the at least two audio applications are opened successively, acquiring attributes of the at least two audio applications respectively.
[0034] When the preset audio device routing table does not include an attribute and an audio device ID of a terminal device audio application, an audio device ID selection box is displayed on the display of the terminal device or a voice prompt is issued, and the audio device ID is acquired according to a user selection. Alternatively, the attribute of the terminal device application is compared with the attributes in the preset audio device switching routing table, and an audio device corresponding to a similar attribute is used as an audio device mapped to the attribute of the terminal device application. When the attribute and the similar attribute are detected at the same time, a selection prompt of activating an audio device mapped to this attribute is sent to the user, the audio device ID is acquired according to the user's prompt, and an audio device specified by the user is activated. If an audio device mapped to the similar attribute in the routing table is not acquired, an audio device ID of an audio device other than the audio device corresponding to the similar attribute is acquired, and the audio device is activated.
[0035] At S103, an audio device corresponding to the audio device ID is activated.
[0036] In some embodiments, when there is one audio application, and it is switched from the first audio application to the second audio application, an attribute of the second audio application is acquired. Activating an audio device mapped to the attribute of the second audio application may include: popping up a selection interface on the display of the terminal device, and according to a selection instruction, activating an audio device corresponding to the audio device ID mapped to the attribute of the second audio application or maintaining a connection of an activated audio device corresponding to the first audio application to the second audio application.
[0037] In some embodiments, when there are at least two audio applications, the acquiring an attribute of an audio application includes: when at least two audio applications are opened successively, acquiring attributes of the at least two audio applications respectively. The activating an audio device corresponding to the audio device ID includes: detecting whether the terminal device supports simultaneous audio output of multiple audio applications, and when it is detecting that the terminal device supports simultaneous audio output of multiple audio applications, activating different audio devices mapped to the attributes of the at least two audio applications, respectively. When the attributes of the at least two audio applications map the same audio device ID, another audio device ID corresponding to attributes of at least two audio applications is selected automatically.
[0038] In some embodiments, when there are at least two audio applications, the acquiring an attribute of an audio application includes: when the at least two audio applications are downloaded successively, acquiring attributes of the at least two audio applications respectively. The attributes of the at least two audio applications may also be acquired respectively after the at least two audio applications are downloaded. As for how to activate the corresponding audio devices after downloading the at least two audio applications successively, the following activation method when at least two audio device applications are opened successively may be adopted, or audio devices corresponding to related audio device IDs may be activated according to a preset rule. The preset rule is: an audio application downloaded earlier has priority in acquiring an audio device ID, and an audio application downloaded later is not allowed to acquire the audio device ID that has already been acquired.
[0039] The following example is not according to the invention and is present for illustration purposes only, in this example, when at least two audio applications are opened successively, attributes of the at least two audio applications are acquired respectively. The activating an audio device corresponding to the audio device ID includes: when it is detected that a shared audio device ID exists in the audio device IDs mapped to the attributes of the at least two audio applications, activating the audio device in the following manner: when it is detected that the shared audio device ID is an audio device ID with a highest priority among audio device IDs mapped to an attribute of a fourth audio application, connecting the fourth audio application to an audio device corresponding to the shared audio device ID, and connecting a third audio application to another audio device, where the another audio device is different from the audio device to which the fourth audio application is connected; and when it is detected that the shared audio device ID is not the audio device ID with the highest priority among the audio device IDs mapped to the attribute of the fourth audio application, connecting the fourth audio application to the audio device corresponding to the audio device ID with the highest priority, and maintaining a connection of the third audio application to an audio device to which the third audio application is originally connected. The maintaining a connection of the third audio application to an audio device to which the third audio application is originally connected may further include: detecting whether the originally connected audio device is an audio device with a highest priority for the third audio application, and if not, switching to the audio device with the highest priority. The third audio application is an audio application opened earlier. The fourth audio application is an audio application opened later.
[0040] In some embodiments, when it is detected that a shared audio device ID exists in the audio device IDs mapped to the attributes of the at least two audio applications, and the attributes of both the at least two audio applications map multiple audio device IDs, the shared audio device ID is excluded, and the at least two successively opened audio applications are respectively connected to other audio devices.
[0041] In some embodiments, when it is detected that the attribute of the audio application opened later maps at least two audio device IDs, that the attribute of the audio application opened earlier maps one audio device ID, and that the shared audio device ID is an audio device ID with a highest priority among the audio device IDs mapped to the attributes of the audio applications opened earlier and later, the audio application opened later may be connected to an audio device corresponding to the audio device ID with a second highest priority, and the audio application opened earlier may be connected to an audio device corresponding to the shared audio device ID.
[0042] When it is detected that no shared audio device ID exists in the audio device IDs mapped to the attributes of the at least two audio applications, a method for activating each audio application in the at least two audio applications may be acquiring the audio device ID and activating the related audio device according to the method for activating an application when there is one audio application.
[0043] After detecting that the shared audio device ID is an audio device ID with a highest priority among audio device IDs mapped to an attribute of a fourth audio application, the following cases may be further included that: the attribute of the audio application opened earlier maps at least one audio device ID, and the audio device ID with the highest priority mapped to the attribute of the audio application opened earlier is the same as the audio device ID with the highest priority mapped to the attribute of the audio application opened later; or the attribute of the audio application opened later maps multiple audio device IDs, the attribute of the audio application opened earlier maps at least one audio device ID, and the audio device ID with the highest priority mapped to the attribute of the audio application opened earlier is the same as the audio device ID with the highest priority mapped to the attribute of the audio application opened later; or the attribute of the audio application opened later maps only one audio device ID, the attribute of the audio application opened earlier maps at least one audio device ID, and there is no conflict between the audio device ID with the highest priority of the audio application opened earlier and the audio device ID with the highest priority of the audio application opened later; or the attribute of the audio application opened later maps at least two audio device IDs, the attribute of the audio application opened earlier maps at least one audio device ID, and there is no conflict between the audio device ID with the highest priority mapped to the attribute of the audio application opened earlier and the audio device ID with the highest priority mapped to the attribute of the audio application opened later.
[0044] In the above case where the attribute of the audio application opened earlier maps multiple audio device IDs and the attribute of the audio application opened later maps at least one audio device ID, no matter whether there is a conflict between the audio device ID with the highest priority of the audio application opened earlier and the audio device ID with the highest priority of the audio application opened later, the audio application opened earlier may be connected to the audio device corresponding to the audio device ID with the second highest priority. The audio device ID with the second highest priority herein is the audio device ID with the second highest priority among the audio device IDs mapped to the attribute of the audio application opened earlier. The audio application opened earlier may also be connected to another audio device. The another audio device herein may not be the audio device corresponding to the audio device ID mapped to the attribute of the audio application opened earlier. The audio application opened later is connected to an audio device that conflicts with the audio application opened earlier. In the case where the attribute of the audio application opened later maps at least two audio device IDs, the audio application opened later may also be connected to multiple audio devices at the same time, and the number of the audio devices connected may be a number of audio devices supported by the terminal device that are acquired based on preset priorities.
[0045] Alternatively, in the case where the attribute of the audio application opened earlier maps multiple audio device IDs, the attribute of the audio application opened later maps at least one audio device ID, and the audio device ID with the highest priority of the audio application opened earlier is the same as the audio device ID with the highest priority of the audio application opened later, the successively opened audio applications may be randomly connected to non-conflicting audio devices respectively.
[0046] In the case where the attribute of the audio application opened earlier maps one audio device ID and the attribute of the audio application opened later also maps one audio device ID, the audio application opened earlier is connected to another audio device, where the another audio device is different from the audio devices corresponding to the audio device IDs mapped to the attribute of the audio application opened later. The audio application opened later is connected to an audio device that conflicts with the audio application opened earlier. Connecting the audio application opened earlier to another audio device may include: randomly selecting another audio device or acquiring an audio device ID corresponding to an attribute similar to the attribute of the audio application opened earlier, and connecting the audio application opened earlier to an audio device corresponding to the audio device ID.
[0047] In the case where the attribute of the audio application opened earlier maps one audio device ID and the attribute of the audio application opened later maps multiple audio device IDs, the audio application opened earlier is connected to another audio device, where the another audio device is different from the audio devices corresponding to the audio device IDs mapped to the attribute of the audio application opened later. The audio application opened later is connected to an audio device that conflicts with the audio application opened earlier. Alternatively, in the case where the attribute of the audio application opened later maps at least two audio device IDs, the audio application opened later may also be connected to multiple audio devices at the same time, and the number of the audio devices connected may be a number of audio devices supported by the terminal device that are acquired based on preset priorities.
[0048] According to the method for activating an audio device provided in the embodiments of the present disclosure, an attribute of an audio application is acquired; an audio device ID mapped to the attribute is acquired from a preset audio device switching routing table according to the attribute; and an audio device corresponding to the audio device ID is activated. In some implementation processes, technical effects including but not limited to allowing the user to switch to an appropriate audio device and realizing the selection of an audio device for audio playback according to different playback applications can be achieved.Embodiment Two
[0049] The method for activating an audio device of the present disclosure allows the user to switch to an appropriate audio device and realizes the selection of an appropriate audio device for playback according to different playback applications. For ease of understanding, the method for activating an audio device of the present disclosure is described below in connection with an application scenario.
[0050] FIG. 2 is a detailed flowchart of a method for activating an audio device according to Embodiment Two of the present disclosure. The method for activating an audio device includes the following steps S201 to S206.
[0051] At S201, a terminal device is connected to at least two audio devices.
[0052] In this embodiment, the terminal device supports simultaneous output of multiple audio applications. In this embodiment, the audio devices are playback devices connected to the terminal device via Bluetooth.
[0053] At S202, when at least two audio applications are opened, a selection interface is displayed on a display of the terminal device, and it is detected whether an instruction of selecting an audio device ID is received.
[0054] If the instruction of selecting the audio device ID is received, S203 is executed, and if the instruction of selecting the audio device ID is not received, S204 is executed. "Not receiving the instruction of selecting the audio device" includes: receiving an instruction of automatically acquiring the audio device ID that is triggered by a user selection, or not receiving any instruction within a preset time.
[0055] At S203, respective audio device IDs are acquired, and related audio devices are activated.
[0056] At S204, attributes of the at least two audio applications are acquired respectively.
[0057] In this embodiment, the attribute of the audio application includes: a package name of the application and an audio parameter of the application. The audio applications in this embodiment include: Tencent Meeting, QQ Music, and Legends of the Three Kingdoms. The description of the above audio applications is given by way of example only, and the present disclosure is not limited to the above audio applications.
[0058] At S205, an audio device ID mapped to the attribute of the audio application is acquired from a preset audio device switching routing table according to the attribute of the audio application.
[0059] In this embodiment, the preset audio device switching routing table includes: the attribute of the audio application, a codec of the audio device, and at least two audio device IDs. The audio device ID includes: an audio device ID mapped according to the attribute of the audio application and the codec of the audio device.
[0060] In this embodiment, the codec of the audio device includes, but is not limited to, aptx, LDAC, aptx HD, WBS, aptx adaptive, etc. Bluetooth devices that support aptx, LDAC, and aptx HD may be used as a playback device group mainly used to support the output of music applications. Bluetooth devices that support WBS may be used as a playback device group mainly used to support the output of telephone applications. Bluetooth devices that support aptx adaptive may be used as a playback device group mainly used to support the output of game applications.
[0061] The audio device ID in this embodiment is classified according to the Bluetooth audio codec, and priorities are set for the audio device ID.
[0062] At S206, when it is detected that a shared audio device ID exists in the audio device IDs mapped to the attributes of the at least two audio applications, the audio application opened later is connected to the audio device corresponding to the shared audio device ID.
[0063] For example, when it is detected that a music application plays music, an optimal Bluetooth device A is selected for the music application. Subsequently when a game application is opened, and it is found that the optimal device A for game playback is already occupied by the music application, switching may be performed to connect the music application to another optimal Bluetooth device B and connect the game application to the device A.
[0064] In this embodiment, when the user opens a music player application, an application package name is extracted. According to a device switching routing table, an Aptx Bluetooth codec and sound effect are set for the music player application. Then, a device with Aptx sound quality is selected according to the Bluetooth codec and sound effect, and activated. Then the user opens a game application. An aptx adaptive Bluetooth codec and sound effect are set for the game application, and then a device in the playback group with aptx adaptive sound quality is selected according to the Bluetooth codec and sound effect, and activated.
[0065] According to the method for activating an audio device provided in the embodiments of the present disclosure, a terminal device is connected to at least two audio devices. When at least two audio applications are opened, a selection interface is displayed on a display of the terminal device, and it is detected whether an instruction of selecting an audio device ID is received. If the instruction of selecting the audio device ID is received, respective audio device IDs are acquired, and related audio devices are activated. If the instruction of selecting the audio device ID is not received, attributes of the at least two audio applications are acquired respectively; audio device IDs mapped to the attributes are acquired from a preset audio device switching routing table according to the attributes; and when it is detected that a shared audio device ID exists in the audio device IDs mapped to the attributes of the at least two audio applications, the audio application opened later is connected to the audio device corresponding to the shared audio device ID. In some implementation processes, technical effects including but not limited to allowing the user to switch to an appropriate audio device and realizing the intelligent selection of an appropriate audio device for playback according to the attributes of different playback applications can be achieved, thereby improving the user experience.Embodiment Three
[0066] The method for activating an audio device of the present disclosure allows the user to switch to an appropriate audio device and realizes the selection of an appropriate audio device for playback according to different playback applications. For ease of understanding, the method for activating an audio device of the present disclosure is described below in connection with an application scenario.
[0067] FIG. 3 is a detailed flowchart of a method for activating an audio device according to Embodiment Three of the present disclosure. The method for activating an audio device includes the following steps S301 to S307.
[0068] In this embodiment, the terminal device supports simultaneous output of multiple audio applications and multiple outputs of one audio application. In this embodiment, the audio devices are playback devices connected to the terminal device via Bluetooth, e.g., Bluetooth headsets, projectors, etc.
[0069] At S301, when switching is performed from a first audio application to a second audio application, an attribute of the second audio application is acquired.
[0070] In this embodiment, the attribute of the audio application includes: a package name of the application, an audio parameter of the application, etc. The audio applications in this embodiment include: WeChat, NetEase Cloud Music, and Exhilarating Battlefield. The description of the above audio applications is given by way of example only, and the present disclosure is not limited to the above audio applications.
[0071] At S302, one or at least two audio device IDs mapped to the attribute of the second audio application are acquired from a preset audio device switching routing table according to the attribute of the second audio application.
[0072] In this embodiment, the preset audio device switching routing table includes: the attribute of the audio application, a codec of the audio device, at least two audio device IDs. The audio device ID includes: an audio device ID mapped according to the attribute of the audio application and the codec of the audio device; and an audio device ID established according to a user habit and the attribute of the audio application. The acquiring the audio devices mapped to the attributes includes: selecting audio device IDs based on preset audio device priorities.
[0073] In this embodiment, the codec of the audio device includes, but is not limited to, aptx, LDAC, aptx HD, WBS, aptx adaptive, etc. Bluetooth devices that support aptx, LDAC, and aptx HD may be used as a playback device group mainly used to support the output of music and audio applications. Bluetooth devices that support WBS may be used as a playback device group mainly used to support the output of telephone applications. Bluetooth devices that support aptx adaptive may be used as a playback device group mainly used to support the output of game applications.
[0074] The routing table in this embodiment can support the process of self-learning, and record applications frequently used by the user and corresponding device according to the user's usage habits. For example, for a user often uses a Bluetooth speaker A to play music and a game Bluetooth headset B to play games, when the user opens an application, the application is intelligently connected to the corresponding device A or B for the user.
[0075] At S303, it is detected whether none of the audio device IDs mapped to the attribute is acquired.
[0076] When it is detected that none of the audio device IDs mapped to the attribute is acquired, S304 is executed. Otherwise, S305 is executed.
[0077] At S304, an audio device ID selection box is displayed on a display of the terminal device or a voice prompt is issued, and the audio device ID is acquired according to a user selection.
[0078] At S305, it is detected whether the number of the acquired audio device IDs mapped to the attribute is one.
[0079] When it is detected that the number of the acquired audio device IDs mapped to the attribute is one, S306 is executed. Otherwise, S307 is executed.
[0080] At S306, an audio device corresponding to the audio device ID is activated.
[0081] At S307, a preset number of target audio device IDs are acquired from at least two audio device IDs according to preset priorities; and the audio devices corresponding to the target audio device IDs are activated.
[0082] The preset number includes: one or at least two. When at least two audio device IDs mapped to the attribute of the audio application are acquired and it is detected that the terminal device supports playing one audio application through at least two audio devices simultaneously, a preset number of audio device IDs supported by the terminal device are acquired according to the preset priorities.
[0083] If a user answers an incoming call while listening to music using a device A that supports Aptx coding, switching is intelligently performed to connect to a device B that supports WBS to play audio, or a selection box pops up on the display of the terminal device for the user to select or confirm whether to switch the audio device to output the call, or a device that the user is accustomed to using is switched to. Priorities may be set for device switching based on user habits and intelligent device switching based parameters and codecs. A highest priority may be set for device switching based on user habits.
[0084] For a terminal device that supports playing of multiple applications through different Bluetooth devices, when it is detected that a music application is about to play music, an optimal Bluetooth device A is selected for the music application. Subsequently when a game application is opened, and it is found that the optimal device A for game playback is already occupied by the music application, switching may be performed to connect the music application to another optimal Bluetooth device B and connect the game application to the device A.
[0085] According to the method for activating an audio device provided in the embodiments of the present disclosure, when switching is performed from a first audio application to a second audio application, an attribute of the second audio application is acquired. One or at least two audio device IDs mapped to the attribute of the second audio application are acquired from a preset audio device switching routing table according to the attribute of the second audio application. When it is detected that none of the audio device IDs mapped to the attribute is acquired, an audio device ID selection box is displayed on the display of the terminal device or a voice prompt is issued, and the audio device ID is acquired according to a user selection. When it is detected that the number of the acquired audio device IDs mapped to the attribute is one, the audio device corresponding to the one audio device ID is activated. When it is detected that the number of the acquired audio device IDs mapped to the attribute is more than one, a preset number of audio device IDs supported by the terminal device are acquired according to preset priorities and activated. In some implementation processes, technical effects including but not limited to allowing the user to switch to an appropriate audio device and realizing the intelligent selection of an appropriate audio device for playback according to the attributes of different playback applications can be achieved, thereby improving the user experience.Embodiment Four
[0086] To solve the technical problems of poor user experience in terminal device audio playing and complicated operation of audio device switching, the present disclosure provides a terminal device, which will be described below in connection with this embodiment.
[0087] Referring to FIG. 4, FIG. 4 is a schematic structural diagram of a terminal device according to Embodiment Four of the present disclosure. The terminal device includes a first acquisition module 401, a second acquisition module 402, and an activation module 403.
[0088] The first acquisition module 401 is configured for acquiring an attribute of an audio application.
[0089] The second acquisition module 402 is configured for acquiring an audio device identification (ID) mapped to the attribute from a preset audio device switching routing table according to the attribute, where the audio device ID mapped to the attribute includes: an audio device ID of an audio device codec corresponding to the attribute.
[0090] The activation module 403 is configured for activating an audio device corresponding to the audio device ID.
[0091] In this embodiment, the audio device may be a wired audio playback device or a wireless audio playback device. The wireless audio playback device includes a Bluetooth playback device. The description of the above audio devices is given by way of example only, and the present disclosure is not limited to the above audio devices.
[0092] In this embodiment, when there is one audio application, the opening of the audio application may include: opening or downloading an audio application for the first time or switching from a first audio application to a second audio application. For example, Tencent Meeting is opened for the first time; or switching from NetEase Cloud Music to a WeChat call is performed. The above examples are for description purposes only and are not intended to limit the specific audio application type.
[0093] In some embodiments, in a case where there are at least two audio applications, when the audio applications are opened, the acquiring an attribute of an audio application includes: when at least two audio applications are opened successively, acquiring attributes of the at least two audio applications respectively. For example, a user opens QQ Music, Romance of the Three Kingdoms, Himalaya, etc., successively; or the user opens Tencent Meeting and NetEase Cloud Music, and then switches from NetEase Cloud Music to WeChat, etc. The above examples are for description purposes only and are not intended to limit the specific audio application type. In addition, the opening sequence of the at least two audio applications is not limited herein.
[0094] The attribute of the audio application includes: a package name of the application and an audio parameter of the application.
[0095] In some examples, acquiring an attribute of an audio application may be acquiring an attribute of an audio application when the audio application is opened.
[0096] In some embodiments, before acquiring an attribute of an audio application, the method may further include: if an instruction of selecting an audio device ID is received, acquiring the audio device ID selected by the instruction, and activating an audio device corresponding to the selected audio device ID. Before activating the audio device corresponding to the selected audio device ID, the method may further include: acquiring the attribute of the audio application, establishing a mapping relationship between the attribute of the audio application and the selected audio device ID, and updating the audio device ID mapped to the attribute of the audio application in the preset audio device switching routing table. Updating the routing table may be performed before, after or during the activation of the audio device corresponding to the selected audio device ID.
[0097] If the instruction of selecting the audio device ID is not received from the user, the attribute of the audio application is acquired, an audio device ID of an audio device codec corresponding to the attribute is found in the preset audio device switching routing table, and an audio device corresponding to the audio device ID is activated. "Not receiving the instruction of selecting the audio device ID" may be receiving a selection of the user to automatically acquire the audio device ID or automatically jump to acquire the attribute of the audio application when a preset time is reached. A user selection instruction or a voice selection instruction may be received on a display of a terminal device. The audio device ID mapped to the attribute includes: an audio device ID of an audio device codec corresponding to the attribute. The audio device ID may be a serial number or a label corresponding to the audio device.
[0098] In some embodiments, the audio device may be a wired audio playback device or a wireless audio playback device. The wireless audio playback device includes a Bluetooth playback device. The description of the above audio devices is given by way of example only, and the present disclosure is not limited to the above audio devices.
[0099] In some embodiments, the preset audio device switching routing table includes: the attribute of the audio application, the codec of the audio device, and the audio device ID. The audio device ID may further include: a user-preset audio device ID corresponding to the attribute of the audio application. The acquiring an audio device ID mapped to the attribute of the audio application may further include: acquiring the audio device ID mapped to the attribute from the preset audio device switching routing table according to the attribute of the audio application, and selecting the audio device ID according to a preset audio device priority.
[0100] In some embodiments, when there is one audio application, the acquiring an audio device ID mapped to the attribute of the audio application from a preset audio device switching routing table according to the attribute includes: acquiring one or at least two audio device IDs mapped to the attribute of the audio application from the preset audio device switching routing table according to the attribute; and when one audio device ID mapped to the attribute is acquired, activating an audio device corresponding to the audio device ID; when at least two audio device IDs mapped to the attribute are acquired, acquiring a preset number of target audio device IDs from the at least two audio device IDs; and activating the audio devices corresponding to the target audio device IDs, where the preset number includes: one or at least two. When at least two audio device IDs mapped to the attribute of the audio application are acquired and it is detected that the terminal device supports playing one audio application through at least two audio devices simultaneously, a preset number of audio device IDs supported by the terminal device are acquired according to preset priorities.
[0101] In some embodiments, when there is one audio application, the opening of the audio application may include: opening an audio application for the first time or switching from a first audio application to a second audio application. When switching is performed from the first audio application to the second audio application, an attribute of the second audio application is acquired. Activating the audio device mapped to the attribute of the second audio application may include: popping up a selection interface on the display of the terminal device, and according to a selection instruction, activating an audio device corresponding to the audio device ID mapped to the attribute of the second audio application or maintaining a connection of an activated audio device corresponding to the first audio application to the second audio application.
[0102] In some embodiments, when there are at least two audio applications, the acquiring an attribute of an audio application includes: when at least two audio applications are opened successively, acquiring attributes of the at least two audio applications respectively. The activating an audio device corresponding to the audio device ID includes: detecting whether the terminal device supports simultaneous audio output of multiple audio applications, and when it is detected that the terminal device supports simultaneous audio output of multiple audio applications, activating different audio devices corresponding to the audio device IDs mapped to the attributes of the at least two audio applications, respectively. When the attributes of the at least two audio applications map the same audio device ID, another audio device ID corresponding to attributes of at least two audio applications is selected automatically.
[0103] In some embodiments, when there are at least two audio applications, the acquiring an attribute of an audio application may further include: when at least two audio applications are downloaded successively, acquiring attributes of the at least two audio applications respectively. The attributes of the at least two audio applications may also be acquired respectively after the at least two audio applications are downloaded. As for how to activate the corresponding audio devices after downloading the at least two audio applications successively, the following activation method when at least two audio device applications are opened successively may be adopted, or audio devices corresponding to related audio device IDs may be activated according to a preset rule. The preset rule is: an audio application downloaded earlier has priority in acquiring an audio device ID, and an audio application downloaded later is not allowed to acquire the audio device ID that has already been acquired.
[0104] The following example is not according to the invention and is present for illustration purposes only, in this example, when at least two audio applications are opened successively, attributes of the at least two audio applications are acquired respectively. The activating an audio device corresponding to the audio device ID includes: when it is detected that a shared audio device ID exists in the audio device IDs mapped to the attributes of the at least two audio applications, activating the audio device in the following manner: when it is detected that the shared audio device ID is an audio device ID with a highest priority among audio device IDs mapped to an attribute of a fourth audio application, connecting the fourth audio application to an audio device corresponding to the shared audio device ID, and connecting a third audio application to another audio device, where the another audio device is different from the audio device to which the fourth audio application is connected; and when it is detected that the shared audio device ID is not the audio device ID with the highest priority among the audio device IDs mapped to the attribute of the fourth audio application, connecting the fourth audio application to the audio device corresponding to the audio device ID with the highest priority, and maintaining a connection of the third audio application to an audio device to which the third audio application is originally connected. The maintaining a connection of the third audio application to an audio device to which the third audio application is originally connected may further include: detecting whether the originally connected audio device is an audio device with a highest priority for the third audio application, and if not, switching to the audio device with the highest priority. The third audio application is an audio application opened earlier. The fourth audio application is an audio application opened later.
[0105] In some embodiments, when it is detected that a shared audio device ID exists in the audio device IDs mapped to the attributes of the at least two audio applications, and the attributes of both the at least two audio applications map multiple audio device IDs, the shared audio device ID is excluded, and the at least two successively opened audio applications are respectively connected to other audio devices.
[0106] When it is detected that no shared audio device ID exists in the audio device IDs mapped to the attributes of the at least two audio applications, a method for activating each audio application in the at least two audio applications may be acquiring the audio device ID and activating the related audio device according to the method for activating an application when there is one audio application.
[0107] After detecting that the shared audio device ID is an audio device ID with a highest priority among audio device IDs mapped to an attribute of a fourth audio application, the following cases may be further included that: the attribute of the audio application opened earlier maps at least one audio device ID, and the audio device ID with the highest priority mapped to the attribute of the audio application opened earlier is the same as the audio device ID with the highest priority mapped to the attribute of the audio application opened later; or the attribute of the audio application opened later maps multiple audio device IDs, the attribute of the audio application opened earlier maps at least one audio device ID, and the audio device ID with the highest priority mapped to the attribute of the audio application opened earlier is the same as the audio device ID with the highest priority mapped to the attribute of the audio application opened later; or the attribute of the audio application opened later maps only one audio device ID, the attribute of the audio application opened earlier maps at least one audio device ID, and there is no conflict between the audio device ID with the highest priority of the audio application opened earlier and the audio device ID with the highest priority of the audio application opened later; or the attribute of the audio application opened later maps at least two audio device IDs, the attribute of the audio application opened earlier maps at least one audio device ID, and there is no conflict between the audio device ID with the highest priority mapped to the attribute of the audio application opened earlier and the audio device ID with the highest priority mapped to the attribute of the audio application opened later.
[0108] In the above case where the attribute of the audio application opened earlier maps multiple audio device IDs and the attribute of the audio application opened later maps at least one audio device ID, no matter whether there is a conflict between the audio device ID with the highest priority of the audio application opened earlier and the audio device ID with the highest priority of the audio application opened later, the audio application opened earlier may be connected to the audio device corresponding to the audio device ID with the second highest priority. The audio device ID with the second highest priority herein is the audio device ID with the second highest priority among the audio device IDs mapped to the attribute of the audio application opened earlier. The audio application opened earlier may also be connected to another audio device. The another audio device herein may not be the audio device corresponding to the audio device ID mapped to the attribute of the audio application opened earlier. The audio application opened later is connected to an audio device that conflicts with the audio application opened earlier. In the case where the attribute of the audio application opened later maps at least two audio device IDs, the audio application opened later may also be connected to multiple audio devices at the same time, and the number of the audio devices connected may be a number of audio devices supported by the terminal device that are acquired based on preset priorities.
[0109] Alternatively, in the case where the attribute of the audio application opened earlier maps multiple audio device IDs, the attribute of the audio application opened later maps at least one audio device ID, and the audio device ID with the highest priority of the audio application opened earlier is the same as the audio device ID with the highest priority of the audio application opened later, the successively opened audio applications may be randomly connected to non-conflicting audio devices respectively.
[0110] In the case where the attribute of the audio application opened earlier is mapped to one audio device ID and the attribute of the audio application opened later also maps one audio device ID, the audio application opened earlier is connected to another audio device, where the another audio device is different from the audio devices corresponding to the audio device IDs mapped to the attribute of the audio application opened later. The audio application opened later is connected to an audio device that conflicts with the audio application opened earlier. Connecting the audio application opened earlier to another audio device may include: randomly selecting another audio device or acquiring an audio device ID corresponding to an attribute similar to the attribute of the audio application opened earlier, and connecting the audio application opened earlier to an audio device corresponding to the audio device ID.
[0111] According to the terminal device provided in the embodiments of the present disclosure, an attribute of an audio application is acquired; an audio device ID mapped to the attribute is acquired from a preset audio device switching routing table according to the attribute; and an audio device corresponding to the audio device ID is activated. In some implementation processes, technical effects including but not limited to allowing the user to switch to an appropriate audio device and realizing the intelligent selection of an appropriate audio device for playback according to the attributes of different playback applications can be achieved.Embodiment Five
[0112] This embodiment further provides a terminal device. Referring to FIG. 5, the terminal device includes a processor 501, a memory 502, and a communication bus 503.
[0113] The communication bus 503 is configured for implementing connection and communication between the processor 501 and the memory 502.
[0114] The processor 501 is configured for executing one or more computer programs stored in the memory 502 to implement at least one step in the method for activating an audio device in any of the above Embodiment One to Embodiment Three.
[0115] This embodiment further provides a computer-readable storage medium. The computer-readable storage medium includes volatile or nonvolatile, removable or non-removable media implemented in any method or technology for storage of information (such as computer readable instructions, data structures, computer program modules, or other data). The computer-readable storage medium includes, but is not limited to, a Random Access Memory (RAM), a Read-Only Memory (ROM), an Electrically Erasable Programmable Read-Only Memory (EEPROM), a flash memory or other memory technology, a Compact Disc Read-Only Memory (CD-ROM), a Digital Versatile Disc (DVD) or other optical storage, a cassette, a magnetic tape, a magnetic disk storage or other magnetic storage device, or any other medium which can be used to store the desired information and which can be accessed by a computer.
[0116] The computer-readable storage medium in this embodiment may be configured for storing one or more computer programs which, when executed by a processor, cause the processor to implement at least one step in the method for activating an audio device in any of the above Embodiment One to Embodiment Three.
[0117] According to the method for activating an audio device, the terminal device and the computer-readable storage medium provided in the embodiments of the present disclosure, an attribute of an audio application is acquired; an audio device identification (ID) mapped to the attribute is acquired from a preset audio device switching routing table according to the attribute, where the audio device ID mapped to the attribute includes: an audio device ID of an audio device codec corresponding to the attribute; and an audio device corresponding to the audio device ID is activated. In some implementation processes, technical effects including but not limited to allowing the user to switch to an appropriate audio device and realizing the selection of an audio device for playback according to the attributes of different playback applications can be achieved.
[0118] Therefore, those having ordinary skills in the art can understand that all or some of the steps in the methods disclosed above and the functional modules / units in the system and the apparatus can be implemented as software (which may be implemented by a computer program code executable by a computing device), firmware, hardware, and appropriate combinations thereof. In a hardware implementation, the division of the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components. For example, one physical component may have multiple functions, or one function or step may be jointly executed by several physical components. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit.
[0119] In addition, as is known to those having ordinary skills in the art, the communication medium typically includes computer-readable instructions, data structures, computer program modules, or other data in a modulated data signal such as a carrier or other transport mechanism, and can include any information passing medium. Therefore, the present disclosure is not limited to any particular combination of hardware and software.
Claims
1. A method applied to a terminal device, for activating an audio device connected to the terminal device, the method comprising the steps: acquiring an attribute of an audio application (S101); acquiring an audio device identification, ID, mapped to the attribute from a preset audio device switching routing table according to the attribute (S102), wherein the audio device ID mapped to the attribute comprises: an audio device ID of an audio device codec corresponding to the attribute; and activating the audio device corresponding to the audio device ID (S103); characterized in that, in response to a presence of at least two audio applications, acquiring an attribute of an audio application (S101) comprises: in response to at least two audio applications being opened successively, acquiring attributes of the at least two audio applications respectively; and activating the audio device corresponding to the audio device ID (S103) comprises: in response to detecting that the attribute of the audio application opened later maps at least two audio device IDs, that the attribute of the audio application opened earlier maps one audio device ID, and that shared audio device ID is an audio device ID with a highest priority among the audio device IDs mapped to the attribute of the audio application opened later, connecting the audio application opened later to an audio device corresponding to the audio device ID with a second highest priority, and connecting the audio application opened earlier to an audio device corresponding to the shared audio device ID.
2. The method of claim 1, wherein prior to acquiring an attribute of an audio application (S101), the method further comprises: in response to receiving an instruction of selecting an audio device ID, acquiring the selected audio device ID, and activating an audio device corresponding to the selected audio device ID; and in response to not receiving the instruction of selecting an audio device ID, performing the operation of acquiring the attribute of the audio application.
3. The method of claim 2, wherein prior to activating an audio device corresponding to the selected audio device ID, the method further comprises: acquiring the attribute of the audio application, establishing a mapping relationship between the attribute of the audio application and the selected audio device ID, and updating the preset audio device switching routing table.
4. The method of any of claims 1 to 3, wherein in response to a presence of one audio application, acquiring an audio device ID mapped to the attribute from a preset audio device switching routing table according to the attribute (S102) comprises: acquiring one or at least two audio device IDs mapped to the attribute from the preset audio device switching routing table according to the attribute; and activating the audio device corresponding to the audio device ID (S103) comprises: in response to acquiring one audio device ID mapped to the attribute, activating an audio device corresponding to the one audio device ID; in response to acquiring at least two audio device IDs mapped to the attribute, acquiring a preset number of audio device IDs from the at least two audio device IDs according to preset priorities; and activating the audio device(s) corresponding to the audio device ID(s), wherein the preset number comprises one or at least two.
5. The method of any of claims 1 to 2, wherein acquiring an attribute of an audio application (S101) comprises: in response to switching from a first audio application to a second audio application, acquiring an attribute of the second audio application; and activating the audio device corresponding to the audio device ID (S103) comprises: acquiring an audio device ID mapped to the attribute of the second audio application, and activating the audio device corresponding to the audio device ID; or switching an activated audio device corresponding to the first audio application to connect to the second audio application.
6. A terminal device, comprising a processor (501), a memory (502), and a communication bus (503), the terminal device being connected to an audio device, characterized in that: the communication bus (503) is configured for implementing connection and communication between the processor (501) and the memory (502); and the processor (501) is configured for executing one or more computer programs stored in the memory (502) to perform of the method of any one of claims 1 to 5.
7. A computer-readable storage medium storing one or more computer programs which, when executed by one or more processors, cause the one or more processors to perform the method of any one of claims 1 to 5.