Audio playing method, electronic equipment and storage medium
By creating virtual screens and virtual audio devices in Android devices, obtaining audio focus and outputting audio data, the problem that virtual screens cannot play music independently is solved, audio focus separation is achieved, and user experience and audio output quality is improved.
Patent Information
- Application Number
- CN202411021075.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-26
- Publication Date
- 2024-11-22
AI Technical Summary
The audio system of the Android device terminal only supports one playback application at the same time, which makes the virtual screen unable to play music independently or control the progress of the music, causing the audio to interfere with each other and the user experience is poor.
By creating a virtual screen and a virtual audio device, obtaining the audio focus and outputting the audio data to the second electronic device, the audio focus separation is achieved and audio conflicts are avoided.
Provide users with a unified multimedia experience interface, enjoy high-quality audio output without switching between different devices or applications, improving user experience.
Smart Images

Figure CN119002850A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and specifically provides an audio playback method, electronic equipment and storage medium. Background Art
[0002] At present, the audio system of Android device terminals only supports one playback application at the same time. Since Android is a multi-tasking system, the audio system is a competitive resource. Applications comply with the calling mechanism of Android audio focus. Before playing audio, they need to apply for audio focus on the system side. Only applications that apply for audio focus can play audio. Once the audio focus is lost, the playback is paused.
[0003] For screen projection application scenarios, the virtual screen can independently display the application projected to the virtual screen, but the virtual screen does not have an independent audio focus and cannot independently play music or control the progress of music. If the application on the virtual screen requires audio output, but the main device is using the audio focus, the audio on the virtual screen may not play normally, causing the audio of the virtual screen to interfere with the audio of the main screen, resulting in a poor user experience. Summary of the invention
[0004] In order to overcome the above defects, the present application is proposed to provide a solution or at least partially solve the technical problem that the existing devices cannot achieve audio focus separation, resulting in poor user experience. The present application provides an audio playback method, an electronic device and a storage medium.
[0005] In a first aspect, the present application provides an audio playback method, applied to a first electronic device, the method comprising:
[0006] receiving a first operation of a user, and creating a virtual screen in response to the first operation, wherein the virtual screen is used to display content of a target application on the first electronic device;
[0007] Creating a virtual audio device corresponding to the virtual screen based on a virtual audio configuration file;
[0008] In response to a second operation of the user, the target application acquires audio focus;
[0009] The audio data is output to a second electronic device for playing based on the audio focus, the audio data is obtained from the virtual audio device, and the second electronic device is communicatively connected with the first electronic device.
[0010] In a specific implementation of the present application, the step of creating a virtual audio device based on a virtual audio configuration file includes:
[0011] Acquiring attribute information of the second electronic device;
[0012] Acquire virtual audio device information from the virtual audio configuration file based on the attribute information;
[0013] The virtual audio device corresponding to the virtual screen is created based on the virtual audio device information.
[0014] In a specific implementation of the present application, the step of creating the virtual audio device corresponding to the virtual screen based on the virtual audio device information includes:
[0015] Acquire a first identifier and a second identifier, wherein the first identifier is a device identifier of a virtual audio device, and the second identifier is a screen identifier of a virtual screen;
[0016] The virtual screen and the virtual audio device are bound based on the first identifier and the second identifier to create the virtual audio device corresponding to the virtual screen.
[0017] In a specific implementation of the present application, the target application obtains the audio focus, including:
[0018] Obtaining an audio focus application request, wherein the audio focus application request includes an identity of the target application;
[0019] Determining a location of focus information of the target application based on the identity identifier;
[0020] The audio focus is acquired based on the position of the focus information.
[0021] In a specific implementation of the present application, obtaining the audio focus based on the position of the focus information includes:
[0022] When the focus information of the target application is located in the first focus stack, in response to the audio focus application request, placing the focus information at the top of the first focus stack to obtain the audio focus;
[0023] When the focus information of the target application is located in the second focus stack, in response to the audio focus application request, the focus information is moved from the second focus stack to the first focus stack, and the focus information is placed on the top of the first focus stack to obtain the audio focus.
[0024] In a specific implementation of the present application, the virtual audio device information includes channel configuration information; the method further includes:
[0025] A multi-channel virtual audio device is created based on the virtual audio device information.
[0026] In a specific implementation of the present application, the virtual audio configuration file includes multiple virtual audio device information; the method further includes:
[0027] A plurality of virtual audio devices are created based on the plurality of virtual audio device information.
[0028] In a specific implementation of the present application, the electronic device includes a screen projection module; and the step of outputting the audio data to a second electronic device for playback based on the audio focus includes:
[0029] The virtual audio device acquires audio data based on the audio focus;
[0030] The virtual audio device outputs the audio data to the screen projection module;
[0031] The screen projection module outputs the audio data to the second electronic device.
[0032] In a specific implementation of the present application, the electronic device includes an audio management module, and the audio management module creates a virtual audio device instance through the following steps: Obtaining the virtual audio configuration file;
[0033] The virtual audio device instance is created based on the virtual audio configuration file.
[0034] In a second aspect, an electronic device is provided, comprising:
[0035] Display screen;
[0036] at least one processor;
[0037] and, a memory communicatively coupled to the at least one processor;
[0038] Wherein, a computer program is stored in the memory, and the computer program is the aforementioned audio playing method when executed by the at least one processor.
[0039] In a third aspect, a computer-readable storage medium is provided, wherein a plurality of program codes are stored in the computer-readable storage medium, wherein the program codes are suitable for being loaded and run by a processor to execute any of the aforementioned audio playback methods.
[0040] Solution 1. An audio playback method, characterized in that it is applied to a first electronic device, and the method includes: receiving a first operation of a user, creating a virtual screen in response to the first operation, and the virtual screen is used to display the content of a target application on the first electronic device; creating a virtual audio device corresponding to the virtual screen based on a virtual audio configuration file; in response to a second operation of the user, the target application obtains an audio focus; based on the audio focus, outputting audio data to a second electronic device for playback, the audio data being obtained from the virtual audio device, and the second electronic device is communicatively connected to the first electronic device.
[0041] Solution 2. The audio playback method according to Solution 1 is characterized in that creating a virtual audio device based on a virtual audio configuration file includes: obtaining attribute information of the second electronic device; obtaining virtual audio device information from the virtual audio configuration file based on the attribute information; and creating the virtual audio device corresponding to the virtual screen based on the virtual audio device information.
[0042] Solution 3. The audio playback method according to Solution 2 is characterized in that creating the virtual audio device corresponding to the virtual screen based on the virtual audio device information includes: obtaining a first identifier and a second identifier, wherein the first identifier is the device identifier of the virtual audio device, and the second identifier is the screen identifier of the virtual screen; binding the virtual screen and the virtual audio device based on the first identifier and the second identifier to create the virtual audio device corresponding to the virtual screen.
[0043] Solution 4. The audio playback method according to Solution 2 is characterized in that the target application obtains the audio focus, including: obtaining an audio focus application request, the audio focus application request including the identity of the target application; determining the position of the focus information of the target application based on the identity; and obtaining the audio focus based on the position of the focus information.
[0044] Solution 5. The audio playback method according to Solution 4 is characterized in that obtaining the audio focus based on the position of the focus information comprises:
[0045] When the focus information of the target application is located in the first focus stack, the focus information is placed at the top of the first focus stack in response to the audio focus application request to obtain the audio focus; when the focus information of the target application is located in the second focus stack, the focus information is moved from the second focus stack to the first focus stack in response to the audio focus application request, and the focus information is placed at the top of the first focus stack to obtain the audio focus.
[0046] Solution 6. The audio playback method according to Solution 2 is characterized in that the virtual audio device information includes channel configuration information; the method also includes: creating a multi-channel virtual audio device based on the virtual audio device information.
[0047] Solution 7. The audio playback method according to Solution 2 is characterized in that the virtual audio configuration file includes multiple virtual audio device information; the method also includes: creating multiple virtual audio devices based on the multiple virtual audio device information.
[0048] Solution 8. The audio playback method according to Solution 1 is characterized in that the electronic device includes a screen projection module; the outputting of audio data to a second electronic device for playback based on the audio focus comprises: the virtual audio device obtains audio data based on the audio focus; the virtual audio device outputs the audio data to the screen projection module; the screen projection module outputs the audio data to the second electronic device.
[0049] Solution 9. The audio playback method according to Solution 3 is characterized in that the electronic device includes an audio management module, and the audio management module creates a virtual audio device instance through the following steps: obtaining the virtual audio configuration file; and creating the virtual audio device instance based on the virtual audio configuration file.
[0050] Scheme 10. An electronic device, characterized in that it comprises: a display screen; at least one processor; and a memory communicatively connected to the at least one processor; wherein a computer program is stored in the memory, and when the computer program is executed by the at least one processor, the audio playback method described in any one of Schemes 1 to 9 is implemented.
[0051] Solution 11. A computer-readable storage medium storing a plurality of program codes, wherein the program codes are suitable for being loaded and run by a processor to execute the audio playback method described in any one of Solutions 1 to 9.
[0052] The above one or more technical solutions of the present application have at least one or more of the following beneficial effects:
[0053] The audio playback method provided in the present application includes: receiving a first operation of a user, creating a virtual screen in response to the first operation, the virtual screen is used to display the content of a target application on a first electronic device; creating a virtual audio device corresponding to the virtual screen based on a virtual audio configuration file; in response to a second operation of the user, the target application obtains an audio focus; based on the audio focus, the audio data is output to a second electronic device for playback, the audio data is obtained from the virtual audio device, and the second electronic device is communicatively connected to the first electronic device. By creating a virtual screen and a virtual audio device corresponding to the virtual screen, a unified multimedia experience interface can be provided to the user, while enjoying high-quality audio output without switching between different devices or applications. At the same time, by obtaining the audio focus, the audio focus separation in a multi-tasking or multi-application environment is achieved, audio conflicts are avoided, and the user experience is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] The disclosure of the present application will become more easily understood with reference to the accompanying drawings. It is easy for those skilled in the art to understand that these drawings are only for illustrative purposes and are not intended to limit the scope of protection of the present application. In addition, similar numbers in the drawings are used to represent similar components, among which:
[0055] Figure 1 This is a schematic diagram of the main process of the audio playback method in one embodiment of the present application;
[0056] Figure 2 is a schematic diagram of the structure of a first electronic device in an embodiment of the present application;
[0057] Figure 3 This is a schematic diagram of the software structure of a first electronic device in an embodiment of the present application;
[0058] Figure 4 is a schematic diagram of a virtual audio configuration file in one embodiment of the present application;
[0059] Figure 5 is a schematic diagram of creating a multi-channel virtual audio device in one embodiment of the present application;
[0060] Figure 6 is a schematic diagram of creating multiple virtual audio devices in one embodiment of the present application;
[0061] Figure 7 is a complete schematic diagram of an audio playback method in one embodiment of the present application;
[0062] Figure 8 is a complete schematic diagram of an audio playback method in another embodiment of the present application;
[0063] Fig. 9 This is a schematic diagram of a process of applying for audio focus by a first application in one embodiment of the present application;
[0064] Fig.10 is a schematic diagram of a process of a second application giving up audio focus in one embodiment of the present application;
[0065] Fig.11 is a schematic diagram of audio focus processing when the playback position of the first application changes in one embodiment of the present application;
[0066] Fig.12 is a schematic diagram of the main structure of an audio playback device according to an embodiment of the present application;
[0067] Fig.13 It is a schematic diagram of an electronic device in one embodiment of the present application. DETAILED DESCRIPTION
[0068] Some embodiments of the present application are described below with reference to the accompanying drawings. Those skilled in the art should understand that these embodiments are only used to explain the technical principles of the present application and are not intended to limit the protection scope of the present application.
[0069] In the description of the present application, "module" and "processor" may include hardware, software or a combination of the two. A module may include hardware circuits, various suitable sensors, communication ports, memory, and may also include software parts, such as program code, or a combination of software and hardware. The processor may be a central processing unit, a microprocessor, an image processor, a digital signal processor or any other suitable processor. The processor has data and / or signal processing functions. The processor may be implemented in software, hardware or a combination of the two. Non-temporary computer-readable storage media include any suitable medium that can store program code, such as a disk, a hard disk, an optical disk, a flash memory, a read-only memory, a random access memory, etc. The term "A and / or B" means all possible combinations of A and B, such as only A, only B or A and B. The term "at least one A or B" or "at least one of A and B" has a similar meaning to "A and / or B" and may include only A, only B or A and B. The singular terms "one" and "the" may also include plural forms.
[0070] In current electronic devices, the virtual screen can independently display applications, but the virtual screen does not have an independent audio focus, and cannot independently play music or control the progress of music. If the application on the virtual screen requires audio output, but the main device is using the audio focus, the audio on the virtual screen may not play properly, causing the audio of the virtual screen to interfere with the audio of the main screen, resulting in a poor user experience.
[0071] To this end, the present application provides an audio playback method, an electronic device and a storage medium.
[0072] The audio playback method of the present application can be applied to a first electronic device. The first electronic device includes a display screen, which is a physical screen for input and display of the first electronic device, and allows the user to control the first electronic device by displaying icons, buttons and menus on the screen. The display screen can be operated using a finger or a special touch pen, which is usually composed of a transparent capacitive layer and a sensor, and can detect the user's touch position and gesture.
[0073] In addition to a mobile phone, the first electronic device described in the embodiment of the present application can also be a tablet computer, a personal computer (PC), a personal digital assistant (PDA), a smart watch, a netbook, a wearable electronic device, an augmented reality technology (AR) device, a virtual reality (VR) device, a vehicle-mounted device, a smart car, a robot, smart glasses, a smart TV, and other devices with a display screen and capable of realizing a display function. The present application does not impose any special restrictions on the specific form of the first electronic device.
[0074] The application scenario of the present application can be to project the content of the first electronic device to the second electronic device. Among them, the second electronic device can be a tablet computer, a personal computer (PC), a personal digital assistant (PDA), a smart watch, a netbook, a wearable electronic device, an augmented reality (AR) device, a virtual reality (VR) device, a vehicle-mounted device, a smart car, a robot, smart glasses, a smart TV, etc., which has a display screen and can realize a display function. The present application does not impose any special restrictions on the specific form of the second electronic device.
[0075] See attached Figure 1 , Figure 1 It is a flowchart of the main steps of an audio playback method according to an embodiment of the present application.
[0076] like Figure 1 As shown, the audio playback method in the embodiment of the present application mainly includes the following steps S10 to S40.
[0077] Before executing the following steps S10 to S40, a communication connection between the first electronic device and the second electronic device may be established first, which is the basis for data exchange between the first electronic device and the second electronic device.
[0078] Exemplarily, taking a mobile phone as an example of the first electronic device and a vehicle (vehicle computer) as an example of the second electronic device, the mobile phone and the vehicle can be communicatively connected.
[0079] In some examples, the communication connection may be Nearby technology. Nearby technology is a technology for detecting and interacting with nearby devices, which supports multiple transmission protocols (such as BLE, Wi-Fi Direct) to achieve fast data transmission and interaction between devices. In some other examples, the communication connection may also be other wireless short-range communication solutions mentioned in this application.
[0080] Step S10: receiving a first operation of the user, and creating a virtual screen in response to the first operation, where the virtual screen is used to display the content of the target application on the first electronic device.
[0081] The first operation may be an operation performed by a user on a screen projection application in the first electronic device. The first operation may be implemented by a user click or voice, etc., without limitation. For example, opening a screen projection application may be used as an example of the first operation, and a virtual screen is created corresponding to the user opening the screen projection application.
[0082] The virtual screen is a virtual display area created on the first electronic device, which is used to display the screen content of the target application on the first electronic device. The content can be the same screen content as the display screen of the first electronic device, or it can be extended content based on the display screen of the first electronic device.
[0083] Step S20: creating a virtual audio device corresponding to the virtual screen based on the virtual audio configuration file.
[0084] A virtual audio profile is a configuration file or template that defines the characteristics, behaviors, and parameters of a virtual audio device. It is used to describe the properties of a virtual audio device, such as the number of channels, sampling rate, buffer size, etc. Its function is to tell the system how to process audio data and how to route audio data to the virtual audio device.
[0085] A virtual audio device is an audio device simulated by software, which can realize audio recording, mixing, redirecting audio streams or providing special audio effects. For example, a virtual audio device can be a virtual mixer for mixing audio from multiple sources, a virtual speaker or headset for playing audio, or a virtual microphone for capturing audio input.
[0086] After the action of creating the virtual screen is completed in step S10, step S20 is triggered to create a virtual audio device corresponding to the virtual screen.
[0087] Specifically, the virtual audio configuration file is a file pre-stored in the operating system of the first electronic device, including virtual audio device information, and a virtual audio device corresponding to the virtual screen can be created according to the virtual audio device information in the virtual configuration file. Exemplarily, the relevant information of the virtual audio device may include a MAC address (mac), a device type (type), channel configuration information (desc), and a number of channels (channel), etc.
[0088] Step S30: In response to the second operation of the user, the target application acquires the audio focus.
[0089] The second operation may be an operation performed by a user on a target application in the first electronic device, and the second operation may be implemented by a user click or voice, etc., without limitation. For example, controlling the target application to play an audio stream may be an example of the second operation, wherein the target application may be a program capable of playing music or video, etc.
[0090] Audio Focus is a mechanism used to manage audio output in the Android system. It controls which application can control audio output at any time.
[0091] The types of focus information include permanently gaining focus (AUDIOFOCUS_GAIN), temporarily gaining focus but allowing background playback (AUDIOFOCUS_GAIN_TRANSIENT), temporarily gaining focus but excluding other audio output (AUDIOFOCUS_GAIN_TRANSIENT_EXCLUSIVE), and temporarily gaining focus but allowing the application currently playing audio to lower the volume instead of stopping it completely (AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK).
[0092] Step S40: outputting the audio data to the second electronic device for playing based on the audio focus, the audio data is obtained from the virtual audio device, and the second electronic device is communicatively connected to the first electronic device.
[0093] Specifically, after the target application obtains the audio focus, the virtual audio device processes the audio stream to obtain audio data, and the audio data can be sent to the second electronic device through the connection link between the first electronic device and the second electronic device for playback.
[0094] Based on the above steps S10-S60, a first operation of the user is received, a virtual screen is created in response to the first operation, and the virtual screen is used to display the content of the target application on the first electronic device; a virtual audio device corresponding to the virtual screen is created based on the virtual audio configuration file; in response to the second operation of the user, the target application obtains the audio focus; based on the audio focus, the audio data is output to the second electronic device for playback, and the audio data is obtained from the virtual audio device, and the second electronic device is connected to the first electronic device for communication. By creating a virtual screen and a virtual audio device corresponding to the virtual screen, a unified multimedia experience interface can be provided for the user, while enjoying high-quality audio output without switching between different devices or applications. At the same time, by obtaining the audio focus, the separation of audio focus in a multi-tasking or multi-application environment is achieved, audio conflicts are avoided, and the user experience is improved.
[0095] like Figure 2 As shown, in a specific implementation, the electronic device of the present application may include a processor 110, an external memory interface 120, an internal memory 121, a Universal Serial Bus (USB) interface 130, a charging management module 140, a wireless charging coil 140A, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a microphone 170B, an earphone interface 170C, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera module 193, a display screen 194, and a Subscriber Identification Module (SIM) card interface 195. The processor 110 may be directly or indirectly connected to other components through a system bus.
[0096] The processor 110 may include one or more processing units, for example, the processor 110 may include a central processing unit (CPU), an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor and / or a neural network processor (NPU), etc. Different processing units may be independent devices or integrated into one or more processors. The processor 110 may generate an operation control signal according to the instruction opcode and the timing signal to complete the control of reading and executing instructions.
[0097] The internal memory 121 can be used to store computer executable program codes, and the executable program codes include instructions. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function, etc. The data storage area may store data created during the use of the electronic device, etc. The internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (Universal Flash Storage, UFS), etc. The processor 110 executes various functional applications and data processing of the electronic device by running instructions stored in the internal memory 121 and / or instructions stored in a memory provided in the processor.
[0098] The wireless communication function of the electronic device can be implemented through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor, baseband processor, etc. In some embodiments, the antenna 1 of the electronic device is coupled with the mobile communication module 150, and the antenna 2 is coupled with the wireless communication module 160, so that the electronic device can communicate with other devices through a wireless communication network.
[0099] The mobile communication module 150 can provide electronic devices with wireless communication solutions including 2G / 3G / 4G / 5G.
[0100] The wireless communication module 160 can provide wireless communication solutions for electronic devices, including wireless local area networks (WLAN), wireless fidelity (Wi-Fi) networks, Bluetooth (BT), global navigation satellite systems (GNSS), near field communication technology (NFC), infrared technology (IR), etc.
[0101] The sensor module 180 may include an ambient light sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a proximity light sensor 180D, an acceleration sensor 180E, a fingerprint sensor 180F, a Hall sensor 180G, and a laser sensor 180H. In some examples, a health sensor and other types of sensors for monitoring the health of the user may also be included. The electronic device may collect various data through the sensor module 180.
[0102] The electronic device implements the display function through a graphics processor GPU, a display screen 194, and an application processor AP. Among them, the GPU connects the display screen 194 and the AP. The GPU can be used to perform mathematical and geometric calculations, as well as graphics rendering. The processor 110 may include one or more GPUs. The display screen 194 is also called a screen, which is used to display images and videos, etc. The display screen 194 can be one or more. In some examples, the display screen 194 may include a touch screen, also known as a "touch screen". The touch screen is used to detect touch operations acting on or near it, such as click operations, sliding operations, etc., and pass the detected touch operations to the application processor to determine the type of touch event. The electronic device can provide visual output related to the touch operation through the display screen 194.
[0103] It is understood that the above example structures do not constitute a specific limitation on the electronic device. In some other examples, the electronic device may include more or fewer components, or combine certain components, or split certain components, or arrange the components differently. In some examples, the same type of components may be one or more, such as a speaker or a microphone. The illustrated components may include hardware, software, or a combination of software and hardware.
[0104] In addition, the present application also provides a software structure of an electronic device. Figure 3As shown, in one embodiment, the software structure of the electronic device includes an application layer, an application framework layer, and a hardware abstraction layer (HAL) from top to bottom. In addition, between the application framework layer and the HAL layer, there is also an Android runtime (Android Runtime) and a system library ( Figure 3 not shown).
[0105] The application layer may include a series of application packages, such as gallery, album, etc. In this embodiment, a screen projection module (screen projection APP) is also included, and the screen projection APP is used to realize the screen projection function of different terminal devices.
[0106] The application framework layer is referred to as the framework layer for short. The framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The framework layer includes some predefined functions.
[0107] like Figure 3 As shown, the framework layer in this embodiment includes an audio management module, wherein the audio management module includes a virtual audio device instance (LinkageAudioDevice), an audio service module (AudioService) and an audio engine module (AudioFlinger).
[0108] Other managers may also be included in the framework layer, such as window managers, content providers, view systems, phone managers, and notification managers.
[0109] In addition, Android Runtime includes core libraries and virtual machines. Android Runtime is responsible for scheduling and management of the Android system. Specifically, the core library contains two parts: one part is the function functions that need to be called by the Java language, and the other part is the Android core library.
[0110] The system library may include multiple functional modules, such as surface manager, media library, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.
[0111] The hardware abstraction layer (HAL) is an interface layer between the operating system kernel and the hardware circuit, and its purpose is to abstract the hardware. It hides the hardware interface details of a specific platform and provides a virtual hardware platform for the operating system, making it hardware-independent and portable on multiple platforms. From the perspective of software and hardware testing, the testing of software and hardware can be completed based on the hardware abstraction layer, making it possible to conduct software and hardware testing in parallel.
[0112] In this embodiment, the hardware abstraction layer HAL includes a virtual audio module, namely, Virtual Audio HAL, wherein Virtual Audio HAL can be used to connect to distributed virtual audio devices, and to connect to remote screen projection audio input and output devices.
[0113] The above steps S20 to S40 are described in detail below.
[0114] Specifically, Figure 3 As shown, the first electronic device includes a screen projection module, an audio management module and a virtual audio module (virtual audio HAL).
[0115] The above step S20 can be specifically implemented through the following steps S201 to S203.
[0116] Step S201: The screen projection module obtains the attribute information of the second electronic device and sends it to the audio management module.
[0117] The attribute information of the second electronic device includes a device identification, a device type, and the number of audio channels supported by the device.
[0118] Specifically, the screen projection module obtains the attribute information of the second electronic device from the second electronic device through the network and sends it to the virtual audio module of the framework layer.
[0119] Step S202: the audio management module obtains virtual audio device information from the virtual audio configuration file based on the attribute information and sends the virtual audio device information to the virtual audio module.
[0120] Specifically, the available virtual audio device information is pre-configured in the virtual audio configuration file, and the framework layer can obtain the virtual audio configuration file according to the path of the virtual audio file. After the virtual audio module receives the attribute information of the second device sent by the projection module, it selects the corresponding virtual audio device information from the virtual audio configuration file according to the attribute information, and forwards the virtual audio device information to the virtual audio module of the hardware abstraction layer (virtual audio HAL).
[0121] Step S203: the virtual audio module creates a virtual audio device corresponding to the virtual screen based on the virtual audio device information.
[0122] Specifically, before the virtual audio module creates a virtual audio device, the virtual audio device instance first binds the virtual screen to the virtual audio device, and then the virtual audio module (virtual audio HAL) creates a virtual audio device corresponding to the virtual screen based on the virtual audio device information.
[0123] The above step S203 can be specifically implemented through the following steps S2031 to S2032.
[0124] Step S2031: The virtual audio device instance receives a first identifier sent by the virtual audio module and a second identifier sent by the screen projection module, wherein the first identifier is the device identifier of the virtual audio device, and the second identifier is the screen identifier of the virtual screen.
[0125] The device identifier of a virtual audio device is a unique code or string generated by the virtual audio module and used to identify its identity. The device identifier enables the application to distinguish different virtual audio devices and perform specific operations on each device, such as audio output, audio format conversion, etc.
[0126] The screen ID of a virtual screen is another unique code or string generated by the screen projection module to identify its identity. The screen ID allows the application to correctly map the main screen content to the corresponding virtual screen in a multi-display environment, ensuring audio and video synchronization and consistency of user experience.
[0127] Specifically, after the virtual audio module creates a virtual audio device, it sends the device identifier of the virtual audio device to the virtual audio device instance. After the screen projection module creates a virtual screen, it sends the screen identifier of the virtual screen to the virtual audio module. Exemplarily, VirtualAudioDevice1 can be used as an example of the device identifier of the virtual audio device, and VirtualDisplay1 can be used as an example of the screen identifier of the virtual screen.
[0128] Step S2032: the virtual audio device instance binds the virtual screen and the virtual audio device based on the first identifier and the second identifier to create a virtual audio device corresponding to the virtual screen.
[0129] The virtual audio device instance binds the virtual screen and the virtual audio device according to the first identifier and the second identifier so that the two have a one-to-one correspondence, and then the virtual audio module creates a virtual audio device corresponding to the virtual screen.
[0130] Virtual audio devices allow different applications or processes to access audio resources independently without interfering with each other. They can simulate multiple independent audio devices on the same physical hardware, allowing multiple applications to perform audio input or output simultaneously without directly competing for limited physical resources.
[0131] The following is a detailed description of the process of creating a virtual audio device instance.
[0132] In a specific implementation of the present application, the audio management module creates a virtual audio device instance through the following steps: obtaining a virtual audio configuration file; and creating a virtual audio device instance based on the virtual audio configuration file.
[0133] Specifically, the virtual audio configuration file can contain various parameters about the virtual audio device, such as sampling rate, bit depth, number of channels, buffer size, audio format, etc. The audio management module of the framework layer parses the configuration file and extracts all necessary parameters, which will be used to initialize the LinkageAudioDeviceImpl instance. The LinkageAudioDeviceImpl instance should contain a constructor that accepts the parameters extracted from the configuration file as input.
[0134] Design a factory mode class called VirtualAudioDeviceFactory, which is responsible for creating LinkageAudioDeviceImpl instances based on the provided parameters. Finally, in the framework layer, call the VirtualAudioDeviceFactory.createAudioDevice method, passing in the parameters parsed from the configuration file to instantiate a LinkageAudioDeviceImpl object based on these parameters to obtain a virtual audio device instance. The virtual audio device instance is mapped one-to-one with the virtual audio device created by the hardware abstraction layer.
[0135] Specifically, the virtual audio device instance can implement the binding operation between the screen and the virtual audio device, record the currently focused virtual screen display, register the changes of the uid on the virtual screen display, and send the uid (identity identifier) to be processed to the audio service module (AudioService) when the uid changes.
[0136] UID (User ID) is the identity of the process, and its full name is "User ID". Each Android application is assigned a unique UID when it is installed. This UID is the identifier of the user group to which the application belongs. It determines the scope of the application's permissions and the usage restrictions of system resources.
[0137] The virtual audio device instance also provides the following interfaces for managing the device:
[0138] mount()
[0139] Mount the virtual audio device;
[0140] bindDisplay(int displayId)
[0141] Bind the screen displayId to the virtual audio device;
[0142] unbindDisplay(int displayId)
[0143] Unbind the screen displayId from the virtual audio device;
[0144] unbindDisplay()
[0145] Unbind all screens of the virtual audio device;
[0146] close()
[0147] Close the virtual audio device.
[0148] The above is a further description of step S20 , and the following is a further description of step S30 .
[0149] After receiving the user's operation to play the relevant audio of the target application, the target application (first application) program needs to apply for audio focus, and can play the relevant audio data only after obtaining the audio focus. Specifically, the above step S30 can be implemented through the following steps S301 to S303.
[0150] Step S301: the virtual audio device instance obtains an audio focus application request and sends it to the audio service module. The audio focus application request includes an identity of a target application.
[0151] Specifically, the virtual audio device instance obtains the screen ID (VirtualDisplayID) of the currently bound virtual screen and pays attention to the uid changes of the target application of the virtual screen. In response to the user's second operation, the target application sends an audio focus request to the virtual audio device instance. After receiving the audio focus request from the target application, the virtual audio device instance sends the audio focus request to the audio service module (AudioService).
[0152] Step S302: the audio service module determines the position of the focus information of the target application based on the identity of the target application.
[0153] Specifically, after the audio service module (AudioService) receives the audio focus application request, it determines the position of the focus information of the target application according to the identity of the target application in the audio focus application request, wherein the position of the focus information of the target application is that the focus information of the target application is located in the first focus stack (virtual focus stack) or the focus information of the target application is located in the second focus stack (Android native focus stack), wherein the first focus stack is used to store the focus information corresponding to the audio application that plays audio through the virtual audio device, and the second focus stack is used to store the focus information corresponding to the audio application that plays audio through the first electronic device.
[0154] Step S303: the audio service module obtains the audio focus based on the position of the focus information.
[0155] In a specific embodiment of the present application, the audio service module obtains audio focus based on the position of focus information, including: when the focus information of the target application is located in the first focus stack, in response to the second operation, the focus information of the focus is placed at the top of the first focus stack to obtain audio focus; when the focus of the target application is located in the second focus stack, in response to the second operation, the focus is moved from the second focus stack to the first focus stack, and the focus information of the focus is placed at the top of the first focus stack to obtain audio focus.
[0156] Specifically, when the focus information of the target application is located in the first focus stack (virtual focus stack), the audio service module identifies the audio focus state of the first focus stack (virtual focus stack), that is, determines whether the audio focus of the first focus stack is in an idle state. If the audio focus of the first focus stack is in an idle state, the focus information of the target application is directly placed at the top of the first focus stack so that the target application obtains the audio focus. If the audio focus of the first focus stack is in a non-idle state, the audio focus is preempted according to the native audio focus preemption logic of Android, and the focus information of the target application is placed at the top of the first focus stack so that the target application obtains the audio focus.
[0157] When the focus information of the target application is located in the second focus stack (Android native focus stack), the audio service module first performs the focus information transfer operation, that is, moves the focus information of the target application from the second focus stack (Android native focus stack) to the first focus stack (virtual focus stack); then the audio service module identifies the audio focus state of the first focus stack (virtual focus stack), that is, determines whether the audio focus of the first focus stack is in an idle state. If the audio focus of the first focus stack is in an idle state, the focus information of the target application is directly placed at the top of the first focus stack so that the target application obtains the audio focus. If the audio focus of the first focus stack is in a non-idle state, the audio focus is preempted according to the Android native audio focus preemption logic, and the focus information of the target application is placed at the top of the first focus stack so that the target application obtains the audio focus.
[0158] Among them, Android's native audio focus preemption logic specifically includes the following execution process: First, the audio service module obtains the focus request type of the target application according to the focus application request of the target application. Next, compare the focus request type of the target application (first application) with the focus request type of the second application (the application currently occupying the audio focus in the virtual focus stack), and determine whether to allow the target application (first application) to obtain the audio focus based on the comparison result. For example, if the focus request type of the target application (first application) is permanent gain focus (AUDIOFOCUS_GAIN), and the focus request type held by the second application is AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK, then the target application (first application) can preempt the audio focus. When the focus request types of the first application and the second application are the same, if the focus request type of the target application has a higher priority, then the target application will obtain the audio focus.
[0159] Placing the focus information of the target application at the top of the first focus stack indicates that the target application (first application) obtains the audio focus and can start playing audio, while the previous audio focus holder (second application) may respond according to the settings when its focus is lost (such as silent, paused, etc.).
[0160] For an application that has lost focus (such as a second application), the system usually notifies it through a callback mechanism that the focus has been lost, and allows it to perform corresponding cleanup work, such as pausing playback, releasing resources, etc.
[0161] Exemplarily, when the target application obtains the audio focus, the response mode of the second application may include the following types:
[0162] When the focus request type of the target application (first application) is AUDIOFOCUS_GAIN and the focus request type of the first application is AUDIOFOCUS_NONE, the second application fades out of the silent state for a preset time, is removed from the focus stack, and notifies the second application of the loss of audio focus to pause the second application. However, whether to pause the playback depends on the behavior of the second application. The behavior of the second application is the response logic of the second application to the audio focus change event defined by the developer of the second application when writing the application. This response logic will determine whether the second application pauses the playback, lowers the volume, or takes other measures when losing the audio focus.
[0163] When the focus request type of the first application is AUDIOFOCUS_GAIN_TRANSIENT and the focus request type of the second application is AUDIOFOCUS_LOSS_TRANSIENT, the second application should pause when it loses the audio focus. Whether the second application actually pauses depends on the behavior of the second application. The behavior of the second application is the response logic of the second application to the audio focus change event defined by the developer of the second application when writing the application. This response logic will determine whether the second application pauses, lowers the volume, or takes other measures when it loses the audio focus.
[0164] When the focus request type of the target application (first application) is AUDIOFOCUS_GAIN_TRANSIENT_EXCLUSIVE and the focus request type of the second application is AUDIOFOCUS_LOSS_TRANSIENT, the second application should pause playback when it loses audio focus. Whether it actually pauses playback depends on the behavior of the second application. The behavior of the second application is the response logic of the second application to the audio focus change event defined by the developer of the second application when writing the application. This response logic will determine whether the second application pauses playback, lowers the volume, or takes other measures when it loses audio focus.
[0165] When the focus request type of the target application (first application) is AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK and the focus request type of the second application is AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK, the system notifies the second application to enter the preset mode (i.e., the mode of lowering the volume corresponding to the application), and then decides whether to suppress playback based on the identity of the second application. If so, the sound of the second application is suppressed to a preset value within a preset duration, otherwise the second application pauses playback.
[0166] By placing the focus information of the target application at the top of the first focus stack, it is ensured that the target application that currently needs audio focus the most can obtain resources first, which helps to avoid resource waste and conflicts and ensures that the audio output of important applications is not disturbed; it ensures the continuity and smoothness of audio output. Even in complex scenarios of multi-tasking switching, users will not feel sudden interruptions or delays in the audio, thereby improving the overall user experience.
[0167] The above is a further description of step S30 , and the following is a further description of step S40 .
[0168] The above step S40 can be specifically implemented through the following steps S401 to S403.
[0169] Step S401: the virtual audio device obtains audio data based on the audio focus.
[0170] Specifically, after the target application obtains the audio focus, the virtual audio device processes the audio stream to obtain audio data. The processing may include volume adjustment, reverberation, equalizer effect, noise suppression, echo cancellation, etc., which are not specifically limited.
[0171] Step S402: The virtual audio device outputs the audio data to the screen projection module.
[0172] Specifically, the virtual audio device outputs audio data to Inner-SDK through LocalSocket, and Inner-SDK outputs audio data to the screen projection module.
[0173] LocalSocket is a mechanism for inter-process communication (IPC) in the Android system, which allows data exchange between different processes on the same device.
[0174] Inner-SDK is used to provide an interface for the framework layer or hardware abstraction layer to interact with applications.
[0175] Step S403: The screen projection module outputs the audio data to the second electronic device.
[0176] Specifically, the screen projection module outputs the audio data to the second electronic device through the networking address, so that the second electronic device plays the audio data.
[0177] In a specific implementation of the present application, the virtual audio device information includes channel configuration information; the method further includes: creating a multi-channel virtual audio device based on the virtual audio device information. .
[0178] For example, Figure 4 An example of a virtual audio configuration file is shown in FIG. In the virtual audio configuration file, multiple virtual audio device information is configured, and each virtual audio device information includes a MAC address (mac), a device type (type), a buffer length (buffer_length), channel configuration information (desc), and a number of channels (channel).
[0179] Specifically, the virtual audio configuration file includes channel configuration information of the virtual audio device, such as stereo, 5.1 channels and / or 7.1.4 channels, etc., and a multi-channel virtual audio device can be created based on the channel configuration information. The multi-channel virtual audio device can provide a richer and more stereoscopic sound environment, thereby enhancing the user's immersive auditory experience. For example, Figure 5This can be used as an example of creating a multi-channel virtual audio device. The multi-channel virtual audio device created at this time supports stereo, 5.1 channels, and 7.1.4 channels at the same time.
[0180] In a specific implementation of the present application, the virtual audio configuration file includes multiple virtual audio device information; the method further includes: creating multiple virtual audio devices based on the multiple virtual audio device information.
[0181] Specifically, multiple virtual audio device information can be configured in the virtual audio configuration file, and multiple virtual audio devices can be created based on the multiple virtual audio device information in the virtual configuration file. Each virtual audio device can run independently and have its own resources and parameter settings. Multiple virtual audio devices can process audio streams in parallel, thereby improving the concurrent processing capability of the system and the compatibility and scalability of audio devices. For example, Figure 6 This can be used as an example to create multiple virtual audio devices.
[0182] Next, the audio playback method of the present application is described in detail by taking a vehicle as an example of the second electronic device.
[0183] For example, Figure 7 and Figure 8 As shown, when the QQ Music app is running on the mobile phone and the conference app needs to be run on the car computer, a communication connection is first established between the mobile phone and the vehicle. For example, the mobile phone and the vehicle can be interconnected through Nearby technology. According to the user's first operation (such as opening the screen projection module), the screen projection module starts and creates a virtual screen. The virtual screen is used to display the content of the conference app on the mobile phone. At this time, the content on the virtual screen can be displayed on the screen of the car computer. Exemplarily, the NioLink application can be used as an example of the screen projection module.
[0184] The screen projection module first obtains the attribute information of the vehicle, and then sends the attribute information of the vehicle to the audio management module, which forwards the attribute information of the vehicle to the virtual audio module of the HAL layer (virtual audio HAL) to create a virtual audio device.
[0185] The binding between the virtual screen and the virtual audio device is realized through the virtual audio device instance of the framework layer, so as to obtain the virtual audio device corresponding to the virtual screen. The virtual audio device instance records the displayID of the currently bound virtual screen and pays attention to the uid changes of the virtual screen display. In response to the user's second operation (such as conducting a video conference), the conference app sends an audio focus application request to the virtual audio device instance. After receiving the audio focus application request, the virtual audio device instance sends the audio focus application request to the audio service module (AudioService). The audio service module (AudioService) determines whether the focus information of the conference app is located in the first focus stack (virtual focus stack) or the second focus stack (Android native focus stack) based on the identity of the conference app in the audio focus application request.
[0186] When the focus information of the conference app is in the first focus stack (virtual focus stack), the audio service module identifies the audio focus state of the first focus stack (virtual focus stack), that is, determines whether the audio focus of the first focus stack is in an idle state. If the audio focus of the first focus stack is in an idle state, the focus information of the conference app is directly placed at the top of the first focus stack so that the conference app obtains the audio focus. If the audio focus of the first focus stack is in a non-idle state, the audio focus is preempted according to the native audio focus preemption logic of Android, and the focus information of the conference app is placed at the top of the first focus stack so that the conference app obtains the audio focus.
[0187] When the focus information of the conference app is located in the second focus stack (Android native focus stack), the audio service module first performs the focus information transfer operation, that is, moves the focus information of the conference app from the second focus stack (Android native focus stack) to the first focus stack (virtual focus stack); then the audio service module identifies the audio focus state of the first focus stack (virtual focus stack), that is, determines whether the audio focus of the first focus stack is in an idle state. If the audio focus of the first focus stack is in an idle state, the focus information of the conference app is directly placed at the top of the first focus stack, so that the conference app obtains the audio focus. If the audio focus of the first focus stack is in a non-idle state, the audio focus is preempted according to the Android native audio focus preemption logic, and the focus information of the conference app is placed at the top of the first focus stack, so that the conference app obtains the audio focus. Fig. 9 This can be used as a flowchart for applying for audio focus in a conference app.
[0001] When the conference app obtains the audio focus, the virtual audio device obtains the audio data according to the audio stream, and AudioFlinger selects the audio path according to the identity of the conference app corresponding to the audio data. The audio data processed by the virtual audio device is sent to the projection module through LocalSocket, and the projection module sends it to the vehicle end through the networking address for playback.
[0177] Fig.10 This can be used as a flowchart of the QQ Music app giving up the audio focus. Specifically, first determine whether the focus information of the QQ Music app is located in the native focus stack (the second focus stack) or the virtual focus stack (the first focus stack). Regardless of whether the focus information is located in the native focus stack (the second focus stack) or the virtual focus stack (the first focus stack), move the focus information in the focus stack downward or delete it so that the focus information of the QQ Music app is no longer at the top of the stack, thereby releasing the audio focus.
[0178] Fig.11 It can be used as a flow chart of the change in the playback position of the conference app. Specifically, according to the audio focus application request of the conference app, it is determined whether the identity of the conference app is added or removed. For the newly added identity, since the focus information of the conference app is located in the Android native focus stack (the second focus stack), the focus information is moved from the Android native focus stack (the second focus stack) to the virtual focus stack (the first focus stack), and the audio focus is seized according to the Android native focus seizure logic to place the focus information of the conference app at the top of the stack, so that the conference app obtains the audio focus.
[0179] It should be pointed out that although the various steps in the above embodiments are described in a specific order, those skilled in the art can understand that in order to achieve the effect of the present application, different steps do not have to be executed in such an order. They can be executed simultaneously (in parallel) or in other orders. These changes are within the scope of protection of the present application.
[0180] Furthermore, the present application also provides an audio playback device.
[0181] See attached Fig.12 , Fig.12 FIG. 1 is a main structural block diagram of an audio playback device according to an embodiment of the present application. Fig.12 As shown, the audio playback device in the embodiment of the present application mainly includes a first creation module 11, a second creation module 12, an acquisition module 13 and an output module 14. In some embodiments, one or more of the first creation module 11, the second creation module 12, the acquisition module 13 and the output module 14 can be combined into one module.
[0182] In some embodiments, the first creation module 11 may be configured to receive a first operation of a user, and create a virtual screen in response to the first operation, wherein the virtual screen is used to display the content of the target application on the first electronic device.
[0183] The second creation module 12 may be configured to create a virtual audio device corresponding to the virtual screen based on the virtual audio configuration file.
[0184] The acquisition module 13 may be configured to respond to a second operation of the user, and the target application acquires the audio focus;
[0185] The output module 14 may be configured to output the audio data to a second electronic device for playback based on the audio focus, the audio data being acquired from the virtual audio device, and the second electronic device being communicatively connected to the first electronic device.
[0186] In one implementation, the description of the specific implementation functions can refer to steps 10 to 40.
[0187] Further, it should be understood that since the setting of each module is only for illustrating the functional units of the device of the present application, the physical devices corresponding to these modules may be the processor itself, or a part of the software in the processor, a part of the hardware, or a part of the combination of software and hardware. Therefore, the number of each module in the figure is only schematic.
[0188] The above-mentioned audio playback device is used to perform Figure 1 The audio playback method embodiment shown in the figure has similar technical principles, technical problems solved and technical effects produced. Technical personnel in this technical field can clearly understand that for the convenience and conciseness of description, the specific working process and related instructions of the audio playback device can refer to the contents described in the embodiment of the audio playback method, which will not be repeated here.
[0189] It is understood by those skilled in the art that all or part of the processes in the method for implementing the above-mentioned embodiment of the present application can also be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable storage medium may include: any entity or device, medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory, random access memory, electrical carrier signal, telecommunication signal and software distribution medium, etc. that can carry the computer program code.
[0190] Furthermore, the present application also provides an electronic device, which may include a display screen and at least one processor; and a memory connected to the at least one processor; wherein the memory stores a computer program, and when the computer program is executed by the at least one processor, the audio playback method described in any of the above embodiments is implemented. Fig.13 As shown, Fig.13 exemplarily shows the structure of an electronic device, which includes a processor 100, a memory 200 and a display screen 300.
[0191] Furthermore, the present application also provides a computer-readable storage medium. In a computer-readable storage medium embodiment according to the present application, the computer-readable storage medium can be configured to store a program for executing the audio playback method of the above-mentioned method embodiment, and the program can be loaded and run by the processor to implement the above-mentioned audio playback method. For ease of explanation, only the parts related to the embodiment of the present application are shown. For specific technical details not disclosed, please refer to the method part of the embodiment of the present application. The computer-readable storage medium can be a memory device formed by various electronic devices. Optionally, the computer-readable storage medium in the embodiment of the present application is a non-temporary computer-readable storage medium.
[0192] The relevant user personal information that may be involved in the various embodiments of this application is strictly in accordance with the requirements of laws and regulations, following the principles of legality, legitimacy and necessity, based on the reasonable purposes of business scenarios, to process the personal information that users actively provide during the use of products / services or generated due to the use of products / services, as well as the personal information obtained with the user's authorization.
[0193] The user personal information processed by this application will vary depending on the specific product / service scenario, and will be based on the specific scenario in which the user uses the product / service. It may involve the user's account information, device information, driving information, vehicle information or other related information. The applicant will treat the user's personal information and its processing with a high degree of diligence.
[0194] This application attaches great importance to the security of user personal information and has taken reasonable and feasible security protection measures that meet industry standards to protect user information and prevent personal information from being accessed, disclosed, used, modified, damaged or lost without authorization.
[0195] So far, the technical solutions of the present application have been described in conjunction with the specific implementations shown in the accompanying drawings, but it is easy for those skilled in the art to understand that the protection scope of the present application is obviously not limited to these specific implementations. Without departing from the principles of the present application, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will fall within the protection scope of the present application.
Claims
1. An audio playback method, characterized in that: Applied to a first electronic device, the method includes: receiving a first operation of a user, and creating a virtual screen in response to the first operation, wherein the virtual screen is used to display content of a target application on the first electronic device; Creating a virtual audio device corresponding to the virtual screen based on a virtual audio configuration file; In response to a second operation of the user, the target application acquires audio focus; The audio data is output to a second electronic device for playing based on the audio focus, the audio data is obtained from the virtual audio device, and the second electronic device is communicatively connected with the first electronic device.
2. The audio playback method according to claim 1, characterized in that: The step of creating a virtual audio device based on the virtual audio configuration file includes: Acquiring attribute information of the second electronic device; Acquire virtual audio device information from the virtual audio configuration file based on the attribute information; The virtual audio device corresponding to the virtual screen is created based on the virtual audio device information.
3. The audio playback method according to claim 2, characterized in that: The creating the virtual audio device corresponding to the virtual screen based on the virtual audio device information includes: Acquire a first identifier and a second identifier, wherein the first identifier is a device identifier of a virtual audio device, and the second identifier is a screen identifier of a virtual screen; The virtual screen and the virtual audio device are bound based on the first identifier and the second identifier to create the virtual audio device corresponding to the virtual screen.
4. The audio playback method according to claim 2, characterized in that: The target application obtains the audio focus, including: Obtaining an audio focus application request, wherein the audio focus application request includes an identity of the target application; Determining a location of focus information of the target application based on the identity identifier; The audio focus is acquired based on the position of the focus information.
5. The audio playback method according to claim 4, characterized in that: Acquiring the audio focus based on the position of the focus information includes: When the focus information of the target application is located in the first focus stack, in response to the audio focus application request, placing the focus information at the top of the first focus stack to obtain the audio focus; When the focus information of the target application is located in the second focus stack, in response to the audio focus application request, the focus information is moved from the second focus stack to the first focus stack, and the focus information is placed on the top of the first focus stack to obtain the audio focus.
6. The audio playback method according to claim 2, characterized in that: The virtual audio device information includes channel configuration information; the method further includes: A multi-channel virtual audio device is created based on the virtual audio device information.
7. The audio playback method according to claim 2, characterized in that: The virtual audio configuration file includes a plurality of virtual audio device information; the method further includes: A plurality of virtual audio devices are created based on the plurality of virtual audio device information.
8. The audio playback method according to claim 1, characterized in that: The electronic device includes a screen projection module; and the step of outputting the audio data to a second electronic device for playback based on the audio focus includes: The virtual audio device acquires audio data based on the audio focus; The virtual audio device outputs the audio data to the screen projection module; The screen projection module outputs the audio data to the second electronic device.
9. The audio playback method according to claim 3, characterized in that: The electronic device comprises an audio management module, and the audio management module creates a virtual audio device instance by the following steps: Obtaining the virtual audio configuration file; The virtual audio device instance is created based on the virtual audio configuration file.
10. An electronic device, characterized in that: include: Display screen; at least one processor; and, a memory communicatively coupled to the at least one processor; The memory stores a computer program, and when the computer program is executed by the at least one processor, the audio playback method according to any one of claims 1 to 9 is implemented.
Citation Information
Cited By
Vehicle machine audio focus management method and device, electronic equipment and storage medium
CN120727027A
Focus control method and device, in-vehicle infotainment system, medium, product and vehicle
CN121658129A
