Audio equipment sharing method, terminal and storage medium
By sharing audio devices between terminals with different operating systems, the problem of users being unable to use PC audio devices is solved, enabling convenient sharing and efficient use of audio devices across terminals and improving the user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-23
- Publication Date
- 2026-03-10
AI Technical Summary
Users are unable to use the PC's audio device when they are outside the microphone's range or when the PC is not equipped with an audio device, resulting in a degraded user experience.
The first terminal displays a virtual audio device identification interface, selects the target audio device, writes the audio data to the cache area, and uses a distributed device virtualization component to send it to the second terminal to control the playback of the target audio device, supporting audio device sharing between terminals with different operating systems.
It enables convenient sharing across different audio devices, improving the ease and efficiency of users' use of audio devices and enhancing the user experience.
Smart Images

Figure CN121635834A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, in particular to an audio device sharing method, a terminal and a storage medium. BACKGROUND
[0002] When a user uses a three-party application installed in a personal computer (PC), the user can use the audio device (such as a loudspeaker and a microphone) of the PC to realize functions such as voice call, sound playing, voice message reminding, and the like. For example, when the user uses a conference application installed in the PC to conduct a remote conference, the user uses the loudspeaker and the microphone of the PC to complete voice call. Or, when the user uses a live broadcast application installed in the PC to watch a live broadcast, the user uses the loudspeaker of the PC to play the sound of the live broadcast.
[0003] However, in a scenario in which the user cannot use the audio device of the PC to complete the above functions, the user experience is reduced. For example, when the user is not near the PC, the distance between the user and the PC is beyond the sound receiving range of the microphone of the PC, and the PC cannot obtain the sound of the user. Or, the PC does not have a microphone or a loudspeaker configured. SUMMARY
[0004] Embodiments of the present application aim to provide an audio device sharing method, a terminal and a storage medium, so as to realize that a first terminal calls an audio device of a second terminal, improve the convenience and efficiency of the user in using the audio device, and further improve the user experience. The specific technical solutions are as follows:
[0005] In a first aspect, in order to achieve the above-mentioned purpose, the embodiments of the present application provide an audio device sharing method, which is applied to a first terminal; the method comprises the following steps:
[0006] displaying a first interface; wherein the first interface comprises an audio device identifier of a virtual audio device allowed to be called by the first terminal; the virtual audio device represents an audio device of another terminal allowed to be called by the first terminal; the operating system of the first terminal is different from that of the other terminal;
[0007] in response to a selection operation of a user on the audio device identifier, determining a virtual audio device corresponding to the selected audio device identifier;
[0008] writing first audio data to be played into a preset cache area; wherein the first audio data is output by a target application in the first terminal;
[0009] sending the first audio data in the preset cache area to a second terminal to which the virtual audio device belongs, so that the second terminal controls a target audio device to play the first audio data.
[0010] It can be seen from the above that the technical scheme provided in the embodiment can realize that the first terminal calls the audio device of the second terminal to play sound according to the selection of the user, improves the convenience and efficiency of the user in using the audio device, meets different use requirements of the user, and further improves the user experience.
[0011] In an embodiment of the present application, the writing of the first audio data to be played into the preset cache area comprises:
[0012] The data packet of the first audio data to be played is written into the preset cache area through a data writing interface of a driver bus;
[0013] The sending of the first audio data in the preset cache area to the second terminal to which the virtual audio device belongs comprises:
[0014] The data packet of the first audio data is read from the preset cache area by a distributed device virtualization component using a data reading interface of the driver bus, and the data packet of the first audio data is sent to the second terminal to which the virtual audio device belongs; wherein the distributed device virtualization component is an application that provides virtualized audio capabilities of the audio device of the other terminal allowed to be called by the first terminal.
[0015] It can be seen from the above that the technical scheme provided in the embodiment realizes the sending of the first audio data to the second terminal through the distributed device virtualization component in the first terminal, improves the data transmission efficiency, and further improves the user experience.
[0016] In an embodiment of the present application, after the data packet of the first audio data to be played is written into the preset cache area through the data writing interface of the driver bus, the method further comprises:
[0017] The acquisition information of the first audio data is written into a first cache queue; wherein the acquisition information contains the storage address of the data packet of the first audio data in the preset cache area, the preset reading length of the data packet of the first audio data, and the port number of the virtual audio device;
[0018] The acquisition information of the first audio data is acquired from the first cache queue in the reading order of the acquisition information in the first cache queue by the distributed device virtualization component, and the acquisition information is analyzed to obtain the storage address of the data packet of the first audio data in the preset cache area, the preset reading length of the data packet of the first audio data, and the port number of the virtual audio device;
[0019] The distributed device virtualization component reads the data packet of the first audio data from the preset cache area by using the data reading interface of the drive bus, and sends the data packet of the first audio data to a second terminal to which the virtual audio device belongs, comprising:
[0020] The distributed device virtualization component reads the data of the preset reading length from the preset cache area according to the storage address of the data packet of the first audio data in the preset cache area by using the data reading interface of the drive bus, obtains the data packet of the first audio data, and sends the data packet of the first audio data to the second terminal to which the virtual audio device represented by the port number belongs.
[0021] As can be seen from the above, the technical scheme provided by the embodiment can realize the ordered sending of the data packet of the first audio data by the distributed device virtualization component obtaining the data packet of the first audio data according to the obtaining information of the first audio data and obtaining the obtaining information of the first audio data from the first cache queue according to the first-in-first-out reading order, avoid the error of the played audio caused by the transmission error, and improve the user experience.
[0022] In an embodiment of the present application, after the distributed device virtualization component reads the data packet of the first audio data from the preset cache area by using the data reading interface of the drive bus, the method further comprises:
[0023] In the case that no data packet is read from the preset cache area within a preset time length, the audio transmission link with the second terminal is disconnected.
[0024] As can be seen from the above, the technical scheme provided by the embodiment can avoid the audio device of the second terminal being occupied by the first terminal for a long time, and further avoid affecting the audio playing business of the second terminal, thereby improving the user experience.
[0025] In an embodiment of the present application, before the first interface is displayed, the method further comprises:
[0026] Obtain the registration information of the target audio device of the second terminal; wherein the registration information comprises at least one of the following: the name of the second terminal, the ID of the second terminal, and the audio parameter of the target audio device of the second terminal;
[0027] Generate the virtual audio device of the target audio device of the second terminal according to the registration information.
[0028] It can be seen from the above that the technical scheme provided in the embodiment can generate a virtual audio device corresponding to a target audio device of a second terminal, so that the first terminal uses the target audio device of the second terminal through the virtual audio device, improves the convenience and efficiency of the user in using the audio device, and further improves the user experience.
[0029] In an embodiment of the present application, the generating the virtual audio device of the target audio device of the second terminal according to the registration information comprises:
[0030] The distributed device virtualization component encapsulates the registration information into a string of a specified length according to a standard format of an operating system of the first terminal to obtain a descriptor of the target audio device of the second terminal, and writes the generated descriptor into a second cache queue through the driver bus.
[0031] The descriptor is obtained from the second cache queue to obtain the virtual audio device.
[0032] It can be seen from the above that the technical scheme provided in the embodiment generates a virtual audio device through a distributed device virtualization component, so that when the user uses a target application, the target application is provided with an audio device identifier of a virtual audio device of another terminal which is allowed to be called by the first terminal, the first terminal uses the target audio device of the second terminal through the virtual audio device, the convenience and efficiency of the user in using the audio device are improved, and the user experience is further improved.
[0033] In an embodiment of the present application, after the descriptor is obtained from the second cache queue to obtain the virtual audio device, the method further comprises:
[0034] The distributed device virtualization component obtains audio playing information of the target audio device of the second terminal, wherein the audio playing information comprises a sampling rate, volume information and mute information, and writes the audio playing information into the second cache queue through the driver bus.
[0035] The audio playing information of the virtual audio device is obtained from the second cache queue.
[0036] Before the first audio data to be played is written into the preset cache area, the method further comprises:
[0037] The audio data output by the target application in the first terminal is processed according to the audio playing information to obtain the first audio data to be played.
[0038] It can be seen from the above that the technical scheme provided in the embodiment processes the audio data output by the target application in the first terminal according to the audio playing information of the target audio device of the second terminal, obtains the first audio data that can be played by the audio device of the second terminal, and realizes the first terminal calling the audio device of the second terminal to play sound, improves the convenience and efficiency of the user using the audio device, and further improves the user experience.
[0039] In an embodiment of the present application, before the first interface is displayed, the method further comprises:
[0040] displaying a second interface; wherein the second interface comprises an audio control option;
[0041] in response to a triggering operation of the user on the audio control option, obtaining an audio device identifier of a virtual audio device of another terminal allowed to be called by the first terminal;
[0042] the first interface comprises:
[0043] displaying a first interface comprising an audio device identifier of a virtual audio device of another terminal allowed to be called by the first terminal.
[0044] It can be seen from the above that the scheme provided in the embodiment provides the user with an audio device identifier of a virtual audio device of another terminal allowed to be called by the first terminal according to the user's indication, so that the user can select the audio device to be used, meet the different needs of the user, and improve the user experience.
[0045] In an embodiment of the present application, after the first audio data in the preset cache area is sent to the second terminal to which the virtual audio device belongs, so that the second terminal controls the target audio device to play the first audio data, the method further comprises:
[0046] displaying a third interface; wherein the third interface comprises a mute control option;
[0047] in response to a mute operation of the user on the mute control option, generating second audio data that is muted;
[0048] sending the second audio data to the second terminal, so that the second terminal controls the target audio device to play the second audio data.
[0049] It can be seen from the above that the scheme provided in the embodiment meets the user's mute playing requirement and improves user experience by enabling the second terminal to control the target audio device to play the second audio data. Moreover, the first terminal sends the second audio data after muting to the second terminal, so that the distributed device virtualization component can obtain the audio data output by the target application from the preset cache area, avoiding the situation that the first terminal disconnects the audio transmission link with the second terminal due to the long time of not obtaining the audio data output by the target application, and improving user experience.
[0050] In an embodiment of the present application, the first terminal and the third terminal perform audio service interaction, and the method further includes:
[0051] receiving third audio data sent by the second terminal, and sending the third audio data to the third terminal, wherein the third audio data is response data of the first audio data obtained by the second terminal controlling the target audio device.
[0052] It can be seen from the above that the scheme provided in the embodiment can enable the first terminal to call the audio device of the second terminal to perform audio service interaction with the third terminal, meet user requirements, and improve user experience.
[0053] In a second aspect, the embodiments of the present application further provide a terminal, including:
[0054] one or more processors and a memory;
[0055] The memory is coupled with the one or more processors, and the memory is configured to store computer program codes, the computer program codes including computer instructions, and the one or more processors are configured to invoke the computer instructions to enable the terminal to perform the audio device sharing method in any of the above aspects.
[0056] In a third aspect, the embodiments of the present application further provide a computer readable storage medium, including a computer program, when the computer program runs on a terminal, enabling the terminal to perform the audio device sharing method in any of the above aspects.
[0057] In a fourth aspect, the embodiments of the present application further provide a computer program product, including executable instructions, when the executable instructions are executed on a terminal, enabling the terminal to perform the audio device sharing method in any of the above aspects.
[0058] In a fifth aspect, the embodiments of the present application further provide a chip system, applied to a terminal, including one or more processors, and the processor is configured to invoke computer instructions to enable the terminal to input data into the chip system, and perform the audio device sharing method in any of the above aspects to process the data and output processing results.
[0059] The advantages of the solutions provided by the embodiments of the second aspect, the third aspect, the fourth aspect and the fifth aspect can refer to the advantages of the solutions provided by the embodiments of the first aspect. BRIEF DESCRIPTION OF DRAWINGS
[0060] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed in the embodiments will be briefly introduced as follows. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0061] Figure 1 A structural diagram of a terminal provided by the embodiments of the present application;
[0062] Figure 2 A software structural block diagram of a terminal provided by the embodiments of the present application;
[0063] Figure 3 An application scenario schematic diagram of the first audio device sharing method provided by the embodiments of the present application;
[0064] Figure 4 An application scenario schematic diagram of the second audio device sharing method provided by the embodiments of the present application;
[0065] Figure 5 An architectural diagram of a first terminal provided by the present application;
[0066] Figure 6 A flowchart of the first audio device sharing method provided by the embodiments of the present application;
[0067] Figure 7 A schematic diagram of a display interface of a music application provided by the embodiments of the present application;
[0068] Figure 8 A schematic diagram of a first setting interface provided by the embodiments of the present application;
[0069] Figure 9 A schematic diagram of a first second interface provided by the embodiments of the present application;
[0070] Figure 10 A schematic diagram of a first first interface provided by the embodiments of the present application;
[0071] Figure 11 A schematic diagram of an operation on the first interface shown in the embodiments of the present application; Figure 10
[0072] Figure 12 A first display interface after selecting an audio device provided by an embodiment of the present application;
[0073] Figure 13 A first display interface of an instant messaging application provided by an embodiment of the present application;
[0074] Figure 14 A second first interface provided by an embodiment of the present application;
[0075] Figure 15 A first interface provided by an embodiment of the present application; Figure 14 A first interface provided by an embodiment of the present application;
[0076] Figure 16 A first interface provided by an embodiment of the present application; Figure 14 A first interface provided by an embodiment of the present application;
[0077] Figure 17 A third first interface provided by an embodiment of the present application;
[0078] Figure 18 A first interface provided by an embodiment of the present application; Figure 17 A first interface provided by an embodiment of the present application;
[0079] Figure 19 A first interface provided by an embodiment of the present application; Figure 17 A first interface provided by an embodiment of the present application;
[0080] Figure 20 A second second interface provided by an embodiment of the present application;
[0081] Figure 21 A fourth first interface provided by an embodiment of the present application;
[0082] Figure 22 A first interface provided by an embodiment of the present application; Figure 21 A first interface provided by an embodiment of the present application;
[0083] Figure 23 A first display interface after selecting an audio device provided by an embodiment of the present application;
[0084] Figure 24 A first display interface after selecting an audio device provided by an embodiment of the present application;
[0085] Figure 25 A third second interface provided by an embodiment of the present application;
[0086] Figure 26 A fifth first interface provided by an embodiment of the present application;
[0087] Figure 27 a sixth first interface provided by an embodiment of the present application;
[0088] Figure 28 a seventh first interface provided by an embodiment of the present application; Figure 27 a schematic diagram of the operation on the third interface provided by an embodiment of the present application;
[0089] Figure 29 a third display interface after selecting an audio device provided by an embodiment of the present application;
[0090] Figure 30 a seventh first interface provided by an embodiment of the present application;
[0091] Figure 31 a flowchart of a first terminal internal data transmission provided by an embodiment of the present application;
[0092] Figure 32 a flowchart of a second terminal playing audio provided by an embodiment of the present application;
[0093] Figure 33 a flowchart of a second audio device sharing method provided by an embodiment of the present application;
[0094] Figure 34 a third interface provided by an embodiment of the present application;
[0095] Figure 35 a schematic diagram of the operation on the third interface provided by an embodiment of the present application; Figure 34 a third display interface after selecting an audio device provided by an embodiment of the present application;
[0096] Figure 36 a schematic diagram of a display interface of an instant messaging application after muting provided by an embodiment of the present application;
[0097] Figure 37 a flowchart of a third audio device sharing method provided by an embodiment of the present application;
[0098] Figure 38 a flowchart of a fourth audio device sharing method provided by an embodiment of the present application;
[0099] Figure 39 a flowchart of a fifth audio device sharing method provided by an embodiment of the present application;
[0100] Figure 40 a schematic diagram of a display interface of a music application and a conference application provided by an embodiment of the present application;
[0101] Figure 41 a schematic diagram of a second setting interface provided by an embodiment of the present application;
[0102] Figure 42 A fourth interface provided by an embodiment of the present application;
[0103] Figure 43 A ninth interface provided by an embodiment of the present application;
[0104] Figure 44 A fourth display interface provided by an embodiment of the present application after selecting an audio device;
[0105] Figure 45 A ninth interface provided by an embodiment of the present application;
[0106] Figure 46 A fifth display interface provided by an embodiment of the present application after selecting an audio device;
[0107] Figure 47 A structure diagram of a chip system provided by an embodiment of the present application. DETAILED DESCRIPTION
[0108] In order to better understand the technical solutions of the present application, the embodiments of the present application will be described in detail below with reference to the drawings.
[0109] In order to clearly describe the technical solutions of the embodiments of the present application, in the embodiments of the present application, the same items or similar items with basically the same functions and effects are distinguished by using "first", "second", etc. For example, the first instruction and the second instruction are used to distinguish different user instructions, and do not limit the order. Those skilled in the art can understand that "first", "second", etc. do not limit the quantity and execution order, and "first", "second", etc. also do not necessarily mean different.
[0110] It should be noted that in the present application, the words "exemplarily" or "for example" are used to represent an example, illustration or description. Any embodiment or design scheme described as "exemplarily" or "for example" in the present application should not be interpreted as more preferred or more advantageous than other embodiments or design schemes. Rather, the words "exemplarily" or "for example" are used to present the relevant concept in a specific manner.
[0111] The audio device sharing method provided by the embodiments of the present application is applied to a terminal. The terminal can be a mobile phone, a tablet computer, a personal digital assistant (PDA), a smart watch, a wearable electronic device, an augmented reality (AR) device, a virtual reality (VR) device, a robot, smart glasses, etc.
[0112] Exemplary, Figure 1 A structural diagram of the terminal 100 is shown. The terminal 100 can include a processor 110, a display screen 120, a camera 130, an internal memory 140, a Subscriber Identification Module (SIM) card interface 150, a Universal Serial Bus (USB) interface 160, a charging management module 170, a battery management module 171, a battery 172 with an electric core and a battery protection device, a sensor module 180, a mobile communication module 190, a wireless communication module 200, an antenna 1 and an antenna 2, and the like. The sensor module 180 can include a pressure sensor 180A, a fingerprint sensor 180B, a touch sensor 180C, an ambient light sensor 180D, and the like.
[0113] It can be understood that the structure shown in the embodiments of the present application does not constitute a specific limitation on the terminal 100. In other embodiments of the present application, the terminal 100 can include more or fewer components than shown, or combine certain components, or split certain components, or different component arrangements. The components shown can be implemented in hardware, software, or a combination of software and hardware.
[0114] The processor 110 can include one or more processing units, e.g., the processor 110 can include a central processing unit (CPU), an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units can be independent components or integrated in one or more processors. In some embodiments, the terminal 100 can also include one or more processors 110. Among them, the controller can generate operation control signals according to instruction operation codes and timing signals, complete the control of fetching instructions and executing instructions. In other embodiments, the processor 110 can also be provided with a memory for storing instructions and data. Exemplarily, the memory in the processor 110 can be a cache memory. The memory can save instructions or data that the processor 110 has just used or repeatedly uses. If the processor 110 needs to use the instructions or data again, it can be directly called from the memory. In this way, repeated access is avoided, the waiting time of the processor 110 is reduced, and thus the efficiency of the terminal 100 in processing data or executing instructions is improved.
[0115] In some embodiments, the processor 110 can include one or more interfaces. The interfaces can include Inter-Integrated Circuit (I2C) interfaces, Inter-Integrated Circuit Sound (I2S) interfaces, Pulse Code Modulation (PCM) interfaces, Universal Asynchronous Receiver / Transmitter (UART) interfaces, Mobile Industry Processor Interface (MIPI), General-Purpose Input / Output (GPIO) interfaces, SIM card interfaces, and / or USB interfaces, etc. The USB interface 160 is an interface that conforms to the USB standard specification, and can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 160 can be used to connect a charger to charge the terminal 100, and can also be used to transmit data between the terminal 100 and a peripheral device. The USB interface 160 can also be used to connect a headset to play audio through the headset.
[0116] It can be understood that the interface connection relationship between the modules shown in the embodiments of the present application is used for illustrative description, and does not constitute a structural limitation of the terminal 100. In some other embodiments of the present application, the terminal 100 can also use different interface connection modes or combinations of multiple interface connection modes in the above embodiments.
[0117] The wireless communication function of the terminal 100 can be realized by the antenna 1, the antenna 2, the mobile communication module 190, the wireless communication module 200, the modem processor, and the baseband processor, etc.
[0118] The antenna 1 and the antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the terminal 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be multiplexed to improve the utilization rate of the antennas. For example, the antenna 1 can be multiplexed as a diversity antenna of a wireless local area network. In some other embodiments, the antennas can be used in combination with tuning switches.
[0119] The terminal 100 realizes the display function through the GPU, the display screen 120, and the application processor, etc. The GPU is a microprocessor for image processing, which is connected to the display screen 120 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 can include one or more GPUs, which execute program instructions to generate or change display information.
[0120] The display screen 120 is configured to display images, videos, and the like. The display screen 120 includes a display panel. The display panel can be a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), an Active-Matrix Organic Light Emitting Diode (AMOLED), a Flex Light-Emitting Diode (FLED), a Miniled, a Micro Led, a Micro-oLed, a Quantum Dot Light Emitting Diodes (QLED), or the like. In some embodiments, the terminal 100 can include one or more display screens 120.
[0121] In some embodiments of the present application, when the display panel is made of OLED, AMOLED, FLED, or the like, the display screen 120 in the above description can be bent. Here, the display screen 120 can be bent at any part to any angle and can be kept at the angle, for example, the display screen 120 can be folded left and right from the middle. It can also be folded up and down from the middle. Figure 1
[0122] The display screen 120 of the terminal 100 can be a flexible screen. At present, the flexible screen is attracting much attention due to its unique characteristics and great potential. Compared with the traditional screen, the flexible screen has the characteristics of strong flexibility and bendability, and can provide a new interaction mode based on the bendable characteristics for users and meet more needs of users for the terminal. For the terminal with a foldable display screen, the foldable display screen on the terminal can be switched between the small screen in the folded form and the large screen in the unfolded form at any time. Therefore, the user uses the split screen function on the terminal with the foldable display screen more and more frequently.
[0123] The terminal 100 can realize the photographing function through an ISP, a camera 130, a video codec, a GPU, a display screen 120, and an application processor, and the like, wherein the camera 130 includes a front camera and a rear camera.
[0124] ISP is used to process the data fed back by the camera 130. For example, when taking a photo, the shutter is opened, the light is transmitted to the camera photosensitive element through the lens, the light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing and conversion into a visible image. The ISP can optimize the noise, brightness and color of the image through algorithms, and the ISP can also optimize the exposure and color temperature of the shooting scene. In some embodiments, the ISP can be arranged in the camera 130.
[0125] The camera 130 is used to take photos or videos. Objects generate optical images through lenses and project them onto photosensitive elements. The photosensitive element can be a charge-coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, which is then transmitted to the ISP for conversion into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into a standard Red Green Blue (RGB), YUV, etc. format image signal. In some embodiments, the terminal 100 can include one or N cameras 130, where N is a positive integer greater than 1.
[0126] The digital signal processor is used to process digital signals, in addition to processing digital image signals, it can also process other digital signals. For example, when the terminal 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy, etc.
[0127] The video codec is used to compress or decompress digital video. The terminal 100 can support one or more video codecs. In this way, the terminal 100 can play or record videos in multiple encoding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG 2, MPEG 3, and MPEG 4.
[0128] The NPU is a neural network (Neural-Network, NN) computing processor that learns from the structure of biological neural networks, such as the transmission mode between human brain neurons, and can quickly process input information and continuously self-learn. Through the NPU, the terminal 100 can realize intelligent cognition and other applications, such as image recognition, face recognition, voice recognition, and text understanding.
[0129] The internal memory 140 can be used to store one or more computer programs including instructions. The processor 110 can cause the terminal 100 to perform the audio device sharing method provided in some embodiments of the present application, various applications and data processing, etc. by running the above-mentioned instructions stored in the internal memory 140. The internal memory 140 can include a program storage area and a data storage area. The program storage area can store an operating system, and can also store one or more applications (such as a gallery, contacts, etc.). The data storage area can store data created during the use of the terminal 100 (such as photos, contacts, etc.). In addition, the internal memory 140 can include a high-speed random access memory, and can also include a non-volatile memory such as one or more disk storage components, flash memory components, Universal Flash Storage (UFS), etc. In some embodiments, the processor 110 can cause the terminal 100 to perform the audio device sharing method provided in the embodiments of the present application, and other applications and data processing by running the instructions stored in the internal memory 140 and / or the instructions stored in the memory disposed in the processor 110.
[0130] The internal memory 140 can be used to store the related programs of the audio device sharing method provided in the embodiments of the present application, and the processor 110 can be used to call the related programs of the audio device sharing method stored in the internal memory 140 when displaying information, and execute the audio device sharing method of the embodiments of the present application.
[0131] The sensor module 180 can include a pressure sensor 180A, a fingerprint sensor 180B, a touch sensor 180C, an ambient light sensor 180D, etc.
[0132] The pressure sensor 180A is configured to sense a pressure signal and convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A can be disposed on the display 120. The pressure sensor 180A can be of various types, such as a resistive pressure sensor, an inductive pressure sensor, or a capacitive pressure sensor. The capacitive pressure sensor can include at least two parallel plates of conductive material. When a force is applied to the pressure sensor 180A, the capacitance between the electrodes changes, and the terminal 100 determines the intensity of the pressure based on the change in capacitance. When a touch operation is applied to the display 120, the terminal 100 detects the touch operation based on the pressure sensor 180A. The terminal 100 can also calculate the position of the touch based on the detection signal of the pressure sensor 180A. In some embodiments, touch operations applied to the same touch position but with different touch operation intensities can correspond to different operation instructions. For example, when a touch operation with an intensity less than a first pressure threshold is applied to a short message application icon, an instruction to view a short message is executed; when a touch operation with an intensity greater than or equal to the first pressure threshold is applied to the short message application icon, an instruction to create a new short message is executed.
[0133] The fingerprint sensor 180B is configured to acquire a fingerprint. The terminal 100 can use the acquired fingerprint characteristics to implement functions such as unlocking, accessing an application lock, taking a photo, and answering an incoming call.
[0134] The touch sensor 180C is also referred to as a touch device. The touch sensor 180C can be disposed on the display 120, and the touch sensor 180C and the display 120 together form a touch screen, also referred to as a touch screen. The touch sensor 180C is configured to detect a touch operation applied to or near the touch sensor 180C. The touch sensor 180C can transmit the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display 120. In other embodiments, the touch sensor 180C can also be disposed on the surface of the terminal 100 and disposed at a different position from the display 120.
[0135] The ambient light sensor 180D is configured to sense the brightness of ambient light. The terminal 100 can adaptively adjust the brightness of the display 120 based on the sensed brightness of the ambient light. The ambient light sensor 180D can also be used to automatically adjust the white balance when taking a photo. The ambient light sensor 180D can also transmit information about the environment in which the device is located to the GPU.
[0136] The ambient light sensor 180D is also configured to obtain the brightness, light ratio, color temperature, and the like of the acquisition environment of the image acquired by the camera 130.
[0137] Figure 2A software structure diagram of a terminal applicable to embodiments of the present application. The software system of the terminal can adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservice architecture, or a cloud architecture. The layered architecture divides the software system of the terminal into several layers, each layer having a clear role and division of labor. Layers communicate with each other through software interfaces. In some embodiments, the software system can be divided into three layers, namely, an application layer, an application framework layer, and a hardware abstract layer (HAL).
[0138] The application layer can include a series of application packages, and the application layer runs the applications by calling the application programming interface (API) provided by the application framework layer. As shown in Figure 2 The application package can include a plurality of applications, such as camera, clock, browser, and music programs.
[0139] The application framework layer provides the API and programming framework for the applications of the application layer. The application framework layer includes some pre-defined functions. As shown in Figure 2 The application framework layer can include a window manager, a content provider, a view system, a resource manager, a notification manager, and a Dynamic Host Configuration Protocol (DHCP) module.
[0140] The driver layer is a layer between hardware and software, which is used to drive hardware to work. A plurality of drivers for driving hardware to work can be installed in the driver layer. For example, camera driver, display driver, audio driver, and sensor driver.
[0141] In addition, the terminal also includes a hardware layer, which can include a camera, a speaker, a display screen, a battery, and the like. The hardware layer is connected with the driver layer.
[0142] The application scenarios of embodiments of the present application are described below.
[0143] When a user uses a three-party application installed in a personal computer (PC), the user can use the audio device (e.g., a speaker and a microphone) of the PC to realize functions such as voice call, sound playing, voice message reminding, and the like. For example, when the user uses a conference application installed in the PC to conduct a remote conference, the user uses the speaker and the microphone of the PC to complete voice call. Or, when the user uses a live broadcast application installed in the PC to watch a live broadcast, the user uses the speaker of the PC to play the sound of the live broadcast. Or, when the user uses a music playing application installed in the PC to play music, the user uses the speaker of the PC to play the music.
[0144] However, when the user is not near the PC or the PC is not configured with the audio device, the user cannot use the above functions, which reduces the user experience.
[0145] The audio device sharing method provided in the embodiments of the present application can realize sharing and using, by a first terminal, an audio device of a second terminal, improve the convenience and efficiency of using the audio device by the user, and further improve the user experience.
[0146] For example, the first terminal is a PC, and the second terminal is a mobile phone. In one application scenario, referring to Figure 3 , when the user uses a music application installed in the PC to play music, the PC sends audio data of the music to be played to the mobile phone, and the mobile phone uses the speaker to play the music. For example, when the PC is not configured with a speaker, the PC can use the speaker of the mobile phone to play sound. It can be understood that, when the PC is configured with a speaker, the PC can also use the speaker of the mobile phone to play sound.
[0147] In another application scenario, referring to Figure 4 , when the user uses an instant messaging application installed in the PC to make a voice call, and the PC is not configured with a speaker and a microphone, the PC sends audio data of the call voice to be played to the mobile phone, the mobile phone uses the speaker to play the call voice, and the mobile phone uses the microphone to receive the call voice and sends audio data of the call voice to the PC.
[0148] Next, the audio device sharing method provided in the embodiments of the present application is described in detail through specific embodiments.
[0149] In the embodiments of the present application, the operating system of the first terminal is different from that of the other terminal (e.g., the second terminal) sharing the audio device. For example, the first terminal is a PC using a Windows operating system, and the second terminal is a mobile phone using an Android operating system.
[0150] The first terminal and the second terminal sharing the audio device with the first terminal have a trust relationship, that is, the first terminal and the second terminal are in a trust ring.
[0151] The first terminal and the second terminal have a trust relationship, which needs to meet the following conditions:
[0152] The first terminal and the second terminal belong to the same local area network, so that the data interaction between the first terminal and the second terminal is more reliable, stable and rapid. Exemplarily, the local area network can be a close-range communication network, such as a WiFi hotspot network, a WiFi P2P network, a Bluetooth network, and a near field communication (NFC) network, etc.
[0153] The first terminal and the second terminal have undergone a system account mutual recognition operation. Exemplarily, the first terminal and the second terminal log in the same system authentication account. The system authentication account can be a registered account provided by a cloud server. For example, the first terminal is a PC, and the second terminal is a mobile phone. The PC and the mobile phone log in the same system authentication account, such as a glory system account.
[0154] After the first terminal and the second terminal establish a trust relationship, the first terminal can obtain the registration information of the audio device (i.e., the target audio device) of the second terminal. For example, for a terminal (such as the first terminal) in the trust ring, if the first terminal leaves the local area network, or the system authentication account logged in by the first terminal is switched to a system authentication account different from the second terminal, the first terminal is offline in the trust ring. Subsequently, when the first terminal is in the same local area network as the second terminal and logs in the same system account as the second terminal, the first terminal is online in the trust ring, and at this time, the first terminal can obtain the registration information of the target audio device of the second terminal.
[0155] The registration information includes at least one of the following: the name of the second terminal, the ID of the second terminal, and the audio parameter of the target audio device of the second terminal.
[0156] The name of the second terminal can be the device name at the time of factory shipment, such as mobile phone A. Alternatively, the name of the second terminal can also be a device name customized by the user, such as the mobile phone of user A. The ID of the second terminal is a string used to represent the second terminal. For example, the ID of the second terminal is 01.
[0157] The audio parameter of the target audio device of the second terminal can include: the sampling rate, the number of channels, the audio format, and the audio data transmission mode supported by the target audio device, etc.
[0158] In an implementation manner, when the first terminal and the second terminal establish a trust relationship, the second terminal can encapsulate the registration information of the target audio device of the second terminal into a response returned to the first terminal, and then the first terminal can obtain the registration information of the target audio device of the second terminal.
[0159] In another implementation, after the first terminal establishes a trust relationship with the second terminal, the first terminal sends a request for obtaining the registration information of the target audio device of the second terminal to the second terminal. After receiving the request, the second terminal returns the registration information of the target audio device of the second terminal to the first terminal.
[0160] Further, the first terminal generates a virtual audio device corresponding to the target audio device of the second terminal in the first terminal based on the registration information of the second terminal (i.e., virtualization of audio capability). Subsequently, the first terminal can display the audio device identifier of the generated virtual audio device. The user can select the audio device identifier of the virtual audio device to be used in the audio device identifier displayed by the first terminal. Then, when the first terminal determines that the user selects the audio device identifier representing the target audio device of the second terminal, the first terminal sends the audio data to be played (i.e., first audio data) to the second terminal, thereby realizing the first terminal calling the target audio device of the second terminal to play sound.
[0161] In some embodiments, the step of generating the virtual audio device of the target audio device of the second terminal according to the registration information comprises: encapsulating the registration information into a string of a specified length according to the standard format of the operating system of the first terminal by the distributed device virtualization component to obtain a descriptor of the target audio device of the second terminal. The generated descriptor is written to the second cache queue by the driver bus. The descriptor is obtained from the second cache queue to obtain the virtual audio device.
[0162] The distributed device virtualization component is an application that provides the virtualization audio capability of the audio device of the other terminal that can be called by the first terminal. The distributed device virtualization component is a DMSDP (Distribute Mobile Sensing Development Platform). The DMSDP is an application developed to realize the first terminal calling the audio device of the second terminal. The DMSDP encapsulates the registration information into a string of a specified length according to the standard format of the operating system of the first terminal to obtain a descriptor of the target audio device of the second terminal. For example, when the first terminal is a PC using a Windows operating system, the name of the second terminal in the registration information is encapsulated into a string of a specified length, the ID of the second terminal is encapsulated into a string of a specified length, and the audio parameter of the target audio device of the second terminal is encapsulated into a string of a specified length according to the standard format of the Windows operating system, thereby obtaining the descriptor of the target audio device of the second terminal. Different registration information corresponds to different specified length. For example, the specified length for encapsulating the name of the second terminal is different from the specified length for encapsulating the ID of the second terminal.
[0163] Further, the descriptor of the target audio device of the second terminal is written into the second cache queue through the device registration interface provided by the driver bus. For example, the descriptor of the name of the second terminal is written into the second cache queue through the name registration interface provided by the driver bus, the descriptor of the ID of the second terminal is written into the second cache queue through the ID registration interface, the audio data transmission mode is written into the second cache queue through the transmission mode registration interface, and the audio parameter is written into the second cache queue through the parameter registration interface. Correspondingly, the descriptor of the target audio device of the second terminal is obtained through the device registration interface provided by the driver bus, so as to realize the generation of the virtual audio device in the first terminal.
[0164] In some embodiments, the generation of the virtual audio device is described by taking the first terminal as a PC as an example. Referring to Figure 5 , Figure 5 A schematic diagram of a first terminal is provided in the present application, and the first terminal includes an application layer, a system layer and a kernel layer. The application layer includes third-party applications and system applications installed in the first terminal, such as music applications, instant messaging applications, conference applications and the like, and an audio registration application. The audio registration application is a DMSDP. The system layer is the operating system layer of the first terminal, and includes a multimedia framework. For example, when the operating system of the first terminal is a Windows operating system, the multimedia framework is a Windows multimedia framework. The kernel layer includes a driver bus.
[0165] The audio registration application includes a service management module, a virtual device management module and a transmission module. The service management module is used to manage audio devices in the first terminal, such as speakers, microphones and the like. In step ①, the service management module in the audio registration application obtains the registration information of the second terminal. In step ②, the service management module sends the registration information of the target audio device of the second terminal to the virtual device management module. Further, in step ③, the virtual device management module sends a device insertion message to the driver bus, and the device insertion message carries the registration information of the target audio device of the second terminal.
[0166] Referring to Table 1, Table 1 is a packaging format table of a device insertion message provided in an embodiment of the present application.
[0167] Table 1
[0168] Uuid (Universal Unique Identifier) ID of the second terminal Size String length deviceNamelen (device name length) device name length deviceIdlen (device ID length) device ID length
[0169] The uuid in the insertion message is the ID of the second terminal. The size is the length of the string obtained by packaging the registration information of the second terminal. The deviceNamelen is the length of the string obtained by packaging the name (i.e., the device name) of the second terminal. The deviceIdlen is the length of the string obtained by packaging the ID (i.e., the device ID) of the second terminal.
[0170] That is, the virtual device management module encapsulates the registration information into a descriptor of the target audio device of the second terminal according to a standard format of an operating system of the first terminal, and further writes the descriptor obtained by encapsulating the registration information of the second terminal into the second cache queue in the kernel layer through the device registration interface.
[0171] In step IV, the multimedia framework obtains the descriptor of the target audio device of the second terminal from the second cache queue, that is, the multimedia framework identifies the virtual audio device generated in the kernel layer of the first terminal, and realizes the generation of the virtual audio device in the first terminal. Further, in step V, the target application obtains the audio identifier of the virtual audio device generated in the first terminal from the multimedia framework. When the user uses the target application in the first terminal, the first terminal can display the audio device identifiers of the other terminals allowed to be called by the first terminal. The user can then perform a selection operation on the audio device identifiers to select the target audio device of the second terminal for sound playing. Figure 5 In steps VI to IX, the implementation manners are the same as those of steps I to IV in Figure 31 may be referred to the related description of Figure 31 .
[0172] As can be seen from the above, the scheme provided in the embodiment can generate a virtual audio device corresponding to the target audio device of the second terminal in the first terminal, so that when the user uses the target application, the target application is provided with the audio device identifier of the virtual audio device of the other terminal allowed to be called by the first terminal, and the first terminal can share the audio device of the second terminal, improving the convenience and efficiency of the user using the audio device, and further improving the user experience.
[0173] In some embodiments, referring to Figure 6 , Figure 6 a flowchart of an audio device sharing method provided by an embodiment of the present application, the method being applied to a first terminal, can include the following steps:
[0174] S601: display a first interface.
[0175] The first interface includes an audio device identifier of a virtual audio device allowed to be called by the first terminal; the virtual audio device represents an audio device of another terminal allowed to be called by the first terminal; and the operating system of the first terminal is different from that of the other terminal.
[0176] S602: in response to a selection operation of the user on the audio device identifier, determine a second terminal to which a target audio device corresponding to the selected audio device identifier belongs.
[0177] S603: send the first audio data to be played to the second terminal, so that the second terminal controls the target audio device to play the first audio data.
[0178] As can be seen from the above, the scheme provided by the embodiment can realize that the first terminal shares and uses the audio device of the second terminal, improves the convenience and efficiency of the user using the audio device, and further improves the user experience. Moreover, without using the application connection capability, the virtualization capability of the audio device of the other terminal is directly called, the first terminal calls the audio device of the second terminal to play sound, and the user experience is improved.
[0179] For steps S601 and S602, the first terminal displays a first interface, and the first interface includes audio device identifiers of audio devices of other terminals allowed to be called by the first terminal. The user can select an audio device identifier of an audio device to be used from the audio device identifiers.
[0180] Further, the user selects an audio device identifier of an audio device to be used in the first interface. Correspondingly, the first terminal determines a target audio device represented by the selected audio device identifier and a second terminal to which the target audio device belongs in response to a selection operation of the user on the audio device identifier.
[0181] In some embodiments, the audio device identifiers displayed in the first interface are identifiers of virtual audio devices in the first terminal. Correspondingly, in response to a selection operation of the user on the audio device identifier, the first terminal can determine a virtual audio device corresponding to the audio device identifier selected by the user, and then determine a second terminal to which the virtual audio device belongs.
[0182] In some embodiments, before step S601, the method further includes the following step: displaying a second interface. The second interface includes an audio control option. In response to a triggering operation of the user on the audio control option, audio device identifiers of virtual audio devices of other terminals allowed to be called by the first terminal are obtained.
[0183] Correspondingly, step S601 includes: displaying a first interface including audio device identifiers of virtual audio devices of other terminals allowed to be called by the first terminal.
[0184] The second interface is a display interface of a target application in the first terminal used by the user, and the second interface includes an audio control option. The audio control option is used to enter the first interface.
[0185] The first terminal acquires audio device identifiers of virtual audio devices of other terminals that the first terminal can invoke in response to a user triggering operation on the audio control option, and displays a first interface containing the acquired audio device identifiers. The acquired audio device identifiers include an audio device identifier of a virtual audio device corresponding to an audio device of the first terminal itself, and audio device identifiers of virtual audio devices corresponding to audio devices of other terminals that the first terminal can share.
[0186] As Figure 5 In step ⑤, when detecting a user triggering operation on the audio control option, the target application acquires audio device identifiers of virtual audio devices of other terminals that the first terminal can invoke from the multimedia framework.
[0187] The following describes a way for a user to select an audio device in conjunction with an example.
[0188] Example 1:
[0189] Take the first terminal as a PC and the target application as a music application as an example. Referring to Figure 7 , Figure 7 is a display interface when a user uses the music application. The display interface includes a settings option 701. The user performs a click operation on the settings option 701. In response to the user's click operation on the settings option 701, the PC displays a settings interface as shown in Figure 8 . The settings interface contains a play option 801. The user performs a click operation on the play option 801, and the PC displays a second interface as shown in Figure 9 . The second interface includes an audio control option 901. The user performs a click operation on the audio control option 901. In response to the user's click operation on the audio control option 901, the first terminal displays a first interface as shown in Figure 10 .
[0190] The first interface displays a list of available speakers 1001. The list of available speakers 1001 includes an audio device identifier 1002 of the PC itself (i.e., a system speaker), and audio device identifiers 1003 of a mobile phone 1 (i.e., mobile phone 1), 1004 of a mobile phone 2 (i.e., mobile phone 2), and 1005 of a tablet computer 3 (i.e., tablet computer 3) that the PC can invoke.
[0191] The user can select a virtual audio device in the audio device shown in the list of available speakers 1001 in the first interface, i.e., select a speaker of another terminal for playing sound.
[0192] The user's selection operation on the audio device identifier is a click operation, as shown in Figure 11When the user clicks on the audio device identifier 1003 in the list of available speakers 1001 (i.e., clicks "Mobile Phone 1"), the PC determines to use the speaker of Mobile Phone 1 to play sound and displays... Figure 12 The interface shown.
[0193] Example 2:
[0194] This explanation will use a PC as the primary terminal and an instant messaging application as the target application. Figure 13 As shown, Figure 13 This refers to the user interface displayed when using an instant messaging application. If, during the user's use of the application, mobile phone 1 in the trust ring comes online and a virtual audio device for mobile phone 1 is created on the PC, then the PC displays... Figure 14 The first interface shown.
[0195] The first interface displays a notification window 1401 indicating that the speaker of mobile phone 1 has been plugged into the PC. The notification window 1401 includes two operation options: a toggle option 1402 and a cancel option 1403. The notification window 1401 includes the audio device identifier (i.e., mobile phone 1) that the PC can share. The user can select the speaker to use for sound playback within the notification window 1401.
[0196] The user selects the audio device identifier by clicking. See also Figure 15 If the user clicks on switch option 1402 in the reminder window 1401, the PC will then determine to use the speaker of mobile phone 1 to play sound. See also Figure 16 If the user clicks the cancel option 1403 in the reminder window 1401, the PC will determine not to use the speaker of the mobile phone 1, that is, the PC will still use its own speaker.
[0197] After the user selects speakers, the PC displays... Figure 17 The first interface is shown. The first interface displays a notification window 1701 indicating that a microphone for mobile phone 1 has been plugged into the PC. The notification window 1701 includes two operation options: a toggle option 1702 and a cancel option 1703. The notification window 1701 includes the audio device identifier (i.e., mobile phone 1) that the PC can share. The user can select the microphone to use for recording in the notification window 1701.
[0198] The user selects the audio device icon by clicking. See also Figure 18 If the user clicks switch option 1702 in the reminder window 1701, the PC will then determine to use the microphone of mobile phone 1 for sound recording. See also Figure 19 If the user clicks the cancel option 1703 in the reminder window 1701, the PC will determine not to use the microphone of mobile phone 1, that is, the PC will still use its own microphone.
[0199] In the above example 2, the PC can also first display Figure 17 the first interface shown in FIG. 2A, the user selects the microphone in the Figure 17 first interface shown in FIG. 2B, and then displays the first interface shown in FIG. 2C. Figure 14 the first interface shown in FIG. 2A, the user selects the speaker in the Figure 14 first interface shown in FIG. 2D.
[0200] Example 3:
[0201] The first terminal is taken as a PC, and the target application is taken as a conference application. Referring to FIG. 3A, Figure 20 , Figure 20 is a second interface for the user using the conference application, and the second interface includes an audio control option 2001. The user performs a click operation on the audio control option 2001. In response to the click operation of the user on the audio control option 2001, the first terminal displays the first interface shown in FIG. 2A. Figure 21
[0202] The first interface displays a list of available speakers 2101 and a list of available microphones 2102. The list of available speakers 2101 includes an audio device identifier 2105 of the PC itself (i.e., a system speaker) and an audio device identifier 2106 of the mobile phone 1 that can be invoked by the PC (i.e., the mobile phone 1). The list of available microphones 2102 includes an audio device identifier 2103 of the PC itself (i.e., a system microphone) and an audio device identifier 2104 of the mobile phone 1 that can be invoked by the PC (i.e., the mobile phone 1).
[0203] The user can select a speaker for playing sound in the list of available speakers 2101 and select a microphone for receiving sound in the list of available microphones 2102.
[0204] The selection operation of the user on the audio device identifier is a click operation. Referring to FIG. 2B, Figure 22 the user first clicks the audio device identifier 2104 in the list of available microphones 2102 (i.e., clicks the "mobile phone 1"), and the PC determines to use the microphone of the mobile phone 1 to receive sound. Then, the user clicks the audio device identifier 2106 in the list of available speakers 2101 (i.e., clicks the "mobile phone 1"), and the PC determines to use the speaker of the mobile phone 1 to play sound, and displays the interface shown in FIG. 2C. Then, the user clicks the audio control option 2001 again, and the PC can stop displaying the interface shown in FIG. 2C, and displays the second interface shown in FIG. 3A again. Figure 23 Figure 23 Figure 20
[0205] The above examples 1 to 3 are exemplary descriptions of the user selecting the audio device using the operation option in the target application, and do not limit the audio device sharing method provided by the embodiments of the present application to only the above three scenarios. In addition, the user can also select the audio device using the system operation option of the PC, and the specific manner can be referred to example 4.
[0206] Example 4:
[0207] Referring to Figure 24 , Figure 24 is a display interface for the user using the instant messaging application, and the display interface includes an audio playing identifier 2401. The user performs a click operation on the audio playing identifier 2401. In response to the click operation of the user on the audio playing identifier 2401, the PC displays a second interface as shown in Figure 25 . The second interface includes an audio control option 2501 and an audio control option 2502. The user performs a click operation on the audio control option 2501. In turn, in response to the click operation of the user on the audio control option 2501, the first terminal displays a first interface as shown in Figure 26 . Figure 26 The volume value (i.e., 10) displayed by the PC in the first interface is the volume value of the currently selected audio device (i.e., the audio device of the PC).
[0208] The first interface includes an available speaker list 2601. The available speaker list 2601 includes an audio device identifier 2602 (i.e., system speaker) of the PC, and an audio device identifier 2603 (i.e., mobile phone 1) of the mobile phone 1 which can be invoked by the PC.
[0209] The user performs a click operation on the audio control option 2502. In turn, in response to the click operation of the user on the audio control option 2502, the first terminal displays a first interface as shown in Figure 27 . The first interface includes the available speaker list 2601, and an available microphone list 2701. The available microphone list 2701 includes the audio device identifier 2702 (i.e., system microphone) of the PC, and the audio device identifier 2703 (i.e., mobile phone 1) of the mobile phone 1 which can be invoked by the PC.
[0210] The user can select the speaker used for playing sound in the available speaker list 2601, and select the microphone used for receiving sound in the audio device shown in the available microphone list 2701.
[0211] The selection operation of the user on the audio device identifier is a click operation, which can be referred to Figure 28, the user clicks the audio device identifier 2703 (i.e., clicks "Mobile Phone 1") in the available microphone list 2701, the PC determines to use the microphone of the mobile phone 1 to receive sound, and then the user clicks the audio device identifier 2603 (i.e., clicks "Mobile Phone 1") in the available speaker list 2601, the PC determines to use the speaker of the mobile phone 1 to play sound, and displays the interface shown in Fig. 26B. Figure 29 Figure 29 The volume value (i.e., 15) displayed in the PC is the volume value of the currently selected audio device (i.e., the audio device of the mobile phone 1).
[0212] The above Figures 24 to 29 is only an example, and the user can also select the microphone or the speaker separately. After the PC displays the first interface shown in Fig. 26A, the user can directly select the speaker to play sound in the available speaker list 2601. Figure 26
[0213] After the PC displays the first interface shown in Fig. 26A, the user can also click the audio control option 2501 first. The PC displays the first interface shown in Fig. 30A. The first interface includes an available microphone list 3001, which includes the audio device identifier 3002 (i.e., the system microphone) of the PC and the audio device identifier 3003 (i.e., the mobile phone 1) of the mobile phone 1 that can be invoked by the PC. Figure 25 Figure 30 After the PC displays the first interface shown in Fig. 30A, the user selects the microphone to receive sound in the available microphone list 3001. Figure 30
[0214] The above Figures 24 to 30 is the way the user selects the audio device when the PC runs the instant messaging application. When the PC runs other applications, the user can also select the audio device in the way shown in Example 4 above. When the PC does not run any application, the user can also select the audio device in the way shown in Example 4 above.
[0215] In addition, after the user selects the audio device in the way shown in Example 4 above, the three-party application and the system application in the PC use the audio device selected by the user to play sound and receive sound. In addition, Example 4 is only an example, and the way to select the audio device is different from the way shown in Example 4 above when the version of the Windows operating system used by the PC is different.
[0216] For step S603, after determining the second terminal to which the user-selected virtual audio device belongs, the first terminal sends the first audio data to be played to the second terminal. The first audio data to be played is the audio output by a target application in the first terminal. The target application is a third-party application or a system application installed in the first terminal. For example, music played by a music application, or call voice output by an instant messaging application, etc.
[0217] In some embodiments, the step of sending the first audio data to the second terminal by the first terminal includes: writing the first audio data to be played into a preset cache area; the first audio data is output by a target application in the first terminal. The first audio data in the preset cache area is sent to the second terminal to which the virtual audio device belongs, so that the second terminal controls the target audio device to play the first audio data.
[0218] For the embodiments of Figure 5 , the target application (i.e. the third-party application / system application) outputs the first audio data to the multimedia framework. The multimedia framework writes the data packet of the first audio data to be played into a preset cache area through a data writing interface provided by the driver bus. The preset cache area is a storage area in the kernel layer for storing audio data to be played. Then, the DMSDP reads the data packet of the first audio data from the preset cache area through a data reading interface of the driver bus, and sends the data packet of the first audio data to the second terminal to which the virtual audio device belongs.
[0219] Specifically, the multimedia framework writes the acquisition information of the first audio data into the first cache queue. The acquisition information includes the storage address of the data packet of the first audio data in the preset cache area, the preset reading length of the data packet of the first audio data, and the port number of the virtual audio device.
[0220] The port number of the virtual audio device is a string generated by the first terminal to represent the virtual audio device. For example, the first terminal is a PC, and the two virtual audio devices in the PC are the virtual audio device of the PC and the virtual audio device of the mobile phone 1. According to the time sequence of generating the above two virtual audio devices by the PC, the port number of the virtual audio device of the PC is 01, and the port of the virtual audio device of the mobile phone 1 is 02.
[0221] The virtual device management module in the DMSDP obtains the obtaining information of the first audio data from the first cache queue according to the reading order of the obtaining information in the first cache queue, and parses the obtaining information to obtain the storage address of the data packet of the first audio data in the preset cache area, the preset reading length of the data packet of the first audio data, and the port number of the virtual audio device. Then, the virtual device management module in the DMSDP reads the data of the preset reading length from the preset cache area according to the storage address of the data packet of the first audio data in the preset cache area through the data reading interface of the driver bus, obtains the data packet of the first audio data, and sends the obtained data packet and the port number to the data transmission module in the DMSDP. The data transmission module in the DMSDP sends the data packet of the first audio data to the second terminal to which the virtual audio device represented by the port number belongs.
[0222] For example, referring to Figure 31 In step ①, the target application (i.e. the three-party application / system application) continuously outputs the first audio data and writes the first audio data into the multimedia framework. The multimedia framework encapsulates the written first audio data according to the manner that the audio data of a specified time length is a data packet, to obtain multiple data packets of the first audio data. For example, the audio data of every 20 milliseconds is encapsulated as a data packet, or the audio data of every 10 milliseconds is encapsulated as a data packet.
[0223] Since the multimedia framework and the driver bus belong to different layers, in step ②, the multimedia framework writes the multiple data packets of the first audio data into the preset cache area of the kernel layer through the data writing interface provided by the driver bus, according to the order in which the target application writes the first audio data into the multimedia framework.
[0224] In addition, the multimedia framework also writes the obtaining information of the multiple data packets of the first audio data into the first cache queue. The order of writing the obtaining information into the first cache queue is the same as the order in which the target application writes the first audio data into the multimedia framework, and this order is also the reading order of the virtual device management module in the audio registration application reading the obtaining information from the first cache queue.
[0225] For example, Figure 31 In the example, there are seven data packets of obtaining information, and each data packet is audio data of 20 milliseconds. Specifically, the first data packet is audio data of the first 20 milliseconds, the second data packet is audio data of 20 milliseconds to 40 milliseconds, and so on, and the seventh data packet is audio data of 120 milliseconds to 140 milliseconds. The multimedia framework first writes the obtaining information of the first data packet into the first cache queue, then writes the obtaining information of the second data packet into the first cache queue, and so on, until the target application stops outputting the first audio data.
[0226] In step ③, the virtual device management module in the audio registration application reads the acquisition information from the first cache queue according to the reading order of the acquisition information in the first cache queue, and parses the acquisition information to obtain the storage address of the data packet of the first audio data in the preset cache region, the preset reading length of the data packet of the first audio data, and the port number of the virtual audio device.
[0227] The reading order of the acquisition information in the first cache queue refers to the order in which the acquisition information is written into the first cache queue, that is, the first-in-first-out order of the acquisition information in the cache queue. For example, Figure 31 In step ③, the virtual device management module reads the acquisition information of the first data packet in the first cache queue first, and then reads the acquisition information of the second data packet, and so on, until the acquisition information of all data packets in the first cache queue is read.
[0228] Since the audio registration application and the driver bus belong to different layers, in step ③, the virtual device management module in the audio registration application reads data from the preset cache region according to the storage address of the data packet of the first audio data in the preset cache region through the interface (i.e., the data reading interface) provided by the driver bus for reading data from the preset cache region, and obtains the data packet of the first audio data and the data packet of the first audio data.
[0229] The preset reading length is the length of the data packet in the storage region for storing the data packet. The storage region for storing the data packet and the preset reading length are both preset when the audio data is encapsulated.
[0230] In step ④, the virtual device management module sends the obtained data packet and the port number of the virtual audio device to the data transmission module. Then, the data transmission module sends the data packet of the first audio data to the second terminal to which the virtual audio device belongs according to the port number of the virtual audio device. Figure 31 In step ③, the interaction between the service management module and the virtual device management module can be referred to the introduction of Figure 5 .
[0231] Referring to Table 2, Table 2 is a data packet encapsulation format table provided by an embodiment of the present application.
[0232] Table 2
[0233]
[0234] The Result represents an interface through which the multimedia framework of the application layer writes data to the preset cache area through the driver bus, and an interface through which the virtual device management module of the application layer reads data from the preset cache area through the driver bus. The Port represents a port number of the inserted device. The DataExlen represents a preset reading length when reading the data packet, and the preset reading length is the total length of the data header and the payload (data body) of the data packet, that is, the length of the data packet in the storage area used for storing the data packet. The Seqnum represents the reading order of the acquisition information of the data packet in the first cache queue. The DataEx represents a storage address of a storage area of the preset cache area used for storing the data packet of the first audio data.
[0235] As can be seen from the above, the scheme provided in the embodiment can realize the ordered sending of the data packet of the first audio data, avoid the out-of-order sending causing the played audio to be out of order, when the first audio data is sent to the second terminal, acquire the data packet of the first audio data according to the acquisition information of the first audio data, and acquire the acquisition information of the first audio data from the first cache queue according to the first-in-first-out reading order. In addition, the acquisition information of the first audio data is acquired from the first cache queue according to the first-in-first-out reading order, and the data packet of the first audio data is acquired according to the acquisition information, which can further avoid the data reading error causing the played audio to be out of order, and improve the user experience.
[0236] Correspondingly, after receiving the first audio data sent by the first terminal, the second terminal controls the target audio device to play the first audio data.
[0237] In some embodiments, referring to Figure 32 , Figure 32 A flowchart of playing audio data by a second terminal provided in the embodiment of the application.
[0238] In step ①, the data transmission module in the second terminal sends the first audio data sent by the first terminal to the audio playing module. In step ②, the audio playing module writes the first audio data to the audio framework. In steps ③ and ④, the audio framework calls the audio driver of the HAL to write the first audio data to the ADSP. The first audio data transmitted in the foregoing steps ① to ④ are all data signals. In step ⑤, the ADSP converts the digital signal first audio data into analog signal first audio data, and outputs the analog signal first audio data to the loudspeaker for playing.
[0239] In some embodiments, the method further includes the following step: in the case where the data packet is not read from the preset cache area within a preset time length, disconnecting the audio transmission link with the second terminal.
[0240] Since the second terminal also has audio playing service, if the audio device of the second terminal is occupied by the first terminal for a long time, the audio playing service of the second terminal will be affected. Therefore, if no data packet is read from the preset cache area within the preset time length, it indicates that the first terminal has no audio data to be played, i.e., the audio playing of the first terminal is completed. The first terminal can disconnect the audio transmission link with the second terminal. The audio transmission link between the first terminal and the second terminal is a logical link in the WiFi P2P link established between the first terminal and the second terminal.
[0241] Correspondingly, the second terminal does not need to wait to receive the audio data of the first terminal any more, and can normally perform the audio playing service of the second terminal, so that the audio device of the second terminal is prevented from being occupied by the first terminal for a long time, and the audio playing service of the second terminal is prevented from being affected, thereby improving the user experience.
[0242] The preset time length is set according to actual business requirements, and is greater than a specified time length for encapsulating the audio data into a data packet. For example, when 20 ms of audio data is encapsulated into a data packet, the preset time length can be 10 s.
[0243] In some embodiments, after the virtual audio device is generated, the method can further include the following steps: obtaining, by the distributed device virtualization component, audio playing information of the target audio device of the second terminal. The audio playing information includes a sampling rate, volume information and mute information. The audio playing information is written into the second cache queue through the driver bus. The audio playing information of the virtual audio device is obtained from the second cache queue. Correspondingly, before the first audio data to be played is written into the preset cache area, the method further includes the following steps: processing the audio data output by the target application in the first terminal according to the audio playing information to obtain the first audio data to be played.
[0244] The first terminal obtains the audio playing information of the target audio device of the second terminal at the same time of obtaining the registration information of the target audio device of the second terminal. Correspondingly, after the virtual audio device is generated, the virtual device management module in the audio registration application writes the audio playing information into the second cache queue through the driver bus. The multimedia framework can issue a control message to the driver bus to obtain the audio playing information of the target audio device of the second terminal from the second cache queue through the driver bus. The control message is a setupPacket (setupPacket). The audio playing information includes a sampling rate, volume information (for example, a maximum volume value, a minimum volume value and a current volume value, etc.) and mute information (for example, whether to support mute).
[0245] Further, the multimedia framework can process the audio data output by the target application in the first terminal according to the audio playback information of the audio device of the second terminal to obtain first audio data to be played. For example, when the sampling rate of the audio data output by the target application is inconsistent with the sampling rate of the target audio device of the second terminal, the multimedia framework resamples the audio data output by the target application to obtain the first audio data, and the sampling rate of the first audio data is the sampling rate of the target audio device of the second terminal. Further, the first terminal sends the first audio data to be played to the second terminal.
[0246] As can be seen from the above, the scheme provided in this embodiment processes the audio data output by the target application in the first terminal according to the audio playback information of the audio device of the second terminal, so that the second terminal obtains the first audio data supported by the target audio device for playback, and the first terminal shares the audio device of the second terminal, improves the convenience and efficiency of using the audio device by the user, and further improves the user experience.
[0247] The following will be described in combination with Figure 33 The manner in which the multimedia framework obtains the audio playback information of the audio device of the second terminal from the driver bus is described. Figure 33 A flowchart of an audio device sharing method provided in this embodiment. The method is applied to a first terminal, which is a PC using a Windows operating system. The first terminal includes a DMSDP, a driver (i.e., the driver bus in the foregoing embodiment), a Windows multimedia framework, a third-party application, and a system application.
[0248] The method includes the following steps:
[0249] S3301: The DMSDP writes a device insertion message (carrying a descriptor) into the driver.
[0250] In this step, the DMSDP writes a device insertion message of the audio device of the second terminal into the driver, that is, encapsulates the registration information of the audio device of the second terminal into a descriptor according to the standard format of the operating system of the PC, and writes the descriptor into the driver, that is, writes the descriptor into the second cache queue in the driver layer (kernel layer) through the driver bus.
[0251] S3302: The driver is registered in the framework.
[0252] In this step, the driver registers the audio device of the second terminal to the Windows multimedia framework. That is, the media framework obtains the descriptor of the audio device of the second terminal from the second cache queue, implements the generated virtual audio device, registers the virtual audio device to the Windows multimedia framework, so that the Windows multimedia framework can identify the audio device of the second terminal when the user uses the third-party application / system application, and displays the identifier of the virtual audio device corresponding to the audio device of the second terminal for the user to select.
[0253] S3303: The Windows multimedia framework sends a basic control protocol 1 to the driver to read the sampling rate.
[0254] In this step, the Windows multimedia framework sends a control protocol 1 to the driver to obtain the sampling rate of the audio device of the second terminal, so as to obtain the sampling rate of the audio device of the second terminal.
[0255] S3304: The DMSDP reads the control protocol 1 from the driver.
[0256] In this step, the DMSDP reads the control protocol 1 sent by the Windows multimedia framework from the driver.
[0257] S3305: The driver returns the control protocol 1 to the DMSDP.
[0258] In this step, the DMSDP obtains the control protocol 1 returned by the driver.
[0259] S3306: The DMSDP parses and fills in the sampling rate.
[0260] In this step, the DMSDP parses the control protocol 1 read by the driver, and writes the sampling rate of the audio device of the second terminal to the driver, that is, writes the sampling rate of the audio device of the second terminal to the second cache queue.
[0261] S3307: The driver returns the result to the framework.
[0262] In this step, the Windows multimedia framework reads the sampling rate of the audio device of the second terminal written by the DMSDP from the driver, that is, reads the sampling rate of the audio device of the second terminal from the second cache queue.
[0263] S3308: The Windows multimedia framework sends a basic control protocol 2 to the driver to read the volume value (maximum / minimum / current, etc.).
[0264] In this step, the Windows multimedia framework sends a control protocol 2 to the driver for obtaining the volume information of the audio device of the second terminal, so as to obtain the maximum volume value, the minimum volume value and the current volume value of the audio device of the second terminal.
[0265] S3309: The DMSDP reads the control protocol 2 from the driver.
[0266] In this step, the DMSDP reads the control protocol 2 sent by the Windows multimedia framework from the driver.
[0267] S3310: The driver returns the control protocol 2 to the DMSDP.
[0268] In this step, the DMSDP obtains the control protocol 2 returned by the driver.
[0269] S3311: The DMSDP parses and fills in the volume value.
[0270] In this step, the DMSDP parses the control protocol 2 read by the driver, and writes the volume value of the audio device of the second terminal to the driver, that is, writes the volume value of the audio device of the second terminal to the second cache queue.
[0271] S3312: The driver returns the result to the framework.
[0272] In this step, the Windows multimedia framework reads the volume value of the audio device of the second terminal written by the DMSDP from the driver, that is, reads the volume value of the audio device of the second terminal from the second cache queue.
[0273] S3313: The Windows multimedia framework sends a basic control protocol 3 to the driver to read the mute control information.
[0274] In this step, the Windows multimedia framework sends a control protocol 3 to the driver for obtaining the mute control information, so as to obtain the mute control information. The mute control information refers to the information for obtaining whether the PC supports the mute operation.
[0275] S3314: The DMSDP reads the control protocol 3 from the driver.
[0276] In this step, the DMSDP reads the control protocol 3 sent by the Windows multimedia framework from the driver.
[0277] S3315: The driver returns the control protocol 3 to the DMSDP.
[0278] In this step, the DMSDP obtains the control protocol 3 returned by the driver.
[0279] S3316: The DMSDP parses and fills in the mute control information.
[0280] In this step, the DMSDP parses the control protocol 3 read by the driver and writes the mute control information of the audio device of the second terminal into the driver. That is, the information whether the PC supports the mute operation is written into the driver, that is, the mute control information of the audio device of the second terminal is written into the second cache queue. When the PC supports the mute, the user can use the mute function. When the PC does not support the mute, the user cannot use the mute function.
[0281] The control protocol 1, the control protocol 2 and the control protocol 3 are control transfer protocols in the audio data interface (USB Audio Class, UAC) protocol, which are used to transfer the parameters of the audio device. The control protocol 1, the control protocol 2 and the control protocol 3 differ in that the contents written in the field for obtaining information are different. The control protocol 1 writes the sampling rate in the field for obtaining information; the control protocol 2 writes the volume value in the field for obtaining information; and the control protocol 3 writes the mute control information in the field for obtaining information.
[0282] S3317: The driver returns the result to the framework.
[0283] In this step, the Windows multimedia framework reads the mute control information of the audio device of the second terminal written by the DMSDP of the driver read, that is, reads the mute control information of the audio device of the second terminal from the second cache queue.
[0284] In the embodiments of the present application, the execution order of the above-mentioned steps of obtaining the sampling rate (i.e., steps S3303 to S3307), obtaining the volume value (i.e., steps S3308 to S3312), and obtaining the mute control information (i.e., steps S3313 to S3317) is not limited, for example, the step of obtaining the sampling rate can be performed first, then the step of obtaining the volume value is performed, and then the step of obtaining the mute control information is performed. Alternatively, the step of obtaining the volume value can be performed first, then the step of obtaining the sampling rate is performed, and then the step of obtaining the mute control information is performed, and the like.
[0285] S3318: The third-party application writes data to the Windows multimedia framework.
[0286] In this step, when the user uses the third-party application, the third-party application writes the output audio data (i.e., the first audio data) to the Windows multimedia framework.
[0287] S3319: The system application writes data to the Windows multimedia framework.
[0288] In this step, when the user uses the system application, the system application writes the output audio data (i.e., first audio data) to the Windows multimedia framework.
[0289] S3320: The Windows multimedia framework writes data queues of the driver.
[0290] In this step, the Windows multimedia framework writes the data packet obtained by encapsulating the first audio data to the preset cache area in the driver, and writes the acquisition information of the data packet to the data queue (i.e., the first cache queue in the foregoing embodiment).
[0291] S3321: The DMSDP reads data according to the port and applies for memory area in advance.
[0292] In this step, the DMSDP reads the acquisition information of the data packet of the first audio data from the data queue in the driver, and reads the data packet of the first audio data according to the acquisition information. The memory applied in advance refers to the storage area (i.e., the preset cache area) for caching the data packet of the first audio data in the driver.
[0293] S3322: The driver returns the read data to the DMSDP.
[0294] In this step, the DMSDP obtains the data packet of the first audio data returned by the driver.
[0295] S3323: The DMSDP performs data analysis and time control (first packet data opens the data channel).
[0296] In this step, the DMSDP analyzes the acquisition information obtained to obtain the port number of the virtual audio device, and sends the data packet of the first audio data to the second terminal represented by the port number. The first packet opens the data channel, which means that when the first data packet is obtained, an audio data transmission link is established with the second terminal, and subsequent audio data is sent to the second terminal through the audio data transmission link.
[0297] S3324: The DMSDP disconnects the data channel when there is no data within 10 seconds.
[0298] In this step, the DMSDP does not read the data packet within 10 seconds, indicating that the three-party application / target application stops outputting data and disconnects the data channel, i.e., disconnects the audio transmission link with the second terminal.
[0299] It can be seen from the above that the method provided in the embodiment can realize that the first terminal shares the audio device of the second terminal, improves the convenience and efficiency of the user in using the audio device, and further improves the user experience.
[0300] In some embodiments, the method can further include the following steps: displaying a third interface; wherein the third interface includes a mute control option. In response to a mute operation of the user on the mute control option, the second audio data is generated. The second audio data is sent to the second terminal to enable the second terminal to control the target audio device to play the second audio data.
[0301] The third interface can be an interface displayed by the first terminal after the user selects the target audio device. The mute operation of the user on the mute control option can be a click operation.
[0302] When the user performs the mute operation on the mute control option, it can be determined that the user needs to mute the playing, and the first terminal generates the second audio data. For example, the first audio data is all set to 0 to obtain the second audio data. Further, the first terminal sends the second audio data to the second terminal. Correspondingly, the second terminal controls the target audio device to play the second audio data, meets the mute playing demand of the user, and improves the user experience. Moreover, the first terminal sends the second audio data after muting to the second terminal, so that the virtual device management module can obtain the audio data output by the target application, avoids the case that the first terminal disconnects the audio transmission link with the second terminal due to the fact that the virtual device management module has not obtained the audio data output by the target application for a long time, and avoids the case that the user cannot use the target audio device of the second terminal to play sound after canceling the mute, thereby improving the user experience.
[0303] Referring to Figure 34 , Figure 34 A third interface provided in an embodiment of the present application is shown in FIG. 34. The third interface includes a mute control option 3401. As shown in FIG. 34, the user performs a click operation on the mute control option. In response to the click operation of the user on the mute control option 3401, the first terminal displays the interface shown in FIG. 35. Figure 35 Figure 36
[0304] It can be seen from the above that the method provided in the embodiment can realize that the first terminal shares the audio device of the second terminal, improves the convenience and efficiency of the user in using the audio device, and further improves the user experience.
[0305] In some embodiments, the first terminal performs audio interaction service with the third terminal. Accordingly, the method can further include the steps of: receiving third audio data sent by the second terminal, and sending the third audio data to the third terminal. The third audio data is response data of the first audio data obtained by the second terminal controlling the target audio device.
[0306] The third terminal is a communication terminal used by a user when using a target application in the first terminal. For example, when the user uses an instant messaging application in the first terminal to perform voice call with other users, the third terminal is a communication terminal used by the user performing voice call with the user. When the user uses a conference application in the first terminal to perform conference with other users, the third terminal is a communication terminal used by the user performing conference with the user.
[0307] After determining the target audio device of the second terminal, the second terminal obtains voice uttered by the user to obtain response data (i.e. third audio data) of the first audio data, and sends the third audio data to the first terminal. Then, after receiving the third audio data sent by the second terminal, the first terminal sends the third audio data to the third terminal, so as to realize communication between the first terminal and the third terminal when the first terminal uses the audio device of the second terminal, meet the user demand, and improve the user experience.
[0308] Referring to Figure 37 , Figure 37 A flowchart of an audio device sharing method provided by the embodiments of the present application is shown. The first terminal is a PC, and the second terminal is a mobile phone. In step ①, the DMSDP in the PC obtains the speaker capability of the mobile phone, i.e. obtains the registration information of the audio device of the mobile phone. The service management module sends the registration information of the mobile phone to the virtual device management module.
[0309] In steps ② and ③, the virtual device management module sends an insertion message to the virtual bus (i.e. the driver bus in the foregoing embodiments), and the insertion message carries the registration information of the audio device of the mobile phone. That is, the virtual device management module encapsulates the registration information into a string with a specified length according to the standard format of the Windows operating system of the PC, to obtain the descriptor of the audio device of the mobile phone. The virtual device management module writes the descriptor into the second cache queue in the kernel layer through the device registration interface provided by the virtual bus, to generate a virtual speaker device (i.e. a virtual audio device) in the kernel layer of the PC.
[0310] In step 4, after generating the virtual Speaker device, the virtual bus notifies the Windows multimedia framework of the system layer to register the virtual Speaker device in the Windows multimedia framework, that is, the Windows multimedia framework obtains the descriptor of the audio device of the mobile phone from the second cache queue. Further, in step 5, when the user uses the third-party application installed in the PC, the PC can display the audio device identifier of the virtual Speaker device.
[0311] In step 6, when it is detected that the user selects the audio device identifier of the virtual Speaker device of the mobile phone, the audio data (i.e., the first audio data) output by the third-party application is written to the Windows multimedia framework. In steps 7 and 8, the Windows multimedia framework writes the data packet of the first audio data to the preset cache area of the kernel layer and writes the acquisition information containing the port number of the virtual Speaker device to the first cache queue.
[0312] In step 9, the virtual device management module reads the acquisition information of the data packet of the first audio data from the first cache queue and reads the data packet of the first audio data from the preset cache area according to the acquisition information. Then, the virtual device management module sends the acquired data packet and the port number of the virtual Speaker device to the data transmission module. Further, the data transmission module sends the data packet of the first audio data to the mobile phone to which the virtual audio device belongs according to the port number of the virtual audio device. The processing manner of the mobile phone after receiving the first audio data sent by the PC is described in detail in the foregoing. Figure 32
[0313] As can be seen from the above, the technical solution provided by the embodiment can realize the PC sharing the audio device of the mobile phone, improve the convenience and efficiency of the user using the audio device, and further improve the user experience.
[0314] Referring to Figure 38 , Figure 38 is a flowchart of an audio device sharing method provided by the embodiment of the present application. The first terminal is a PC, and the second terminal is a mobile phone. In step 1, the DMSDP in the PC obtains the speaker capability and parameters of the opposite terminal (i.e., the mobile phone), that is, obtains the registration information of the audio device of the mobile phone.
[0315] In step 2 and step 3, the DMSDP inserts the audio device of the mobile phone into the virtual bus of the PC and creates a virtual speaker device. That is, the DMSDP encapsulates the registration information into a string of a specified length according to the standard format of the Windows operating system of the PC to obtain a descriptor of the audio device of the mobile phone. The virtual device management module writes the descriptor into the second cache queue through a device registration interface provided by the virtual bus to realize generation of the virtual speaker device (i.e., the virtual audio device) in the virtual bus of the PC. The Windows multimedia framework obtains the descriptor of the audio device of the mobile phone from the second cache queue to realize registration of the virtual speaker device in the Windows multimedia framework.
[0316] In step 4, when the user uses the third-party application installed in the PC, the audio data output by the third-party application is written into the Windows multimedia framework. The Windows multimedia framework writes the data packet of the first audio data into a preset cache area in the kernel layer and writes the acquisition information containing the port number of the virtual speaker device into the first cache queue.
[0317] In step 5, the DMSDP reads the acquisition information of the data packet of the first audio data from the first cache queue and reads the data packet of the first audio data from the preset cache area according to the acquisition information. The DMSDP sends the data packet of the first audio data to the mobile phone to which the target audio device represented by the port number belongs according to the port number of the virtual audio device. After receiving the first audio data sent by the first terminal, the mobile phone controls the loudspeaker to play the first audio data.
[0318] As can be seen from the above, the method provided in the embodiment can realize sharing of the audio device of the mobile phone by the PC, improve the convenience and efficiency of the user in using the audio device, and further improve the user experience.
[0319] In some embodiments, the user can simultaneously use multiple applications installed in the first terminal, and if multiple virtual audio devices are registered in the driver bus of the first terminal, the user can select different audio devices for different applications.
[0320] Referring to Figure 39 , Figure 39 A flowchart of an audio device sharing method provided in the embodiment of the application is shown in FIG. 13. The method is applied to a first terminal, and can include the following steps.
[0321] S3901: display a first interface.
[0322] The first interface includes a first display window of a first application and a second display window of a second application.
[0323] S3902: In response to the selection operation of the audio device identifier in the first display window, determine the terminal to which the selected audio device identifier corresponds, and obtain the second terminal corresponding to the first application.
[0324] S3903: In response to the selection operation of the audio device identifier in the second display window, determine the terminal to which the selected audio device identifier corresponds, and obtain the second terminal corresponding to the second application.
[0325] S3904: Send the audio data to be played by the first application to the second terminal corresponding to the first application, so that the second terminal corresponding to the first application controls the audio device to play the audio data to be played by the first application.
[0326] S3905: Send the audio data to be played by the second application to the second terminal corresponding to the second application, so that the second terminal corresponding to the second application controls the audio device to play the audio data to be played by the second application.
[0327] As can be seen from the above, the technical scheme provided by the embodiment can realize the sharing of the audio device of the second terminal by the first terminal, improve the convenience and efficiency of the user using the audio device, and further improve the user experience. Moreover, without using the application connection capability, the virtualization capability of the audio device of the other terminal is directly called to realize the calling of the audio device of the second terminal by the first terminal to play sound, and the user experience is improved.
[0328] In the embodiment of the application, the execution order of the above steps S3902 and S3903 is not limited, the first terminal can execute step S3902 first and then execute step S3903, or execute step S3903 first and then execute step S3902. Similarly, the execution order of the above steps S3904 and S3905 is not limited, the first terminal can execute step S3904 first and then execute step S3905, or execute step S3905 first and then execute step S3904.
[0329] The implementation manner of the above steps S3902 and S3903 is the same as that of step S602 in Figure 6 The implementation manner of the above steps S3904 and S3905 is the same as that of step S603 in Figure 6 The implementation manner of the above steps S3904 and S3905 is the same as that of step S603 in
[0330] The first display window and the second display window include the audio identifier of the audio device of the other terminal allowed to be called by the first terminal. The first terminal generates a virtual audio device corresponding to the audio device of the other terminal. The generation manner of the virtual audio device can be referred to the related introduction of the foregoing embodiments.
[0331] The following example illustrates how users can select different audio devices for different applications.
[0332] The first terminal is a PC, on which a music application (the first application) and a conferencing application (the second application) are installed. When the user uses both the music application and the conferencing application simultaneously, the PC displays... Figure 40 The interface shown includes a first display window 4002 for a music application, which contains settings options 4003. The interface also includes a second display window 4001 for a conferencing application, which contains audio control options 4004.
[0333] When a user configures the audio device for a music application, they can click on settings option 4003 in the first display window 4002. Correspondingly, the PC displays [the relevant information] in the first display window 4002. Figure 41 The settings interface shown. The settings interface contains playback option 4101.
[0334] When the user clicks the play option 4101, the PC displays the first display window 4002. Figure 42 The second interface is shown. This second interface includes audio control option 4201. The user clicks on audio control option 4201. In response to the user's click on audio control option 4201, the PC displays... Figure 43 The first interface is shown. The first display window 4002 in the first interface includes a list of available speakers 4301, which includes the audio device identifier 4302 of the PC, the audio device identifier 4303 of mobile phone 1, and the audio device identifier 4304 of mobile phone 2. Furthermore, the audio device currently playing sound on the PC is the PC's own system speakers.
[0335] The user clicks on the audio device identifier 4303 (i.e., mobile phone 1) in the list of available speakers 4301. The PC can then determine that the user has selected the speaker of mobile phone 1 as the speaker for playing sound in the music application and display... Figure 44 The interface shown indicates that you have now completed the setup of the audio device for playing sound in your music application.
[0336] When a user configures the audio device for the conferencing application, they can click on the audio control option 4004 in the second display window 4001. Correspondingly, the PC displays [the relevant information] in the second display window 4002. Figure 45The first interface shown. The first interface includes a list of available microphones 4502 in the second display window 4001, and a list of available speakers 4501. The list of available microphones 4502 includes an audio device identifier 4503 of the PC (i.e., the system microphone), an audio device identifier 4504 of the mobile phone 1 (i.e., the mobile phone 1), and an audio device identifier 4505 of the mobile phone 2 (i.e., the mobile phone 2). The list of available speakers 4501 includes an audio device identifier 4506 of the PC (i.e., the system microphone), an audio device identifier 4507 of the mobile phone 1 (i.e., the mobile phone 1), and an audio device identifier 4508 of the mobile phone 2 (i.e., the mobile phone 2). Moreover, the PC currently plays sound using the system speaker of the PC, and the PC currently receives sound using the system microphone of the PC.
[0337] The user clicks the audio device identifier 4505 (i.e., the mobile phone 2) in the list of available microphones 4502, and the PC determines that the user selects the microphone of the mobile phone 2 as the microphone for the conference application to receive sound; and the user clicks the audio device identifier 4508 (i.e., the mobile phone 2) in the list of available speakers 4501, and the PC can determine that the user selects the speaker of the mobile phone 2 as the speaker for the conference application to play sound. Then, the PC displays Figure 46 the interface shown.
[0338] In the above example, the order in which the user selects the audio devices for the music application and the conference application is not limited. For example, the user can first select the audio device for the music application in the manner of Figures 41 to 44 , and then select the audio device for the conference application in the manner of Figures 45 to 46 . Alternatively, the user can first select the audio device for the conference application in the manner of Figures 45 to 46 , and then select the audio device for the music application in the manner of Figures 41 to 44 .
[0339] In some embodiments, if the user selects the same audio device for multiple applications, for example, the user selects the audio device of the mobile phone 1 for both the music application and the conference application in the above example. In this case, to avoid interference caused by multiple applications playing different sounds, affecting the user experience, the PC can display a prompt window to remind the user that multiple applications currently use the same audio device. Further, the user can select different audio devices for different applications, to avoid the interference caused by multiple applications playing different sounds using the same audio device, and improve the user experience.
[0340] In specific implementations, the present disclosure also provides a terminal, which includes one or more processors and a memory; the memory is coupled to the one or more processors, and the memory is configured to store computer program code including computer instructions; the one or more processors invoke the computer instructions to cause the terminal to perform part or all of the steps in the above method embodiments.
[0341] The application further provides a computer readable storage medium comprising a computer program, which, when executed on a terminal, causes the terminal to perform some or all of the steps in the above method embodiments. The storage medium described above can be a magnetic disc, an optical disc, a Read-Only Memory (ROM) or a Random Access Memory (RAM), etc.
[0342] In a specific implementation, the application further provides a computer program product comprising executable instructions, which, when executed on a terminal, cause the terminal to perform some or all of the steps in the above method embodiments.
[0343] As shown in Figure 47 The application further provides a chip system applied to a terminal, which comprises one or more processors 4701 configured to invoke computer instructions to cause the terminal to input data to be processed into the chip system, and output a processing result after processing the data by the audio device sharing method provided by the embodiments of the application.
[0344] In a possible implementation, the chip system further comprises an input and output interface configured to input and output data.
[0345] Embodiments of the mechanisms disclosed herein can be implemented in hardware, software, firmware, or any combination thereof. Embodiments of the application can be implemented as computer programs or program code on programmable systems that include at least one processor, a storage system (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device.
[0346] Program code can be applied to input instructions to perform the functions described and generate output information. The output information can be applied to one or more output devices in known ways. For purposes of this application, a processing system includes any system that has a processor, such as a Digital Signal Processor (DSP), a microcontroller, an Application Specific Integrated Circuit (ASIC), or a microprocessor.
[0347] Program code can be implemented in a high level procedural or object oriented programming language to communicate with a processing system. In the alternative, the program code can be implemented in assembly or machine language, if desired. In fact, the mechanisms described herein are not limited in scope to any particular programming language. In any case, the language can be a compiled or interpreted language.
[0348] In some cases, the disclosed embodiments can be implemented in hardware, firmware, software, or any combination thereof. The disclosed embodiments can also be implemented as instructions carried by or stored on one or more transitory or non-transitory machine- readable (e.g., computer-readable) media, which can be read and executed by one or more processors. For example, the instructions can be distributed over the network or by other computer readable media. Thus, a machine-readable medium can include any mechanism for storing or transmitting information in a form readable by a machine (e.g., a computer), including without limitation, a floppy disk, an optical disc, an optical disc read only memory (CD-ROM), a magnetic disk read only memory (DVD-ROM), a read only memory (ROM), a random access memory (RAM), an erasable programmable read only memory (EPROM), an electrically erasable programmable read only memory (EEPROM), a magnetic or optical card, a flash memory, or a tangible, machine-readable storage used in the transmission of information over the Internet using electrical, optical, acoustical or other forms of propagated signals (e.g., carrier waves, infrared signals, digital signals, etc.). Accordingly, the machine-readable medium includes any type of mechanical or tangible implementation that is adapted to store, communicate, or transmit information in a form readable by a machine (e.g., a computer).
[0349] In the drawings, some of the structural or methodological features can be shown in particular arrangements and / or orders. However, it should be appreciated that such particular arrangements and / or orders can not be required. Instead, in some embodiments, the features can be arranged differently than as shown in the figures. Also, inclusion of a structural or methodological feature in a particular figure does not imply that the feature is required in all embodiments, and the features can be excluded or combined in some embodiments.
[0350] It should be noted that each unit / module mentioned in each device embodiment of the present application is a logical unit / module, and in physical, one logical unit / module can be a physical unit / module, or a part of a physical unit / module, or be realized in a combination of multiple physical unit / modules, and the physical realization of these logical units / modules is not the most important, and the combination of functions implemented by these logical units / modules is the key to solving the technical problems proposed in the present application. In addition, in order to highlight the innovative part of the present application, the above-mentioned device embodiments of the present application do not introduce the units / modules which are not closely related to solving the technical problems proposed in the present application, which does not mean that the above-mentioned device embodiments do not have other units / modules.
[0351] It should be noted that in the examples and descriptions of the present patent, the relationship terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between the entities or operations. Moreover, the terms "include", "contain" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, article or device. Without more limitations, the element defined by the statement "including one" does not exclude the presence of other identical elements in the process, method, article or device including the element.
[0352] Although the present application has been illustrated and described with reference to certain preferred embodiments thereof, it should be understood by those skilled in the art that various changes in form and details can be made therein without departing from the spirit and scope of the present application.
Claims
1. An audio device sharing method, characterized by, The method is applied to a first terminal; the method comprises: displaying a first interface; wherein the first interface comprises audio device identifiers of virtual audio devices allowed to be invoked by the first terminal; the virtual audio devices represent audio devices of other terminals allowed to be invoked by the first terminal; the first terminal is different from operating systems of the other terminals; in response to a selection operation of a user on an audio device identifier, determining a virtual audio device corresponding to the selected audio device identifier; writing first audio data to be played into a preset cache area; wherein the first audio data is output by a target application in the first terminal; sending the first audio data in the preset cache area to a second terminal to which the virtual audio device belongs, so that the second terminal controls a target audio device to play the first audio data.
2. The method of claim 1, wherein, The writing of the first audio data to be played into the preset cache area comprises: writing a data packet of the first audio data to be played into the preset cache area through a data writing interface of a driver bus; The sending of the first audio data in the preset cache area to the second terminal to which the virtual audio device belongs comprises: reading the data packet of the first audio data from the preset cache area by using a data reading interface of the driver bus through a distributed device virtualization component; and sending the data packet of the first audio data to the second terminal to which the virtual audio device belongs; wherein the distributed device virtualization component is an application that provides virtualization audio capabilities of audio devices of the other terminals allowed to be invoked by the first terminal.
3. The method of claim 2, wherein, After the writing of the data packet of the first audio data to be played into the preset cache area through the data writing interface of the driver bus, the method further comprises: writing acquisition information of the first audio data into a first cache queue; wherein the acquisition information contains a storage address of the data packet of the first audio data in the preset cache area, a preset reading length of the data packet of the first audio data, and a port number of the virtual audio device; acquiring the acquisition information of the first audio data from the first cache queue in a reading order of the acquisition information in the first cache queue through the distributed device virtualization component; and analyzing the acquisition information to obtain the storage address of the data packet of the first audio data in the preset cache area, the preset reading length of the data packet of the first audio data, and the port number of the virtual audio device; The reading of the data packet of the first audio data from the preset cache area by using the data reading interface of the driver bus through the distributed device virtualization component; and the sending of the data packet of the first audio data to the second terminal to which the virtual audio device belongs, comprises: The distributed device virtualization component reads the data of the preset reading length from the preset cache area according to the storage address of the data packet of the first audio data in the preset cache area by using the data reading interface of the drive bus, and obtains the data packet of the first audio data.
4. The method of claim 2, wherein, After the distributed device virtualization component reads the data packet of the first audio data from the preset cache area by using the data reading interface of the drive bus, the method further comprises: In the case that no data packet is read from the preset cache area within a preset time length, the audio transmission link with the second terminal is disconnected.
5. The method of claim 1, wherein, Before the first interface is displayed, the method further comprises: Obtaining registration information of a target audio device of the second terminal; wherein the registration information comprises at least one of the following: the name of the second terminal, the ID of the second terminal, and the audio parameter of the target audio device of the second terminal; Generating a virtual audio device of the target audio device of the second terminal according to the registration information.
6. The method of claim 5, wherein, The generating of the virtual audio device of the target audio device of the second terminal according to the registration information comprises: The distributed device virtualization component encapsulates the registration information into a string of a specified length according to the standard format of the operating system of the first terminal, and obtains a descriptor of the target audio device of the second terminal; and the generated descriptor is written into a second cache queue through the drive bus; The descriptor is obtained from the second cache queue to obtain a virtual audio device.
7. The method of claim 6, wherein, After the descriptor is obtained from the second cache queue to obtain a virtual audio device, the method further comprises: The distributed device virtualization component obtains audio playback information of the target audio device of the second terminal; wherein the audio playback information comprises: sampling rate, volume information and mute information; and the audio playback information is written into the second cache queue through the drive bus; The audio playback information of the virtual audio device is obtained from the second cache queue; Before the first audio data to be played is written into the preset cache area, the method further comprises: The audio data output by the target application in the first terminal is processed according to the audio playback information to obtain the first audio data to be played.
8. The method of claim 1, wherein, Before the first interface is displayed, the method further comprises: Displaying a second interface; wherein the second interface comprises an audio control option; In response to the triggering operation of the user on the audio control option, obtaining the audio device identifier of the virtual audio device of the other terminal allowed to be called by the first terminal; The display of the first interface comprises: Displaying the first interface comprising the audio device identifier of the virtual audio device of the other terminal allowed to be called by the first terminal.
9. The method of claim 1, wherein, After the first audio data in the preset cache area is sent to a second terminal to which the virtual audio device belongs, so that the second terminal controls a target audio device to play the first audio data, the method further includes: displaying a third interface, wherein the third interface includes a mute control option; in response to a mute operation of a user on the mute control option, generating second audio data that is muted; sending the second audio data to the second terminal, so that the second terminal controls the target audio device to play the second audio data.
10. The method of claim 1, wherein, The first terminal and a third terminal perform audio service interaction, and the method further includes: receiving third audio data sent by the second terminal and sending the third audio data to the third terminal; wherein the third audio data is response data of the first audio data obtained by the target audio device controlled by the second terminal.
11. A terminal, characterized by comprising: comprise: one or more processors and a memory; the memory is coupled to the one or more processors, and the memory is configured to store computer program code, the computer program code comprising computer instructions, and the one or more processors are configured to invoke the computer instructions to cause the terminal to perform the method of any one of claims 1-10.
12. A computer-readable storage medium, characterized in that, comprise a computer program, which, when executed on a terminal, causes the terminal to perform the method of any one of claims 1-10.
13. A computer program product, characterised in that, the computer program product comprises executable instructions, which, when executed on a terminal, cause the terminal to perform the method of any one of claims 1-10.