WO2024094069A1 - Audio playback method and electronic device - Google Patents

Audio playback method and electronic device Download PDF

Info

Publication number
WO2024094069A1
WO2024094069A1 PCT/CN2023/129093 CN2023129093W WO2024094069A1 WO 2024094069 A1 WO2024094069 A1 WO 2024094069A1 CN 2023129093 W CN2023129093 W CN 2023129093W WO 2024094069 A1 WO2024094069 A1 WO 2024094069A1
Authority
WO
WIPO (PCT)
Prior art keywords
audio
electronic device
virtual
bus
sending
Prior art date
Application number
PCT/CN2023/129093
Other languages
French (fr)
Chinese (zh)
Inventor
陈全全
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2024094069A1 publication Critical patent/WO2024094069A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/16Sound input; Sound output
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M1/00Substation equipment, e.g. for use by subscribers
    • H04M1/72Mobile telephones; Cordless telephones, i.e. devices for establishing wireless links to base stations without route selection
    • H04M1/724User interfaces specially adapted for cordless or mobile telephones
    • H04M1/72403User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality
    • H04M1/72442User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality for playing music files
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M1/00Substation equipment, e.g. for use by subscribers
    • H04M1/72Mobile telephones; Cordless telephones, i.e. devices for establishing wireless links to base stations without route selection
    • H04M1/724User interfaces specially adapted for cordless or mobile telephones
    • H04M1/72448User interfaces specially adapted for cordless or mobile telephones with means for adapting the functionality of the device according to specific conditions

Definitions

  • the present application relates to the technical field of electronic equipment, and in particular to an audio playback method and electronic equipment.
  • terminal devices can broadcast audio to other audio playback devices through short-range communication methods such as Bluetooth, that is, the terminal device sends the audio generated by itself to other audio playback devices for playback.
  • short-range communication methods such as Bluetooth
  • the device that initiates the audio broadcasting generally broadcasts the audio according to a set fixed audio broadcasting strategy, and usually only supports broadcasting one audio stream to other audio playback devices for playback. Therefore, the audio broadcasting efficiency is low, resulting in low flexibility and practicality of audio playback based on this method.
  • the present application provides an audio playback method and an electronic device, which are used to broadcast different applications or different types of audio in an electronic device to other different electronic devices for playback, thereby improving the flexibility and practicality of the electronic device in playing audio.
  • the present application provides an audio playback method, which is applied to a first electronic device, and the method includes: in response to a received first operation, sending a first audio to at least one second electronic device, and instructing the at least one second electronic device to play the first audio; wherein the first operation is used to instruct the at least one second electronic device to play the first audio; in response to a received second operation, sending a second audio to at least one third electronic device, and instructing the at least one third electronic device to play the second audio; wherein the second operation is used to instruct the at least one third electronic device to play the second audio; wherein the first audio and the second audio belong to different applications of the first electronic device, or the first audio and the second audio are of different audio types.
  • the electronic device can broadcast the first audio to at least one second electronic device for playback, and can broadcast the second audio to at least one third electronic device for playback, and the first audio and the second audio are audio of different applications or different types. Therefore, based on this method, the electronic device can broadcast audio of different applications or different types to other different electronic devices for playback, and the broadcasting process of different audio is relatively independent, so it can achieve the effect of broadcasting multiple audio channels to multiple devices, improve the audio broadcasting efficiency, and thus improve the flexibility and practicality of electronic devices in playing audio.
  • the method before sending the first audio to at least one second electronic device, also includes: creating a first virtual audio device; wherein the first virtual audio device corresponds to the at least one second electronic device; and sending the first audio to at least one second electronic device includes: sending the first audio to the at least one second electronic device through the first virtual audio device.
  • the electronic device transmits audio by creating a virtual audio device, which can create an independent audio transmission channel for the audio stream, thereby improving the audio transmission efficiency, while avoiding conflicts with other audio transmissions, thereby supporting multi-audio parallel transmission.
  • the method before sending the second audio to at least one third electronic device, also includes: creating a second virtual audio device; wherein the second virtual audio device corresponds to the at least one third electronic device; and sending the second audio to at least one third electronic device includes: sending the second audio to the at least one third electronic device through the second virtual audio device.
  • the electronic device transmits audio by creating a virtual audio device, which can create an independent audio transmission channel for the audio stream, thereby improving the audio transmission efficiency, while avoiding conflicts with other audio transmissions, thereby supporting multi-audio parallel transmission.
  • the method before creating the first virtual audio device, further includes: selecting a target audio mode corresponding to the current scene from a plurality of audio modes; wherein the plurality of audio modes include a first audio mode and a second audio mode, and the first audio mode
  • the first audio mode is a mode for playing audio of different applications through different devices
  • the second audio mode is a mode for playing audio of different audio types through different devices
  • the creating of the first virtual audio device includes: when the target audio mode is the first audio mode, creating the first virtual audio device associated with the application to which the first audio belongs; when the target audio mode is the second audio mode, creating the first virtual audio device associated with the audio type of the first audio.
  • the electronic device can use a variety of sound projection modes to broadcast audio, which is highly flexible.
  • the electronic device can flexibly select the specific sound projection mode to be used according to the application scenario, so it is highly practical.
  • the method further includes: in response to a received third operation, sending a third audio to the at least one second electronic device through the first virtual audio device, and instructing the at least one second electronic device to play the third audio; wherein the third operation is used to instruct the playing of the third audio, the third audio and the first audio belong to the same application, or the third audio and the first audio have the same audio type.
  • the electronic device can use the same audio output device to play audio of the same application or the same type of audio, so the electronic device can support audio broadcasting by type, which can improve the efficiency of audio broadcasting and improve the user's listening experience.
  • the method further includes: when it is determined that an electronic device among the at least one second electronic device is offline, destroying the first virtual audio device; or, when it is determined that all of the at least one second electronic device are offline, destroying the first virtual audio device.
  • the electronic device can delete the virtual audio device corresponding to the device that has been created, thereby ensuring the correspondence between the virtual audio device and the available audio playback device, while reducing unnecessary resource consumption.
  • the electronic device can dynamically manage the corresponding virtual audio device according to the status of the available audio playback device, thereby realizing dynamic audio routing management, so it is highly flexible and practical.
  • the first electronic device includes a first application, an audio processing service and an audio sending service; before sending the first audio to the at least one second electronic device through the first virtual audio device, the method also includes: generating the first audio through the first application, and sending the first audio to the audio processing service; distributing the first audio to the first virtual audio device through the audio processing service; sending the first audio to the at least one second electronic device through the first virtual audio device includes: receiving the first audio from the audio processing service through the first virtual audio device; sending the first audio to the audio sending service through the first virtual audio device, and instructing the audio sending service to send the first audio to the at least one second electronic device.
  • the electronic device can establish an audio transmission channel corresponding to the first application through a virtual audio device, an audio processing service, and an audio sending service, thereby realizing independent transmission of the audio of the first application. Based on this method, the electronic device can create corresponding audio transmission channels for different applications, thereby realizing independent and non-interfering audio projection effects when multiple applications are projected at the same time.
  • distributing the first audio to the first virtual audio device through the audio processing service includes: allocating, through the audio processing service, an idle first bus in the first electronic device as a bus for transmitting the first audio, and associating the first bus to the first virtual audio device; sending the first audio to the first virtual audio device using the first bus; before sending the first audio to the audio sending service through the first virtual audio device, the method also includes: receiving, through the first virtual audio device, first bus information sent by the audio processing service using the first bus; wherein the first bus information is used to indicate the first bus; after sending the first audio to the audio sending service through the first virtual audio device, the method also includes: sending, through the first virtual audio device, the first bus indication information to the audio sending service, so that the audio sending service determines the first bus according to the first bus indication information, and determines, according to the first bus, the at least one second electronic device corresponding to the associated first virtual audio device corresponding to the first bus.
  • the electronic device can establish a multi-bus mechanism based on the virtual audio device, and different types of audio can flow along the bus corresponding to the virtual audio device, which can realize the independent transmission of different types of audio. Therefore, this method can support the parallel projection of multiple audio streams, and then realize the concurrent playback control of multiple audio streams, which is highly practical.
  • the method further includes: when the first virtual audio device is destroyed, releasing the association between the first bus and the first virtual audio device, and setting the first bus to an idle state.
  • the first operation includes a fourth operation and a fifth operation; wherein the fourth operation is used to instruct the at least one second electronic device to be used as an electronic device for playing the first audio, and the fifth operation is used to instruct the playing of the first audio.
  • the electronic device can receive the user's audio broadcast instruction before playing the audio.
  • the electronic device can achieve the effect of broadcasting the audio to be played to other electronic devices according to the user's instruction, and the user experience is high.
  • the method before sending the first audio to at least one second electronic device in response to a received first operation and instructing the at least one second electronic device to play the first audio, the method also includes: playing the first audio in response to a received sixth operation.
  • the electronic device can receive the user's audio broadcast instruction during the audio playback process. Combined with the above method, the electronic device can achieve the effect of broadcasting the audio being played to other electronic devices according to the user's instruction, and the user experience is high.
  • the present application provides an electronic device, comprising a display screen, a memory and one or more processors; wherein the memory is used to store computer program code, and the computer program code comprises computer instructions; when the computer instructions are executed by one or more processors, the electronic device executes the method described in the above-mentioned first aspect or any possible design of the first aspect.
  • the present application provides a computer-readable storage medium storing a computer program.
  • the computer program runs on a computer, the computer executes the method described in the first aspect or any possible design of the first aspect.
  • the present application provides a computer program product, which includes a computer program or instructions.
  • the computer program or instructions When the computer program or instructions are run on a computer, the computer executes the method described in the first aspect or any possible design of the first aspect.
  • FIG1 is a schematic diagram of a hardware architecture of an electronic device provided in an embodiment of the present application.
  • FIG2 is a schematic diagram of a software architecture of an electronic device provided in an embodiment of the present application.
  • FIG3 is a schematic diagram of the architecture of an audio playback system provided in an embodiment of the present application.
  • FIG4 is a schematic diagram of the architecture of an audio control system provided in an embodiment of the present application.
  • FIG5 is a schematic diagram of an audio playback method provided in an embodiment of the present application.
  • FIG6 is a schematic diagram of a sound projection device selection interface provided in an embodiment of the present application.
  • FIG7 is a flow chart of a method for starting audio projection and configuring an audio routing strategy provided by an embodiment of the present application
  • FIG8 is a flow chart of a method for turning off audio projection provided in an embodiment of the present application.
  • FIG9 is a schematic diagram of a flow chart of an audio playback method provided in an embodiment of the present application.
  • FIG10 is a schematic diagram of a flow chart of an audio playback method provided in an embodiment of the present application.
  • FIG11 is a schematic diagram of an audio playback method provided in an embodiment of the present application.
  • FIG. 12 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
  • first and second are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as “first” and “second” may explicitly or implicitly include one or more of the features.
  • the electronic device may be a device that supports virtual audio devices and has communication functions.
  • the electronic device may be a portable device, such as a mobile phone, a tablet computer, a wearable device with wireless communication functions (such as a watch, a bracelet, etc.), a vehicle-mounted terminal device, an augmented reality (AR)/virtual reality (VR) device, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), smart home devices (such as smart TVs, smart speakers, etc.), smart robots, workshop equipment, wireless terminals in self-driving, wireless terminals in remote medical surgery, wireless terminals in smart grids, wireless terminals in transportation safety, wireless terminals in smart cities, or wireless terminals in smart homes, flight equipment (such as smart robots, drones, airplanes), etc.
  • a portable device such as a mobile phone, a tablet computer, a wearable device with wireless communication functions (such as a watch, a bracelet, etc.), a vehicle-mounted terminal
  • the virtual audio device is a logical device that virtualizes at least one independent electronic device through virtualization technology, which can be used by applications, services or processes in the electronic device.
  • Wearable devices are devices that users can wear directly on their bodies or integrate into their clothes or accessories.
  • a portable device is a logical device that virtualizes at least one independent electronic device through virtualization technology, which can be used by applications, services or processes in the electronic device.
  • the electronic device may also be a portable terminal device that also includes other functions such as a personal digital assistant and/or a music player.
  • Exemplary embodiments of the portable terminal device include but are not limited to: Or a portable terminal device with other operating systems.
  • the portable terminal device may also be other portable terminal devices, such as a laptop computer with a touch-sensitive surface (e.g., a touch panel).
  • the electronic device may not be a portable terminal device, but a desktop computer with a touch-sensitive surface (e.g., a touch panel).
  • At least one refers to one or more
  • plural refers to two or more.
  • “And/or” describes the association relationship of associated objects, indicating that three relationships may exist.
  • a and/or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural.
  • the character “/” generally indicates that the objects associated before and after are in an “or” relationship.
  • “At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items.
  • At least one of a, b or c can represent: a, b, c, a and b, a and c, b and c, or a, b and c, where a, b, c can be single or multiple.
  • the current audio framework of the Android platform supports the mechanisms for local sound generation by electronic devices (i.e., playing audio) and sound generation by external devices (such as external universal serial bus (USB), Bluetooth devices, etc.).
  • electronic devices i.e., playing audio
  • external devices such as external universal serial bus (USB), Bluetooth devices, etc.
  • the playback mechanism of the audio framework of the Android platform is fixed, and only supports one audio stream to be broadcasted to other audio playback devices. Due to this limitation, electronic devices can only support one audio stream to be broadcasted. For example, if a user opens multiple music apps in an electronic device at the same time to play sounds and broadcast the sounds to other audio output devices, only one audio stream, that is, the sound played by one music app, can be successfully broadcasted to other audio output devices. Therefore, this method cannot meet the user's needs to broadcast different audios to the same or different multiple audio playback devices for playback, and its practicality is low.
  • electronic devices currently based on the Android audio framework can support broadcasting one audio stream to multiple audio playback devices for playback.
  • this method requires that multiple audio playback devices are devices of the same model, and this method achieves the effect of combining multiple audio playback devices to play audio.
  • currently multiple speakers can be used to form a stereo or multi-channel combination, and the electronic device can broadcast audio to the main speaker among multiple speakers, and the main speaker controls the combination of multiple speakers to play audio from the electronic device.
  • the process of user control of audio broadcasting is relatively complicated, and this method cannot meet the user's needs to broadcast different audio to different multiple audio playback devices for playback, so it is less practical.
  • an embodiment of the present application provides an audio playback method and an electronic device. This solution can broadcast different audios in an electronic device to different audio playback devices for playback, and has high flexibility and practicality.
  • FIG. 1 the structure of an electronic device to which the method provided in an embodiment of the present application is applicable is introduced.
  • the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a USB interface 130, a charging management module 140, 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 receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a SIM card interface 195, etc.
  • a processor 110 an external memory interface 120, an internal memory 121, a USB interface 130, a charging management module 140, 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 receiver 170B, a microphone 170C, an earphone interface 170D, a sensor
  • the sensor module 180 may include a gyroscope sensor, an acceleration sensor, a proximity light sensor, a fingerprint sensor, a touch sensor, a temperature sensor, a pressure sensor, a distance sensor, a magnetic sensor, an ambient light sensor, an air pressure sensor, a bone conduction sensor, and the like.
  • the electronic device 100 shown in FIG. 1 is merely an example and does not constitute a limitation on the electronic device, and the electronic device may have more or fewer components than those shown in the figure, may combine two or more components, or may have different component configurations.
  • the various components shown in FIG. 1 may be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and/or application specific integrated circuits.
  • the processor 110 may include one or more processing units, for example: the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), a controller, a memory, a video codec, a digital signal processor (digital signal processor, DSP), a baseband processor, and/or a neural network processor (neural-network processing unit, NPU), etc.
  • different processing units can be independent devices or integrated in one or more processors.
  • the controller can be the nerve center and command center of the electronic device 100. The controller can generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.
  • the processor 110 may also include a memory for storing instructions and data.
  • the memory in the processor 110 may include a memory for storing instructions and data.
  • a high-speed cache memory The memory can store instructions or data that have just been used or are used cyclically by the processor 110. If the processor 110 needs to use the instruction or data again, it can be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
  • the execution of the audio playback method provided in the embodiment of the present application can be controlled by the processor 110 or completed by calling other components, such as calling the processing program of the embodiment of the present application stored in the internal memory 121, or calling the processing program of the embodiment of the present application stored in the third-party device through the external memory interface 120, to control the wireless communication module 160 to communicate data with other devices, improve the intelligence and convenience of the electronic device 100, and enhance the user experience.
  • the processor 110 may include different devices. For example, when the CPU and GPU are integrated, the CPU and GPU can cooperate to execute the audio playback method provided in the embodiment of the present application, such as part of the algorithm in the audio playback method is executed by the CPU, and the other part of the algorithm is executed by the GPU to obtain faster processing efficiency.
  • the display screen 194 is used to display images, videos, etc.
  • the display screen 194 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 or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, quantum dot light-emitting diodes (QLED), etc.
  • the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.
  • the display screen 194 can be used to display information input by a user or information provided to a user and various graphical user interfaces (GUI).
  • GUI graphical user interfaces
  • the display screen 194 can display photos, videos, web pages, or files, etc.
  • the display screen 194 may display the user control interface described in the embodiments of the present application (eg, a sound projection mode selection interface, a sound projection device selection interface, etc.).
  • the display screen 194 may be an integrated flexible display screen, or a spliced display screen consisting of two rigid screens and a flexible screen located between the two rigid screens.
  • the camera 193 (a front camera or a rear camera, or one camera can be used as both a front camera and a rear camera) is used to capture still images or videos.
  • the camera 193 may include a photosensitive element such as a lens group and an image sensor, wherein the lens group includes a plurality of lenses (convex lenses or concave lenses) for collecting light signals reflected by the object to be photographed and transmitting the collected light signals to the image sensor.
  • the image sensor generates an original image of the object to be photographed based on the light signal.
  • the internal memory 121 can be used to store computer executable program codes, which include instructions.
  • the processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121.
  • the internal memory 121 may include a program storage area and a data storage area.
  • the program storage area can store the code of the operating system, application program (such as the function corresponding to the solution of the present application, etc.).
  • the data storage area can store data created during the use of the electronic device 100, etc.
  • the internal memory 121 may also store one or more computer programs corresponding to the algorithm of the present application.
  • the one or more computer programs are stored in the internal memory 121 and configured to be executed by one or more processors 110.
  • the one or more computer programs include instructions, which may be used to execute the various steps in the following embodiments.
  • 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 (UFS), etc.
  • a non-volatile memory such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.
  • the code of the algorithm of the embodiment of the present application can also be stored in an external memory.
  • the processor 110 can run the code of the algorithm of the embodiment of the present application stored in the external memory through the external memory interface 120.
  • the sensor module 180 may include a gyro sensor, an acceleration sensor, a proximity light sensor, a fingerprint sensor, a touch sensor, and the like.
  • a touch sensor is also called a "touch panel”.
  • the touch sensor can be arranged on the display screen 194.
  • the touch sensor and the display screen 194 form a touch display screen, also called a "touch screen”.
  • the touch sensor is used to detect touch operations acting on or near it.
  • the touch sensor can pass 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 screen 194.
  • the touch sensor can also be arranged on the surface of the electronic device 100, which is different from the position of the display screen 194.
  • the display screen 194 of the electronic device 100 displays a main interface, which includes icons of multiple applications (such as a camera application, etc.). For example, a user can click the icon of the camera application in the main interface through a touch sensor to trigger the processor 110 to start the camera application and turn on the camera 193.
  • the display screen 194 displays the interface of the camera application, such as a viewfinder interface.
  • the wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
  • Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals.
  • Each antenna in electronic device 100 can be used to cover a single or multiple channels. Different antennas can also be reused to improve the utilization of the antennas.
  • antenna 1 can be reused as a diversity antenna for a wireless local area network.
  • the antenna can be used in combination with a tuning switch.
  • the mobile communication module 150 can provide solutions for wireless communications including 2G/3G/4G/5G, etc., applied to the electronic device 100.
  • the mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc.
  • the mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation.
  • the mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1.
  • at least some of the functional modules of the mobile communication module 150 can be set in the processor 110.
  • at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.
  • the mobile communication module 150 can also be used to interact with other devices for information.
  • the modem processor may include a modulator and a demodulator.
  • the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal.
  • the demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal.
  • the demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing.
  • the application processor outputs a sound signal through an audio device (not limited to a speaker 170A, a receiver 170B, etc.), or displays an image or video through a display screen 194.
  • the modem processor may be an independent device.
  • the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.
  • the wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (WiFi) network), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR) and the like applied to the electronic device 100.
  • the wireless communication module 160 can be one or more devices integrating at least one communication processing module.
  • the wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 110.
  • the wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of the signal, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
  • the wireless communication module 160 is used to establish a connection with other electronic devices and perform data interaction.
  • the wireless communication module 160 can be used to access the access point device, send control instructions to other electronic devices, or receive data sent from other electronic devices.
  • the electronic device 100 can implement audio functions through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone interface 170D, and the application processor. For example, music playback, recording, etc.
  • the electronic device 100 can receive input from the key 190 and generate key signal input related to the user settings and function control of the electronic device 100.
  • the electronic device 100 can use the motor 191 to generate a vibration prompt (such as an incoming call vibration prompt).
  • the indicator 192 in the electronic device 100 can be an indicator light, which can be used to indicate the charging status, power changes, and can also be used to indicate messages, missed calls, notifications, etc.
  • the SIM card interface 195 in the electronic device 100 is used to connect the SIM card. The SIM card can be inserted into the SIM card interface 195, or pulled out from the SIM card interface 195, to achieve contact and separation with the electronic device 100.
  • the electronic device 100 may include more or fewer components than those shown in FIG. 1, and the embodiments of the present application are not limited thereto.
  • the illustrated electronic device 100 is only an example, and the electronic device 100 may have more or fewer components than those shown in the figure, may combine two or more components, or may have different component configurations.
  • the various components shown in the figure may be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and/or application specific integrated circuits.
  • the software system of the electronic device 100 can adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture.
  • the layered architecture divides the software into several layers, each with a clear role and division of labor.
  • the layers communicate with each other through software interfaces.
  • the software architecture can be divided into four layers, from top to bottom, namely, the application layer, the application framework layer (framework, FWK), the runtime and system library, and the (Linux) kernel layer.
  • the application layer is the top layer of the operating system, including native applications of the operating system, such as camera, gallery, calendar, Bluetooth, music, video, information, etc., and may also include third-party applications.
  • the application involved in the embodiment of the present application is referred to as application (APP), which is a software program that can implement one or more specific functions.
  • APP application
  • multiple applications can be installed in an electronic device, such as a camera application, a mailbox application, etc.
  • the application mentioned below may be a system application installed when the electronic device leaves the factory, or it may be a third-party application downloaded from the Internet or obtained from other electronic devices by the user while using the electronic device.
  • applications can be developed using the Java language by calling the application programming interface (API) provided by the application framework layer. Developers can interact with the bottom layer of the operating system (such as the kernel layer) through the application framework to develop their own applications.
  • API application programming interface
  • the application framework layer is the API and programming framework of the application layer.
  • the application framework layer may include some predefined functions.
  • the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, etc.
  • the window manager is used to manage window programs.
  • the window manager can obtain the display screen size, determine whether there is a status bar, lock the display screen (or screen), capture the display screen, etc.
  • Content providers are used to store and retrieve data and make these data accessible to applications.
  • the data may include files (such as documents, videos, images, audio), text and other information.
  • the view system includes visual controls, such as controls for displaying text, images, documents, etc.
  • the view system can be used to build applications.
  • the interface in the display window can be composed of one or more views.
  • the display interface including the SMS notification icon can include a view for displaying text and a view for displaying images.
  • the phone manager is used to provide communication functions for electronic devices.
  • the notification manager enables applications to display notification information in the status bar, which can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction.
  • the runtime includes the core library and the virtual machine.
  • the runtime is responsible for the scheduling and management of the system.
  • the core library of the system consists of two parts: one is the function that the Java language needs to call, and the other is the core library of the system.
  • the application layer and the application framework layer run in the virtual machine. Taking Java as an example, the virtual machine executes the Java files of the application layer and the application framework layer as binary files.
  • the virtual machine is used to perform object life cycle management, stack management, thread management, security and exception management, and garbage collection.
  • the system library can include multiple functional modules. For example: surface manager, media library, 3D graphics processing library (for example: OpenGL ES), 2D graphics engine (for example: SGL), image processing library, etc.
  • the surface manager is used to manage the display subsystem and provide the fusion of 2D and 3D layers for multiple applications.
  • the media library supports a variety of commonly used audio and video format playback and recording, as well as static image files, etc.
  • the media library can support a variety of audio and video encoding formats, such as: MPEG4, H.564, MP3, AAC, AMR, JPG, PNG, etc.
  • the 3D graphics processing library is used to implement 3D graphics drawing, image rendering, synthesis and layer processing, etc.
  • the 2D graphics engine is a drawing engine for 2D drawing.
  • the kernel layer provides the core system services of the operating system, such as security, memory management, process management, network protocol stack and driver model, which are all implemented based on the kernel layer.
  • the kernel layer also serves as an abstraction layer between the hardware and software stacks. This layer has many drivers related to electronic devices, the main drivers are: display driver; keyboard driver as input device; Flash driver based on memory technology device; camera driver; audio driver; Bluetooth driver; WiFi driver, etc.
  • the software architecture shown in FIG. 2 may be applied to an Android system.
  • the solution provided in the embodiment of the present application can be applied to the scenario where one device projects audio to multiple devices (i.e., performs audio broadcasting). Specifically, it can be applied to the scenario where an electronic device projects audio to multiple audio playback devices, that is, the electronic device sends audio to multiple audio playback devices and the audio is played by multiple audio playback devices. Among them, the electronic device can project different audio to one or more audio playback devices among the multiple audio playback devices respectively, and can ensure that the projection processes corresponding to different audio are independent of each other and do not interfere with each other.
  • the solution provided in the embodiment of the present application can be applied to the audio playback system including an electronic device and multiple audio playback devices shown in Figure 3.
  • the electronic device can control the sound projection of multiple audio playback devices.
  • the electronic device itself can play audio, or the electronic device can send audio to at least one audio playback device among the multiple audio playback devices, and the at least one audio playback device plays the audio.
  • composition framework of the electronic device shown in FIG. 1 or FIG. 2 can be used as a possible implementation of the electronic device or audio playback device provided in the embodiment of the present application.
  • the structure of the electronic device or audio playback device can also be implemented in other ways, for example, it can include more or fewer modules, etc., which is not specifically limited in the embodiment of the present application.
  • the distributed device virtualization platform can realize resource integration, device management, and data processing of different devices, and multiple devices together form a super virtual terminal. For different types of tasks, the platform matches and selects execution hardware with appropriate capabilities for users, allowing services to flow continuously between different devices, giving full play to the capabilities of different devices, such as display capabilities, camera capabilities, audio capabilities, interaction capabilities, and sensor capabilities.
  • the electronic device can construct a virtual audio device corresponding to the audio playback device through the distributed device virtualization platform, and construct a sound projection channel between the electronic device and the audio playback device through the virtual audio device to achieve unique audio playback of different audios.
  • one virtual audio device can correspond to at least one audio playback device, and the electronic device can transmit the audio to be played to the corresponding audio playback device through the virtual audio device for playback.
  • multiple audio playback devices and electronic devices can be connected to each other by communication, wherein the communication connection method can adopt a short-range wireless communication method such as WiFi, Bluetooth, etc.
  • the electronic device and the multiple audio playback devices are located in the same spatial environment, which can be, for example, a spatial environment corresponding to a family, the same indoor environment, a set spatial area, etc.
  • the multiple audio playback devices in the spatial environment can provide audio playback services to the user under the control of the electronic device.
  • the multiple audio playback devices are online audio playback devices scanned by the electronic device in the spatial environment.
  • the electronic device described in the embodiment of the present application at least has a communication function and supports a virtual audio device function.
  • the electronic device may also have other functions such as an audio playback function, a display function, etc., which are not specifically limited in the embodiment of the present application.
  • the audio playback device described in the embodiment of the present application is a device that at least has an audio playback function and a communication function.
  • the audio output device may also have other functions such as a display function, etc., which are not specifically limited in the embodiment of the present application.
  • the solution provided in the embodiments of the present application can be applied in a home scenario, where the electronic device may be a portable device such as a mobile phone, a tablet, a computer, etc., and the audio output device may be a large screen (or smart screen), a speaker, headphones, and other devices.
  • the electronic device may be a portable device such as a mobile phone, a tablet, a computer, etc.
  • the audio output device may be a large screen (or smart screen), a speaker, headphones, and other devices.
  • FIG4 is a schematic diagram of the architecture of an audio control system provided by an embodiment of the present application.
  • the audio control system can be deployed in an electronic device, specifically in an application layer, an application framework layer, and a hardware abstract layer (HAL) in a software system of the electronic device.
  • the audio control system is used to select an audio playback device for playing application audio and send the audio to the selected audio playback device for playback.
  • HAL hardware abstract layer
  • the audio control system may include an application, a virtual audio framework module, an audio processing module, a communication module, a local audio (Audio Primary) HAL module, a virtual audio (Virtual Audio) HAL module, etc.
  • the application belongs to the application layer of the electronic device software system
  • the audio framework module, the audio processing module, and the communication module are located in the application framework layer of the electronic device software system
  • the local audio HAL module and the virtual audio HAL module are located in the HAL layer of the electronic device software system.
  • the virtual audio framework module is used to configure an audio routing strategy, that is, a routing strategy for transmitting audio to a playback device, wherein the playback device may be the electronic device itself or at least one audio playback device connected to the electronic device.
  • the audio routing strategy may include a correspondence between the electronic device and the audio playback device.
  • the electronic device may transmit the audio stream applied in the electronic device to the audio playback device corresponding to the electronic device for playback based on the audio routing strategy.
  • the audio routing strategy may include a correspondence between different applications or different audio types and audio playback devices. Then the electronic device may transmit the audio streams of different applications or different audio types in the electronic device to different audio playback devices for playback based on the audio routing strategy.
  • the audio processing module is used to receive the audio stream from the application in the application layer, and distribute (i.e., transmit) the audio stream to the local audio HAL module or virtual audio HAL module of the HAL layer according to the audio routing strategy configured by the virtual audio framework module.
  • the audio processing module determines that the audio is played by the electronic device itself according to the audio routing strategy, the audio processing module can distribute the audio stream corresponding to the audio to the local audio HAL module; if the audio processing module determines that the audio is played by the audio playback device connected to the electronic device according to the audio routing, the audio processing module can distribute the audio stream corresponding to the audio to the virtual audio HAL module, and the virtual audio HAL module performs subsequent transmission.
  • the audio processing module may include an audio policy engine (Audio Policy Engine) and an audio manager (Audio Flinger).
  • the audio policy engine is used to receive an audio stream (Audio Track) from an application in the application layer, identify the type of the audio stream, and determine the direction of the audio stream according to the type of the audio stream and the audio routing policy configured by the virtual audio framework module.
  • the audio manager is used to distribute the audio stream according to the direction of the audio stream determined by the audio policy engine.
  • the audio manager can distribute the audio stream to different virtual audio devices in the virtual audio HAL module through different buses.
  • Different buses have different bus numbers, and the bus number can be used to identify the bus, and each bus can be connected to one or more virtual audio devices in the virtual audio HAL module.
  • the audio manager can send the audio stream to the corresponding bus through the mixer corresponding to the bus, and each bus corresponds to a mixer.
  • the local audio HAL module is used to transmit the audio stream from the audio manager to the local audio playback device of the electronic device for audio playback.
  • the virtual audio HAL module is used to maintain virtual audio devices corresponding to the audio playback devices connected to the electronic device, wherein each virtual audio device corresponds to at least one audio playback device, and is used to transmit the audio from the audio manager to the communication module.
  • the virtual audio devices maintained by the virtual audio HAL module can be dynamically expanded, and the virtual audio HAL module can be created or Delete the virtual audio device corresponding to the audio playback device. Based on this method, the virtual audio HAL module can maintain the virtual audio device corresponding to at least one audio playback device selected by the user, and then transmit the audio stream through the virtual audio device.
  • the communication module can complete functions such as establishing a communication connection with the audio playback device, dynamically routing the audio stream from the virtual audio HAL and sending it to the audio playback device for playback.
  • the communication module dynamically routes the audio stream from the virtual audio HAL, that is, the communication module determines the audio playback device corresponding to the audio stream from the virtual audio HAL based on the audio routing strategy configured by the virtual audio framework, and sends the audio stream to the corresponding audio playback device for playback.
  • the application layer shown in FIG. 4 above can be implemented as the application layer shown in FIG. 2, the virtual audio framework module, audio processing module, communication module, etc. shown in FIG. 4 above can be deployed in the application framework layer shown in FIG. 2, the local audio HAL module and virtual audio HAL module shown in FIG. 4 above can be deployed in the HAL layer, and the HAL layer can be used as the interface layer between the kernel layer shown in FIG. 2 and the hardware circuit (not shown in FIG. 2).
  • the HAL layer may include a bus for transmitting an audio stream (or audio data).
  • the system architecture of the audio control system described above is only an example.
  • the audio control system may also be divided into more or fewer functional modules (or services) according to other factors, or the functions of each module may be divided in other ways, or the functional modules may not be divided but the system may work as a whole.
  • the audio control system may also include more or fewer functional modules.
  • connection method between the functional modules or devices and the data routing method shown in Figure 4 are only an exemplary description provided in the embodiments of the present application.
  • the connection method between the functional modules or devices inside the electronic device and the data routing method are not limited to the method shown in Figure 4. During specific implementation, relevant deployment can be carried out according to the method executed.
  • the electronic device can send the audio to be played to the audio playback device for playback according to a pre-configured audio routing strategy, wherein the audio routing strategy configures the mapping relationship between the audio, the bus inside the electronic device for transmitting the audio, the virtual audio device created by the electronic device, and the audio playback device. Based on the mapping relationship, the electronic device can transmit the audio to the corresponding virtual audio device through the bus corresponding to the audio, and transmit the audio to the audio playback device through the virtual audio device for playback.
  • an audio playback method provided in an embodiment of the present application may include:
  • S501 The electronic device establishes communication connections with multiple audio playback devices.
  • the electronic device can determine multiple available audio playback devices by scanning the devices in the environment, and establish communication connections with the multiple audio playback devices respectively.
  • the electronic device can automatically scan and discover the audio playback devices in the environment, or scan and discover the audio playback devices in the environment after receiving user instructions.
  • the electronic device After establishing a communication connection with the multiple audio playback devices, the electronic device can obtain the identification information of each audio playback device respectively. When the user needs to select an audio playback device for projection, the electronic device can display the obtained identification information of the multiple audio playback devices to the user so that the user can select the audio playback device for projection.
  • the identification information of the audio playback device can be information that can uniquely identify the audio playback device, such as the name and location of the audio playback device.
  • the electronic device creates a first virtual audio device in response to a received first operation; wherein the first operation is used to select at least one audio playback device from the multiple audio playback devices as a device for playing a first audio; and the first virtual audio device corresponds to the at least one audio playback device.
  • the electronic device may also, after establishing a communication connection with the multiple electronic devices, pre-process and pre-execute a portion of the process of creating virtual audio devices corresponding to some or all of the multiple electronic devices in a pre-processing manner, and then execute the subsequent process required to create the first virtual audio playback device after receiving the first operation.
  • the electronic device may pre-create virtual audio devices corresponding to the multiple electronic devices but not activate the virtual audio devices, and after receiving the first operation, the electronic device selects the first virtual audio device from the pre-created virtual audio devices and activates it, thereby completing the creation of the first virtual audio device.
  • the first audio may be any of the following types of audio: audio belonging to the electronic device, audio belonging to the first application, and audio belonging to the first audio type.
  • the electronic device can perform audio projection in different projection modes, and when the projection mode adopted by the electronic device is different, the type of the first audio is different. Before the electronic device creates the first virtual audio device in response to the received first operation, it can first determine the adopted projection mode and the type of the first audio.
  • the sound projection mode adopted by the electronic device may be any of the following modes:
  • Mode 1 Device audio projection mode. In this mode, the first audio is the audio belonging to the electronic device.
  • the per-device audio projection mode can be understood as a one-to-many audio projection mode.
  • the audio of an electronic device can be projected to at least one audio playback device among multiple audio playback devices for playback.
  • the first audio i.e., the audio generated by the electronic device
  • the electronic device directly projects the audio to the audio playback device selected by the user.
  • the electronic device can project all audio generated by itself to the audio playback device selected by the user from multiple audio playback devices connected to the electronic device for playback, thereby achieving the effect of projecting the audio of one electronic device to at least one other audio playback device for playback.
  • Mode 2 Audio projection mode by application.
  • the first audio is the audio belonging to the first application.
  • the first application may be an application selected by a user from applications installed in the electronic device, or may be an application indicated by a user, or may be an application running in the foreground of the electronic device.
  • the audio projection mode by application can be understood as a many-to-many audio projection mode.
  • the audio of each application in the electronic device can be projected to at least one audio playback device among multiple audio playback devices for playback, and the audio of different applications can be projected to different audio playback devices for playback.
  • the user can select the audio playback devices corresponding to different applications, and the electronic device can project the audio of different applications to the audio playback devices corresponding to the applications selected by the user.
  • the electronic device can project the audio of a specific application to an audio playback device selected by the user from among multiple audio playback devices connected to the electronic device for playback. Based on this method, the electronic device can achieve the effect of projecting the audio of different applications to different audio playback devices for playback.
  • Mode 3 audio projection mode based on audio type.
  • the first audio is audio belonging to the first audio type.
  • the first audio type may be an audio type selected by the user from a plurality of preset audio types, or may be an audio type specified by the user, or may be an audio type of the audio to be played or being played recognized by the electronic device.
  • the audio type may include, for example, video, music, audiobook, etc.
  • the audio type projection mode can be understood as a many-to-many projection mode.
  • audio of each audio type generated by the electronic device can be projected to at least one audio playback device among multiple audio playback devices for playback, and audio of different audio types can be projected to different audio playback devices for playback.
  • the user can select the audio playback device corresponding to the audio of different audio types, and the electronic device can project the audio of different audio types to the audio playback device corresponding to the audio type selected by the user.
  • the electronic device can project a specific type of audio to an audio playback device selected by the user from among multiple audio playback devices connected to the electronic device for playback. Based on this method, the electronic device can achieve the effect of projecting different types of audio to different audio playback devices for playback.
  • the electronic device may determine the adopted sound projection mode in any of the following ways:
  • Method 1 Select the sound projection mode according to the scene.
  • the electronic device can select the sound projection mode corresponding to the current scene as the desired sound projection mode from the above-mentioned multiple sound projection modes according to the preset correspondence between different scenes and sound projection modes.
  • the correspondence between different scenes and sound projection modes can be pre-configured by the system of the electronic device or pre-set by the user.
  • Method 2 determining the sound projection mode according to the user's instruction, that is, determining the sound projection mode selected by the user as the adopted sound projection mode.
  • the user can indicate the desired sound projection mode in real time.
  • the electronic device can display the above-mentioned available sound projection modes to the user, and the user can select the desired sound projection mode from them.
  • the electronic device can display a sound projection mode selection interface, in which the alternative sound projection modes can include the above-mentioned three sound projection modes, and of course can also include other more sound projection modes, or can include fewer sound projection modes, which is not specifically limited in the embodiments of the present application.
  • the user can select the desired sound projection mode from the sound projection modes displayed in the sound projection mode selection interface.
  • the electronic device can display an audio projection device selection interface after the user selects the audio projection mode or when the user triggers the audio projection, and the interface may include identification information of available audio playback devices, and the user can select which audio playback devices to project the audio to from the available audio playback devices.
  • the available audio playback devices are: audio playback devices that establish a communication connection with the electronic device.
  • the audio projection device selection interface displayed by the electronic device may include identification information of multiple audio playback devices that establish communication connections with the electronic device, such as speakers in the living room, a large screen in the living room, speakers in the bedroom, etc. The user can select the audio playback device to which the audio needs to be projected in the interface.
  • the electronic device can display an application selection interface after the user selects the audio projection mode or after the user triggers the configuration of the audio projection application, the interface includes a list of applications that support audio projection, and the user can select the application that needs to configure the audio projection device from the list. Then the electronic device can further display the audio projection device selection interface, which may include the identification information of the available audio playback devices, and the user can choose which audio playback devices to project the audio of the application from the available audio playback devices.
  • the available audio playback devices are: audio playback devices that establish a communication connection with the electronic device.
  • the electronic device when the user triggers the selection of the audio projection mode in the application interface displayed by the electronic device, the electronic device can display the audio projection device selection interface after the user selects the audio projection mode, the interface may include the identification information of the available audio playback devices, and the user can choose which audio playback devices to project the audio of the application currently running in the foreground from the available audio playback devices.
  • the available audio playback devices are: audio playback devices that establish a communication connection with the electronic device.
  • the method for the electronic device to select the sound projection device can refer to the method for the electronic device to select the sound projection device in the sound projection mode by application mentioned above, which will not be described in detail here.
  • the electronic device can display controls for triggering functions such as sound projection in a setting interface (such as a system setting interface, an application interface, etc.).
  • a setting interface such as a system setting interface, an application interface, etc.
  • the user can trigger the electronic device to display the corresponding function interface by operating the relevant controls.
  • the first operation is an operation of the user selecting an audio playback device, for example, it can be an operation of the user selecting an audio playback device in the above-mentioned sound projection device selection interface.
  • the electronic device can determine at least one audio device selected by the user based on the first operation, and can create a first virtual audio device corresponding to the at least one audio playback device.
  • the first virtual audio device is used to transmit the audio generated by the upper-layer application in the electronic device to the at least one audio playback device for playback.
  • the electronic device may not set the above-mentioned sound projection mode, but directly determine the sound projection device according to the user's selection.
  • the electronic device may add a control for triggering sound projection in the application interface, and may further display a sound projection device selection interface in response to the user's operation on the control, which may include information indicating available audio playback devices, and the user can select which audio playback devices to project the sound to from the available audio playback devices.
  • the available audio playback devices include audio playback devices that establish a communication connection with the electronic device.
  • the audio projection device selection interface displayed by the electronic device may include information on multiple available audio playback devices that establish communication connections with the electronic device, such as living room speakers, living room large screens, bedroom speakers, etc.
  • the user can select an audio playback device that accepts audio projection in this interface.
  • a video interface may be displayed on the display screen of the mobile phone, and the interface may include controls for triggering audio projection.
  • the mobile phone may switch to display the application interface shown in the schematic diagram (a) in Figure 6, which includes an audio projection device selection interface, and the user can select at least one audio output device (such as a living room large screen and a living room speaker) as an audio projection device in the audio projection device selection interface, and then play the audio corresponding to the video through the selected audio projection device.
  • a music application in a mobile phone plays music
  • a music playback interface may be displayed on the display screen of the mobile phone, and the interface may include controls for triggering audio projection.
  • the mobile phone can switch to display the application interface shown in the schematic diagram (b) in Figure 6, which includes a sound projection device selection interface.
  • the user can select at least one audio output device (such as a bedroom speaker) as a sound projection device in the sound projection device selection interface, and then play music through the selected sound projection device.
  • the user can independently select the sound projection device for playing the audio of each application in the application interface of the application, and the selection process of the sound projection devices corresponding to different applications is independent of each other.
  • the electronic device can project the audio of different applications to the audio playback device selected by the user for playback, thereby achieving the effect of projecting by application.
  • S503 The electronic device establishes a mapping relationship among the first audio, the first virtual audio device, and the at least one audio playback device, and saves the mapping relationship as an audio routing policy.
  • the electronic device after creating the first virtual audio device, can obtain a mapping relationship between the first audio, the first virtual audio device, and the at least one audio playback device, and can use the mapping relationship as an audio routing strategy.
  • the electronic device may allocate a corresponding first bus to the first virtual audio device after creating the first virtual audio device, and the first bus is specifically used to transmit the audio generated by the system or application in the electronic device to the first virtual audio device.
  • the electronic device may use the mapping relationship between the first audio, the first bus, the first virtual audio device, and the at least one audio playback device as an audio routing strategy.
  • the electronic device may randomly select a bus from the idle buses as the first bus, or may select the first bus from the idle buses according to a preconfigured bus selection rule. After the electronic device configures the first bus for the first virtual audio device, the state of the first bus changes from an idle state to a non-idle state.
  • the electronic device can The relationship determines a transmission path of the first audio and an audio playback device that plays the first audio, and then transmits the first audio to the corresponding audio playback device through the determined transmission path for playback.
  • the electronic device can record the identification information of the first audio, the identification information of the first virtual audio device, the bus number of the first bus, the identification information of the at least one audio playback device, etc. in the created mapping relationship.
  • the electronic device can use the device/application/audio type to which the first audio belongs as the identification information of the first audio.
  • the first audio can be any audio generated by the electronic device, and the electronic device can use the identification information of the electronic device as the identification information of the first audio.
  • the identification information of the electronic device can be the name of the electronic device, the location, the device ID, and other information that can uniquely identify the electronic device.
  • the first audio can be any audio generated by the first application, and the electronic device can use the identification information of the first application as the identification information of the first audio.
  • the identification information of the first application can be, for example, the name, code, and other information that can uniquely identify the first application.
  • the first audio can be any audio of the first audio type generated by the electronic device, and the electronic device can use the first audio type as the identification information of the first audio.
  • the identification information of the virtual audio device can be the name of the virtual audio device, the identification document (ID) (which can be configured by the electronic device), and other information that can uniquely identify the virtual audio device.
  • the bus number of the first bus may be a system configuration of the electronic device.
  • the identification information of the audio playback device may be a name of the audio playback device, an identification document (ID), or other information that can uniquely identify the audio playback device.
  • the electronic device can establish multiple groups of mapping relationships used as audio routing strategies. For example, taking the electronic device adopting the sound projection mode described in the above mode 2 as an example, an audio routing strategy provided in the embodiment of the present application is shown in Table 1 below:
  • the applications 1 to 3 shown in the above Table 1 are applications in the electronic device, buses 0 to 2 are buses inside the electronic device, local audio playback services and virtual audio devices 1 to 2 can be system services inside the electronic device, audio playback device 0 can be the electronic device itself, and audio playback devices 1 to 3 are multiple audio playback devices that establish communication connections with the electronic device.
  • the audio routing strategy shown in the above Table 1 includes three groups of mapping relationships. Among them, the audio playback device 0 in the mapping relationship 1 is the electronic device itself, corresponding to the audio of application 1, bus 0 and local audio playback service. The audio playback device 1 in the mapping relationship 2 corresponds to the audio of application 2, bus 1 and virtual audio device 1.
  • the audio playback devices 2 to audio playback devices 3 in the mapping relationship 3 correspond to the audio of application 3, bus 2 and virtual audio device 2.
  • the audio of application 1 can be transmitted to the local audio playback device, that is, the player of the electronic device itself, through bus 0 and the local audio playback service for playback.
  • the audio of application 2 can be transmitted to the audio playback device 1 through bus 1 and virtual audio device 1 for playback.
  • the audio of application 3 can be transmitted to audio playback device 2 and audio playback device 3 through bus 2 and virtual audio device 2 for playback.
  • the electronic device can update the mapping relationship in the audio routing policy according to user instructions or changes in actual scenarios. For example, based on the scenario corresponding to the audio routing policy shown in Table 1 above, when the user chooses to update the device that plays application 2 to audio playback device 4, the electronic device can update the audio playback device 2 in the routing mapping relationship 2 to the audio playback device 4, thereby implementing the update of the audio routing policy. For another example, based on the scenario corresponding to the audio routing policy shown in Table 1 above, when the audio playback device 2 goes offline, the communication connection between the electronic device and the audio playback device 2 is disconnected, and the electronic device can delete the routing mapping relationship 2, thereby implementing the update of the audio routing policy.
  • the electronic device can dynamically maintain the audio routing strategy by maintaining the above routing mapping relationship table, so as to perform audio projection related control according to the audio routing strategy.
  • step S503 may be completed by the above-mentioned first service.
  • S504 When the electronic device receives an instruction to play the first audio or to project the first audio to other audio playback devices for playback, the first audio is transmitted to the at least one audio playback device through the first virtual audio device, and the at least one audio playback device is instructed to play the first audio.
  • the electronic device can transmit the first audio generated by the application in the electronic device to the first virtual audio device through the first bus allocated to the first virtual audio device, and then the first virtual audio device transmits the first audio to the corresponding at least one audio playback device for playback.
  • the specific implementation of this step can be referred to the relevant introduction below, which will not be described in detail here.
  • the electronic device when it is in the process of projecting the first audio to the at least one audio playback device for playback, if it is necessary to disconnect the projection, it can stop sending the audio to the at least one audio playback device, delete the mapping relationship between the first audio, the first virtual audio device and the at least one audio playback device, delete (or destroy) the created first virtual audio device, and set the first bus corresponding to the first virtual audio device to an idle state.
  • the electronic device when there is an offline device in the at least one audio playback device, can delete the mapping relationship between the first audio, the first virtual audio device and the at least one audio playback device, delete the created first virtual audio device, and set the first bus corresponding to the first virtual audio device to an idle state.
  • the electronic device when there is an offline device in the at least one audio playback device, can update the mapping relationship between the first audio, the first virtual audio device and the at least one audio playback device to the mapping relationship between the first audio, the first virtual audio device and the audio playback device that is not offline in the at least one audio playback device.
  • the electronic device can be played through the device that is not offline in the at least one audio playback device.
  • the electronic device can delete the mapping relationship between the first audio, the first virtual audio device and the at least one audio playback device, delete the created first virtual audio device, and set the first bus corresponding to the first virtual audio device to an idle state.
  • the electronic device can configure the audio routing strategy based on user needs, and forward the audio stream through the virtual audio device according to the strategy, so as to achieve the effect of projecting the audio of the electronic device to other audio playback devices for playback.
  • the method can support the above processing of different audio in parallel, and can achieve the effect of transmitting different audio to different audio playback devices for playback through different virtual audio devices, with high flexibility and practicality.
  • the following takes the method provided in the above embodiment as an example applied to the audio control system shown in Figure 4 above, and takes the electronic device adopting the sound projection mode described in the above mode 2 and the user triggering the sound projection in the application as an example to illustrate the solution provided in the embodiment of the present application.
  • the electronic device can execute the method provided in the above embodiment to create a virtual audio device and establish an audio routing strategy, and perform audio projection-related controls according to the established audio routing strategy during the audio projection process.
  • the electronic device can delete the created virtual audio device and audio routing strategy, and disconnect the communication connection with the audio playback device.
  • a possible process of the electronic device starting the audio projection function and configuring the audio routing strategy may include:
  • a communication module in the electronic device establishes a communication connection with the scanned audio playback device.
  • the application in the electronic device receives an audio projection start operation performed by the user, where the operation is used to indicate the start of the audio projection function and to indicate multiple audio playback devices for playing the audio of the application.
  • the application Before receiving the start-up audio projection operation, the application may first determine the audio projection mode to be adopted, namely, the above-mentioned mode 2, according to the user's instructions or the current application scenario, and indicate the audio projection mode to the audio processing module.
  • the multiple audio playback devices may be audio playback devices that have established a communication connection with the electronic device.
  • the method for an electronic device to determine the audio playback device that receives the sound projected by the electronic device based on user operations can be referred to the introduction in the above embodiments and will not be repeated here.
  • the application instructs the audio processing module in the electronic device to configure audio paths corresponding to multiple audio playback devices, where the audio paths are used to project the audio of the application to the multiple audio playback devices.
  • the audio processing module instructs the virtual audio HAL module in the electronic device to create virtual audio devices corresponding to the multiple audio playback devices, and selects a bus allocated to the virtual audio device from the idle buses and sets the bus to a non-idle state.
  • the virtual audio HAL module creates virtual audio devices corresponding to the multiple audio playback devices.
  • S706 The virtual audio HAL module notifies the audio processing module that the virtual audio device has been successfully created.
  • the audio processing module notifies the communication module to establish a mapping relationship between the virtual audio device and the multiple audio playback devices.
  • the communication module establishes a mapping relationship between the virtual audio device and the multiple audio playback devices, and creates a virtual audio data path based on the mapping relationship.
  • the virtual audio data path is used to send the audio from the virtual audio device to the multiple audio playback devices.
  • the communication module notifies the audio processing module that the virtual audio data path has been successfully created.
  • the audio processing module notifies the application that the audio path has been successfully created.
  • a possible process for the electronic device to turn off the sound projection may include:
  • S801 An application in the electronic device receives an operation performed by a user, where the operation is used to trigger the stop of the audio projection.
  • the application instructs the audio processing module in the electronic device to disconnect the audio paths corresponding to the multiple audio playback devices, where the audio paths are paths configured by the audio processing module to transmit the audio of the application to the multiple audio playback devices.
  • the audio processing module instructs the communication module in the electronic device to delete the established mapping relationship between the virtual audio device and the multiple audio playback devices.
  • the communication module deletes the established mapping relationship between the virtual audio device and the multiple audio playback devices, and disconnects the established virtual audio data path, where the virtual audio data path is used to send the audio from the virtual audio device to the multiple audio playback devices.
  • the audio processing module instructs the virtual audio HAL module in the electronic device to delete the created virtual audio device, and sets the bus allocated to the virtual audio device to an idle state.
  • step S801 may be performed after step S710 .
  • an audio playback method provided in an embodiment of the present application may include:
  • S901 The first application generates the first audio in response to an instruction to play the first audio.
  • S902 The first application sends the first audio to the audio processing module.
  • the audio processing module determines, according to a pre-created audio routing policy, a first virtual audio device corresponding to the first audio and a first bus corresponding to the first virtual audio device.
  • the audio processing module sends the first audio and first bus indication information to the first virtual audio device through the first bus, wherein the first bus indication information is used to indicate the first bus.
  • the first virtual audio device receives the first audio from the audio processing module through the corresponding first bus.
  • the first bus indication information may be a bus number of the first bus.
  • the first virtual audio device sends the first audio and first device indication information to the communication module, wherein the first device indication information is used to indicate the first audio playback device.
  • the first virtual audio device may instruct the communication module to send the first audio to the first audio playback device.
  • the first device indication information may be the first bus indication information
  • the communication module may determine the first bus according to the first bus indication information, determine the corresponding first virtual audio device according to the first bus, and further determine the corresponding first audio playback device according to the first virtual audio device.
  • the first device indication information may also be a device identifier of the first audio playback device.
  • the communication module determines the first audio playback device according to the first device indication information.
  • the communication module sends the first audio to the first audio playback device.
  • step S901 is executed after step S710
  • step S801 is executed after step S907.
  • an audio playback method provided in an embodiment of the present application may include:
  • S1001 The second application generates a second audio in response to an instruction to play the second audio.
  • S1002 The second application sends the second audio to the audio processing module.
  • the audio processing module determines, according to a pre-created audio routing strategy, a second virtual audio device corresponding to the second audio and a second bus corresponding to the second virtual audio device.
  • the audio processing module sends the second audio and the second bus indication information to the second virtual audio device through the second bus, wherein the second bus indication information is used to indicate the second bus.
  • the second virtual audio device receives the second audio from the audio processing module through the corresponding second bus.
  • the second bus indication information may be a bus number of the second bus.
  • the second virtual audio device sends the second audio and second device indication information to the communication module, wherein the second device indication information is used to indicate the second audio playback device.
  • the second virtual audio device may instruct the communication module to send the second audio to the second audio playback device.
  • the communication module determines the second audio playback device according to the second device indication information.
  • the communication module sends the second audio to the second audio playback device.
  • the execution order of the method shown in FIG. 10 and the method shown in FIG. 9 can be any order, that is, the method shown in FIG. 10 can be executed earlier than the method shown in FIG. 9, or the method shown in FIG. 10 can be executed later than the method shown in FIG. 9, or the method shown in FIG. 10 can be executed synchronously with the method shown in FIG. 9.
  • the method shown in FIG. 10 is executed after the execution of the method shown in FIG. 7 is completed and before the execution of the method shown in FIG. 8 is started, that is, step S1001 is executed after step S710, and step S801 is executed after step S1007.
  • the embodiment of the present application further provides an audio playback method, as shown in FIG11 , which may include:
  • a first electronic device In response to a received first operation, a first electronic device sends a first audio to at least one second electronic device and instructs the at least one second electronic device to play the first audio; wherein the first operation is used to instruct the at least one second electronic device to play the first audio.
  • the first electronic device may include a first application, an audio processing service, and an audio sending service.
  • the first application is used to generate a first audio and send the first audio to the audio processing service.
  • the audio processing service can be used to distribute the first audio to a first virtual audio device corresponding to the at least one second electronic device created by the first electronic device.
  • the first virtual audio device can be used to send the first audio to the audio sending service.
  • the audio sending service can be used to send the first audio to the at least one second electronic device.
  • the first application can be any application in the audio control system shown in Figure 4, the audio processing service can be the audio processing module in the audio control system shown in Figure 4, the audio sending service can be the communication module in the audio control system shown in Figure 4, and the first virtual audio device can be a virtual audio device in the audio control system shown in Figure 4.
  • the first application, the audio processing service, the first virtual audio device and the audio sending service can transmit the audio of the first application based on the audio routing strategy configured by the virtual audio framework module in the audio control system shown in Figure 4, thereby transmitting the audio of the first application to at least one second electronic device for playback.
  • the specific implementation process of this method can be implemented with reference to the method described in the aforementioned embodiment, which will not be described in detail here.
  • the first electronic device In response to receiving a second operation, the first electronic device sends a second audio to at least one third electronic device and instructs the at least one third electronic device to play the second audio; wherein the second operation is used to instruct the at least one third electronic device to play the second audio; the first audio and the second audio belong to different applications of the first electronic device, or the first audio and the second audio are of different audio types.
  • the second audio may be audio of a different audio type from the first audio, generated by a first application in the first electronic device.
  • the first electronic device may also include a second application, and the second application may be used to generate a second audio.
  • the audio processing service in the first electronic device may also be used to distribute the second audio to a second virtual audio device corresponding to the at least one third electronic device created by the first electronic device.
  • the second virtual audio device may be used to send the second audio to the audio sending service.
  • the audio sending service may be used to send the second audio to the at least one third electronic device.
  • the first electronic device may be the electronic device described in the aforementioned embodiment
  • the second electronic device and the third electronic device may be the audio playback device described in the aforementioned embodiment
  • the first audio and the second audio may be audio of different applications or different audio types in the electronic device.
  • the specific implementation of the above step S1101 may refer to the method shown in FIG5
  • the specific implementation of the above step S1102 may also refer to the method shown in FIG5 , which will not be described in detail here.
  • the embodiment of the present application also provides an electronic device, which can be used to implement the audio playback method provided in the embodiment of the present application.
  • the electronic device 1200 may include: a display screen 1201, a memory 1202, one or more processors 1203, and one or more computer programs (not shown in the figure).
  • the above-mentioned devices can be coupled via one or more communication buses 1204.
  • the display screen 1201 is used to display application interfaces and other related user interfaces.
  • One or more computer programs are stored in the memory 1202, and the one or more computer programs include computer instructions; one or more processors 1203 call the computer instructions stored in the memory 1202, so that the electronic device 1200 executes the audio control method provided in the embodiment of the present application.
  • the memory 1202 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more disk storage devices, flash memory devices, or other non-volatile solid-state storage devices.
  • the memory 1202 may store an operating system (hereinafter referred to as system), such as an embedded operating system such as ANDROID, IOS, WINDOWS, or LINUX.
  • system an operating system
  • the memory 1202 may be used to store an implementation program of an embodiment of the present application.
  • the memory 1202 may also store a network communication program, which may be used to communicate with one or more additional devices, one or more user devices, or one or more network devices.
  • One or more processors 1203 can be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits used to control the execution of the program of the present application.
  • CPU central processing unit
  • ASIC application-specific integrated circuit
  • FIG. 12 is only one implementation of the electronic device 1200 provided in the embodiment of the present application. In actual applications, the electronic device 1200 may also include more or fewer components, which is not limited here.
  • an embodiment of the present application further provides a computer-readable storage medium, which stores a computer program.
  • the computer program runs on a computer, the computer executes the method provided in the above embodiments.
  • the embodiments of the present application also provide a computer program product, which includes a computer program or instructions.
  • the computer program or instructions When the computer program or instructions are run on a computer, the computer executes the method provided in the above embodiments.
  • the method provided in the embodiment of the present application can be implemented in whole or in part by software, hardware, firmware or any combination thereof.
  • software When implemented using software, it can be implemented in whole or in part in the form of a computer program product.
  • the computer program product includes one or more computer instructions.
  • the process or function according to the embodiment of the present invention is generated in whole or in part.
  • the computer can be a general-purpose computer, a special-purpose computer, a computer network, a network device, a user device or other programmable device.
  • Computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium.
  • Computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center via wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means.
  • Computer-readable storage media can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more available media integrated. Available media can be magnetic media (e.g., floppy disks, hard disks, tapes), optical media (e.g., digital video discs (DVD), or semiconductor media (e.g., SSD), etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Theoretical Computer Science (AREA)
  • General Health & Medical Sciences (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Multimedia (AREA)
  • Telephone Function (AREA)

Abstract

An audio playback method and an electronic device. The method is applied to a first electronic device, and comprises: in response to a received first operation, sending a first audio to at least one second electronic device, and instructing the at least one second electronic device to play the first audio, the first operation being used for instructing to play the first audio by means of the at least one second electronic device (S1101); and in response to a received second operation, sending a second audio to at least one third electronic device, and instructing the at least one third electronic device to play the second audio, the second operation being used for instructing to play the second audio by means of the at least one third electronic device, the first audio and the second audio belonging to different applications of the first electronic device, or the audio types of the first audio and the second audio being different (S1102). According to the solution, audios of different applications or different types of audios in an electronic device can be casted to other different electronic devices for playback, so that the flexibility and practicability of playing audios by electronic devices are improved.

Description

一种音频播放方法及电子设备Audio playing method and electronic device
相关申请的交叉引用CROSS-REFERENCE TO RELATED APPLICATIONS
本申请要求在2022年11月02日提交中华人民共和国知识产权局、申请号为202211359898.2、申请名称为“一种音频播放方法及电子设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中;本申请要求在2023年01月31日提交中华人民共和国知识产权局、申请号为202310121194.X、申请名称为“一种音频播放方法及电子设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application filed with the Intellectual Property Office of the People's Republic of China on November 2, 2022, with application number 202211359898.2 and application name “A method for audio playback and an electronic device”, the entire contents of which are incorporated by reference into this application; this application claims the priority of the Chinese patent application filed with the Intellectual Property Office of the People's Republic of China on January 31, 2023, with application number 202310121194.X and application name “A method for audio playback and an electronic device”, the entire contents of which are incorporated by reference into this application.
技术领域Technical Field
本申请涉及电子设备技术领域,尤其涉及一种音频播放方法及电子设备。The present application relates to the technical field of electronic equipment, and in particular to an audio playback method and electronic equipment.
背景技术Background technique
目前终端设备可以通过蓝牙等短距离通信方式实现到其它音频播放设备的音频投播,即终端设备将自身生成的音频发送至其它音频播放设备进行播放。但是,当前音频投播场景中,发起音频投播的设备一般都是按照设定好的固定投音策略进行音频投播的,且通常仅支持将一路音频流投播到其它音频播放设备进行播放,因此音频投播效率较低,导致基于该方法进行音频播放的灵活性和实用性较低。Currently, terminal devices can broadcast audio to other audio playback devices through short-range communication methods such as Bluetooth, that is, the terminal device sends the audio generated by itself to other audio playback devices for playback. However, in the current audio broadcasting scenario, the device that initiates the audio broadcasting generally broadcasts the audio according to a set fixed audio broadcasting strategy, and usually only supports broadcasting one audio stream to other audio playback devices for playback. Therefore, the audio broadcasting efficiency is low, resulting in low flexibility and practicality of audio playback based on this method.
发明内容Summary of the invention
本申请提供一种音频播放方法及电子设备,用以将电子设备中不同应用或不同类型的音频投播到其它不同的电子设备进行播放,提高电子设备播放音频的灵活性和实用性。The present application provides an audio playback method and an electronic device, which are used to broadcast different applications or different types of audio in an electronic device to other different electronic devices for playback, thereby improving the flexibility and practicality of the electronic device in playing audio.
第一方面,本申请提供一种音频播放方法,该方法应用于第一电子设备,该方法包括:响应于接收到的第一操作,将第一音频发送到至少一个第二电子设备,并指示所述至少一个第二电子设备播放所述第一音频;其中,所述第一操作用于指示通过所述至少一个第二电子设备播放所述第一音频;响应于接收到的第二操作,将第二音频发送到至少一个第三电子设备,并指示所述至少一个第三电子设备播放所述第二音频;其中,所述第二操作用于指示通过所述至少一个第三电子设备播放所述第二音频;其中,所述第一音频与所述第二音频属于所述第一电子设备的不同应用,或者,所述第一音频与所述第二音频的音频类型不同。In a first aspect, the present application provides an audio playback method, which is applied to a first electronic device, and the method includes: in response to a received first operation, sending a first audio to at least one second electronic device, and instructing the at least one second electronic device to play the first audio; wherein the first operation is used to instruct the at least one second electronic device to play the first audio; in response to a received second operation, sending a second audio to at least one third electronic device, and instructing the at least one third electronic device to play the second audio; wherein the second operation is used to instruct the at least one third electronic device to play the second audio; wherein the first audio and the second audio belong to different applications of the first electronic device, or the first audio and the second audio are of different audio types.
在该方法中,电子设备可以将第一音频投播到至少一个第二电子设备进行播放,并可以将第二音频投播到至少一个第三电子设备进行播放,而第一音频与第二音频为不同应用或不同类型的音频。因此,基于该方法,电子设备能够将不同应用或不同类型的音频分别投播至其它不同的电子设备进行播放,且不同音频的投播过程相对独立,因此能够实现多路音频投播到多设备的效果,能够提高音频投播效率,进而提高电子设备播放音频的灵活性和实用性。In this method, the electronic device can broadcast the first audio to at least one second electronic device for playback, and can broadcast the second audio to at least one third electronic device for playback, and the first audio and the second audio are audio of different applications or different types. Therefore, based on this method, the electronic device can broadcast audio of different applications or different types to other different electronic devices for playback, and the broadcasting process of different audio is relatively independent, so it can achieve the effect of broadcasting multiple audio channels to multiple devices, improve the audio broadcasting efficiency, and thus improve the flexibility and practicality of electronic devices in playing audio.
在一种可能的设计中,在将第一音频发送到至少一个第二电子设备之前,所述方法还包括:创建第一虚拟音频设备;其中,所述第一虚拟音频设备对应所述至少一个第二电子设备;所述将第一音频发送到至少一个第二电子设备,包括:通过所述第一虚拟音频设备,将所述第一音频发送到所述至少一个第二电子设备。In one possible design, before sending the first audio to at least one second electronic device, the method also includes: creating a first virtual audio device; wherein the first virtual audio device corresponds to the at least one second electronic device; and sending the first audio to at least one second electronic device includes: sending the first audio to the at least one second electronic device through the first virtual audio device.
在该方法中,电子设备通过创建虚拟音频设备进行音频的传输,能够为音频流创建独立的音频传输通道,进而提高音频传输效率,同时能够避免与其它音频的传输产生冲突,进而支持多音频并行传输。In this method, the electronic device transmits audio by creating a virtual audio device, which can create an independent audio transmission channel for the audio stream, thereby improving the audio transmission efficiency, while avoiding conflicts with other audio transmissions, thereby supporting multi-audio parallel transmission.
在一种可能的设计中,在将第二音频发送到至少一个第三电子设备之前,所述方法还包括:创建第二虚拟音频设备;其中,所述第二虚拟音频设备对应所述至少一个第三电子设备;所述将第二音频发送到至少一个第三电子设备,包括:通过所述第二虚拟音频设备,将所述第二音频发送到所述至少一个第三电子设备。In one possible design, before sending the second audio to at least one third electronic device, the method also includes: creating a second virtual audio device; wherein the second virtual audio device corresponds to the at least one third electronic device; and sending the second audio to at least one third electronic device includes: sending the second audio to the at least one third electronic device through the second virtual audio device.
在该方法中,电子设备通过创建虚拟音频设备进行音频的传输,能够为音频流创建独立的音频传输通道,进而提高音频传输效率,同时能够避免与其它音频的传输产生冲突,进而支持多音频并行传输。In this method, the electronic device transmits audio by creating a virtual audio device, which can create an independent audio transmission channel for the audio stream, thereby improving the audio transmission efficiency, while avoiding conflicts with other audio transmissions, thereby supporting multi-audio parallel transmission.
在一种可能的设计中,在创建第一虚拟音频设备之前,所述方法还包括:在多种音频模式中选择当前场景对应的目标音频模式;其中,所述多种音频模式包括第一音频模式和第二音频模式,所述第一音 频模式为通过不同设备播放不同应用的音频的模式,所述第二音频模式为通过不同设备播放不同音频类型的音频的模式;所述创建第一虚拟音频设备,包括:当所述目标音频模式为所述第一音频模式时,创建与所述第一音频所属的应用关联的所述第一虚拟音频设备;当所述目标音频模式为所述第二音频模式时,创建与所述第一音频的音频类型关联的所述第一虚拟音频设备。In a possible design, before creating the first virtual audio device, the method further includes: selecting a target audio mode corresponding to the current scene from a plurality of audio modes; wherein the plurality of audio modes include a first audio mode and a second audio mode, and the first audio mode The first audio mode is a mode for playing audio of different applications through different devices, and the second audio mode is a mode for playing audio of different audio types through different devices; the creating of the first virtual audio device includes: when the target audio mode is the first audio mode, creating the first virtual audio device associated with the application to which the first audio belongs; when the target audio mode is the second audio mode, creating the first virtual audio device associated with the audio type of the first audio.
在该方法中,电子设备可以采用多种投音模式进行音频的投播,灵活性较高。此外,电子设备可以根据应用场景灵活选择具体采用的投音模式,因此实用性较高。In this method, the electronic device can use a variety of sound projection modes to broadcast audio, which is highly flexible. In addition, the electronic device can flexibly select the specific sound projection mode to be used according to the application scenario, so it is highly practical.
在一种可能的设计中,在通过所述第一虚拟音频设备,将所述第一音频发送到所述至少一个第二电子设备之后,所述方法还包括:响应于接收到的第三操作,通过所述第一虚拟音频设备,将第三音频发送到所述至少一个第二电子设备,并指示所述至少一个第二电子设备播放所述第三音频;其中,所述第三操作用于指示播放第三音频,所述第三音频与所述第一音频属于同一应用,或者,所述第三音频与所述第一音频的音频类型相同。In one possible design, after sending the first audio to the at least one second electronic device through the first virtual audio device, the method further includes: in response to a received third operation, sending a third audio to the at least one second electronic device through the first virtual audio device, and instructing the at least one second electronic device to play the third audio; wherein the third operation is used to instruct the playing of the third audio, the third audio and the first audio belong to the same application, or the third audio and the first audio have the same audio type.
在该方法中,电子设备能够采用相同的音频输出装置播放同一应用的音频或同一类型的音频,因此电子设备能够支持按类型投播音频,能够提高音频投播的效率,还能够提高用户收听体验。In this method, the electronic device can use the same audio output device to play audio of the same application or the same type of audio, so the electronic device can support audio broadcasting by type, which can improve the efficiency of audio broadcasting and improve the user's listening experience.
在一种可能的设计中,所述方法还包括:当确定所述至少一个第二电子设备中出现下线的电子设备时,销毁所述第一虚拟音频设备;或者,当确定所述至少一个第二电子设备均下线时,销毁所述第一虚拟音频设备。In one possible design, the method further includes: when it is determined that an electronic device among the at least one second electronic device is offline, destroying the first virtual audio device; or, when it is determined that all of the at least one second electronic device are offline, destroying the first virtual audio device.
在该方法中,当用于播放音频的设备下线时,该设备变为不可用状态,则电子设备可以删除已创建的该设备对应的虚拟音频装置,从而保证虚拟音频设备与可用的音频播放设备的对应性,同时减少不必要的资源消耗。基于该方法,电子设备可以根据可用的音频播放设备的状态,动态管理对应的虚拟音频设备,进而实现动态音频路由管理,因此灵活性和实用性较高。In this method, when a device for playing audio goes offline, the device becomes unavailable, and the electronic device can delete the virtual audio device corresponding to the device that has been created, thereby ensuring the correspondence between the virtual audio device and the available audio playback device, while reducing unnecessary resource consumption. Based on this method, the electronic device can dynamically manage the corresponding virtual audio device according to the status of the available audio playback device, thereby realizing dynamic audio routing management, so it is highly flexible and practical.
在一种可能的设计中,所述第一电子设备包括第一应用、音频处理服务和音频发送服务;在通过所述第一虚拟音频设备,将所述第一音频发送到所述至少一个第二电子设备之前,所述方法还包括:通过所述第一应用生成所述第一音频,并将所述第一音频发送至所述音频处理服务;通过所述音频处理服务将所述第一音频分发至所述第一虚拟音频设备;所述通过所述第一虚拟音频设备,将所述第一音频发送到所述至少一个第二电子设备,包括:通过所述第一虚拟音频设备接收来自所述音频处理服务的所述第一音频;通过所述第一虚拟音频设备,将所述第一音频发送至所述音频发送服务,并指示所述音频发送服务将所述第一音频发送至所述至少一个第二电子设备。In one possible design, the first electronic device includes a first application, an audio processing service and an audio sending service; before sending the first audio to the at least one second electronic device through the first virtual audio device, the method also includes: generating the first audio through the first application, and sending the first audio to the audio processing service; distributing the first audio to the first virtual audio device through the audio processing service; sending the first audio to the at least one second electronic device through the first virtual audio device includes: receiving the first audio from the audio processing service through the first virtual audio device; sending the first audio to the audio sending service through the first virtual audio device, and instructing the audio sending service to send the first audio to the at least one second electronic device.
在该方法中,电子设备可以通过虚拟音频设备、音频处理服务和音频发送服务建立第一应用对应的音频传输通道,进而实现对第一应用的音频的独立传输。基于该方法,电子设备能够针对不同应用分别创建对应的音频传输通道,进而能够在多应用同时投音时实现互相独立互不干扰的投音效果。In this method, the electronic device can establish an audio transmission channel corresponding to the first application through a virtual audio device, an audio processing service, and an audio sending service, thereby realizing independent transmission of the audio of the first application. Based on this method, the electronic device can create corresponding audio transmission channels for different applications, thereby realizing independent and non-interfering audio projection effects when multiple applications are projected at the same time.
在一种可能的设计中,所述通过所述音频处理服务将所述第一音频分发至所述第一虚拟音频设备,包括:通过所述音频处理服务,将所述第一电子设备中空闲的第一总线分配为用于传输所述第一音频的总线,并将所述第一总线关联到所述第一虚拟音频设备;利用所述第一总线将所述第一音频发送至所述第一虚拟音频设备;在通过所述第一虚拟音频设备,将所述第一音频发送至所述音频发送服务之前,所述方法还包括:通过所述第一虚拟音频设备,接收所述音频处理服务利用所述第一总线发送的第一总线信息;其中,所述第一总线信息用于指示所述第一总线;在通过所述第一虚拟音频设备,将所述第一音频发送至所述音频发送服务之后,所述方法还包括:通过所述第一虚拟音频设备,将所述第一总线指示信息发送至所述音频发送服务,以使所述音频发送服务根据所述第一总线指示信息确定所述第一总线,根据所述第一总线确定关联的所述第一虚拟音频设备所对应的所述至少一个第二电子设备。In a possible design, distributing the first audio to the first virtual audio device through the audio processing service includes: allocating, through the audio processing service, an idle first bus in the first electronic device as a bus for transmitting the first audio, and associating the first bus to the first virtual audio device; sending the first audio to the first virtual audio device using the first bus; before sending the first audio to the audio sending service through the first virtual audio device, the method also includes: receiving, through the first virtual audio device, first bus information sent by the audio processing service using the first bus; wherein the first bus information is used to indicate the first bus; after sending the first audio to the audio sending service through the first virtual audio device, the method also includes: sending, through the first virtual audio device, the first bus indication information to the audio sending service, so that the audio sending service determines the first bus according to the first bus indication information, and determines, according to the first bus, the at least one second electronic device corresponding to the associated first virtual audio device corresponding to the first bus.
在该方法中,电子设备可以建立基于虚拟音频设备的多总线机制,不同类别的音频可以跟随虚拟音频设备对应的总线进行流动,能够实现不同类别音频的独立传输。因此该方法能够支持多路音频流并行投音,进而实现多路音频流的并发播放控制,实用性较高。In this method, the electronic device can establish a multi-bus mechanism based on the virtual audio device, and different types of audio can flow along the bus corresponding to the virtual audio device, which can realize the independent transmission of different types of audio. Therefore, this method can support the parallel projection of multiple audio streams, and then realize the concurrent playback control of multiple audio streams, which is highly practical.
在一种可能的设计中,所述方法还包括:当所述第一虚拟音频设备被销毁时,解除所述第一总线与所述第一虚拟音频设备的关联关系,并将所述第一总线设置为空闲状态。In a possible design, the method further includes: when the first virtual audio device is destroyed, releasing the association between the first bus and the first virtual audio device, and setting the first bus to an idle state.
在该方法中,当虚拟音频设备被销毁时,不再使用对应的总线资源,因此电子设备可以将总线资源释放以提供给其它虚拟音频设备使用,能够提高总线资源的利用率,进而提高处理效率。In this method, when a virtual audio device is destroyed, the corresponding bus resources are no longer used, so the electronic device can release the bus resources to provide them to other virtual audio devices, which can improve the utilization of bus resources and further improve processing efficiency.
在一种可能的设计中,所述第一操作包括第四操作和第五操作;其中,所述第四操作用于指示将所述至少一个第二电子设备作为播放所述第一音频的电子设备,所述第五操作用于指示播放所述第一音频。 In one possible design, the first operation includes a fourth operation and a fifth operation; wherein the fourth operation is used to instruct the at least one second electronic device to be used as an electronic device for playing the first audio, and the fifth operation is used to instruct the playing of the first audio.
在该方法中,电子设备可以在播放音频之前接收用户的音频投播指示。结合上述方法,电子设备能够实现根据用户指示将待播放的音频投播到其它电子设备的效果,用户使用体验度较高。In this method, the electronic device can receive the user's audio broadcast instruction before playing the audio. In combination with the above method, the electronic device can achieve the effect of broadcasting the audio to be played to other electronic devices according to the user's instruction, and the user experience is high.
在一种可能的设计中,在响应于接收到的第一操作,将第一音频发送到至少一个第二电子设备,并指示所述至少一个第二电子设备播放所述第一音频之前,所述方法还包括:响应于接收到的第六操作,播放所述第一音频。In one possible design, before sending the first audio to at least one second electronic device in response to a received first operation and instructing the at least one second electronic device to play the first audio, the method also includes: playing the first audio in response to a received sixth operation.
在该方法中,电子设备可以在音频播放过程中接收用户的音频投播指示。结合上述方法,电子设备能够实现根据用户指示将正在播放的音频投播到其它电子设备的效果,用户使用体验度较高。In this method, the electronic device can receive the user's audio broadcast instruction during the audio playback process. Combined with the above method, the electronic device can achieve the effect of broadcasting the audio being played to other electronic devices according to the user's instruction, and the user experience is high.
第二方面,本申请提供一种电子设备,该电子设备包括显示屏,存储器和一个或多个处理器;其中,存储器用于存储计算机程序代码,计算机程序代码包括计算机指令;当计算机指令被一个或多个处理器执行时,使得电子设备执行上述第一方面或第一方面的任一可能的设计所描述的方法。In a second aspect, the present application provides an electronic device, comprising a display screen, a memory and one or more processors; wherein the memory is used to store computer program code, and the computer program code comprises computer instructions; when the computer instructions are executed by one or more processors, the electronic device executes the method described in the above-mentioned first aspect or any possible design of the first aspect.
第三方面,本申请提供一种计算机可读存储介质,该计算机可读存储介质存储有计算机程序,当计算机程序在计算机上运行时,使得计算机执行上述第一方面或第一方面的任一可能的设计所描述的方法。In a third aspect, the present application provides a computer-readable storage medium storing a computer program. When the computer program runs on a computer, the computer executes the method described in the first aspect or any possible design of the first aspect.
第四方面,本申请提供一种计算机程序产品,该计算机程序产品包括计算机程序或指令,当计算机程序或指令在计算机上运行时,使得计算机执行上述第一方面或第一方面的任一可能的设计所描述的方法。In a fourth aspect, the present application provides a computer program product, which includes a computer program or instructions. When the computer program or instructions are run on a computer, the computer executes the method described in the first aspect or any possible design of the first aspect.
上述第二方面到第四方面的有益效果,请参见上述第一方面的有益效果的描述,这里不再重复赘述。For the beneficial effects of the second to fourth aspects, please refer to the description of the beneficial effects of the first aspect, which will not be repeated here.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
图1为本申请实施例提供的一种电子设备的硬件架构示意图;FIG1 is a schematic diagram of a hardware architecture of an electronic device provided in an embodiment of the present application;
图2为本申请实施例提供的一种电子设备的软件架构示意图;FIG2 is a schematic diagram of a software architecture of an electronic device provided in an embodiment of the present application;
图3为本申请实施例提供的一种音频播放***的架构示意图;FIG3 is a schematic diagram of the architecture of an audio playback system provided in an embodiment of the present application;
图4为本申请实施例提供的一种音频控制***的架构示意图;FIG4 is a schematic diagram of the architecture of an audio control system provided in an embodiment of the present application;
图5为本申请实施例提供的一种音频播放方法的示意图;FIG5 is a schematic diagram of an audio playback method provided in an embodiment of the present application;
图6为本申请实施例提供的一种投音设备选择界面的示意图;FIG6 is a schematic diagram of a sound projection device selection interface provided in an embodiment of the present application;
图7为本申请实施例提供的一种启动投音及配置音频路由策略的方法的流程示意图;FIG7 is a flow chart of a method for starting audio projection and configuring an audio routing strategy provided by an embodiment of the present application;
图8为本申请实施例提供的一种关闭投音的方法的流程示意图;FIG8 is a flow chart of a method for turning off audio projection provided in an embodiment of the present application;
图9为本申请实施例提供的一种音频播放方法的流程示意图;FIG9 is a schematic diagram of a flow chart of an audio playback method provided in an embodiment of the present application;
图10为本申请实施例提供的一种音频播放方法的流程示意图;FIG10 is a schematic diagram of a flow chart of an audio playback method provided in an embodiment of the present application;
图11为本申请实施例提供的一种音频播放方法的示意图;FIG11 is a schematic diagram of an audio playback method provided in an embodiment of the present application;
图12为本申请实施例提供的一种电子设备的结构示意图。FIG. 12 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
具体实施方式Detailed ways
为了使本申请实施例的目的、技术方案和优点更加清楚,下面将结合附图对本申请实施例作进一步地详细描述。In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the embodiments of the present application will be further described in detail below with reference to the accompanying drawings.
其中,在本申请实施例的描述中,以下,术语“第一”、“第二”仅用于描述目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括一个或者更多个该特征。In the description of the embodiments of the present application, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features.
为了便于理解,示例性的给出了与本申请相关概念的说明以供参考。To facilitate understanding, exemplary descriptions of concepts related to the present application are provided for reference.
电子设备,可以为支持虚拟音频设备、具有通信功能的设备。本申请一些实施例中电子设备可以是便携式设备,诸如手机、平板电脑、具备无线通信功能的可穿戴设备(例如手表、手环等)、车载终端设备、增强现实(augmented reality,AR)/虚拟现实(virtual reality,VR)设备、笔记本电脑、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本、个人数字助理(personal digital assistant,PDA)、智能家居设备(例如,智能电视、智能音箱等)、智能机器人、车间设备、无人驾驶(self driving)中的无线终端、远程手术(remote medical surgery)中的无线终端、智能电网(smart grid)中的无线终端、运输安全(transportation safety)中的无线终端、智慧城市(smart city)中的无线终端,或智慧家庭(smart home)中的无线终端、飞行设备(例如,智能机器人、无人机、飞机)等。The electronic device may be a device that supports virtual audio devices and has communication functions. In some embodiments of the present application, the electronic device may be a portable device, such as a mobile phone, a tablet computer, a wearable device with wireless communication functions (such as a watch, a bracelet, etc.), a vehicle-mounted terminal device, an augmented reality (AR)/virtual reality (VR) device, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), smart home devices (such as smart TVs, smart speakers, etc.), smart robots, workshop equipment, wireless terminals in self-driving, wireless terminals in remote medical surgery, wireless terminals in smart grids, wireless terminals in transportation safety, wireless terminals in smart cities, or wireless terminals in smart homes, flight equipment (such as smart robots, drones, airplanes), etc.
其中,虚拟音频设备是通过虚拟技术将至少一个独立的电子设备虚拟成的逻辑设备,可以供电子设备中的应用、服务或进程使用。可穿戴设备为用户可以直接穿戴在身上或者整合到用户的衣服或配件上 的一种便携式设备。Among them, the virtual audio device is a logical device that virtualizes at least one independent electronic device through virtualization technology, which can be used by applications, services or processes in the electronic device. Wearable devices are devices that users can wear directly on their bodies or integrate into their clothes or accessories. A portable device.
在本申请一些实施例中,电子设备还可以是还包含其它功能诸如个人数字助理和/或音乐播放器功能的便携式终端设备。便携式终端设备的示例性实施例包括但不限于搭载或者其它操作***的便携式终端设备。上述便携式终端设备也可以是其它便携式终端设备,诸如具有触敏表面(例如触控面板)的膝上型计算机(laptop)等。还应当理解的是,在本申请其它一些实施例中,上述电子设备也可以不是便携式终端设备,而是具有触敏表面(例如触控面板)的台式计算机。In some embodiments of the present application, the electronic device may also be a portable terminal device that also includes other functions such as a personal digital assistant and/or a music player. Exemplary embodiments of the portable terminal device include but are not limited to: Or a portable terminal device with other operating systems. The portable terminal device may also be other portable terminal devices, such as a laptop computer with a touch-sensitive surface (e.g., a touch panel). It should also be understood that in some other embodiments of the present application, the electronic device may not be a portable terminal device, but a desktop computer with a touch-sensitive surface (e.g., a touch panel).
应理解,本申请实施例中“至少一个”是指一个或者多个,“多个”是指两个或两个以上。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B的情况,其中A、B可以是单数或者复数。字符“/”一般表示前后关联对象是一种“或”的关系。“以下至少一(项)个”或其类似表达,是指的这些项中的任意组合,包括单项(个)或复数项(个)的任意组合。例如,a、b或c中的至少一项(个),可以表示:a,b,c,a和b,a和c,b和c,或a、b和c,其中a、b、c可以是单个,也可以是多个。It should be understood that in the embodiments of the present application, "at least one" refers to one or more, and "plurality" refers to two or more. "And/or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and/or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character "/" generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can represent: a, b, c, a and b, a and c, b and c, or a, b and c, where a, b, c can be single or multiple.
当前Andriod平台的音频框架支持电子设备本地发声(即播放音频)和外接设备(如外接通用串行总线(universal serial bus,USB)、蓝牙设备等)发声的机制。The current audio framework of the Android platform supports the mechanisms for local sound generation by electronic devices (i.e., playing audio) and sound generation by external devices (such as external universal serial bus (USB), Bluetooth devices, etc.).
但是Android平台的音频框架的播放机制是固定的,仅支持一路音频流投播到其它音频播放设备,受此限制,电子设备只能支持一路音频流投播。例如,如果用户同时打开电子设备中的多个音乐APP播放声音并将声音投播到其它音频输出设备,则只有一个音频流即一个音乐APP播放的声音能够成功投播到其它音频输出设备。因此,该方法无法满足用户将不同音频投播到相同或不同的多个音频播放设备进行播放的需求,实用性较低。However, the playback mechanism of the audio framework of the Android platform is fixed, and only supports one audio stream to be broadcasted to other audio playback devices. Due to this limitation, electronic devices can only support one audio stream to be broadcasted. For example, if a user opens multiple music apps in an electronic device at the same time to play sounds and broadcast the sounds to other audio output devices, only one audio stream, that is, the sound played by one music app, can be successfully broadcasted to other audio output devices. Therefore, this method cannot meet the user's needs to broadcast different audios to the same or different multiple audio playback devices for playback, and its practicality is low.
此外,在一些特定场景中,当前基于Android音频框架的电子设备能够支持将一路音频流投播到多个音频播放设备进行播放。但是该方法要求多个音频播放设备为同一型号的设备,且该方法实现的是多个音频播放设备组合播放音频的效果。例如,当前可以通过多个音箱组成立体声或多声道组合,电子设备可以将音频投播到多个音箱中的主音箱,由主音箱控制多个音箱组合播放来自电子设备的音频。该方法中,用户控制音频投播的过程较为复杂,且该方法也无法满足用户将不同音频投播到不同的多个音频播放设备进行播放的需求,因此实用性较低。In addition, in some specific scenarios, electronic devices currently based on the Android audio framework can support broadcasting one audio stream to multiple audio playback devices for playback. However, this method requires that multiple audio playback devices are devices of the same model, and this method achieves the effect of combining multiple audio playback devices to play audio. For example, currently multiple speakers can be used to form a stereo or multi-channel combination, and the electronic device can broadcast audio to the main speaker among multiple speakers, and the main speaker controls the combination of multiple speakers to play audio from the electronic device. In this method, the process of user control of audio broadcasting is relatively complicated, and this method cannot meet the user's needs to broadcast different audio to different multiple audio playback devices for playback, so it is less practical.
鉴于以上问题,本申请实施例提供了一种音频播放方法及电子设备,该方案可以将电子设备中不同音频投播到不同音频播放设备进行播放,灵活性和实用性较高。In view of the above problems, an embodiment of the present application provides an audio playback method and an electronic device. This solution can broadcast different audios in an electronic device to different audio playback devices for playback, and has high flexibility and practicality.
下面参阅图1,对本申请实施例提供的方法适用的电子设备的结构进行介绍。Referring to FIG. 1 , the structure of an electronic device to which the method provided in an embodiment of the present application is applicable is introduced.
如图1中所示,电子设备100可以包括处理器110,外部存储器接口120,内部存储器121,USB接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,摄像头193,显示屏194,以及SIM卡接口195等。As shown in Figure 1, the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a USB interface 130, a charging management module 140, 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 receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a SIM card interface 195, etc.
其中传感器模块180可以包括陀螺仪传感器、加速度传感器、接近光传感器、指纹传感器、触摸传感器、温度传感器、压力传感器、距离传感器、磁传感器、环境光传感器、气压传感器、骨传导传感器等。The sensor module 180 may include a gyroscope sensor, an acceleration sensor, a proximity light sensor, a fingerprint sensor, a touch sensor, a temperature sensor, a pressure sensor, a distance sensor, a magnetic sensor, an ambient light sensor, an air pressure sensor, a bone conduction sensor, and the like.
可以理解的是,图1所示的电子设备100仅仅是一个范例,并不构成对电子设备的限定,并且电子设备可以具有比图中所示出的更多的或者更少的部件,可以组合两个或更多的部件,或者可以具有不同的部件配置。图1中所示出的各种部件可以在包括一个或多个信号处理和/或专用集成电路在内的硬件、软件、或硬件和软件的组合中实现。It is understood that the electronic device 100 shown in FIG. 1 is merely an example and does not constitute a limitation on the electronic device, and the electronic device may have more or fewer components than those shown in the figure, may combine two or more components, or may have different component configurations. The various components shown in FIG. 1 may be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and/or application specific integrated circuits.
处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processing unit,GPU),图像信号处理器(image signal processor,ISP),控制器,存储器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。其中,控制器可以是电子设备100的神经中枢和指挥中心。控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。The processor 110 may include one or more processing units, for example: the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), a controller, a memory, a video codec, a digital signal processor (digital signal processor, DSP), a baseband processor, and/or a neural network processor (neural-network processing unit, NPU), etc. Among them, different processing units can be independent devices or integrated in one or more processors. Among them, the controller can be the nerve center and command center of the electronic device 100. The controller can generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.
处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器 为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了***的效率。The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 may include a memory for storing instructions and data. A high-speed cache memory. The memory can store instructions or data that have just been used or are used cyclically by the processor 110. If the processor 110 needs to use the instruction or data again, it can be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
本申请实施例提供的音频播放方法的执行可以由处理器110来控制或调用其他部件来完成,比如调用内部存储器121中存储的本申请实施例的处理程序,或者通过外部存储器接口120调用第三方设备中存储的本申请实施例的处理程序,来控制无线通信模块160向其它设备进行数据通信,提高电子设备100的智能化、便捷化程度,提升用户的体验。处理器110可以包括不同的器件,比如集成CPU和GPU时,CPU和GPU可以配合执行本申请实施例提供的音频播放方法,比如音频播放方法中部分算法由CPU执行,另一部分算法由GPU执行,以得到较快的处理效率。The execution of the audio playback method provided in the embodiment of the present application can be controlled by the processor 110 or completed by calling other components, such as calling the processing program of the embodiment of the present application stored in the internal memory 121, or calling the processing program of the embodiment of the present application stored in the third-party device through the external memory interface 120, to control the wireless communication module 160 to communicate data with other devices, improve the intelligence and convenience of the electronic device 100, and enhance the user experience. The processor 110 may include different devices. For example, when the CPU and GPU are integrated, the CPU and GPU can cooperate to execute the audio playback method provided in the embodiment of the present application, such as part of the algorithm in the audio playback method is executed by the CPU, and the other part of the algorithm is executed by the GPU to obtain faster processing efficiency.
显示屏194用于显示图像,视频等。显示屏194包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emitting diode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrix organic light emitting diode的,AMOLED),柔性发光二极管(flex light-emitting diode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot light emitting diodes,QLED)等。在一些实施例中,电子设备100可以包括1个或N个显示屏194,N为大于1的正整数。显示屏194可用于显示由用户输入的信息或提供给用户的信息以及各种图形用户界面(graphical user interface,GUI)。例如,显示屏194可以显示照片、视频、网页、或者文件等。再例如,显示屏194可以显示本申请实施例中所述的用户控制界面(例如投音模式选择界面、投音设备选择界面等)等。The display screen 194 is used to display images, videos, etc. The display screen 194 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 or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, quantum dot light-emitting diodes (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1. The display screen 194 can be used to display information input by a user or information provided to a user and various graphical user interfaces (GUI). For example, the display screen 194 can display photos, videos, web pages, or files, etc. For another example, the display screen 194 may display the user control interface described in the embodiments of the present application (eg, a sound projection mode selection interface, a sound projection device selection interface, etc.).
在本申请实施例中,显示屏194可以是一个一体的柔性显示屏,也可以采用两个刚性屏以及位于两个刚性屏之间的一个柔性屏组成的拼接显示屏。In the embodiment of the present application, the display screen 194 may be an integrated flexible display screen, or a spliced display screen consisting of two rigid screens and a flexible screen located between the two rigid screens.
摄像头193(前置摄像头或者后置摄像头,或者一个摄像头既可作为前置摄像头,也可作为后置摄像头)用于捕获静态图像或视频。通常,摄像头193可以包括感光元件比如镜头组和图像传感器,其中,镜头组包括多个透镜(凸透镜或凹透镜),用于采集待拍摄物体反射的光信号,并将采集的光信号传递给图像传感器。图像传感器根据所述光信号生成待拍摄物体的原始图像。The camera 193 (a front camera or a rear camera, or one camera can be used as both a front camera and a rear camera) is used to capture still images or videos. Generally, the camera 193 may include a photosensitive element such as a lens group and an image sensor, wherein the lens group includes a plurality of lenses (convex lenses or concave lenses) for collecting light signals reflected by the object to be photographed and transmitting the collected light signals to the image sensor. The image sensor generates an original image of the object to be photographed based on the light signal.
内部存储器121可以用于存储计算机可执行程序代码,所述可执行程序代码包括指令。处理器110通过运行存储在内部存储器121的指令,从而执行电子设备100的各种功能应用以及数据处理。内部存储器121可以包括存储程序区和存储数据区。其中,存储程序区可存储操作***,应用程序(比如本申请方案对应的功能等)的代码等。存储数据区可存储电子设备100使用过程中所创建的数据等。The internal memory 121 can be used to store computer executable program codes, which include instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area can store the code of the operating system, application program (such as the function corresponding to the solution of the present application, etc.). The data storage area can store data created during the use of the electronic device 100, etc.
内部存储器121还可以存储本申请方案的算法对应的一个或多个计算机程序。该一个或多个计算机程序被存储在上述内部存储器121中并被配置为被一个或多个处理器110执行,该一个或多个计算机程序包括指令,上述指令可以用于执行以下实施例中的各个步骤。The internal memory 121 may also store one or more computer programs corresponding to the algorithm of the present application. The one or more computer programs are stored in the internal memory 121 and configured to be executed by one or more processors 110. The one or more computer programs include instructions, which may be used to execute the various steps in the following embodiments.
此外,内部存储器121可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universal flash storage,UFS)等。In addition, 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 (UFS), etc.
当然,本申请实施例方案的算法的代码还可以存储在外部存储器中。这种情况下,处理器110可以通过外部存储器接口120运行存储在外部存储器中的本申请方案的算法的代码。Of course, the code of the algorithm of the embodiment of the present application can also be stored in an external memory. In this case, the processor 110 can run the code of the algorithm of the embodiment of the present application stored in the external memory through the external memory interface 120.
传感器模块180可以包括陀螺仪传感器、加速度传感器、接近光传感器、指纹传感器、触摸传感器等。The sensor module 180 may include a gyro sensor, an acceleration sensor, a proximity light sensor, a fingerprint sensor, a touch sensor, and the like.
触摸传感器,也称“触控面板”。触摸传感器可以设置于显示屏194,由触摸传感器与显示屏194组成触摸显示屏,也称“触控屏”。触摸传感器用于检测作用于其上或附近的触摸操作。触摸传感器可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏194提供与触摸操作相关的视觉输出。在另一些实施例中,触摸传感器也可以设置于电子设备100的表面,与显示屏194所处的位置不同。A touch sensor is also called a "touch panel". The touch sensor can be arranged on the display screen 194. The touch sensor and the display screen 194 form a touch display screen, also called a "touch screen". The touch sensor is used to detect touch operations acting on or near it. The touch sensor can pass 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 screen 194. In other embodiments, the touch sensor can also be arranged on the surface of the electronic device 100, which is different from the position of the display screen 194.
示例性的,电子设备100的显示屏194显示主界面,主界面中包括多个应用(比如相机应用等)的图标。例如用户可以通过触摸传感器点击主界面中相机应用的图标,触发处理器110启动相机应用,打开摄像头193。显示屏194显示相机应用的界面,例如取景界面。Exemplarily, the display screen 194 of the electronic device 100 displays a main interface, which includes icons of multiple applications (such as a camera application, etc.). For example, a user can click the icon of the camera application in the main interface through a touch sensor to trigger the processor 110 to start the camera application and turn on the camera 193. The display screen 194 displays the interface of the camera application, such as a viewfinder interface.
电子设备100的无线通信功能可以通过天线1,天线2,移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
天线1和天线2用于发射和接收电磁波信号。电子设备100中的每个天线可用于覆盖单个或多个通 信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple channels. Different antennas can also be reused to improve the utilization of the antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
移动通信模块150可以提供应用在电子设备100上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块150可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。移动通信模块150可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块150还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。在一些实施例中,移动通信模块150的至少部分功能模块可以被设置于处理器110中。在一些实施例中,移动通信模块150的至少部分功能模块可以与处理器110的至少部分模块被设置在同一个器件中。在本申请实施例中,移动通信模块150还可以用于与其它设备进行信息交互。The mobile communication module 150 can provide solutions for wireless communications including 2G/3G/4G/5G, etc., applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110. In the embodiment of the present application, the mobile communication module 150 can also be used to interact with other devices for information.
调制解调处理器可以包括调制器和解调器。其中,调制器用于将待发送的低频基带信号调制成中高频信号。解调器用于将接收的电磁波信号解调为低频基带信号。随后解调器将解调得到的低频基带信号传送至基带处理器处理。低频基带信号经基带处理器处理后,被传递给应用处理器。应用处理器通过音频装置(不限于扬声器170A,受话器170B等)输出声音信号,或通过显示屏194显示图像或视频。在一些实施例中,调制解调处理器可以是独立的器件。在另一些实施例中,调制解调处理器可以独立于处理器110,与移动通信模块150或其他功能模块设置在同一个器件中。The modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 170A, a receiver 170B, etc.), or displays an image or video through a display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.
无线通信模块160可以提供应用在电子设备100上的包括无线局域网(wireless local area networks,WLAN)(如无线保真(wireless fidelity,WiFi)网络),蓝牙(bluetooth,BT),全球导航卫星***(global navigation satellite system,GNSS),调频(frequency modulation,FM),近距离无线通信技术(near field communication,NFC),红外技术(infrared,IR)等无线通信的解决方案。无线通信模块160可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块160经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器110。无线通信模块160还可以从处理器110接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。本申请实施例中,无线通信模块160,用于与其它电子设备建立连接,进行数据交互。或者无线通信模块160可以用于接入接入点设备,向其它电子设备发送控制指令,或者接收来自其它电子设备发送的数据。The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (WiFi) network), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR) and the like applied to the electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of the signal, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2. In the embodiment of the present application, the wireless communication module 160 is used to establish a connection with other electronic devices and perform data interaction. Or the wireless communication module 160 can be used to access the access point device, send control instructions to other electronic devices, or receive data sent from other electronic devices.
另外,电子设备100可以通过音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,以及应用处理器等实现音频功能。例如音乐播放,录音等。电子设备100可以接收按键190输入,产生与电子设备100的用户设置以及功能控制有关的键信号输入。电子设备100可以利用马达191产生振动提示(比如来电振动提示)。电子设备100中的指示器192可以是指示灯,可以用于指示充电状态,电量变化,也可以用于指示消息,未接来电,通知等。电子设备100中的SIM卡接口195用于连接SIM卡。SIM卡可以通过***SIM卡接口195,或从SIM卡接口195拔出,实现和电子设备100的接触和分离。In addition, the electronic device 100 can implement audio functions through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone interface 170D, and the application processor. For example, music playback, recording, etc. The electronic device 100 can receive input from the key 190 and generate key signal input related to the user settings and function control of the electronic device 100. The electronic device 100 can use the motor 191 to generate a vibration prompt (such as an incoming call vibration prompt). The indicator 192 in the electronic device 100 can be an indicator light, which can be used to indicate the charging status, power changes, and can also be used to indicate messages, missed calls, notifications, etc. The SIM card interface 195 in the electronic device 100 is used to connect the SIM card. The SIM card can be inserted into the SIM card interface 195, or pulled out from the SIM card interface 195, to achieve contact and separation with the electronic device 100.
应理解,在实际应用中,电子设备100可以包括比图1所示的更多或更少的部件,本申请实施例不作限定。图示电子设备100仅是一个范例,并且电子设备100可以具有比图中所示出的更多的或者更少的部件,可以组合两个或更多的部件,或者可以具有不同的部件配置。图中所示出的各种部件可以在包括一个或多个信号处理和/或专用集成电路在内的硬件、软件、或硬件和软件的组合中实现。It should be understood that in practical applications, the electronic device 100 may include more or fewer components than those shown in FIG. 1, and the embodiments of the present application are not limited thereto. The illustrated electronic device 100 is only an example, and the electronic device 100 may have more or fewer components than those shown in the figure, may combine two or more components, or may have different component configurations. The various components shown in the figure may be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and/or application specific integrated circuits.
电子设备100的软件***可以采用分层架构,事件驱动架构,微核架构,微服务架构,或云架构。分层架构将软件分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。示例性的,如图2所示,该软件架构可以分为四层,从上至下分别为应用程序层,应用程序框架层(framework,FWK),运行时和***库,以及(Linux)内核(kernel)层。The software system of the electronic device 100 can adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture. The layered architecture divides the software into several layers, each with a clear role and division of labor. The layers communicate with each other through software interfaces. Exemplarily, as shown in FIG2 , the software architecture can be divided into four layers, from top to bottom, namely, the application layer, the application framework layer (framework, FWK), the runtime and system library, and the (Linux) kernel layer.
应用程序层是操作***的最上一层,包括操作***的原生应用程序,例如相机、图库、日历、蓝牙、音乐、视频、信息等,还可以包括第三方应用程序。本申请实施例涉及的应用程序简称应用(application,APP),为能够实现某项或多项特定功能的软件程序。通常,电子设备中可以安装多个应用,例如相机应用、邮箱应用等。下文中提到的应用,可以是电子设备出厂时已安装的***应用,也可以是用户在使用电子设备的过程中从网络下载或从其他电子设备获取的第三方应用。The application layer is the top layer of the operating system, including native applications of the operating system, such as camera, gallery, calendar, Bluetooth, music, video, information, etc., and may also include third-party applications. The application involved in the embodiment of the present application is referred to as application (APP), which is a software program that can implement one or more specific functions. Typically, multiple applications can be installed in an electronic device, such as a camera application, a mailbox application, etc. The application mentioned below may be a system application installed when the electronic device leaves the factory, or it may be a third-party application downloaded from the Internet or obtained from other electronic devices by the user while using the electronic device.
当然,对于开发者来说,开发者可以编写应用程序并安装到该层。一种可能的实现方式中,应用程序可以使用Java语言开发,通过调用应用程序框架层所提供的应用程序编程接口(application programming interface,API)来完成,开发者可以通过应用程序框架来与操作***的底层(例如内核层等)进行交互,开发自己的应用程序。 Of course, for developers, developers can write applications and install them in this layer. In a possible implementation, applications can be developed using the Java language by calling the application programming interface (API) provided by the application framework layer. Developers can interact with the bottom layer of the operating system (such as the kernel layer) through the application framework to develop their own applications.
应用程序框架层为应用程序层的API和编程框架。应用程序框架层可以包括一些预先定义的函数。应用程序框架层可以包括窗口管理器,内容提供器,视图***,电话管理器,资源管理器,通知管理器等。The application framework layer is the API and programming framework of the application layer. The application framework layer may include some predefined functions. The application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, etc.
窗口管理器用于管理窗口程序。窗口管理器可以获取显示屏大小,判断是否有状态栏,锁定显示屏(或屏幕),截取显示屏等。The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the display screen (or screen), capture the display screen, etc.
内容提供器用来存放和获取数据,并使这些数据可以被应用程序访问。所述数据可以包括文件(例如文档、视频、图像、音频),文本等信息。Content providers are used to store and retrieve data and make these data accessible to applications. The data may include files (such as documents, videos, images, audio), text and other information.
视图***包括可视控件,例如显示文字、图片、文档等内容的控件等。视图***可用于构建应用程序。显示窗口中的界面可以由一个或多个视图组成的。例如,包括短信通知图标的显示界面,可以包括显示文字的视图以及显示图片的视图。The view system includes visual controls, such as controls for displaying text, images, documents, etc. The view system can be used to build applications. The interface in the display window can be composed of one or more views. For example, the display interface including the SMS notification icon can include a view for displaying text and a view for displaying images.
电话管理器用于提供电子设备的通信功能。通知管理器使应用程序可以在状态栏中显示通知信息,可以用于传达告知类型的消息,可以短暂停留后自动消失,无需用户交互。The phone manager is used to provide communication functions for electronic devices. The notification manager enables applications to display notification information in the status bar, which can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction.
运行时包括核心库和虚拟机。运行时负责***的调度和管理。The runtime includes the core library and the virtual machine. The runtime is responsible for the scheduling and management of the system.
***的核心库包含两部分:一部分是Java语言需要调用的功能函数,另一部分是***的核心库。应用程序层和应用程序框架层运行在虚拟机中。以Java举例,虚拟机将应用程序层和应用程序框架层的Java文件执行为二进制文件。虚拟机用于执行对象生命周期的管理,堆栈管理,线程管理,安全和异常的管理,以及垃圾回收等功能。The core library of the system consists of two parts: one is the function that the Java language needs to call, and the other is the core library of the system. The application layer and the application framework layer run in the virtual machine. Taking Java as an example, the virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform object life cycle management, stack management, thread management, security and exception management, and garbage collection.
***库可以包括多个功能模块。例如:表面管理器,媒体库,三维图形处理库(例如:OpenGL ES),二维图形引擎(例如:SGL)、图像处理库等。表面管理器用于对显示子***进行管理,并且为多个应用程序提供了二维和三维图层的融合。媒体库支持多种常用的音频,视频格式回放和录制,以及静态图像文件等。媒体库可以支持多种音视频编码格式,例如:MPEG4,H.564,MP3,AAC,AMR,JPG,PNG等。三维图形处理库用于实现三维图形绘图、图像渲染、合成和图层处理等。二维图形引擎是二维绘图的绘图引擎。The system library can include multiple functional modules. For example: surface manager, media library, 3D graphics processing library (for example: OpenGL ES), 2D graphics engine (for example: SGL), image processing library, etc. The surface manager is used to manage the display subsystem and provide the fusion of 2D and 3D layers for multiple applications. The media library supports a variety of commonly used audio and video format playback and recording, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.564, MP3, AAC, AMR, JPG, PNG, etc. The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, synthesis and layer processing, etc. The 2D graphics engine is a drawing engine for 2D drawing.
内核层提供操作***的核心***服务,如安全性、内存管理、进程管理、网络协议栈和驱动模型等都基于内核层实现。内核层同时也作为硬件和软件栈之间的抽象层。该层有许多与电子设备相关的驱动程序,主要的驱动有:显示驱动;作为输入设备的键盘驱动;基于内存技术设备的Flash驱动;照相机驱动;音频驱动;蓝牙驱动;WiFi驱动等。The kernel layer provides the core system services of the operating system, such as security, memory management, process management, network protocol stack and driver model, which are all implemented based on the kernel layer. The kernel layer also serves as an abstraction layer between the hardware and software stacks. This layer has many drivers related to electronic devices, the main drivers are: display driver; keyboard driver as input device; Flash driver based on memory technology device; camera driver; audio driver; Bluetooth driver; WiFi driver, etc.
可选的,图2所示的软件架构可以应用于Android***中。Optionally, the software architecture shown in FIG. 2 may be applied to an Android system.
需要理解的是,如上所述的功能服务只是一种示例,在实际应用中,电子设备也可以按照其他因素来划分为更多或更少的功能服务,或者可以按照其他方式来划分各个服务的功能,或者也可以不划分功能服务,而是按照整体来工作。It should be understood that the functional services described above are only examples, and in actual applications, electronic devices may also be divided into more or fewer functional services according to other factors, or the functions of each service may be divided in other ways, or the functional services may not be divided but work as a whole.
下面对本申请实施例提供的方案进行详细介绍。The solution provided in the embodiments of the present application is described in detail below.
本申请实施例提供的方案可以应用在一个设备对多个设备投音(即进行音频投播)的场景中。具体可以应用于电子设备对多个音频播放设备投音的场景,即电子设备将音频发送到多个音频播放设备并由多个音频播放设备播放音频的场景中。其中,电子设备可以将不同音频分别投音到多个音频播放设备中的一个或多个音频播放设备,且能够保证不同音频对应的投音过程相互独立,互不干扰。The solution provided in the embodiment of the present application can be applied to the scenario where one device projects audio to multiple devices (i.e., performs audio broadcasting). Specifically, it can be applied to the scenario where an electronic device projects audio to multiple audio playback devices, that is, the electronic device sends audio to multiple audio playback devices and the audio is played by multiple audio playback devices. Among them, the electronic device can project different audio to one or more audio playback devices among the multiple audio playback devices respectively, and can ensure that the projection processes corresponding to different audio are independent of each other and do not interfere with each other.
本申请实施例提供的方案可以应用于图3所示的包含电子设备和多个音频播放设备的音频播放***中。在该音频播放***中,电子设备可以对多个音频播放设备进行投音控制。电子设备自身可以播放音频,或者,电子设备可以将音频发送到多个音频播放设备中的至少一个音频播放设备,由所述至少一个音频播放设备播放音频。The solution provided in the embodiment of the present application can be applied to the audio playback system including an electronic device and multiple audio playback devices shown in Figure 3. In the audio playback system, the electronic device can control the sound projection of multiple audio playback devices. The electronic device itself can play audio, or the electronic device can send audio to at least one audio playback device among the multiple audio playback devices, and the at least one audio playback device plays the audio.
可选的,上述图1或图2所示的电子设备的组成框架可以作为本申请实施例提供的电子设备或音频播放设备的一种可能的实现方式。实际应用中,电子设备或音频播放设备的结构还可以采用其它方式实现,例如可以包括更多或更少的模块等,本申请实施例中不进行具体限定。Optionally, the composition framework of the electronic device shown in FIG. 1 or FIG. 2 can be used as a possible implementation of the electronic device or audio playback device provided in the embodiment of the present application. In practical applications, the structure of the electronic device or audio playback device can also be implemented in other ways, for example, it can include more or fewer modules, etc., which is not specifically limited in the embodiment of the present application.
分布式设备虚拟化平台可以实现不同设备的资源融合、设备管理、数据处理,多种设备共同形成一个超级虚拟终端。针对不同类型的任务,为用户匹配并选择能力合适的执行硬件,让业务连续地在不同设备间流转,充分发挥不同设备的能力优势,如显示能力、摄像能力、音频能力、交互能力以及传感器能力等。在本申请一些实施例中,电子设备可以通过分布式设备虚拟化平台构建音频播放设备对应的虚拟音频设备,并通过虚拟音频设备构建电子设备与音频播放设备之间的投音通路,以实现不同音频的独 立传输。其中,一个虚拟音频设备可以对应至少一个音频播放设备,电子设备可以通过虚拟音频设备将待播放的音频传输至对应的音频播放设备进行播放。The distributed device virtualization platform can realize resource integration, device management, and data processing of different devices, and multiple devices together form a super virtual terminal. For different types of tasks, the platform matches and selects execution hardware with appropriate capabilities for users, allowing services to flow continuously between different devices, giving full play to the capabilities of different devices, such as display capabilities, camera capabilities, audio capabilities, interaction capabilities, and sensor capabilities. In some embodiments of the present application, the electronic device can construct a virtual audio device corresponding to the audio playback device through the distributed device virtualization platform, and construct a sound projection channel between the electronic device and the audio playback device through the virtual audio device to achieve unique audio playback of different audios. Among them, one virtual audio device can correspond to at least one audio playback device, and the electronic device can transmit the audio to be played to the corresponding audio playback device through the virtual audio device for playback.
可选的,在音频播放***中,多个音频播放设备与电子设备之间可以通信连接。其中,通信连接方式可以采用WiFi、蓝牙等短距离无线通信方式。Optionally, in the audio playback system, multiple audio playback devices and electronic devices can be connected to each other by communication, wherein the communication connection method can adopt a short-range wireless communication method such as WiFi, Bluetooth, etc.
在本申请一些实施例中,电子设备和多个音频播放设备位于同一空间环境内,该空间环境例如可以是一个家庭对应的空间环境、同一室内环境、设定的空间区域等。基于本申请实施例提供的方案,空间环境内的多个音频播放设备可以在电子设备的控制下,为用户提供音频播放服务。可选的,多个音频播放设备为电子设备在所在的空间环境内扫描到的在线的音频播放设备。In some embodiments of the present application, the electronic device and the multiple audio playback devices are located in the same spatial environment, which can be, for example, a spatial environment corresponding to a family, the same indoor environment, a set spatial area, etc. Based on the solution provided in the embodiments of the present application, the multiple audio playback devices in the spatial environment can provide audio playback services to the user under the control of the electronic device. Optionally, the multiple audio playback devices are online audio playback devices scanned by the electronic device in the spatial environment.
本申请实施例中所述的电子设备至少具备通信功能且支持虚拟音频设备功能。当然,电子设备也可以具备其它功能例如音频播放功能、显示功能等,本申请实施例中不做具体限制。本申请实施例中所述的音频播放设备为至少具备音频播放功能和通信功能的设备。当然,音频输出设备也可以具备其它功能例如显示功能等,本申请实施例中不做具体限制。The electronic device described in the embodiment of the present application at least has a communication function and supports a virtual audio device function. Of course, the electronic device may also have other functions such as an audio playback function, a display function, etc., which are not specifically limited in the embodiment of the present application. The audio playback device described in the embodiment of the present application is a device that at least has an audio playback function and a communication function. Of course, the audio output device may also have other functions such as a display function, etc., which are not specifically limited in the embodiment of the present application.
示例性的,本申请实施例提供的方案可以应用于家庭场景中,该场景下电子设备可以为手机、平板、电脑等便携设备,音频输出设备可以为大屏(或称智慧屏)、音箱、耳机等设备。Exemplarily, the solution provided in the embodiments of the present application can be applied in a home scenario, where the electronic device may be a portable device such as a mobile phone, a tablet, a computer, etc., and the audio output device may be a large screen (or smart screen), a speaker, headphones, and other devices.
图4为本申请实施例提供的一种音频控制***的架构示意图。该音频控制***可以部署在电子设备中,具体可以部署在电子设备软件***中的应用层、应用框架层和硬件抽象层(hardware abstract layer,HAL)中。该音频控制***用于选择播放应用音频的音频播放设备并将音频发送至所选择的音频播放设备进行播放。FIG4 is a schematic diagram of the architecture of an audio control system provided by an embodiment of the present application. The audio control system can be deployed in an electronic device, specifically in an application layer, an application framework layer, and a hardware abstract layer (HAL) in a software system of the electronic device. The audio control system is used to select an audio playback device for playing application audio and send the audio to the selected audio playback device for playback.
如图4中所示,该音频控制***中可以包括应用、虚拟音频框架模块、音频处理模块、通信模块、本地音频(Audio Primary)HAL模块、虚拟音频(Virtual Audio)HAL模块等。其中,应用属于电子设备软件***的应用层,音频框架模块、音频处理模块、通信模块位于电子设备软件***的应用框架层中,本地音频HAL模块、虚拟音频HAL模块位于电子设备软件***的HAL层中。As shown in FIG4 , the audio control system may include an application, a virtual audio framework module, an audio processing module, a communication module, a local audio (Audio Primary) HAL module, a virtual audio (Virtual Audio) HAL module, etc. Among them, the application belongs to the application layer of the electronic device software system, the audio framework module, the audio processing module, and the communication module are located in the application framework layer of the electronic device software system, and the local audio HAL module and the virtual audio HAL module are located in the HAL layer of the electronic device software system.
虚拟音频框架模块用于配置音频路由策略,即将音频传输至播放设备的路由策略,其中,播放设备可以为电子设备自身或者电子设备连接的至少一个音频播放设备。The virtual audio framework module is used to configure an audio routing strategy, that is, a routing strategy for transmitting audio to a playback device, wherein the playback device may be the electronic device itself or at least one audio playback device connected to the electronic device.
作为一种可选的实施方式,音频路由策略可以包括电子设备与音频播放设备之间的对应关系,则电子设备可以基于该音频路由策略,将电子设备中应用的音频流传输至电子设备对应的音频播放设备进行播放。As an optional implementation, the audio routing strategy may include a correspondence between the electronic device and the audio playback device. The electronic device may transmit the audio stream applied in the electronic device to the audio playback device corresponding to the electronic device for playback based on the audio routing strategy.
作为另一种可选的实施方式,音频路由策略可以包括不同应用或不同音频类型与音频播放设备之间的对应关系。则电子设备可以基于该音频路由策略,将电子设备中不同应用或不同音频类型的音频流传输至不同音频播放设备进行播放。As another optional implementation, the audio routing strategy may include a correspondence between different applications or different audio types and audio playback devices. Then the electronic device may transmit the audio streams of different applications or different audio types in the electronic device to different audio playback devices for playback based on the audio routing strategy.
音频处理模块用于接收来自应用层中应用的音频流,并按照虚拟音频框架模块配置的音频路由策略,将音频流分发(即传输)至HAL层的本地音频HAL模块或虚拟音频HAL模块。其中,若音频处理模块按照音频路由策略确定由电子设备自身播放音频时,音频处理模块可以将音频对应的音频流分发至本地音频HAL模块;若音频处理模块按照音频路由确定由电子设备连接的音频播放设备播放音频时,音频处理模块可以将音频对应的音频流分发至虚拟音频HAL模块,由虚拟音频HAL模块进行后续传输。The audio processing module is used to receive the audio stream from the application in the application layer, and distribute (i.e., transmit) the audio stream to the local audio HAL module or virtual audio HAL module of the HAL layer according to the audio routing strategy configured by the virtual audio framework module. Among them, if the audio processing module determines that the audio is played by the electronic device itself according to the audio routing strategy, the audio processing module can distribute the audio stream corresponding to the audio to the local audio HAL module; if the audio processing module determines that the audio is played by the audio playback device connected to the electronic device according to the audio routing, the audio processing module can distribute the audio stream corresponding to the audio to the virtual audio HAL module, and the virtual audio HAL module performs subsequent transmission.
在本申请一些实施例中,音频处理模块可以包括音频策略引擎(Audio Policy Engine)和音频管理器(Audio Flinger)。其中,音频策略引擎用于接收来自应用层中应用的音频流(Audio Track),识别音频流的类型,并根据音频流的类型和虚拟音频框架模块配置的音频路由策略确定音频流的流向。音频管理器用于根据音频策略引擎确定的音频流的流向对音频流进行分发。在本申请一些实施例中,音频管理器可以通过不同总线将音频流分发至虚拟音频HAL模块中的不同虚拟音频设备中。其中,不同总线具有不同的总线(Bus)号,总线号可以用于标识总线,每个总线可以连接虚拟音频HAL模块中的一个或多个虚拟音频设备。可选的,音频管理器可以通过总线对应的混音器将音频流发送到对应的总线,每个总线对应一个混音器。In some embodiments of the present application, the audio processing module may include an audio policy engine (Audio Policy Engine) and an audio manager (Audio Flinger). The audio policy engine is used to receive an audio stream (Audio Track) from an application in the application layer, identify the type of the audio stream, and determine the direction of the audio stream according to the type of the audio stream and the audio routing policy configured by the virtual audio framework module. The audio manager is used to distribute the audio stream according to the direction of the audio stream determined by the audio policy engine. In some embodiments of the present application, the audio manager can distribute the audio stream to different virtual audio devices in the virtual audio HAL module through different buses. Different buses have different bus numbers, and the bus number can be used to identify the bus, and each bus can be connected to one or more virtual audio devices in the virtual audio HAL module. Optionally, the audio manager can send the audio stream to the corresponding bus through the mixer corresponding to the bus, and each bus corresponds to a mixer.
本地音频HAL模块用于将来自音频管理器的音频流传输至电子设备本地的音频播放器件进行音频播放。The local audio HAL module is used to transmit the audio stream from the audio manager to the local audio playback device of the electronic device for audio playback.
虚拟音频HAL模块用于维护电子设备连接的音频播放设备对应的虚拟音频设备,其中,每个虚拟音频设备对应至少一个音频播放设备,用于将来自音频管理器的音频传输至通信模块。其中,虚拟音频HAL模块维护的虚拟音频设备可以动态扩展,虚拟音频HAL模块可以根据实际场景和业务需求创建或 删除音频播放设备对应的虚拟音频设备。基于此方式,虚拟音频HAL模块可以维护用户选择的至少一个音频播放设备对应的虚拟音频设备,进而通过虚拟音频设备进行音频流的传输。The virtual audio HAL module is used to maintain virtual audio devices corresponding to the audio playback devices connected to the electronic device, wherein each virtual audio device corresponds to at least one audio playback device, and is used to transmit the audio from the audio manager to the communication module. The virtual audio devices maintained by the virtual audio HAL module can be dynamically expanded, and the virtual audio HAL module can be created or Delete the virtual audio device corresponding to the audio playback device. Based on this method, the virtual audio HAL module can maintain the virtual audio device corresponding to at least one audio playback device selected by the user, and then transmit the audio stream through the virtual audio device.
通信模块可以完成与音频播放设备建立通信连接、对来自虚拟音频HAL的音频流进行动态路由后发送至音频播放设备进行播放等功能。其中,通信模块对来自虚拟音频HAL的音频流进行动态路由,即通信模块基于虚拟音频框架配置的音频路由策略,确定来自虚拟音频HAL的音频流所对应的音频播放设备,并将该音频流发送至对应的音频播放设备进行播放。The communication module can complete functions such as establishing a communication connection with the audio playback device, dynamically routing the audio stream from the virtual audio HAL and sending it to the audio playback device for playback. Among them, the communication module dynamically routes the audio stream from the virtual audio HAL, that is, the communication module determines the audio playback device corresponding to the audio stream from the virtual audio HAL based on the audio routing strategy configured by the virtual audio framework, and sends the audio stream to the corresponding audio playback device for playback.
在本申请一些实施例中,在电子设备采用如上图2所示的软件架构时,上述图4中所示的应用层可以实现为图2中所示的应用层,上述图4中所示的虚拟音频框架模块、音频处理模块、通信模块等可以部署在图2中所示的应用程序框架层中,上述图4中所示的本地音频HAL模块、虚拟音频HAL模块可以部署在HAL层,HAL层可以作为图2中所示的内核层与硬件电路(图2中未示出)之间的接口层。HAL层可以包括用于传输音频流(或音频数据)的总线。In some embodiments of the present application, when the electronic device adopts the software architecture shown in FIG. 2 above, the application layer shown in FIG. 4 above can be implemented as the application layer shown in FIG. 2, the virtual audio framework module, audio processing module, communication module, etc. shown in FIG. 4 above can be deployed in the application framework layer shown in FIG. 2, the local audio HAL module and virtual audio HAL module shown in FIG. 4 above can be deployed in the HAL layer, and the HAL layer can be used as the interface layer between the kernel layer shown in FIG. 2 and the hardware circuit (not shown in FIG. 2). The HAL layer may include a bus for transmitting an audio stream (or audio data).
需要理解的是,如上所述的音频控制***的***架构只是一种示例,在实际应用中,该音频控制***也可以按照其它因素来划分为更多或更少的功能模块(或服务),或者可以按照其它方式来划分各个模块的功能,或者也可以不划分功能模块,而是按照整体来工作。在实际应用中,该音频控制***也可以包括更多或者更少的功能模块。It should be understood that the system architecture of the audio control system described above is only an example. In actual applications, the audio control system may also be divided into more or fewer functional modules (or services) according to other factors, or the functions of each module may be divided in other ways, or the functional modules may not be divided but the system may work as a whole. In actual applications, the audio control system may also include more or fewer functional modules.
需要说明的是,图4中所示的功能模块或器件之间的连接方式以及数据的走线方式等仅为本申请实施例提供的一种示例性说明,电子设备内部功能模块或器件之间的连接方式以及数据的走线方式等不局限于图4中所示的方式,具体实施时可以根据所执行的方法进行相关部署。It should be noted that the connection method between the functional modules or devices and the data routing method shown in Figure 4 are only an exemplary description provided in the embodiments of the present application. The connection method between the functional modules or devices inside the electronic device and the data routing method are not limited to the method shown in Figure 4. During specific implementation, relevant deployment can be carried out according to the method executed.
下面结合具体实施例,对本申请提供的方案进行说明。The solution provided in this application is described below in conjunction with specific embodiments.
本申请实施例提供的方案中,电子设备可以根据预先配置的音频路由策略,将待播放的音频发送至音频播放设备进行播放,其中,音频路由策略配置了音频、电子设备内部用于传输音频的总线、电子设备创建的虚拟音频设备以及音频播放设备之间的映射关系,基于该映射关系,电子设备可以通过音频对应的总线将音频传输至对应的虚拟音频设备,并通过虚拟音频设备将音频传输至音频播放设备进行播放。In the solution provided in the embodiment of the present application, the electronic device can send the audio to be played to the audio playback device for playback according to a pre-configured audio routing strategy, wherein the audio routing strategy configures the mapping relationship between the audio, the bus inside the electronic device for transmitting the audio, the virtual audio device created by the electronic device, and the audio playback device. Based on the mapping relationship, the electronic device can transmit the audio to the corresponding virtual audio device through the bus corresponding to the audio, and transmit the audio to the audio playback device through the virtual audio device for playback.
参照图5,本申请实施例提供的一种音频播放方法可以包括:Referring to FIG. 5 , an audio playback method provided in an embodiment of the present application may include:
S501:电子设备与多个音频播放设备建立通信连接。S501: The electronic device establishes communication connections with multiple audio playback devices.
在本申请一些实施例中,电子设备可以通过扫描所在环境中存在的设备,确定可用的多个音频播放设备,并分别与所述多个音频播放设备建立通信连接。其中,电子设备可以自动扫描和发现所在环境中的音频播放设备,也可以在接收到用户指示后扫描和发现所在环境中的音频播放设备。In some embodiments of the present application, the electronic device can determine multiple available audio playback devices by scanning the devices in the environment, and establish communication connections with the multiple audio playback devices respectively. The electronic device can automatically scan and discover the audio playback devices in the environment, or scan and discover the audio playback devices in the environment after receiving user instructions.
在与所述多个音频播放设备建立通信连接后,电子设备可以分别获取每个音频播放设备的标识信息。当用户需要选择投音的音频播放设备时,电子设备可以将获取的所述多个音频播放设备的标识信息显示给用户,以便用户从中选择投音的音频播放设备。其中,音频播放设备的标识信息可以为音频播放设备对应的名称、所在的位置等能够唯一标识音频播放设备的信息。After establishing a communication connection with the multiple audio playback devices, the electronic device can obtain the identification information of each audio playback device respectively. When the user needs to select an audio playback device for projection, the electronic device can display the obtained identification information of the multiple audio playback devices to the user so that the user can select the audio playback device for projection. The identification information of the audio playback device can be information that can uniquely identify the audio playback device, such as the name and location of the audio playback device.
S502:电子设备响应于接收到的第一操作,创建第一虚拟音频设备;其中,所述第一操作用于选择所述多个音频播放设备中的至少一个音频播放设备作为播放第一音频的设备;所述第一虚拟音频设备与所述至少一个音频播放设备对应。S502: The electronic device creates a first virtual audio device in response to a received first operation; wherein the first operation is used to select at least one audio playback device from the multiple audio playback devices as a device for playing a first audio; and the first virtual audio device corresponds to the at least one audio playback device.
在本申请一些实施例中,电子设备也可以在与所述多个电子设备建立通信连接后,以预处理方式预先执行创建所述多个电子设备中部分或全部电子设备对应的虚拟音频设备的部分过程,在接收到第一操作后再执行创建第一虚拟音频播放设备所需的后续过程。例如,电子设备可以在与多个电子设备建立通信连接后,预创建所述多个电子设备对应的虚拟音频设备但不激活虚拟音频设备,当接收到第一操作后,电子设备再从预创建的虚拟音频设备中选择第一虚拟音频设备并激活,从而完成第一虚拟音频设备的创建。In some embodiments of the present application, the electronic device may also, after establishing a communication connection with the multiple electronic devices, pre-process and pre-execute a portion of the process of creating virtual audio devices corresponding to some or all of the multiple electronic devices in a pre-processing manner, and then execute the subsequent process required to create the first virtual audio playback device after receiving the first operation. For example, after establishing a communication connection with the multiple electronic devices, the electronic device may pre-create virtual audio devices corresponding to the multiple electronic devices but not activate the virtual audio devices, and after receiving the first operation, the electronic device selects the first virtual audio device from the pre-created virtual audio devices and activates it, thereby completing the creation of the first virtual audio device.
在本申请一些实施例中,所述第一音频可以为以下任一种类型的音频:属于所述电子设备的音频,属于第一应用的音频,属于第一音频类型的音频。In some embodiments of the present application, the first audio may be any of the following types of audio: audio belonging to the electronic device, audio belonging to the first application, and audio belonging to the first audio type.
在本申请一些实施例中,电子设备可以在不同的投音模式下进行音频的投播,在电子设备采用的投音模式不同时,所述第一音频的类型不同。电子设备在响应于接收到的第一操作,创建第一虚拟音频设备之前,可以先确定采用的投音模式及第一音频的类型。In some embodiments of the present application, the electronic device can perform audio projection in different projection modes, and when the projection mode adopted by the electronic device is different, the type of the first audio is different. Before the electronic device creates the first virtual audio device in response to the received first operation, it can first determine the adopted projection mode and the type of the first audio.
在本申请一些实施例中,电子设备采用的投音模式可以为如下任一种模式: In some embodiments of the present application, the sound projection mode adopted by the electronic device may be any of the following modes:
模式1、按设备投音模式,该模式下,第一音频为属于所述电子设备的音频。Mode 1: Device audio projection mode. In this mode, the first audio is the audio belonging to the electronic device.
按设备投音模式可以理解为一对多投音模式,该模式下,一个电子设备的音频可以投音到多个音频播放设备中的至少一个音频播放设备上进行播放。在该模式下,第一音频(即电子设备生成的音频)可以包括电子设备中的所有应用或服务生成的音频。用户仅需选择需要投音的音频播放设备,针对电子设备的所有音频,电子设备均直接投音到用户所选择的音频播放设备。The per-device audio projection mode can be understood as a one-to-many audio projection mode. In this mode, the audio of an electronic device can be projected to at least one audio playback device among multiple audio playback devices for playback. In this mode, the first audio (i.e., the audio generated by the electronic device) can include the audio generated by all applications or services in the electronic device. The user only needs to select the audio playback device to which the audio needs to be projected, and for all the audio of the electronic device, the electronic device directly projects the audio to the audio playback device selected by the user.
基于该方法,电子设备可以将自身生成的所有音频,均投音到用户在电子设备连接的多个音频播放设备中所选择的音频播放设备进行播放,从而实现将一个电子设备的音频投音到其它至少一个音频播放设备进行播放的效果。Based on this method, the electronic device can project all audio generated by itself to the audio playback device selected by the user from multiple audio playback devices connected to the electronic device for playback, thereby achieving the effect of projecting the audio of one electronic device to at least one other audio playback device for playback.
模式2、按应用投音模式,该模式下,第一音频为属于第一应用的音频。Mode 2: Audio projection mode by application. In this mode, the first audio is the audio belonging to the first application.
其中,第一应用可以是用户从电子设备中安装的应用中选择的应用,或者可以是用户指示的应用,或者可以是电子设备中前台运行的应用。The first application may be an application selected by a user from applications installed in the electronic device, or may be an application indicated by a user, or may be an application running in the foreground of the electronic device.
按应用投音模式可以理解为多对多投音模式,该模式下,电子设备中每个应用的音频可以投音到多个音频播放设备中的至少一个音频播放设备上进行播放,不同应用的音频可以投音到不同的音频播放设备上进行播放。在该模式下,用户可以选择不同应用对应的音频播放设备,电子设备可以将不同应用的音频,分别投音到用户所选择的应用对应的音频播放设备。The audio projection mode by application can be understood as a many-to-many audio projection mode. In this mode, the audio of each application in the electronic device can be projected to at least one audio playback device among multiple audio playback devices for playback, and the audio of different applications can be projected to different audio playback devices for playback. In this mode, the user can select the audio playback devices corresponding to different applications, and the electronic device can project the audio of different applications to the audio playback devices corresponding to the applications selected by the user.
基于该方法,电子设备可以将特定应用的音频,投音到用户在电子设备连接的多个音频播放设备中所选择的音频播放设备进行播放。基于此方式,电子设备能够实现将不同应用的音频投音到不同的音频播放设备进行播放的效果。Based on this method, the electronic device can project the audio of a specific application to an audio playback device selected by the user from among multiple audio playback devices connected to the electronic device for playback. Based on this method, the electronic device can achieve the effect of projecting the audio of different applications to different audio playback devices for playback.
模式3、按音频类型投音模式,该模式下,第一音频为属于第一音频类型的音频。Mode 3: audio projection mode based on audio type. In this mode, the first audio is audio belonging to the first audio type.
其中,第一音频类型可以是用户从设定的多个音频类型中选择的音频类型,或者可以是用户指定的音频类型,或者可以是电子设备识别的待播放音频或正在播放的音频的音频类型。音频类型例如可以包括:视频类、音乐类、听书类等。The first audio type may be an audio type selected by the user from a plurality of preset audio types, or may be an audio type specified by the user, or may be an audio type of the audio to be played or being played recognized by the electronic device. The audio type may include, for example, video, music, audiobook, etc.
按音频类型投音模式可以理解为多对多投音模式,在该模式下,电子设备生成的每种音频类型的音频可以投音到多个音频播放设备中的至少一个音频播放设备上进行播放,不同音频类型的音频可以投音到不同的音频播放设备上进行播放。在该模式下,用户可以选择不同音频类型的音频对应的音频播放设备,电子设备可以将不同音频类型的音频,分别投音到用户所选择的该音频类型对应的音频播放设备。The audio type projection mode can be understood as a many-to-many projection mode. In this mode, audio of each audio type generated by the electronic device can be projected to at least one audio playback device among multiple audio playback devices for playback, and audio of different audio types can be projected to different audio playback devices for playback. In this mode, the user can select the audio playback device corresponding to the audio of different audio types, and the electronic device can project the audio of different audio types to the audio playback device corresponding to the audio type selected by the user.
基于该方法,电子设备可以将特定类型的音频,投音到用户在电子设备连接的多个音频播放设备中所选择的音频播放设备进行播放。基于此方式,电子设备能够实现将不同类型的音频投音到不同的音频播放设备进行播放的效果。Based on this method, the electronic device can project a specific type of audio to an audio playback device selected by the user from among multiple audio playback devices connected to the electronic device for playback. Based on this method, the electronic device can achieve the effect of projecting different types of audio to different audio playback devices for playback.
在本申请一些实施例中,电子设备可以按照如下任一种方式确定采用的投音模式:In some embodiments of the present application, the electronic device may determine the adopted sound projection mode in any of the following ways:
方式1、根据场景选择采用的投音模式。Method 1: Select the sound projection mode according to the scene.
在该方式中,电子设备可以根据预设的不同场景与投音模式的对应关系,在上述多种投音模式中选择当前场景对应的投音模式为所需采用的投音模式。其中,不同场景与投音模式的对应关系可以是电子设备的***预先配置的,或者用户预先设定的。In this manner, the electronic device can select the sound projection mode corresponding to the current scene as the desired sound projection mode from the above-mentioned multiple sound projection modes according to the preset correspondence between different scenes and sound projection modes. The correspondence between different scenes and sound projection modes can be pre-configured by the system of the electronic device or pre-set by the user.
方式2、根据用户指示确定投音模式,即将用户选择的投音模式确定为采用的投音模式。Method 2: determining the sound projection mode according to the user's instruction, that is, determining the sound projection mode selected by the user as the adopted sound projection mode.
在该方式中,用户可以实时指示所需采用的投音模式,在选择时,电子设备可以将上述可用的投音模式显示给用户,用户可以从中选择所需采用的投音模式。In this manner, the user can indicate the desired sound projection mode in real time. When selecting, the electronic device can display the above-mentioned available sound projection modes to the user, and the user can select the desired sound projection mode from them.
示例性的,在用户触发投音或者触发配置投音模式后,电子设备可以显示投音模式选择界面,该界面中备选的投音模式可以包括上述3种投音模式,当然也可以包括其它更多的投音模式,或者可以包括更少的投音模式,本申请实施例中不做具体限制。用户可以在投音模式选择界面中显示的投音模式中选择所需采用的投音模式。Exemplarily, after the user triggers the sound projection or triggers the configuration of the sound projection mode, the electronic device can display a sound projection mode selection interface, in which the alternative sound projection modes can include the above-mentioned three sound projection modes, and of course can also include other more sound projection modes, or can include fewer sound projection modes, which is not specifically limited in the embodiments of the present application. The user can select the desired sound projection mode from the sound projection modes displayed in the sound projection mode selection interface.
在本申请一些实施例中,若用户选择的投音模式为按设备投音,电子设备可以在用户选择投音模式后或者在用户触发投音时,显示投音设备选择界面,该界面中可以包括可用的音频播放设备的标识信息,用户可以在可用的音频播放设备中选择投音到哪些音频播放设备。其中,可用的音频播放设备为:与电子设备建立通信连接的音频播放设备。In some embodiments of the present application, if the audio projection mode selected by the user is audio projection by device, the electronic device can display an audio projection device selection interface after the user selects the audio projection mode or when the user triggers the audio projection, and the interface may include identification information of available audio playback devices, and the user can select which audio playback devices to project the audio to from the available audio playback devices. Among them, the available audio playback devices are: audio playback devices that establish a communication connection with the electronic device.
示例性的,以电子设备为手机,电子设备所在环境为家庭环境为例,电子设备显示的投音设备选择界面中可以包括与电子设备建立通信连接的多个音频播放设备的标识信息,例如客厅的音箱、客厅的大屏、卧室的音箱等。用户可以在该界面中选择需要投音的音频播放设备。 For example, taking the electronic device as a mobile phone and the environment where the electronic device is located as a home environment, the audio projection device selection interface displayed by the electronic device may include identification information of multiple audio playback devices that establish communication connections with the electronic device, such as speakers in the living room, a large screen in the living room, speakers in the bedroom, etc. The user can select the audio playback device to which the audio needs to be projected in the interface.
在本申请一些实施例中,若用户选择的投音模式为按应用投音,作为一种可选的实施方式,电子设备可以在用户选择投音模式后或者在用户触发配置投音应用后,显示应用选择界面,该界面中包括支持投音的应用列表,用户可以从该列表中选择需要配置投音设备的应用。然后电子可以进一步显示投音设备选择界面,该界面中可以包括可用的音频播放设备的标识信息,用户可以在可用的音频播放设备中选择将该应用的音频投音到哪些音频播放设备。其中,可用的音频播放设备为:与电子设备建立通信连接的音频播放设备。作为另一种可选的实施方式,在用户在电子设备显示的应用界面中触发选择投音模式的情况下,电子设备可以在用户选择投音模式后显示投音设备选择界面,该界面中可以包括可用的音频播放设备的标识信息,用户可以在可用的音频播放设备中选择将当前前台运行的应用的音频投音到哪些音频播放设备。其中,可用的音频播放设备为:与电子设备建立通信连接的音频播放设备。In some embodiments of the present application, if the audio projection mode selected by the user is audio projection by application, as an optional implementation, the electronic device can display an application selection interface after the user selects the audio projection mode or after the user triggers the configuration of the audio projection application, the interface includes a list of applications that support audio projection, and the user can select the application that needs to configure the audio projection device from the list. Then the electronic device can further display the audio projection device selection interface, which may include the identification information of the available audio playback devices, and the user can choose which audio playback devices to project the audio of the application from the available audio playback devices. Among them, the available audio playback devices are: audio playback devices that establish a communication connection with the electronic device. As another optional implementation, when the user triggers the selection of the audio projection mode in the application interface displayed by the electronic device, the electronic device can display the audio projection device selection interface after the user selects the audio projection mode, the interface may include the identification information of the available audio playback devices, and the user can choose which audio playback devices to project the audio of the application currently running in the foreground from the available audio playback devices. Among them, the available audio playback devices are: audio playback devices that establish a communication connection with the electronic device.
在本申请一些实施例中,若用户选择的投音模式为按音频类型投音,电子设备选择投音设备的方法可以参照上述按应用投音模式下电子设备选择投音设备的方法,此处不再详述。In some embodiments of the present application, if the sound projection mode selected by the user is sound projection by audio type, the method for the electronic device to select the sound projection device can refer to the method for the electronic device to select the sound projection device in the sound projection mode by application mentioned above, which will not be described in detail here.
可选的,上述方法中,电子设备可以在设定界面(例如***设置界面、应用界面等)中显示用于触发投音等功能等的控件。用户可以通过对相关控件进行操作,来触发电子设备显示对应的功能界面。Optionally, in the above method, the electronic device can display controls for triggering functions such as sound projection in a setting interface (such as a system setting interface, an application interface, etc.). The user can trigger the electronic device to display the corresponding function interface by operating the relevant controls.
在本申请一些实施例中,第一操作为用户选择音频播放设备的操作,例如可以为用户在上述的投音设备选择界面中进行的选择音频播放设备的操作。在接收到第一操作后,电子设备可以根据第一操作确定用户选择的至少一个音频设备,并可以创建所述至少一个音频播放设备对应的第一虚拟音频设备。其中,第一虚拟音频设备用于将电子设备中上层应用生成的音频传输至所述至少一个音频播放设备进行播放。In some embodiments of the present application, the first operation is an operation of the user selecting an audio playback device, for example, it can be an operation of the user selecting an audio playback device in the above-mentioned sound projection device selection interface. After receiving the first operation, the electronic device can determine at least one audio device selected by the user based on the first operation, and can create a first virtual audio device corresponding to the at least one audio playback device. The first virtual audio device is used to transmit the audio generated by the upper-layer application in the electronic device to the at least one audio playback device for playback.
在本申请一些实施例中,电子设备也可以不设置上述的投音模式,而是根据用户的选择直接确定投音设备。具体的,电子设备可以在应用界面中增加用于触发投音的控件,并可以响应于用户对该控件进行的操作,进一步显示投音设备选择界面,该界面中可以包括用于指示可用的音频播放设备的信息,用户可以在可用的音频播放设备中选择投音到哪些音频播放设备。其中,可用的音频播放设备包括与电子设备建立通信连接的音频播放设备。In some embodiments of the present application, the electronic device may not set the above-mentioned sound projection mode, but directly determine the sound projection device according to the user's selection. Specifically, the electronic device may add a control for triggering sound projection in the application interface, and may further display a sound projection device selection interface in response to the user's operation on the control, which may include information indicating available audio playback devices, and the user can select which audio playback devices to project the sound to from the available audio playback devices. Among them, the available audio playback devices include audio playback devices that establish a communication connection with the electronic device.
示例性的,以电子设备为手机,电子设备所在环境为家庭环境为例,电子设备显示的投音设备选择界面中可以包括与电子设备建立通信连接的多个可用的音频播放设备的信息如客厅音箱、客厅大屏、卧室音箱等。用户可以在该界面中选择接受投音的音频播放设备。例如,当手机中的视频应用播放视频时,手机的显示屏上可以显示视频界面,该界面中可以包括用于触发投音的控件。在用户点击该控件后,手机可以切换为显示图6中的(a)示意图所示的应用界面,该应用界面中包括投音设备选择界面,用户可以在投音设备选择界面中选择至少一个音频输出设备(例如客厅大屏和客厅音箱)作为投音设备,进而通过所选择的投音设备播放视频对应的音频。再例如,当手机中的音乐应用播放音乐时,手机的显示屏上可以显示音乐播放界面,该界面中可以包括用于触发投音的控件。在用户点击该控件后,手机可以切换为显示图6中的(b)示意图所示的应用界面,该应用界面中包括投音设备选择界面,用户可以在投音设备选择界面中选择至少一个音频输出设备(例如卧室音箱)作为投音设备,进而通过所选择的投音设备播放音乐。基于上述方法,用户可以在各应用的应用界面中独立选择用于播放该应用的音频的投音设备,且不同应用对应的投音设备的选择过程是互相独立的。基于此,电子设备可以将不同应用的音频分别投音到用户选择的音频播放设备进行播放,进而实现按应用投音的效果。Exemplarily, taking the electronic device as a mobile phone and the environment where the electronic device is located as a home environment, the audio projection device selection interface displayed by the electronic device may include information on multiple available audio playback devices that establish communication connections with the electronic device, such as living room speakers, living room large screens, bedroom speakers, etc. The user can select an audio playback device that accepts audio projection in this interface. For example, when a video application in a mobile phone plays a video, a video interface may be displayed on the display screen of the mobile phone, and the interface may include controls for triggering audio projection. After the user clicks on the control, the mobile phone may switch to display the application interface shown in the schematic diagram (a) in Figure 6, which includes an audio projection device selection interface, and the user can select at least one audio output device (such as a living room large screen and a living room speaker) as an audio projection device in the audio projection device selection interface, and then play the audio corresponding to the video through the selected audio projection device. For another example, when a music application in a mobile phone plays music, a music playback interface may be displayed on the display screen of the mobile phone, and the interface may include controls for triggering audio projection. After the user clicks on the control, the mobile phone can switch to display the application interface shown in the schematic diagram (b) in Figure 6, which includes a sound projection device selection interface. The user can select at least one audio output device (such as a bedroom speaker) as a sound projection device in the sound projection device selection interface, and then play music through the selected sound projection device. Based on the above method, the user can independently select the sound projection device for playing the audio of each application in the application interface of the application, and the selection process of the sound projection devices corresponding to different applications is independent of each other. Based on this, the electronic device can project the audio of different applications to the audio playback device selected by the user for playback, thereby achieving the effect of projecting by application.
S503:电子设备建立第一音频、第一虚拟音频设备、所述至少一个音频播放设备间的映射关系,并将该映射关系保存为音频路由策略。S503: The electronic device establishes a mapping relationship among the first audio, the first virtual audio device, and the at least one audio playback device, and saves the mapping relationship as an audio routing policy.
在本申请一些实施例中,电子设备在创建第一虚拟音频设备后,可以得到所述第一音频、所述第一虚拟音频设备、所述至少一个音频播放设备之间的映射关系,并可以将该映射关系作为一条音频路由策略。In some embodiments of the present application, after creating the first virtual audio device, the electronic device can obtain a mapping relationship between the first audio, the first virtual audio device, and the at least one audio playback device, and can use the mapping relationship as an audio routing strategy.
在本申请一些实施例中,电子设备可以在创建第一虚拟音频设备后为第一虚拟音频设备分配对应的第一总线,第一总线具体用于将电子设备中***或应用生成的音频传输到第一虚拟音频设备。在分配总线后,电子设备可以将第一音频、第一总线、第一虚拟音频设备、所述至少一个音频播放设备之间的映射关系作为一条音频路由策略。可选的,电子设备可以在空闲的总线中随机选择一个总线作为第一总线,或者可以按照预配置的总线选择规则,在空闲的总线中选择第一总线。电子设备为第一虚拟音频设备配置第一总线后,第一总线的状态由空闲状态变为非空闲状态。In some embodiments of the present application, the electronic device may allocate a corresponding first bus to the first virtual audio device after creating the first virtual audio device, and the first bus is specifically used to transmit the audio generated by the system or application in the electronic device to the first virtual audio device. After allocating the bus, the electronic device may use the mapping relationship between the first audio, the first bus, the first virtual audio device, and the at least one audio playback device as an audio routing strategy. Optionally, the electronic device may randomly select a bus from the idle buses as the first bus, or may select the first bus from the idle buses according to a preconfigured bus selection rule. After the electronic device configures the first bus for the first virtual audio device, the state of the first bus changes from an idle state to a non-idle state.
在创建上述映射关系作为音频路由策略后,后续当需要播放第一音频时,电子设备可以根据该映射 关系确定第一音频的传输路径和播放该第一音频的音频播放设备,进而通过确定的传输路径将第一音频传输至对应的音频播放设备进行播放。After creating the above mapping relationship as the audio routing strategy, when the first audio needs to be played later, the electronic device can The relationship determines a transmission path of the first audio and an audio playback device that plays the first audio, and then transmits the first audio to the corresponding audio playback device through the determined transmission path for playback.
上述方法中,电子设备可以在创建的映射关系中记录第一音频的标识信息、第一虚拟音频设备的标识信息、第一总线的总线号、所述至少一个音频播放设备的标识信息等。其中,电子设备可以采用第一音频所属的设备/应用/音频类型作为第一音频的标识信息。示例性的,当电子设备采用上述模式1所述的投音模式时,第一音频可以为电子设备生成的任意音频,电子设备可以将电子设备的标识信息作为第一音频的标识信息。其中,电子设备的标识信息可以为电子设备的名称、所在位置、设备ID等能够唯一标识电子设备的信息。当电子设备采用上述模式2所述的投音模式时,第一音频可以为第一应用生成的任意音频,电子设备可以将第一应用的标识信息作为第一音频的标识信息。其中,第一应用的标识信息例如可以为第一应用的名称、代码等能够唯一标识该第一应用的信息。当电子设备采用上述模式3所述的投音模式时,第一音频可以为电子设备生成的属于第一音频类型的任意音频,电子设备可以将第一音频类型作为第一音频的标识信息。虚拟音频设备的标识信息可以为虚拟音频设备的名称、标识号(identity document,ID)(可以是电子设备配置的)等能够唯一标识虚拟音频设备的信息。第一总线的总线号可以是电子设备***配置的。音频播放设备的标识信息可以为音频播放设备的名称、标识号(identity document,ID)等能够唯一标识音频播放设备的信息。In the above method, the electronic device can record the identification information of the first audio, the identification information of the first virtual audio device, the bus number of the first bus, the identification information of the at least one audio playback device, etc. in the created mapping relationship. Among them, the electronic device can use the device/application/audio type to which the first audio belongs as the identification information of the first audio. Exemplarily, when the electronic device adopts the sound projection mode described in the above mode 1, the first audio can be any audio generated by the electronic device, and the electronic device can use the identification information of the electronic device as the identification information of the first audio. Among them, the identification information of the electronic device can be the name of the electronic device, the location, the device ID, and other information that can uniquely identify the electronic device. When the electronic device adopts the sound projection mode described in the above mode 2, the first audio can be any audio generated by the first application, and the electronic device can use the identification information of the first application as the identification information of the first audio. Among them, the identification information of the first application can be, for example, the name, code, and other information that can uniquely identify the first application. When the electronic device adopts the sound projection mode described in the above mode 3, the first audio can be any audio of the first audio type generated by the electronic device, and the electronic device can use the first audio type as the identification information of the first audio. The identification information of the virtual audio device can be the name of the virtual audio device, the identification document (ID) (which can be configured by the electronic device), and other information that can uniquely identify the virtual audio device. The bus number of the first bus may be a system configuration of the electronic device. The identification information of the audio playback device may be a name of the audio playback device, an identification document (ID), or other information that can uniquely identify the audio playback device.
基于上述实施例提供的方法,电子设备可以建立用于作为音频路由策略的多组映射关系。示例性的,以电子设备采用上述模式2所述的投音模式为例,本申请实施例提供的一种音频路由策略如下表1中所示:Based on the method provided in the above embodiment, the electronic device can establish multiple groups of mapping relationships used as audio routing strategies. For example, taking the electronic device adopting the sound projection mode described in the above mode 2 as an example, an audio routing strategy provided in the embodiment of the present application is shown in Table 1 below:
表1音频路由策略
Table 1 Audio routing strategy
其中,上述表1中所示的应用1~3为电子设备中的应用,总线0~2为电子设备内部的总线,本地音频播放服务、虚拟音频设备1~2可以为电子设备内部的***服务,音频播放设备0可以为电子设备自身,音频播放设备1~3为与电子设备建立通信连接的多个音频播放设备。上述表1所示的音频路由策略中包括3组映射关系。其中,映射关系1中的音频播放设备0即为电子设备自身,与应用1的音频、总线0以及本地音频播放服务对应。映射关系2中的音频播放设备1、应用2的音频、总线1以及虚拟音频设备1对应。映射关系3中的音频播放设备2~音频播放设备3、应用3的音频、总线2以及虚拟音频设备2对应。则基于上述音频路由策略,当电子设备需要播放应用1的音频时,可以通过总线0和本地音频播放服务将应用1的音频传输至本地音频播放设备即电子设备自身的播放器进行播放。当电子设备需要播放应用2的音频时,可以通过总线1和虚拟音频设备1将应用2的音频传输至音频播放设备1进行播放。当电子设备需要播放应用3的音频时,可以通过总线2和虚拟音频设备2将应用3的音频传输至音频播放设备2和音频播放设备3进行播放。Among them, the applications 1 to 3 shown in the above Table 1 are applications in the electronic device, buses 0 to 2 are buses inside the electronic device, local audio playback services and virtual audio devices 1 to 2 can be system services inside the electronic device, audio playback device 0 can be the electronic device itself, and audio playback devices 1 to 3 are multiple audio playback devices that establish communication connections with the electronic device. The audio routing strategy shown in the above Table 1 includes three groups of mapping relationships. Among them, the audio playback device 0 in the mapping relationship 1 is the electronic device itself, corresponding to the audio of application 1, bus 0 and local audio playback service. The audio playback device 1 in the mapping relationship 2 corresponds to the audio of application 2, bus 1 and virtual audio device 1. The audio playback devices 2 to audio playback devices 3 in the mapping relationship 3 correspond to the audio of application 3, bus 2 and virtual audio device 2. Based on the above audio routing strategy, when the electronic device needs to play the audio of application 1, the audio of application 1 can be transmitted to the local audio playback device, that is, the player of the electronic device itself, through bus 0 and the local audio playback service for playback. When the electronic device needs to play the audio of application 2, the audio of application 2 can be transmitted to the audio playback device 1 through bus 1 and virtual audio device 1 for playback. When the electronic device needs to play the audio of application 3, the audio of application 3 can be transmitted to audio playback device 2 and audio playback device 3 through bus 2 and virtual audio device 2 for playback.
在本申请一些实施例中,电子设备可以根据用户指示或者实际场景的变化,对音频路由策略中的映射关系进行更新。例如,基于上述表1所示音频路由策略对应的场景,当用户选择将播放应用2的设备更新为音频播放设备4时,电子设备可以将路由映射关系2中的音频播放设备2更新为音频播放设备4,从而实现音频路由策略的更新。再例如,基于上述表1所示音频路由策略对应的场景,当音频播放设备2下线时,电子设备与音频播放设备2之间的通信连接断开,则电子设备可以删除路由映射关系2,从而实现音频路由策略的更新。In some embodiments of the present application, the electronic device can update the mapping relationship in the audio routing policy according to user instructions or changes in actual scenarios. For example, based on the scenario corresponding to the audio routing policy shown in Table 1 above, when the user chooses to update the device that plays application 2 to audio playback device 4, the electronic device can update the audio playback device 2 in the routing mapping relationship 2 to the audio playback device 4, thereby implementing the update of the audio routing policy. For another example, based on the scenario corresponding to the audio routing policy shown in Table 1 above, when the audio playback device 2 goes offline, the communication connection between the electronic device and the audio playback device 2 is disconnected, and the electronic device can delete the routing mapping relationship 2, thereby implementing the update of the audio routing policy.
基于上述方法,电子设备可以通过维护上述路由映射关系表的方式,动态维护音频路由策略,以便根据音频路由策略进行投音相关的控制。Based on the above method, the electronic device can dynamically maintain the audio routing strategy by maintaining the above routing mapping relationship table, so as to perform audio projection related control according to the audio routing strategy.
可选的,步骤S503可以由上述的第一服务完成。Optionally, step S503 may be completed by the above-mentioned first service.
S504:当电子设备接收到播放第一音频或者将第一音频投音到其它音频播放设备进行播放的指示时,通过所述第一虚拟音频设备将所述第一音频传输至所述至少一个音频播放设备,并指示所述至少一个音频播放设备播放所述第一音频。 S504: When the electronic device receives an instruction to play the first audio or to project the first audio to other audio playback devices for playback, the first audio is transmitted to the at least one audio playback device through the first virtual audio device, and the at least one audio playback device is instructed to play the first audio.
在本申请一些实施例中,电子设备可以通过为第一虚拟音频设备分配的第一总线,将电子设备中应用生成的第一音频传输至第一虚拟音频设备,再由第一虚拟音频设备将第一音频传输至对应的所述至少一个音频播放设备进行播放。该步骤的具体实施方式可参照下文中的相关介绍,此处暂不详述。In some embodiments of the present application, the electronic device can transmit the first audio generated by the application in the electronic device to the first virtual audio device through the first bus allocated to the first virtual audio device, and then the first virtual audio device transmits the first audio to the corresponding at least one audio playback device for playback. The specific implementation of this step can be referred to the relevant introduction below, which will not be described in detail here.
在本申请一些实施例中,电子设备在将第一音频投音到所述至少一个音频播放设备进行播放的过程中,若需断开投音,则可以停止将音频发送至所述至少一个音频播放设备,删除第一音频、第一虚拟音频设备和所述至少一个音频播放设备间的映射关系,删除(或销毁)已创建的第一虚拟音频设备,以及将第一虚拟音频设备对应的第一总线设置为空闲状态。In some embodiments of the present application, when the electronic device is in the process of projecting the first audio to the at least one audio playback device for playback, if it is necessary to disconnect the projection, it can stop sending the audio to the at least one audio playback device, delete the mapping relationship between the first audio, the first virtual audio device and the at least one audio playback device, delete (or destroy) the created first virtual audio device, and set the first bus corresponding to the first virtual audio device to an idle state.
在本申请一些实施例中,作为一种可选的实施方式,当所述至少一个音频播放设备中存在下线的设备时,电子设备可以删除第一音频、第一虚拟音频设备和所述至少一个音频播放设备间的映射关系,删除已创建的第一虚拟音频设备,以及将第一虚拟音频设备对应的第一总线设置为空闲状态。作为另一种可选的实施方式,当所述至少一个音频播放设备中存在下线的设备时,电子设备可以将第一音频、第一虚拟音频设备和所述至少一个音频播放设备间的映射关系更新为第一音频、第一虚拟音频设备和所述至少一个音频播放设备中未下线的音频播放设备间的映射关系。则电子设备需要播放第一音频时,可以通过所述至少一个音频播放设备中的未下线的设备进行播放。作为又一种可选的实施方式,当所述至少一个音频播放设备均下线时,电子设备可以删除第一音频、第一虚拟音频设备和所述至少一个音频播放设备间的映射关系,删除已创建的第一虚拟音频设备,以及将第一虚拟音频设备对应的第一总线设置为空闲状态。In some embodiments of the present application, as an optional implementation, when there is an offline device in the at least one audio playback device, the electronic device can delete the mapping relationship between the first audio, the first virtual audio device and the at least one audio playback device, delete the created first virtual audio device, and set the first bus corresponding to the first virtual audio device to an idle state. As another optional implementation, when there is an offline device in the at least one audio playback device, the electronic device can update the mapping relationship between the first audio, the first virtual audio device and the at least one audio playback device to the mapping relationship between the first audio, the first virtual audio device and the audio playback device that is not offline in the at least one audio playback device. Then when the electronic device needs to play the first audio, it can be played through the device that is not offline in the at least one audio playback device. As another optional implementation, when the at least one audio playback device is offline, the electronic device can delete the mapping relationship between the first audio, the first virtual audio device and the at least one audio playback device, delete the created first virtual audio device, and set the first bus corresponding to the first virtual audio device to an idle state.
在上述实施例提供的方法中,电子设备可以基于用户需求配置音频路由策略,并按照该策略,通过虚拟音频设备进行音频流的转发,实现将电子设备的音频投音至其它音频播放设备进行播放的效果。该方法能够支持并行的对不同音频进行上述处理过程,能够实现通过不同虚拟音频设备将不同音频分别传输至不同音频播放设备进行播放的效果,灵活性和实用性较高。In the method provided in the above embodiment, the electronic device can configure the audio routing strategy based on user needs, and forward the audio stream through the virtual audio device according to the strategy, so as to achieve the effect of projecting the audio of the electronic device to other audio playback devices for playback. The method can support the above processing of different audio in parallel, and can achieve the effect of transmitting different audio to different audio playback devices for playback through different virtual audio devices, with high flexibility and practicality.
下面以上述实施例提供的方法应用于上述图4所示的音频控制***中为例,以电子设备采用上述模式2所述的投音模式、用户在应用中触发投音为例,对本申请实施例提供的方案进行说明。The following takes the method provided in the above embodiment as an example applied to the audio control system shown in Figure 4 above, and takes the electronic device adopting the sound projection mode described in the above mode 2 and the user triggering the sound projection in the application as an example to illustrate the solution provided in the embodiment of the present application.
其中,电子设备可以在用户指示启动投音功能后,执行上述实施例提供的方法来创建虚拟音频设备并建立音频路由策略,并在投音过程中按照建立的音频路由策略进行投音相关的控制。相应的,在用户触发关闭投音功能后,电子设备可以将创建的虚拟音频设备以及音频路由策略删除,并断开与音频播放设备之间的通信连接。下面进行具体说明。Among them, after the user instructs to start the audio projection function, the electronic device can execute the method provided in the above embodiment to create a virtual audio device and establish an audio routing strategy, and perform audio projection-related controls according to the established audio routing strategy during the audio projection process. Correspondingly, after the user triggers to turn off the audio projection function, the electronic device can delete the created virtual audio device and audio routing strategy, and disconnect the communication connection with the audio playback device. The following is a detailed explanation.
示例性的,参照图7,电子设备启动投音功能并配置音频路由策略的一种可能的流程可以包括:Exemplarily, referring to FIG. 7 , a possible process of the electronic device starting the audio projection function and configuring the audio routing strategy may include:
S701:电子设备中的通信模块与扫描到的音频播放设备建立通信连接。S701: A communication module in the electronic device establishes a communication connection with the scanned audio playback device.
S702:电子设备中的应用接收用户进行的启动投音操作,该操作用于指示启动投音功能并指示用于播放该应用的音频的多个音频播放设备。S702: The application in the electronic device receives an audio projection start operation performed by the user, where the operation is used to indicate the start of the audio projection function and to indicate multiple audio playback devices for playing the audio of the application.
其中,应用在接收启动投音操作之前,可以先根据用户指示或者当前应用场景确定采用的投音模式即上述模式2,并将该投音模式指示给音频处理模块。Before receiving the start-up audio projection operation, the application may first determine the audio projection mode to be adopted, namely, the above-mentioned mode 2, according to the user's instructions or the current application scenario, and indicate the audio projection mode to the audio processing module.
可选的,所述多个音频播放设备可以为已与电子设备建立通信连接的音频播放设备。Optionally, the multiple audio playback devices may be audio playback devices that have established a communication connection with the electronic device.
电子设备根据用户操作确定接受电子设备投音的音频播放设备的方法,可以参照上述实施例中的介绍,此处不再赘述。The method for an electronic device to determine the audio playback device that receives the sound projected by the electronic device based on user operations can be referred to the introduction in the above embodiments and will not be repeated here.
S703:应用响应于接收到的操作,指示电子设备中的音频处理模块配置多个音频播放设备对应的音频通路,该音频通路用于将应用的音频投音至所述多个音频播放设备。S703: In response to the received operation, the application instructs the audio processing module in the electronic device to configure audio paths corresponding to multiple audio playback devices, where the audio paths are used to project the audio of the application to the multiple audio playback devices.
S704:音频处理模块指示电子设备中的虚拟音频HAL模块创建所述多个音频播放设备对应的虚拟音频设备,以及,从空闲的总线中选择分配给所述虚拟音频设备的总线,并将该总线设置为非空闲状态。S704: The audio processing module instructs the virtual audio HAL module in the electronic device to create virtual audio devices corresponding to the multiple audio playback devices, and selects a bus allocated to the virtual audio device from the idle buses and sets the bus to a non-idle state.
S705:虚拟音频HAL模块创建所述多个音频播放设备对应的虚拟音频设备。S705: The virtual audio HAL module creates virtual audio devices corresponding to the multiple audio playback devices.
S706:虚拟音频HAL模块通知音频处理模块已成功创建虚拟音频设备。S706: The virtual audio HAL module notifies the audio processing module that the virtual audio device has been successfully created.
S707:音频处理模块通知通信模块建立所述虚拟音频设备与所述多个音频播放设备之间的映射关系。S707: The audio processing module notifies the communication module to establish a mapping relationship between the virtual audio device and the multiple audio playback devices.
S708:通信模块建立虚拟音频设备与多个音频播放设备之间的映射关系,并基于该映射关系创建虚拟音频数据通路,该虚拟音频数据通路用于将来自虚拟音频设备的音频发送至多个音频播放设备。S708: The communication module establishes a mapping relationship between the virtual audio device and the multiple audio playback devices, and creates a virtual audio data path based on the mapping relationship. The virtual audio data path is used to send the audio from the virtual audio device to the multiple audio playback devices.
S709:通信模块通知音频处理模块已成功创建虚拟音频数据通路。 S709: The communication module notifies the audio processing module that the virtual audio data path has been successfully created.
S710:音频处理模块通知应用已成功创建音频通路。S710: The audio processing module notifies the application that the audio path has been successfully created.
示例性的,参照图8,以上述方法应用于上述图4所示的音频控制***中为例,以电子设备采用上述模式2所述的投音模式、用户在应用中触发投音为例,电子设备关闭投音的一种可能的流程可以包括:For example, referring to FIG8 , taking the above method applied to the audio control system shown in FIG4 as an example, taking the electronic device adopting the sound projection mode described in Mode 2 above and the user triggering the sound projection in the application as an example, a possible process for the electronic device to turn off the sound projection may include:
S801:电子设备中的应用接收用户进行的操作,该操作用于触发停止投音。S801: An application in the electronic device receives an operation performed by a user, where the operation is used to trigger the stop of the audio projection.
S802:应用响应于接收到的操作,指示电子设备中的音频处理模块断开多个音频播放设备对应的音频通路,该音频通路为音频处理模块配置的用于将应用的音频传输至所述多个音频播放设备的通路。S802: In response to the received operation, the application instructs the audio processing module in the electronic device to disconnect the audio paths corresponding to the multiple audio playback devices, where the audio paths are paths configured by the audio processing module to transmit the audio of the application to the multiple audio playback devices.
S803:音频处理模块指示电子设备中的通信模块删除已建立的虚拟音频设备与多个音频播放设备之间的映射关系。S803: The audio processing module instructs the communication module in the electronic device to delete the established mapping relationship between the virtual audio device and the multiple audio playback devices.
S804:通信模块删除已建立的虚拟音频设备与多个音频播放设备之间的映射关系,并断开已建立的虚拟音频数据通路,该虚拟音频数据通路用于将来自虚拟音频设备的音频发送至多个音频播放设备。S804: The communication module deletes the established mapping relationship between the virtual audio device and the multiple audio playback devices, and disconnects the established virtual audio data path, where the virtual audio data path is used to send the audio from the virtual audio device to the multiple audio playback devices.
S805:音频处理模块指示电子设备中的虚拟音频HAL模块删除已创建的虚拟音频设备,并将为该虚拟音频设备分配的总线设置为空闲状态。S805: The audio processing module instructs the virtual audio HAL module in the electronic device to delete the created virtual audio device, and sets the bus allocated to the virtual audio device to an idle state.
S806:虚拟音频HAL模块删除已创建的虚拟音频设备。S806: The virtual audio HAL module deletes the created virtual audio device.
可选的,图8所示的方法可以在上述图7所示的方法之后执行,即步骤S801可以在步骤S710之后执行。Optionally, the method shown in FIG. 8 may be performed after the method shown in FIG. 7 , that is, step S801 may be performed after step S710 .
参阅图9,以将第一应用的音频投音到第一虚拟音频设备对应的第一音频播放设备进行播放为例,本申请实施例提供的一种音频播放方法可以包括:Referring to FIG. 9 , taking the example of projecting the audio of the first application to the first audio playback device corresponding to the first virtual audio device for playback, an audio playback method provided in an embodiment of the present application may include:
S901:第一应用响应于播放第一音频的指示,生成第一音频。S901: The first application generates the first audio in response to an instruction to play the first audio.
S902:第一应用将第一音频发送至音频处理模块。S902: The first application sends the first audio to the audio processing module.
S903:音频处理模块根据预先创建的音频路由策略,确定第一音频对应的第一虚拟音频设备和第一虚拟音频设备对应的第一总线。S903: The audio processing module determines, according to a pre-created audio routing policy, a first virtual audio device corresponding to the first audio and a first bus corresponding to the first virtual audio device.
S904:音频处理模块通过第一总线,将第一音频和第一总线指示信息发送至第一虚拟音频设备,其中,第一总线指示信息用于指示第一总线。S904: The audio processing module sends the first audio and first bus indication information to the first virtual audio device through the first bus, wherein the first bus indication information is used to indicate the first bus.
其中,第一虚拟音频设备通过对应的第一总线接收来自音频处理模块的第一音频。The first virtual audio device receives the first audio from the audio processing module through the corresponding first bus.
可选的,第一总线指示信息可以为第一总线的总线号。Optionally, the first bus indication information may be a bus number of the first bus.
S905:第一虚拟音频设备将第一音频和第一设备指示信息发送至通信模块,其中,第一设备指示信息用于指示第一音频播放设备。S905: The first virtual audio device sends the first audio and first device indication information to the communication module, wherein the first device indication information is used to indicate the first audio playback device.
其中,第一虚拟音频设备可以指示通信模块将第一音频发送至第一音频播放设备。The first virtual audio device may instruct the communication module to send the first audio to the first audio playback device.
可选的,所述第一设备指示信息可以为所述第一总线指示信息,则通信模块可以根据第一总线指示信息确定第一总线,根据第一总线确定对应的第一虚拟音频设备,进而根据第一虚拟音频设备确定对应的第一音频播放设备。Optionally, the first device indication information may be the first bus indication information, and the communication module may determine the first bus according to the first bus indication information, determine the corresponding first virtual audio device according to the first bus, and further determine the corresponding first audio playback device according to the first virtual audio device.
可选的,所述第一设备指示信息也可以为所述第一音频播放设备的设备标识。Optionally, the first device indication information may also be a device identifier of the first audio playback device.
S906:通信模块根据第一设备指示信息确定第一音频播放设备。S906: The communication module determines the first audio playback device according to the first device indication information.
S907:通信模块将第一音频发送至第一音频播放设备。S907: The communication module sends the first audio to the first audio playback device.
其中,上述图9所示的方法在上述图7所示的方法执行结束后执行,在上述图8所示的方法开始执行前执行,即上述步骤S901在上述步骤S710之后执行,上述步骤S801在上述步骤S907之后执行。The method shown in FIG. 9 is executed after the method shown in FIG. 7 is completed, and before the method shown in FIG. 8 starts to be executed, that is, step S901 is executed after step S710, and step S801 is executed after step S907.
参阅图10,以将第二应用的音频投音到第二虚拟音频设备对应的第二音频播放设备进行播放为例,本申请实施例提供的一种音频播放方法可以包括:Referring to FIG. 10 , taking the example of projecting the audio of the second application to the second audio playback device corresponding to the second virtual audio device for playback, an audio playback method provided in an embodiment of the present application may include:
S1001:第二应用响应于播放第二音频的指示,生成第二音频。S1001: The second application generates a second audio in response to an instruction to play the second audio.
S1002:第二应用将第二音频发送至音频处理模块。S1002: The second application sends the second audio to the audio processing module.
S1003:音频处理模块根据预先创建的音频路由策略,确定第二音频对应的第二虚拟音频设备和第二虚拟音频设备对应的第二总线。S1003: The audio processing module determines, according to a pre-created audio routing strategy, a second virtual audio device corresponding to the second audio and a second bus corresponding to the second virtual audio device.
S1004:音频处理模块通过第二总线,将第二音频和第二总线指示信息发送至第二虚拟音频设备,其中,第二总线指示信息用于指示第二总线。S1004: The audio processing module sends the second audio and the second bus indication information to the second virtual audio device through the second bus, wherein the second bus indication information is used to indicate the second bus.
其中,第二虚拟音频设备通过对应的第二总线接收来自音频处理模块的第二音频。The second virtual audio device receives the second audio from the audio processing module through the corresponding second bus.
可选的,第二总线指示信息可以为第二总线的总线号。Optionally, the second bus indication information may be a bus number of the second bus.
S1005:第二虚拟音频设备将第二音频和第二设备指示信息发送至通信模块,其中,第二设备指示信息用于指示第二音频播放设备。 S1005: The second virtual audio device sends the second audio and second device indication information to the communication module, wherein the second device indication information is used to indicate the second audio playback device.
其中,第二虚拟音频设备可以指示通信模块将第二音频发送至第二音频播放设备。The second virtual audio device may instruct the communication module to send the second audio to the second audio playback device.
S1006:通信模块根据第二设备指示信息确定第二音频播放设备。S1006: The communication module determines the second audio playback device according to the second device indication information.
S1007:通信模块将第二音频发送至第二音频播放设备。S1007: The communication module sends the second audio to the second audio playback device.
其中,上述图10所示的方法与上述图9所示的方法的执行先后顺序可以是任意顺序,即上述图10所示的方法可以早于上述图9所示的方法执行,或者上述图10所示的方法可以晚于上述图9所示的方法执行,或者上述图10所示的方法可以与上述图9所示的方法同步执行。上述图10所示的方法在上述图7所示的方法执行结束后执行,在上述图8所示的方法开始执行前执行,即上述步骤S1001在上述步骤S710之后执行,上述步骤S801在上述步骤S1007之后执行。The execution order of the method shown in FIG. 10 and the method shown in FIG. 9 can be any order, that is, the method shown in FIG. 10 can be executed earlier than the method shown in FIG. 9, or the method shown in FIG. 10 can be executed later than the method shown in FIG. 9, or the method shown in FIG. 10 can be executed synchronously with the method shown in FIG. 9. The method shown in FIG. 10 is executed after the execution of the method shown in FIG. 7 is completed and before the execution of the method shown in FIG. 8 is started, that is, step S1001 is executed after step S710, and step S801 is executed after step S1007.
需要说明的是,上述各实施例提供的具体实施流程,仅是对本申请实施例适用方法流程的举例说明,其中各步骤的执行顺序可根据实际需求进行相应调整,还可以增加其它步骤,或减少部分步骤。各步骤的具体实施方式可参照前文实施例中的相关介绍,此处不再详述。It should be noted that the specific implementation processes provided in the above embodiments are only examples of the applicable method processes of the embodiments of the present application, wherein the execution order of each step can be adjusted accordingly according to actual needs, and other steps can be added or some steps can be reduced. The specific implementation methods of each step can refer to the relevant introduction in the previous embodiments, and will not be described in detail here.
基于以上实施例及相同技术构思,本申请实施例还提供一种音频播放方法,如图11中所示,该方法可以包括:Based on the above embodiments and the same technical concept, the embodiment of the present application further provides an audio playback method, as shown in FIG11 , which may include:
S1101:第一电子设备响应于接收到的第一操作,将第一音频发送到至少一个第二电子设备,并指示所述至少一个第二电子设备播放所述第一音频;其中,所述第一操作用于指示通过所述至少一个第二电子设备播放所述第一音频。S1101: In response to a received first operation, a first electronic device sends a first audio to at least one second electronic device and instructs the at least one second electronic device to play the first audio; wherein the first operation is used to instruct the at least one second electronic device to play the first audio.
在本申请一些实施例中,第一电子设备中可以包括第一应用、音频处理服务和音频发送服务。其中,第一应用用于生成第一音频,并将第一音频发送至音频处理服务。音频处理服务可以用于将第一音频分发至所述第一电子设备创建的所述至少一个第二电子设备对应的第一虚拟音频设备。第一虚拟音频设备可以用于将所述第一音频发送至所述音频发送服务。所述音频发送服务可以用于将所述第一音频发送至所述至少一个第二电子设备。In some embodiments of the present application, the first electronic device may include a first application, an audio processing service, and an audio sending service. Among them, the first application is used to generate a first audio and send the first audio to the audio processing service. The audio processing service can be used to distribute the first audio to a first virtual audio device corresponding to the at least one second electronic device created by the first electronic device. The first virtual audio device can be used to send the first audio to the audio sending service. The audio sending service can be used to send the first audio to the at least one second electronic device.
示例性的,所述第一应用可以为图4所示的音频控制***中的任一应用,所述音频处理服务可以为图4所示的音频控制***中的音频处理模块,所述音频发送服务可以为图4所示的音频控制***中的通信模块,所述第一虚拟音频设备可以为图4所示的音频控制***中的一个虚拟音频设备。第一应用、音频处理服务、第一虚拟音频设备以及音频发送服务可以基于图4所示的音频控制***中的虚拟音频框架模块配置的音频路由策略进行第一应用的音频的传输,从而将第一应用的音频传输到至少一个第二电子设备进行播放。该方法的具体实施过程可以参照前述实施例中所述的方法实现,此处不再详述。Exemplarily, the first application can be any application in the audio control system shown in Figure 4, the audio processing service can be the audio processing module in the audio control system shown in Figure 4, the audio sending service can be the communication module in the audio control system shown in Figure 4, and the first virtual audio device can be a virtual audio device in the audio control system shown in Figure 4. The first application, the audio processing service, the first virtual audio device and the audio sending service can transmit the audio of the first application based on the audio routing strategy configured by the virtual audio framework module in the audio control system shown in Figure 4, thereby transmitting the audio of the first application to at least one second electronic device for playback. The specific implementation process of this method can be implemented with reference to the method described in the aforementioned embodiment, which will not be described in detail here.
S1102:第一电子设备响应于接收到的第二操作,将第二音频发送到至少一个第三电子设备,并指示所述至少一个第三电子设备播放所述第二音频;其中,所述第二操作用于指示通过所述至少一个第三电子设备播放所述第二音频;所述第一音频与所述第二音频属于所述第一电子设备的不同应用,或者,所述第一音频与所述第二音频的音频类型不同。S1102: In response to receiving a second operation, the first electronic device sends a second audio to at least one third electronic device and instructs the at least one third electronic device to play the second audio; wherein the second operation is used to instruct the at least one third electronic device to play the second audio; the first audio and the second audio belong to different applications of the first electronic device, or the first audio and the second audio are of different audio types.
在本申请一些实施例中,所述第二音频可以为第一电子设备中的第一应用生成的与第一音频的音频类型不同的音频。In some embodiments of the present application, the second audio may be audio of a different audio type from the first audio, generated by a first application in the first electronic device.
在本申请一些实施例中,所述第一电子设备中还可以包括第二应用,所述第二应用可以用于生成第二音频。所述第一电子设备中的音频处理服务还可以用于将第二音频分发至所述第一电子设备创建的所述至少一个第三电子设备对应的第二虚拟音频设备。第二虚拟音频设备可以用于将所述第二音频发送至所述音频发送服务。所述音频发送服务可以用于将所述第二音频发送至所述至少一个第三电子设备。该方法的具体实施过程可以参照前述实施例中所述的方法实现,此处不再详述。In some embodiments of the present application, the first electronic device may also include a second application, and the second application may be used to generate a second audio. The audio processing service in the first electronic device may also be used to distribute the second audio to a second virtual audio device corresponding to the at least one third electronic device created by the first electronic device. The second virtual audio device may be used to send the second audio to the audio sending service. The audio sending service may be used to send the second audio to the at least one third electronic device. The specific implementation process of the method may be implemented with reference to the method described in the aforementioned embodiments, and will not be described in detail herein.
示例性的,所述第一电子设备可以为前述实施例中所述的电子设备,所述第二电子设备、第三电子设备可以为前述实施例中所述的音频播放设备。所述第一音频和所述第二音频可以为电子设备中不同应用或不同音频类型的音频。可选的,上述步骤S1101的具体实现方式可以参照图5所示的方法,上述步骤S1102的具体实现方式也可以参照图5所示的方法,此处不再一一详述。Exemplarily, the first electronic device may be the electronic device described in the aforementioned embodiment, and the second electronic device and the third electronic device may be the audio playback device described in the aforementioned embodiment. The first audio and the second audio may be audio of different applications or different audio types in the electronic device. Optionally, the specific implementation of the above step S1101 may refer to the method shown in FIG5 , and the specific implementation of the above step S1102 may also refer to the method shown in FIG5 , which will not be described in detail here.
上述方法对应的具体实施方式可以参照前述实施例中相关方法的介绍,此处不再赘述。The specific implementation methods corresponding to the above methods can refer to the introduction of the relevant methods in the above embodiments, which will not be repeated here.
基于以上实施例及相同技术构思,本申请实施例还提供一种电子设备,该电子设备可以用于实现本申请实施例提供的音频播放方法。如图12中所示,电子设备1200可以包括:显示屏1201,存储器1202,一个或多个处理器1203,以及一个或多个计算机程序(图中未示出)。上述各器件可以通过一个或多个通信总线1204耦合。 Based on the above embodiments and the same technical concept, the embodiment of the present application also provides an electronic device, which can be used to implement the audio playback method provided in the embodiment of the present application. As shown in Figure 12, the electronic device 1200 may include: a display screen 1201, a memory 1202, one or more processors 1203, and one or more computer programs (not shown in the figure). The above-mentioned devices can be coupled via one or more communication buses 1204.
其中,显示屏1201用于显示应用界面等相关用户界面。The display screen 1201 is used to display application interfaces and other related user interfaces.
存储器1202中存储有一个或多个计算机程序(代码),一个或多个计算机程序包括计算机指令;一个或多个处理器1203调用存储器1202中存储的计算机指令,使得电子设备1200执行本申请实施例提供的音频控制方法。One or more computer programs (codes) are stored in the memory 1202, and the one or more computer programs include computer instructions; one or more processors 1203 call the computer instructions stored in the memory 1202, so that the electronic device 1200 executes the audio control method provided in the embodiment of the present application.
具体实现中,存储器1202可包括高速随机存取的存储器,并且也可包括非易失性存储器,例如一个或多个磁盘存储设备、闪存设备或其他非易失性固态存储设备。存储器1202可以存储操作***(下述简称***),例如ANDROID,IOS,WINDOWS,或者LINUX等嵌入式操作***。存储器1202可用于存储本申请实施例的实现程序。存储器1202还可以存储网络通信程序,该网络通信程序可用于与一个或多个附加设备,一个或多个用户设备,一个或多个网络设备进行通信。In a specific implementation, the memory 1202 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more disk storage devices, flash memory devices, or other non-volatile solid-state storage devices. The memory 1202 may store an operating system (hereinafter referred to as system), such as an embedded operating system such as ANDROID, IOS, WINDOWS, or LINUX. The memory 1202 may be used to store an implementation program of an embodiment of the present application. The memory 1202 may also store a network communication program, which may be used to communicate with one or more additional devices, one or more user devices, or one or more network devices.
一个或多个处理器1203可以是一个通用中央处理器(Central Processing Unit,CPU),微处理器,特定应用集成电路(Application-Specific Integrated Circuit,ASIC),或一个或多个用于控制本申请方案程序执行的集成电路。One or more processors 1203 can be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits used to control the execution of the program of the present application.
需要说明的是,图12仅仅是本申请实施例提供的电子设备1200的一种实现方式,实际应用中,电子设备1200还可以包括更多或更少的部件,这里不作限制。It should be noted that FIG. 12 is only one implementation of the electronic device 1200 provided in the embodiment of the present application. In actual applications, the electronic device 1200 may also include more or fewer components, which is not limited here.
基于以上实施例及相同技术构思,本申请实施例还提供一种计算机可读存储介质,该计算机可读存储介质存储有计算机程序,当计算机程序在计算机上运行时,使得计算机执行上述实施例提供的方法。Based on the above embodiments and the same technical concept, an embodiment of the present application further provides a computer-readable storage medium, which stores a computer program. When the computer program runs on a computer, the computer executes the method provided in the above embodiments.
基于以上实施例及相同技术构思,本申请实施例还提供一种计算机程序产品,该计算机程序产品包括计算机程序或指令,当计算机程序或指令在计算机上运行时,使得计算机执行上述实施例提供的方法。Based on the above embodiments and the same technical concept, the embodiments of the present application also provide a computer program product, which includes a computer program or instructions. When the computer program or instructions are run on a computer, the computer executes the method provided in the above embodiments.
本申请实施例提供的方法中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行计算机程序指令时,全部或部分地产生按照本发明实施例的流程或功能。计算机可以是通用计算机、专用计算机、计算机网络、网络设备、用户设备或者其他可编程装置。计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(digital subscriber line,简称DSL)或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。计算机可读存储介质可以是计算机可以存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。可用介质可以是磁性介质(例如,软盘、硬盘、磁带)、光介质(例如,数字视频光盘(digital video disc,简称DVD)、或者半导体介质(例如,SSD)等。The method provided in the embodiment of the present application can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, a network device, a user device or other programmable device. Computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center via wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. Computer-readable storage media can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more available media integrated. Available media can be magnetic media (e.g., floppy disks, hard disks, tapes), optical media (e.g., digital video discs (DVD), or semiconductor media (e.g., SSD), etc.
显然,本领域的技术人员可以对本申请进行各种改动和变型而不脱离本申请的范围。这样,倘若本申请的这些修改和变型属于本申请权利要求及其等同技术的范围之内,则本申请也意图包含这些改动和变型在内。 Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims (14)

  1. 一种音频播放方法,应用于第一电子设备,其特征在于,所述方法包括:An audio playback method is applied to a first electronic device, characterized in that the method comprises:
    响应于接收到的第一操作,将第一音频发送到至少一个第二电子设备,并指示所述至少一个第二电子设备播放所述第一音频;其中,所述第一操作用于指示通过所述至少一个第二电子设备播放所述第一音频;In response to the received first operation, sending the first audio to at least one second electronic device and instructing the at least one second electronic device to play the first audio; wherein the first operation is used to instruct the at least one second electronic device to play the first audio;
    响应于接收到的第二操作,将第二音频发送到至少一个第三电子设备,并指示所述至少一个第三电子设备播放所述第二音频;其中,所述第二操作用于指示通过所述至少一个第三电子设备播放所述第二音频;In response to the received second operation, sending the second audio to at least one third electronic device, and instructing the at least one third electronic device to play the second audio; wherein the second operation is used to instruct the at least one third electronic device to play the second audio;
    其中,所述第一音频与所述第二音频属于所述第一电子设备的不同应用,或者,所述第一音频与所述第二音频的音频类型不同。The first audio and the second audio belong to different applications of the first electronic device, or the first audio and the second audio are of different audio types.
  2. 如权利要求1所述的方法,其特征在于,在将第一音频发送到至少一个第二电子设备之前,所述方法还包括:The method according to claim 1, characterized in that before sending the first audio to at least one second electronic device, the method further comprises:
    创建第一虚拟音频设备;其中,所述第一虚拟音频设备对应所述至少一个第二电子设备;Creating a first virtual audio device; wherein the first virtual audio device corresponds to the at least one second electronic device;
    所述将第一音频发送到至少一个第二电子设备,包括:The sending of the first audio to at least one second electronic device comprises:
    通过所述第一虚拟音频设备,将所述第一音频发送到所述至少一个第二电子设备。The first audio is sent to the at least one second electronic device through the first virtual audio device.
  3. 如权利要求2所述的方法,其特征在于,在将第二音频发送到至少一个第三电子设备之前,所述方法还包括:The method of claim 2, wherein before sending the second audio to at least one third electronic device, the method further comprises:
    创建第二虚拟音频设备;其中,所述第二虚拟音频设备对应所述至少一个第三电子设备;Creating a second virtual audio device; wherein the second virtual audio device corresponds to the at least one third electronic device;
    所述将第二音频发送到至少一个第三电子设备,包括:The sending of the second audio to at least one third electronic device comprises:
    通过所述第二虚拟音频设备,将所述第二音频发送到所述至少一个第三电子设备。The second audio is sent to the at least one third electronic device through the second virtual audio device.
  4. 如权利要求2或3所述的方法,其特征在于,在创建第一虚拟音频设备之前,所述方法还包括:The method according to claim 2 or 3, characterized in that before creating the first virtual audio device, the method further comprises:
    在多种音频模式中选择当前场景对应的目标音频模式;其中,所述多种音频模式包括第一音频模式和第二音频模式,所述第一音频模式为通过不同设备播放不同应用的音频的模式,所述第二音频模式为通过不同设备播放不同音频类型的音频的模式;Selecting a target audio mode corresponding to the current scene from a plurality of audio modes; wherein the plurality of audio modes include a first audio mode and a second audio mode, the first audio mode is a mode for playing audio of different applications through different devices, and the second audio mode is a mode for playing audio of different audio types through different devices;
    所述创建第一虚拟音频设备,包括:The step of creating a first virtual audio device comprises:
    当所述目标音频模式为所述第一音频模式时,创建与所述第一音频所属的应用关联的所述第一虚拟音频设备;When the target audio mode is the first audio mode, creating the first virtual audio device associated with the application to which the first audio belongs;
    当所述目标音频模式为所述第二音频模式时,创建与所述第一音频的音频类型关联的所述第一虚拟音频设备。When the target audio mode is the second audio mode, the first virtual audio device associated with the audio type of the first audio is created.
  5. 如权利要求2~4任一所述的方法,其特征在于,在通过所述第一虚拟音频设备,将所述第一音频发送到所述至少一个第二电子设备之后,所述方法还包括:The method according to any one of claims 2 to 4, characterized in that after sending the first audio to the at least one second electronic device through the first virtual audio device, the method further comprises:
    响应于接收到的第三操作,通过所述第一虚拟音频设备,将第三音频发送到所述至少一个第二电子设备,并指示所述至少一个第二电子设备播放所述第三音频;In response to the received third operation, sending a third audio to the at least one second electronic device through the first virtual audio device, and instructing the at least one second electronic device to play the third audio;
    其中,所述第三操作用于指示播放第三音频,所述第三音频与所述第一音频属于同一应用,或者,所述第三音频与所述第一音频的音频类型相同。The third operation is used to instruct to play a third audio, and the third audio and the first audio belong to the same application, or the third audio and the first audio are of the same audio type.
  6. 如权利要求2~5任一所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 2 to 5, characterized in that the method further comprises:
    当确定所述至少一个第二电子设备中出现下线的电子设备时,销毁所述第一虚拟音频设备;或者When it is determined that an electronic device among the at least one second electronic device is offline, destroying the first virtual audio device; or
    当确定所述至少一个第二电子设备均下线时,销毁所述第一虚拟音频设备。When it is determined that the at least one second electronic device is offline, the first virtual audio device is destroyed.
  7. 如权利要求2~6任一所述的方法,其特征在于,所述第一电子设备包括第一应用、音频处理服务和音频发送服务;The method according to any one of claims 2 to 6, characterized in that the first electronic device includes a first application, an audio processing service and an audio sending service;
    在通过所述第一虚拟音频设备,将所述第一音频发送到所述至少一个第二电子设备之前,所述方法还包括:Before sending the first audio to the at least one second electronic device through the first virtual audio device, the method further includes:
    通过所述第一应用生成所述第一音频,并将所述第一音频发送至所述音频处理服务;Generate the first audio through the first application, and send the first audio to the audio processing service;
    通过所述音频处理服务将所述第一音频分发至所述第一虚拟音频设备;Distributing the first audio to the first virtual audio device through the audio processing service;
    所述通过所述第一虚拟音频设备,将所述第一音频发送到所述至少一个第二电子设备,包括:The step of sending the first audio to the at least one second electronic device through the first virtual audio device comprises:
    通过所述第一虚拟音频设备接收来自所述音频处理服务的所述第一音频; receiving, through the first virtual audio device, the first audio from the audio processing service;
    通过所述第一虚拟音频设备,将所述第一音频发送至所述音频发送服务,并指示所述音频发送服务将所述第一音频发送至所述至少一个第二电子设备。The first audio is sent to the audio sending service through the first virtual audio device, and the audio sending service is instructed to send the first audio to the at least one second electronic device.
  8. 如权利要求7所述的方法,其特征在于,所述通过所述音频处理服务将所述第一音频分发至所述第一虚拟音频设备,包括:The method according to claim 7, wherein distributing the first audio to the first virtual audio device through the audio processing service comprises:
    通过所述音频处理服务,将所述第一电子设备中空闲的第一总线分配为用于传输所述第一音频的总线,并将所述第一总线关联到所述第一虚拟音频设备;Allocating, by means of the audio processing service, an idle first bus in the first electronic device as a bus for transmitting the first audio, and associating the first bus with the first virtual audio device;
    利用所述第一总线将所述第一音频发送至所述第一虚拟音频设备;Sending the first audio to the first virtual audio device using the first bus;
    在通过所述第一虚拟音频设备,将所述第一音频发送至所述音频发送服务之前,所述方法还包括:Before sending the first audio to the audio sending service through the first virtual audio device, the method further includes:
    通过所述第一虚拟音频设备,接收所述音频处理服务利用所述第一总线发送的第一总线信息;其中,所述第一总线信息用于指示所述第一总线;Receiving, through the first virtual audio device, first bus information sent by the audio processing service using the first bus; wherein the first bus information is used to indicate the first bus;
    在通过所述第一虚拟音频设备,将所述第一音频发送至所述音频发送服务之后,所述方法还包括:After sending the first audio to the audio sending service through the first virtual audio device, the method further includes:
    通过所述第一虚拟音频设备,将所述第一总线指示信息发送至所述音频发送服务,以使所述音频发送服务根据所述第一总线指示信息确定所述第一总线,根据所述第一总线确定关联的所述第一虚拟音频设备所对应的所述至少一个第二电子设备。The first bus indication information is sent to the audio sending service through the first virtual audio device, so that the audio sending service determines the first bus according to the first bus indication information, and determines the at least one second electronic device corresponding to the first virtual audio device associated with the first bus according to the first bus.
  9. 如权利要求8所述的方法,其特征在于,所述方法还包括:The method according to claim 8, characterized in that the method further comprises:
    当所述第一虚拟音频设备被销毁时,解除所述第一总线与所述第一虚拟音频设备的关联关系,并将所述第一总线设置为空闲状态。When the first virtual audio device is destroyed, the association between the first bus and the first virtual audio device is released, and the first bus is set to an idle state.
  10. 如权利要求1~9任一所述的方法,其特征在于,所述第一操作包括第四操作和第五操作;其中,所述第四操作用于指示将所述至少一个第二电子设备作为播放所述第一音频的电子设备,所述第五操作用于指示播放所述第一音频。The method according to any one of claims 1 to 9 is characterized in that the first operation includes a fourth operation and a fifth operation; wherein the fourth operation is used to indicate that the at least one second electronic device is used as an electronic device for playing the first audio, and the fifth operation is used to indicate playing the first audio.
  11. 如权利要求1~9任一所述的方法,其特征在于,在响应于接收到的第一操作,将第一音频发送到至少一个第二电子设备,并指示所述至少一个第二电子设备播放所述第一音频之前,所述方法还包括:The method according to any one of claims 1 to 9, characterized in that before sending the first audio to at least one second electronic device in response to the received first operation and instructing the at least one second electronic device to play the first audio, the method further comprises:
    响应于接收到的第六操作,播放所述第一音频。In response to the received sixth operation, the first audio is played.
  12. 一种电子设备,其特征在于,所述电子设备包括显示屏,存储器和一个或多个处理器;An electronic device, characterized in that the electronic device comprises a display screen, a memory and one or more processors;
    其中,所述存储器用于存储计算机程序代码,所述计算机程序代码包括计算机指令;当所述计算机指令被所述一个或多个处理器执行时,使得所述电子设备执行如权利要求1~11任一所述的方法。The memory is used to store computer program codes, and the computer program codes include computer instructions; when the computer instructions are executed by the one or more processors, the electronic device executes the method according to any one of claims 1 to 11.
  13. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储有计算机程序,当所述计算机程序在电子设备上运行时,使得所述电子设备执行如权利要求1~11任一所述的方法。A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program, and when the computer program runs on an electronic device, the electronic device executes any one of the methods described in claims 1 to 11.
  14. 一种计算机程序产品,其特征在于,所述计算机程序产品包括计算机程序或指令,当所述计算机程序或指令在计算机上运行时,使得所述计算机执行如权利要求1~11任一所述的方法。 A computer program product, characterized in that the computer program product comprises a computer program or instructions, and when the computer program or instructions are run on a computer, the computer is caused to execute any one of the methods according to claims 1 to 11.
PCT/CN2023/129093 2022-11-02 2023-11-01 Audio playback method and electronic device WO2024094069A1 (en)

Applications Claiming Priority (4)

Application Number Priority Date Filing Date Title
CN202211359898.2 2022-11-02
CN202211359898 2022-11-02
CN202310121194.XA CN117992008A (en) 2022-11-02 2023-01-31 Audio playing method and electronic equipment
CN202310121194.X 2023-01-31

Publications (1)

Publication Number Publication Date
WO2024094069A1 true WO2024094069A1 (en) 2024-05-10

Family

ID=90901675

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/129093 WO2024094069A1 (en) 2022-11-02 2023-11-01 Audio playback method and electronic device

Country Status (2)

Country Link
CN (1) CN117992008A (en)
WO (1) WO2024094069A1 (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180176274A1 (en) * 2016-12-19 2018-06-21 Bose Corporation Preset assignments for streaming music players
WO2019127114A1 (en) * 2017-12-27 2019-07-04 深圳前海达闼云端智能科技有限公司 Audio playback method for virtual machine and device thereof, and mobile terminal
CN113126948A (en) * 2019-12-30 2021-07-16 华为技术有限公司 Audio playing method and related equipment
CN113890932A (en) * 2020-07-02 2022-01-04 华为技术有限公司 Audio control method and system and electronic equipment
CN114697742A (en) * 2020-12-25 2022-07-01 华为技术有限公司 Video recording method and electronic equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180176274A1 (en) * 2016-12-19 2018-06-21 Bose Corporation Preset assignments for streaming music players
WO2019127114A1 (en) * 2017-12-27 2019-07-04 深圳前海达闼云端智能科技有限公司 Audio playback method for virtual machine and device thereof, and mobile terminal
CN113126948A (en) * 2019-12-30 2021-07-16 华为技术有限公司 Audio playing method and related equipment
CN113890932A (en) * 2020-07-02 2022-01-04 华为技术有限公司 Audio control method and system and electronic equipment
CN114697742A (en) * 2020-12-25 2022-07-01 华为技术有限公司 Video recording method and electronic equipment

Also Published As

Publication number Publication date
CN117992008A (en) 2024-05-07

Similar Documents

Publication Publication Date Title
CN111182083B (en) Equipment control method and device and edge equipment
CN114924671B (en) Application connection method and device
US20240111473A1 (en) Distributed display method and terminal for application interface
CN109194972B (en) Live stream acquisition method and device, computer equipment and storage medium
CN111221845A (en) Cross-device information searching method and terminal device
CN112118477B (en) Virtual gift display method, device, equipment and storage medium
JP7369281B2 (en) Device capacity scheduling method and electronic devices
CN112749022B (en) Camera resource access method, operating system, terminal and virtual camera
CN115039378A (en) Audio output method and terminal equipment
CN114442969B (en) Inter-equipment screen collaboration method and equipment
WO2022135527A1 (en) Video recording method and electronic device
CN114741008B (en) Distributed cross-device cooperation method, electronic device and communication system
US20230367572A1 (en) Patch Package Installation Method and Apparatus
CN113703849A (en) Screen-casting application opening method and device
JP2023547821A (en) Control method and device, and electronic device
CN111131272B (en) Scheduling method, device and system of stream server, computing equipment and storage medium
WO2024094069A1 (en) Audio playback method and electronic device
CN111600862A (en) User account management method and device
WO2024078337A1 (en) Display-screen selection method, and electronic device
WO2023131051A1 (en) Content sharing method and electronic device
WO2024046318A1 (en) Call control method and electronic device
WO2024067142A1 (en) Display method and electronic device
WO2022161191A1 (en) Method for sharing files, and electronic device
WO2024109443A1 (en) Device connection method, device and system
WO2024088046A1 (en) Device control method and electronic device

Legal Events

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

Ref document number: 23884995

Country of ref document: EP

Kind code of ref document: A1