Audio playing method, apparatus, device, storage medium and program product

By setting up a hardware switching device in the dual-system electronic device to switch paths, the synchronization problem between different processors of the dual-system audio playback device is solved, the availability of audio functions and power consumption are reduced, and the audio playback effect is improved.

CN115309691BActive Publication Date: 2026-11-27GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210948823.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-09
Publication Date
2026-11-27
Estimated Expiration
2042-08-09

AI Technical Summary

Technical Problem

In dual-system electronic devices, how can we reduce audio data synchronization between processors, lower power consumption, and improve audio playback quality while ensuring the availability of audio functions?

Method used

By setting up a hardware switching device between the processor and the audio playback device, and controlling the switching device through the first system to switch the path, the connected objects of the audio playback device can be switched between the two processors corresponding to the dual systems, thereby enabling the use rights of the audio playback device to be switched between the dual systems.

Benefits of technology

To ensure dual-system audio availability in different scenarios, reduce audio data synchronization between processors, lower power consumption, and improve audio playback quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115309691B_ABST
    Figure CN115309691B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose an audio playing method, device, equipment, storage medium and program product, and belong to the field of electronic equipment. The method comprises the following steps: in the case that a first processor is in communication with an audio playing device, a first system transmits first audio data to the audio playing device; in the case that an audio playing demand exists in a second system, the first system controls a switching device to perform path switching, so that a second processor is in communication with the audio playing device, the switching device is used for switching the communication object of the audio playing device; and the second system transmits second audio data to the audio playing device. By using the above path switching scheme, the switching device is used for path switching, each processor can directly transmit audio data to the audio playing device, and the audio data synchronization between the processors is reduced under the premise of ensuring the audio availability of the double systems in different scenes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of electronic devices, and in particular to an audio playback method, apparatus, device, storage medium, and program product. Background Technology

[0002] With the continuous development of science and technology, more and more electronic devices with different functions have emerged, bringing many conveniences to users' daily lives.

[0003] Typically, electronic devices are equipped with audio playback devices (such as speakers), through which they can play music, provide call reminders, and send notifications. Summary of the Invention

[0004] This application provides an audio playback method, apparatus, device, storage medium, and program product. The technical solution is as follows:

[0005] On one hand, embodiments of this application provide an audio playback method for an electronic device, wherein the electronic device supports the operation of a first system and a second system, the first system being run by a first processor and the second system being run by a second processor;

[0006] The method includes:

[0007] When the first processor is connected to the audio playback device, the first system transmits the first audio data to the audio playback device;

[0008] When the second system has an audio playback requirement, the first system controls the switching device to switch the path so that the second processor can connect to the audio playback device. The switching device is used to switch the connection object of the audio playback device.

[0009] The second system transmits second audio data to the audio playback device.

[0010] On the other hand, embodiments of this application provide an audio playback device, the device comprising:

[0011] The first system module is used to transmit first audio data to the audio playback device when the first processor is connected to the audio playback device;

[0012] The first system module is also used to control the switching device to switch the path when there is an audio playback requirement in the second system module. The switching device is used to switch the connected object of the audio playback device, and after the path is switched, the second processor is connected to the audio playback device.

[0013] The second system module is used to transmit second audio data to the audio playback device.

[0014] On the other hand, embodiments of this application provide an electronic device, which includes a processor, a memory, a switching device, and an audio playback device; the memory stores at least one instruction, which is executed by the processor to implement the audio playback method described above.

[0015] On the other hand, embodiments of this application provide a computer-readable storage medium storing at least one instruction, which is executed by a processor to implement the audio playback method as described above.

[0016] On the other hand, embodiments of this application provide a computer program product including computer instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the electronic device to perform the audio playback method provided in the above aspects.

[0017] For electronic devices supporting dual systems, since both systems require audio playback, a hardware switching device is installed between the processor and the audio playback device. The first system controls this switching device to switch pathways, allowing the audio playback device's connectivity to switch between the two processors in the dual systems. This enables the audio playback device's access rights to switch between the two systems. Compared to when the audio playback device is exclusively used by one processor, which requires frequent audio data synchronization between processors (because only one processor can directly transmit audio data to the audio playback device), the aforementioned pathway switching scheme, using the switching device, allows each processor to directly transmit audio data to the audio playback device. This helps reduce audio data synchronization between processors while ensuring the audio availability of the dual systems in different scenarios. Attached Figure Description

[0018] Figure 1 This is a schematic diagram illustrating the implementation of audio playback using a dual-core system in related technologies;

[0019] Figure 2 This invention illustrates a structural block diagram of an electronic device provided in an exemplary embodiment of this application;

[0020] Figure 3 This is a schematic diagram illustrating a dual-core communication software framework corresponding to a first processor, as shown in an exemplary embodiment of this application;

[0021] Figure 4This is a schematic diagram illustrating a dual-core communication software framework corresponding to a second processor, as shown in an exemplary embodiment of this application;

[0022] Figure 5 A flowchart illustrating an exemplary embodiment of the audio playback method provided in this application is shown;

[0023] Figure 6 This is a schematic diagram illustrating an exemplary embodiment of the audio playback process of the first system in this application;

[0024] Figure 7 This is a schematic diagram illustrating an exemplary embodiment of the audio playback process of the second system in this application;

[0025] Figure 8 A flowchart of an audio playback method provided by another exemplary embodiment of this application is shown;

[0026] Figure 9 This is a schematic diagram illustrating an embodiment of the audio focus switching process of this application;

[0027] Figure 10 This is a schematic diagram illustrating an implementation of the audio focus switching process, as shown in another exemplary embodiment of this application.

[0028] Figure 11 This is a schematic diagram illustrating an exemplary embodiment of the audio playback process of the first system in this application;

[0029] Figure 12 A structural block diagram of an audio playback device provided in one embodiment of this application is shown. Detailed Implementation

[0030] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.

[0031] In this article, "multiple" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following related objects have an "or" relationship.

[0032] In related technologies, electronic devices typically incorporate a single processor, which, through an operating system running on that processor, processes all system events generated during device operation. Therefore, this processor needs strong data processing capabilities and must remain operational throughout the device's lifespan. However, in everyday use, electronic devices often only require functions with low processing power demands. For example, smartwatches and smart bracelets primarily only need to display the time and provide notifications. Therefore, keeping the processor constantly active does not improve the performance of the electronic device; instead, it increases power consumption, resulting in shorter battery life (especially noticeable in wearable devices with smaller battery capacities).

[0033] In order to reduce the power consumption of electronic devices while ensuring their performance, in one possible implementation, the electronic device is equipped with at least a first processor and a second processor with different processing performance and power consumption, which are used to run the first system and the second system respectively (i.e., dual-core dual system), and a system switching mechanism is designed for the dual-core dual system.

[0034] During the operation of an electronic device, a first system running on a low-power processor handles events requiring low performance processing while keeping the high-power processor in a sleep state (correspondingly, the second system running on the high-power processor is also in a sleep state). This sleep state reduces the power consumption of the electronic device while fulfilling its basic functions. When an event requiring high performance processing occurs (such as when an application is launched), the high-power processor is woken up, and the second system is switched to handle the event, ensuring that the triggered event can be responded to and processed in a timely manner to meet the performance requirements of the electronic device.

[0035] With the introduction of a dual system, since both systems require audio playback during operation, while electronic devices typically only have a single audio playback device (due to cost and internal space considerations), ensuring the availability of audio functionality in various scenarios becomes an urgent problem to solve.

[0036] In related technologies, audio playback devices are typically integrated with a dedicated processor, and audio playback functionality across systems is achieved through dual-core communication. For example... Figure 1 As shown, the audio playback device 13 is connected to the first processor 11. When the first system running on the first processor 11 has an audio playback requirement, it sends the audio data to the audio playback device 13. When the second system running on the second processor 12 has an audio playback requirement, it synchronizes the audio data to the first processor 11 through a dual-core communication mechanism, and then the first processor 11 transmits the audio data to the audio playback device 13.

[0037] Clearly, implementing audio playback using the above method requires frequent data and instruction exchanges between processors. On one hand, when the first system is in sleep mode, if the second system needs to play audio, it must wake up the first system, increasing the power consumption of the electronic device. On the other hand, when the first processor 11 is powered off, the second system will be unable to play audio, meaning the audio playback function will be unavailable in some usage scenarios. Furthermore, due to differences in the audio processing capabilities of processors, connecting the audio playback device to a processor with weaker audio processing capabilities will result in poor audio playback quality.

[0038] In this embodiment, a hardware switching device is set between the processor and the audio playback device, and the first system controls the switching device to switch pathways. This allows the connected objects of the audio playback device to switch between the two processors corresponding to the dual systems, thus enabling the switching of the audio playback device's usage rights between the dual systems. Compared to when the audio playback device is exclusively used by one processor, which requires frequent audio data synchronization between processors, the pathway switching scheme provided in this embodiment, through hardware pathway switching using the switching device, allows each processor to directly transmit audio data to the audio playback device. This helps reduce audio data synchronization between processors while ensuring the audio availability of the dual systems in different scenarios.

[0039] Please refer to Figure 2 This diagram illustrates a structural block diagram of an electronic device provided in an exemplary embodiment of this application. The electronic device in this application may include one or more of the following components: a processor 210, a memory 220, a switching device 230, and an audio playback device 240.

[0040] Optionally, the processor 210 includes at least a first processor 211 and a second processor 212, wherein the first processor 211 is used to run a first system and the second processor 212 is used to run a second system. In some embodiments, the power consumption of the first processor 211 is lower than that of the second processor 212, and the performance of the first processor 211 is lower than that of the second processor 212; or, the power consumption of the first processor 211 is higher than that of the second processor 212, and the performance of the first processor 211 is better than that of the second processor 212.

[0041] Optionally, the first processor 211 and the second processor 212 can be two independent processors, or they can be different processing cores on the same processor. This application embodiment does not limit this.

[0042] Processor 210 connects various parts within the electronic device using various interfaces and lines. It performs various functions and processes data by running or executing instructions, programs, code sets, or instruction sets stored in memory 220, and by calling data stored in memory 220. Optionally, processor 210 can be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). Processor 210 can integrate one or more of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), Neural-network Processing Unit (NPU), and modem. Specifically, the CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the content displayed on the touchscreen; the NPU implements Artificial Intelligence (AI) functions; and the modem handles wireless communication. It is understood that the modem can also be implemented separately as a single chip without being integrated into processor 210.

[0043] The memory 220 may include random access memory (RAM) or read-only memory (ROM). Optionally, the memory 220 may include a non-transitory computer-readable storage medium. The memory 220 may be used to store instructions, programs, code, code sets, or instruction sets. The memory 220 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as touch function, sound playback function, image playback function, etc.), instructions for implementing the various method embodiments described below, etc.; the data storage area may store data created according to the use of the electronic device (such as audio data, phone book, etc.).

[0044] Switching device 230 is an electronic component used to switch the connected objects of audio playback device 240. In one possible design, one end of switching device 230 is connected to the first processor 211 and the second processor 212 respectively, and the other end is connected to audio playback device 240. Switching device 230 switches the communication buses of audio playback device 240, such as the built-in integrated circuit audio bus (Inter-IC Sound, I2S) and the built-in integrated circuit bus (Inter-Integrated Circuit, I2C), to be connected to the first processor 211 or the second processor 212 through the internal hardware bus.

[0045] The audio playback device 240 (speaker) is an electronic component used to realize audio playback. In one possible design, the audio playback device 240 consists of an audio amplifier and a speaker, wherein the audio amplifier is used to amplify the power of the audio signal, and the speaker is used to convert the electrical signal output by the audio amplifier into a sound signal.

[0046] In addition, those skilled in the art will understand that the structure of the electronic device shown in the above figures does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements. For example, the electronic device may also include components such as a display screen, communication devices, radio frequency circuits, input units, sensors, microphones, and power supplies, which will not be described in detail here.

[0047] In this embodiment, the first processor and the second processor operate asynchronously, and the first system and the second system need to achieve system communication (or dual-core communication). In one possible application scenario, the first system is the Android operating system running on a central processing unit (CPU), and the second system is a real-time operating system (RTOS) running on a microcontroller unit (MCU).

[0048] like Figure 3 As shown, this application illustrates a dual-core communication software framework for the Android operating system, as illustrated in an exemplary embodiment. This dual-core communication software framework follows the design principles of "low coupling, high reliability, and high reusability," and includes module development for the Kernel, HIDL (Hardware Abstraction Layer Interface Description Language), Native Service, Framework Service, Framework API, and APP (Application) components.

[0049] The APP module includes functional modules such as Launcher, Settings, and SystemUI. The Framework API module includes management modules such as MCUManager, SensorManager, and LocationManager. The Framework Service module includes service modules such as MCUManagerService, SystemSensorManager, and LocationManagerService. The Native Service module includes service modules such as dccservice (dcc (dynamic camera configuration) service) and Sensorservice. The HIDL module includes modules such as Sensor HAL (sensor hardware abstraction layer) and GPS HAL (global positioning system hardware abstraction layer). The Kernel module includes DCC Transfer Drivers such as dcc_data, MCU_sensor, and MCU_gps.

[0050] As the interface layer connecting the upper and lower layers in the dual-core communication software framework, the transport layer shields the application layer from the transmission details of the lower layer (data link layer) of the system, providing a service channel for application scenarios. The application layer, as the main provider of services, responds to human-computer interaction and transmits the data generated during the human-computer interaction process through the transport layer, as well as responding to external data requests.

[0051] RTOS is designed using the peer-to-peer principle. Taking a smartwatch as an example, such as... Figure 4 As shown, it illustrates a dual-core communication software framework for an RTOS according to an exemplary embodiment of this application.

[0052] The dual-core communication software framework of RTOS is divided into the Application Layer, Service Layer, Framework Layer, Hardware Abstraction Layer, and Platform Layer.

[0053] The application layer includes modules such as watch face, Daily Tracker, Messagecenter, Voice around Apps, Health Apps, and Settings; the service layer includes modules such as Sport & Health task, System manager task, AMS (Activity Management Service), Audio Service, Log Service, OFTP Service (Odette file transfer protocol service), BT Service (Bluetooth service), Delegate Service, RPC Service (Remote Call Service), Sensor Service, and Storage Service; the framework layer includes modules such as Message Pub, UIFramework, G2D Engine (G2D (2D acceleration) engine), Audio Middleware, Preference, and File. The framework modules include system (file system), Algorithms, and AsyncEvent (in-process asynchronous events); the hardware abstraction layer includes hardware abstraction modules such as Screen / TP (screen / touchscreen) and sensors; the platform layer includes Board Support Package (BSP) and Low-level Driver. The BSP includes Screen / TP, Codec (encoder / decoder), sensors, Flash, PSRAM (pseudo-static random access memory), etc., while the Low-level Driver includes UART (Universal Asynchronous Receiver / Transmitter), ADC (Analog-to-Digital Converter), GPIO (General Purpose Input / Output), SPI (Serial Peripheral Interface), I2C (Integrated Circuit Bus), IOS (Input / Output System), PCM (Pulse Code Modulation), I2S (Integrated Audio Bus), and HWTimer (Hardware Timer).

[0054] It should be noted that the above dual-core communication software framework is for illustrative purposes only. Those skilled in the art can add, delete or modify the framework according to actual needs. The embodiments of this application do not limit the specific structure of the dual-core communication software framework.

[0055] Please refer to Figure 5The document illustrates a flowchart of an audio playback method provided in an exemplary embodiment of this application. This embodiment describes the method as being applied to an electronic device, where the electronic device supports the operation of a first system and a second system, with the first system being run by a first processor and the second system being run by a second processor. The method may include the following steps.

[0056] Step 501: When the first processor is connected to the audio playback device, the first system transmits the first audio data to the audio playback device.

[0057] In one possible implementation, the electronic device includes a first processor and a second processor, wherein the processing performance of the first processor is higher than that of the second processor (both the processing power and speed of the first processor are higher than those of the second processor), and the power consumption of the first processor is higher than that of the second processor. Accordingly, the operating power consumption of the first system is higher than that of the second system. The first system (run by the second processor) is capable of processing events processed by the second system (run by the first processor), while the second system may not necessarily be able to process events processed by the first system.

[0058] In another possible implementation, the electronic device may also be equipped with a single processor, with the first system and the second system running on different cores of the processor, wherein the processing performance of the core running the first system is higher than that of the core running the second system.

[0059] For example, taking a smartwatch as an electronic device, the first processor is a CPU, the second processor is an MCU, the first system is the Android system, and the second system is an RTOS. Correspondingly, the events that the second system can handle include scenarios with low processing performance requirements or weak interaction scenarios such as watch face display, watch face interface switching, and notification prompts; the events that the first system can handle include scenarios with high processing performance requirements or strong interaction scenarios such as answering calls, replying to messages, watch face editing, and function settings.

[0060] In one possible design, the electronic device operates in three modes: a performance mode (highest overall power consumption), a hybrid mode (medium overall power consumption), and a low-power mode (lowest overall power consumption). In performance mode, both the first and second processors are powered on, and both the first and second systems are awake. In low-power mode, only the second processor is powered on, while the first processor is powered off. Correspondingly, the first system is awake, while the second system is off. In hybrid mode, both the first and second processors are powered on, the second system remains awake, and the first system can switch between awake and sleep states according to task processing needs to avoid increased power consumption due to prolonged awake states.

[0061] In one possible implementation, in hybrid mode, both the first processor and the second processor are powered on. When the first system has an audio playback requirement and the first processor is connected to the audio player, since the first system has the right to use the audio playback device, the first system, which is in a wake-up state, can directly transmit the first audio data to the audio playback device.

[0062] Optionally, the first audio data is audio data related to the first system. For example, the first audio data may be voice data from an instant messaging application, a call application, or a music playback application in the first system, etc. This embodiment does not limit this.

[0063] Optionally, the first audio data is received by the electronic device from a terminal device with which a data communication connection (such as a Bluetooth connection) has been established; or, the first audio data is local audio data of the electronic device; or, the first audio data is downloaded by the electronic device from the network through a communication component. The embodiments of this application do not limit the source of the first audio data.

[0064] When the first processor is connected to the audio playback device, the communication bus of the audio playback device is connected to the first processor under the control of the switching device. Therefore, the first processor can directly send the first audio data to the audio playback device through the communication bus. In addition to sending the first audio data, the first processor can also send control commands to the audio playback device. For example, the first processor can send control commands to the audio playback device via the I2C bus and send the first audio data to the audio playback device via the I2S bus.

[0065] Optionally, before transmitting the first audio data, the first system processes the first audio data using a digital signal processor (DSP) corresponding to the first processor, thereby transmitting the processed first audio data to the audio playback device to improve the final audio playback quality.

[0066] Accordingly, the audio playback device plays audio based on the first audio data. Optionally, the audio amplifier in the audio playback device drives the speaker based on the control commands sent by the first system and the first audio data, and the speaker converts the audio signal into a sound signal.

[0067] Indicative, such as Figure 6As shown, both the first processor 61 and the second processor 62 are connected to the switching device 64, and the switching device 64 is connected to the audio playback device 63. When the first system has an audio playback requirement, and under the control of the switching device 64, the first processor 61 is connected to the audio playback device 63, the first processor 61 transmits the first audio data to the audio playback device 63.

[0068] Step 502: When there is an audio playback requirement in the second system, the first system controls the switching device to switch the path so that the second processor can be connected to the audio playback device. The switching device is used to switch the connected object of the audio playback device.

[0069] In one possible implementation, the first system has control over the switching device. When the second system requires audio playback, since the audio playback device's access rights are currently with the first system (i.e., there is no connection between the second processor and the audio playback device), the first system needs to control the switching device to perform a path switching, changing the connection object of the audio playback device from the first processor to the second processor, thereby transferring the access rights of the audio playback device to the second system.

[0070] Optionally, a control bus is provided between the first processor and the switching device, and the first processor controls the switching device to switch paths through the control bus. For example, when the control IO is pulled low through the control bus, the switching device switches the connection object of the audio playback device to the second processor; when the control IO is pulled high through the control bus, the switching device switches the connection object of the audio playback device back to the first processor.

[0071] Optionally, the second system can communicate its audio playback needs to the first system via dual-core communication, so that the first system can control the switching device to switch the path.

[0072] It should be noted that, in order to ensure the real-time response to the audio playback needs of the second system, if the first system has not finished playing audio, the first system will pause audio playback and control the switching device to switch the path; or, the first system will actively stop audio playback and control the switching device to switch the path.

[0073] Indicative, such as Figure 7 As shown, when the second system has an audio playback requirement, the first processor 61 controls the switching device 64 to switch the path. After the path is switched, the path between the first processor 61 and the audio playback device 63 is disconnected, while the path between the second processor 62 and the audio playback device 63 is connected.

[0074] Step 503: The second system transmits the second audio data to the audio playback device.

[0075] Optionally, the second audio data is audio data related to the second system. For example, the second audio data may be notification sounds, key press sounds, voice messages received in the application within the second system, etc. This embodiment does not limit this.

[0076] Optionally, the second audio data is received by the electronic device from a terminal device with which a data communication connection (such as a Bluetooth connection) has been established; or, the second audio data is local audio data of the electronic device; or, the second audio data is downloaded by the electronic device from the network through a communication component. The embodiments of this application do not limit the source of the second audio data.

[0077] When the second processor is connected to the audio playback device, the communication bus of the audio playback device is connected to the second processor under the control of the switching device. Therefore, the second processor can directly send second audio data to the audio playback device through the communication bus. In addition to sending second audio data to the audio playback device, the second processor can also send control commands to the audio playback device. For example, the second processor can send control commands to the audio playback device via the I2C bus and send second audio data to the audio playback device via the I2S bus.

[0078] Optionally, before transmitting the first audio data, the second system processes the second audio data through the DSP corresponding to the second processor, thereby transmitting the processed second audio data to the audio playback device to improve the final audio playback quality.

[0079] It should be noted that different processors may have different DSP processing capabilities, resulting in different audio playback quality across different systems. For example, if the processing performance of the first processor is higher than that of the second processor, the processing performance of the DSP corresponding to the first processor will also be higher than that of the DSP corresponding to the second processor. Therefore, the audio playback quality of the first system will be inferior to that of the second system.

[0080] Accordingly, the audio playback device plays audio based on the second audio data. Optionally, the audio amplifier in the audio playback device drives the speaker based on the control commands sent by the second system and the second audio data, and the speaker converts the audio signal into a sound signal.

[0081] Indicative, such as Figure 7 As shown, after the second processor 62 is connected to the audio playback device 63, the second processor 62 transmits the second audio data to the audio playback device 63.

[0082] Obviously, in hybrid mode, the solution provided in this application embodiment eliminates the need for audio data synchronization between processors, which helps reduce the number of dual-core communications. Furthermore, before different systems directly transmit audio data to the audio playback device, the corresponding DSP can process the audio data, which helps improve the audio playback quality.

[0083] In summary, in this embodiment of the application, for electronic devices supporting dual systems, since both systems have audio playback requirements, a hardware switching device is set between the processor and the audio playback device. The first system controls the switching device to switch pathways, allowing the audio playback device's connectivity to switch between the two processors corresponding to the dual systems. This enables the switching of the audio playback device's access rights between the two systems. Compared to when the audio playback device is exclusively used by a single processor, where processors need to frequently synchronize audio data (because only one processor can directly transmit audio data to the audio playback device), the aforementioned pathway switching scheme, using the switching device to switch pathways, allows each processor to directly transmit audio data to the audio playback device. This helps reduce audio data synchronization between processors while ensuring the audio availability of the dual systems in different scenarios.

[0084] In one possible application scenario, when the first system is playing audio and the second system also needs to play audio, in order to ensure that the first system can continue playing audio after the second system finishes playing audio, thus improving the continuity of the audio playback process between the two systems, in one possible implementation, the first system can apply an audio focus mechanism to the process of transferring the right to use the audio playback device. The following is an illustrative example.

[0085] Please refer to Figure 8 The diagram illustrates a flowchart of an audio playback method provided in another exemplary embodiment of this application. This embodiment describes the method as being applied to an electronic device, where the electronic device supports the operation of a first system and a second system, and the first system is operated by a first processor and the second system is operated by a second processor. The method may include the following steps.

[0086] Step 801: When the first processor is connected to the audio playback device, the first system transmits the first audio data to the audio playback device.

[0087] In one possible implementation, the first system runs a first audio playback service and a second audio playback service, wherein the first audio playback service is the player service corresponding to the player in the first system, and the second audio playback service is the virtual player service corresponding to the second system.

[0088] In some embodiments, there can be multiple first audio playback services, meaning that each application in the first system that has an audio playback requirement corresponds to its own first audio playback service. For example, when a music playback application plays music in the first system, a first audio playback service corresponding to the music playback application runs in the first system; when a call application plays call audio in the first system, a first audio playback service corresponding to the call application runs in the first system.

[0089] Unlike the first audio playback service, which corresponds to a real application in the first system, the first system abstracts the second system into a virtual player and sets up a corresponding virtual player service for this virtual player, namely the second music playback service, which is at the same level as the first audio playback service.

[0090] In the first system, when at least two audio playback services exist simultaneously, each audio playback service obtains audio playback permission by requesting audio focus (or a token). The audio playback service that loses audio focus will pause playback and resume playback when it regains focus.

[0091] In this embodiment, when the first system plays audio, the first audio playback service acquires audio focus.

[0092] Indicative, in Figure 6 On the basis of, such as Figure 9 As shown, when the first system has an audio playback requirement but the second system does not, the audio focus is on the first audio playback service 611, while the second audio playback service 612 corresponding to the second system does not obtain the audio focus.

[0093] Step 802: If the second system has an audio playback requirement, the second system sends an audio playback request to the first system.

[0094] When the second system has an audio playback requirement, the second system sends an audio playback request to the first system through dual-core communication. This audio playback request is used to instruct the second audio playback service to request audio focus.

[0095] Indicative, such as Figure 9 As shown, when the second system has an audio playback requirement, the second processor 62 sends an audio playback request to the first processor 61, requesting the first system to transfer the right to use the audio playback device.

[0096] Step 803: Based on the audio playback request, the first system switches the audio focus from the first audio playback service to the second audio playback service.

[0097] Upon receiving an audio playback request, the first system knows that the second system needs to use an audio playback device for audio playback. In one possible implementation, when the first audio playback request is received during the operation of the first audio playback service (i.e., the first system receives the first audio playback request during audio playback), the first system switches the audio focus from the first audio playback service to the second audio playback service.

[0098] Indicative, such as Figure 9 As shown, when the first processor 61 receives an audio playback request, it switches the audio focus from the first audio playback service 611 to the second audio playback service 612. Since the first audio playback service loses audio focus, the first system suspends the transmission of the first audio data to the audio playback device 63, that is, the first system suspends audio playback.

[0099] In one possible implementation, the audio playback request includes the application identifier of a second application in the second system that requires audio playback, or the audio playback priority of the second application. Upon receiving the audio playback request, the first system checks whether the audio playback priority of the second application in the second system is higher than the audio playback priority of the first application currently playing audio. If the audio playback priority of the second application is higher than or equal to the audio playback priority of the first application, the first system performs an audio focus switch; if the audio playback priority of the second application is lower than the audio playback priority of the first application, the first system does not perform an audio focus switch.

[0100] In an illustrative example, while the first system is running a voice call using a calling application, a notification application in the second system requests audio playback (e.g., playing a notification tone). Because the audio playback priority of the calling application is higher than that of the notification application, the first system does not switch audio focus, and the electronic device continues playing the call audio.

[0101] In another illustrative example, while the first system is playing music using a music application, a notification application in the second system requests audio playback (e.g., playing a notification tone). Because the music's audio playback priority is lower than the notification application's audio playback priority, the first system switches audio focus, and the electronic device stops playing music.

[0102] Step 804: The first system controls the switching device to switch the path based on the audio playback request.

[0103] Similar to step 502 above, when the first system learns that the second system has an audio playback requirement based on the audio playback request, it controls the switching device to switch the path.

[0104] It should be noted that there is no strict sequential execution order between steps 804 and 803. That is, steps 803 and 804 can be executed sequentially or synchronously. This embodiment does not limit this.

[0105] In one possible implementation, to avoid unnecessary audio data transmission by the second system when the path switching fails, the first system controls the switching device to perform path switching and then detects whether the path switching was successful.

[0106] If the path switching is completed, the first system sends a successful switching response to the second system (via a dual-core communication mechanism); if the path switching is not completed, the first system sends a failed switching response to the second system.

[0107] It should be noted that when the audio focus switching conditions are not met, the first system will not control the switching device to switch the path.

[0108] Step 805: The second system transmits the second audio data to the audio playback device.

[0109] In one possible implementation, upon receiving a successful switching response, the second system transmits second audio data to the audio playback device. The specific process of transmitting the second audio data can be referred to step 503 above, and will not be repeated here.

[0110] Optionally, if the second system receives a switching failure response, it will not transmit the second audio data to the audio playback device.

[0111] Optionally, if the path switching fails, the first system will retry the switching and, if the retry is successful, send a switching success response to the second system.

[0112] Step 806: When the second system finishes playing audio, the second system sends a playback end command to the first system.

[0113] When the second system finishes playing audio, in order to enable the first system to continue playing the paused audio, the second system sends a playback end command to the first system through a dual-core communication mechanism, informing the first system that the second audio has finished playing.

[0114] Indicative, such as Figure 10 As shown, when the second system finishes audio playback, the second processor 62 sends a playback end command to the first processor 61.

[0115] Step 807: Based on the playback end command, the first system switches the audio focus from the second audio playback service to the first audio playback service.

[0116] Accordingly, after receiving the playback end command, the first system instructs the second audio playback service to release the audio focus and instructs the first audio playback service to reacquire the audio focus.

[0117] Indicative, such as Figure 10 As shown, after receiving the playback end command, the audio focus switches from the second audio playback service 612 to the first audio playback service 611.

[0118] Step 808: Based on the playback end command, the first system controls the switching device to switch the path so that the first processor can connect to the audio playback device.

[0119] When the first system learns from the end-of-play command that the second system does not require audio playback, it controls the switching device to switch the path.

[0120] It should be noted that there is no strict sequential execution order between steps 808 and 807. That is, steps 808 and 807 can be executed sequentially or synchronously. This embodiment does not limit this.

[0121] Indicative, such as Figure 10 As shown, the first processor 61 (corresponding to the first system) controls the switching device 64 to switch the path, so that the path between the first processor 61 and the audio playback device 63 is connected.

[0122] Step 809: The first system continues to transmit the first audio data to the audio playback device.

[0123] In one possible implementation, after the first system controls the switching device to perform a path switching, it detects whether the path switching was successful. If the path switching is successful, the first system continues to transmit the first audio data.

[0124] It should be noted that, in this embodiment, "continuing to transmit the first audio data" means that the first system continues to transmit subsequent first audio data from the audio playback progress corresponding to the moment when the first audio playback service loses audio focus.

[0125] In an illustrative example, during music playback in the first system running a music application, when the music reaches 00:30, a notification application in the second system requests a notification sound. After the first system switches audio focus, it pauses music playback, and the second system plays the notification sound. After the notification sound finishes playing, the music application in the first system regains audio focus and resumes music playback from 00:30.

[0126] In this embodiment, the first system can apply the audio focus mechanism to the process of transferring the right to use the audio playback device, so that before and after the transfer of the right to use the audio playback device, the first system can continue to play audio according to the audio playback progress before the transfer of the right to use the audio playback device, thus ensuring the continuity of the audio playback process of the first system.

[0127] In one possible design, the power consumption of the first system is higher than that of the second system. When the first system is in a sleep state (e.g., the first system is in sleep mode in hybrid mode) and the first processor is connected to the audio playback device, if the second system has an audio playback requirement, the second system needs to wake up the first system (waking up the first system will increase the power consumption of the electronic device) so that the first system can control the switching device to switch the path.

[0128] The problem arises when the first system is in a powered-off state (e.g., the first processor is powered off in low-power mode, and the first system is shut down), and the second processor is not connected to the audio playback device, the second system cannot play audio.

[0129] To address the aforementioned issues, in one possible implementation, after the first system transmits the first audio data to the audio playback device, if the first system terminates audio playback, the first system controls a switching device to switch the path, thereby enabling the second processor to connect to the audio playback device. In other words, if the first system does not require audio playback, the second system has the default right to use the audio playback device.

[0130] Accordingly, when the second system has an audio playback requirement, before sending an audio playback request to the first system, the second system first needs to determine the connection status between the second processor and the audio playback device.

[0131] When the connection is disconnected, the second system sends an audio playback request to the first system; when the connection is established, the second system directly transmits the second audio data to the audio playback device without instructing the first system to switch paths by sending an audio playback request.

[0132] In one possible implementation, the second processor determines its connection status with the audio playback device by detecting the port level of the connection port between the switching device and the device. For example, when the port level is high, it determines that it is connected to the audio playback device; when the port level is low, it determines that it is not connected to the audio playback device.

[0133] Of course, other methods can be used to determine the connection status between the processor and the audio playback device, and this embodiment does not limit this.

[0134] With the above solution, in low-power mode, the first processor is not powered on, and the switching device defaults to controlling the connection between the second processor and the audio playback device. When the second system needs audio playback, it can directly transmit audio data to the audio playback device, ensuring the normal use of audio functions in low-power mode.

[0135] In hybrid mode, before the first system enters sleep mode and has no audio playback requirement, the control switching device connects the second processor and the audio playback device. During the first system's sleep process, if the second system has an audio playback requirement, it can directly transmit audio data to the audio playback device without waking up the first system, which helps reduce the power consumption of electronic devices in hybrid mode.

[0136] Furthermore, in one possible implementation, when the switching device is in the initialization state, the audio playback device is connected to the second processor, meaning the second processor has the right to use the audio playback device by default. Optionally, when the electronic device has completed device startup and the switching device is in the initialization state, the first system controls the switching device to connect the second processor and the audio playback device.

[0137] Accordingly, when the first system has an audio playback requirement, the first system controls the switching device to switch the path so that the first processor can connect with the audio playback device and then transmit the first audio data to the audio playback device.

[0138] In the above embodiments, the first system can achieve audio playback continuity through an audio focus mechanism. To ensure the continuity of audio in the second system before and after the first system interrupts the second system (the second system may not support the audio focus mechanism), such as... Figure 11 As shown, the method may also include the following steps.

[0139] Step 1101: When the first system has an audio playback requirement and the second system is in an audio playback state, the first system sends a progress recording instruction to the second system.

[0140] During the transmission of second audio data from the second system to the audio playback device, the second system is in audio playback mode, meaning it has not yet finished playing audio. If the first system requires audio playback during this process, it needs to interrupt the second system's audio playback. To ensure the second system can continue playing audio subsequently, the first system sends a progress recording command to the second system.

[0141] Step 1102: The second system records the audio playback progress based on the progress recording instruction and stops transmitting the second audio data.

[0142] Upon receiving the progress recording instruction, the second system recognizes that the first system needs to play audio, and thus records the current audio playback progress and stops transmitting the second audio data to the audio playback device.

[0143] Optionally, the progress recording instruction includes the application identifier of the third application in the first system that has audio playback requirements, or the audio playback priority of the third application. After receiving the progress recording instruction, the second system checks whether the audio playback priority of the third application is higher than the audio playback priority of the second application (the application in the second system that currently has audio playback requirements). If the audio playback priority of the third application is higher than or equal to the audio playback priority of the second application, the second system records the audio playback progress and stops transmitting the second audio data; if the audio playback priority of the third application is lower than the audio playback priority of the second application, the second system does not stop playing the audio.

[0144] Step 1103: The first system controls the switching device to switch the path so that the first processor can be connected to the audio playback device.

[0145] In one possible implementation, when the first system has an audio playback requirement, the second system is in an audio playback state, and the audio playback priority of the third application in the first system is higher than or equal to the audio playback priority of the second application, the first system controls the switching device to switch the path.

[0146] It should be noted that there is no strict sequential relationship between step 1103 and step 1101. That is, step 1103 can be executed synchronously with step 1101 or sequentially. This embodiment does not limit this.

[0147] Step 1104: The first system transmits third audio data to the audio player.

[0148] Optionally, before the first system transmits the third audio data to the audio player, it is also necessary to switch the audio focus. The process of switching the audio focus can be referred to in the above embodiment, and will not be repeated here.

[0149] Step 1105: When the first system finishes playing audio, the first system controls the switching device to switch the path so that the second processor can connect to the audio playback device.

[0150] When the first system stops playing audio, in order to enable the second system to continue playing audio, the first system controls the switching device to switch the path, so that the second processor can connect to the audio playback device.

[0151] Step 1106: The first system sends a playback command to the second system.

[0152] Optionally, the first system sends a playback command to the second system via a dual-core communication mechanism, instructing the second system to continue playing audio.

[0153] It should be noted that there is no strict sequential relationship between steps 1105 and 1106. That is, steps 1105 and 1106 can be executed synchronously or sequentially. This embodiment does not limit this.

[0154] Optionally, before sending the playback command, the first system also needs to switch the audio focus. The process of switching the audio focus can be referred to the above embodiment, and will not be repeated here.

[0155] Step 1107: The second system continues to transmit second audio data to the audio playback device based on the playback command and audio playback progress.

[0156] Because the audio playback progress is recorded when the audio playback is interrupted, the second system, after regaining access to the audio playback device, can continue transmitting second audio data to the audio playback device from the playback node indicated by the recorded audio playback progress, ensuring the continuity of audio playback before and after the interruption.

[0157] In an illustrative example, during voice messaging in the second system's instant messaging application, when the voice message reaches 00:15, the call application in the first system requests a voice call. The first system instructs the second system to record the playback progress of the voice message, then switches the access to the audio playback device and transmits the voice call data to it. After the call ends, the first system sends a playback command to the second system. The instant messaging application in the second system then resumes playing the voice message from 00:15 according to the recorded playback progress, ensuring the continuity of voice message playback.

[0158] Please refer to Figure 12 This diagram illustrates a structural block diagram of an audio playback device according to an embodiment of this application. The device can be implemented as all or part of an electronic device through software, hardware, or a combination of both. The device includes:

[0159] The first system module 1201 is used to transmit first audio data to the audio playback device when the first processor is connected to the audio playback device;

[0160] The first system module 1201 is also used to control the switching device to switch the path when there is an audio playback requirement in the second system module 1202. The switching device is used to switch the connected object of the audio playback device, and after the path is switched, the second processor is connected to the audio playback device.

[0161] The second system module 1202 is used to transmit second audio data to the audio playback device.

[0162] Optionally, the second system module 1202 is used to send an audio playback request to the first system module 1201 when there is an audio playback requirement;

[0163] The first system module 1201 is used to switch the audio focus from the first audio playback service to the second audio playback service based on the audio playback request. The first audio playback service is the player service corresponding to the player in the first system module 1201, and the second audio playback service is the virtual player service corresponding to the second system module 1202.

[0164] The first system module 1201 is used to control the switching device to switch channels based on the audio playback request.

[0165] Optionally, the second system module 1202 is used to send a playback end command to the first system module 1201 when the audio playback has ended.

[0166] The first system module 1201 is used to switch the audio focus from the second audio playback service to the first audio playback service based on the playback end command;

[0167] The first system module 1201 is used to control the switching device to switch paths based on the playback end command, so that the first processor can be connected to the audio playback device;

[0168] The first system module 1201 is used to continue transmitting the first audio data to the audio playback device.

[0169] Optionally, the second system module 1202 is used to determine the connection status between the second processor and the audio playback device when there is an audio playback requirement; and to send the audio playback request to the first system module 1201 when the connection status is disconnected.

[0170] Optionally, the first system module 1201 is used to control the switching device to perform a path switching when the audio playback ends, so that the second processor can be connected to the audio playback device.

[0171] The second system module 1202 is used to transmit the second audio data to the audio playback device when the connection state is in the connected state.

[0172] Optionally, the first system module 1201 is used to send a switching success response to the second system module 1202 when the path switching is completed;

[0173] The second system module 1202 is used to transmit second audio data to the audio playback device, including:

[0174] The second system module 1202 is used to transmit the second audio data to the audio playback device upon receiving the successful switching response.

[0175] Optionally, when the switching device is in the initialization state, the audio playback device is connected to the second processor;

[0176] The first system module 1201 is used to control the switching device to switch paths when there is an audio playback requirement, so that the first processor can connect to the audio playback device.

[0177] Optionally, the first system module 1201 is used to send a progress recording instruction to the second system module 1202 when there is an audio playback requirement and the second system module 1202 is in an audio playback state.

[0178] The second system module 1202 is used to record the audio playback progress based on the progress recording instruction and stop transmitting the second audio data;

[0179] The first system module 1201 is used to control the switching device to perform path switching so that the first processor can be connected to the audio playback device;

[0180] The first system module 1201 is used to transmit third audio data to the audio player;

[0181] The first system module 1201 is used to control the switching device to switch the path when the audio playback ends, so that the second processor can be connected to the audio playback device.

[0182] The first system module 1201 is used to send playback instructions to the second system module 1202;

[0183] The second system module 1202 is used to continue transmitting the second audio data to the audio playback device based on the playback command and the audio playback progress.

[0184] Optionally, the power consumption of the first system module 1201 is higher than that of the second system module 1202.

[0185] In summary, in this embodiment of the application, for electronic devices supporting dual systems, since both systems have audio playback requirements, a hardware switching device is set between the processor and the audio playback device. The first system controls the switching device to switch pathways, allowing the audio playback device's connectivity to switch between the two processors corresponding to the dual systems. This enables the switching of the audio playback device's access rights between the two systems. Compared to when the audio playback device is exclusively used by a single processor, where processors need to frequently synchronize audio data (because only one processor can directly transmit audio data to the audio playback device), the aforementioned pathway switching scheme, using the switching device to switch pathways, allows each processor to directly transmit audio data to the audio playback device. This helps reduce audio data synchronization between processors while ensuring the audio availability of the dual systems in different scenarios.

[0186] This application also provides a computer-readable storage medium storing at least one instruction, which is executed by a processor to implement the audio playback method as described in the above embodiments.

[0187] This application provides a computer program product including computer instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the electronic device to perform the audio playback method provided in the above embodiment.

[0188] Those skilled in the art will recognize that the functions described in the embodiments of this application in one or more of the above examples can be implemented using hardware, software, firmware, or any combination thereof. When implemented using software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or code on a computer-readable medium. Computer-readable media include computer storage media and communication media, wherein communication media include any medium that facilitates the transfer of a computer program from one place to another. Storage media can be any available medium that can be accessed by a general-purpose or special-purpose computer.

[0189] The above description is merely an optional embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.

Claims

1. An audio playback method, characterized in that, The method is used in an electronic device that supports the operation of a first system and a second system, wherein the first system is run by a first processor and the second system is run by a second processor. The method includes: When the first processor is connected to the speaker, the first system transmits first audio data to the speaker; When the second system has an audio playback requirement, the second system sends an audio playback request to the first system; Based on the audio playback request, the first system switches the audio focus from the first audio playback service to the second audio playback service. The first audio playback service is the player service corresponding to the player in the first system, and the second audio playback service is the virtual player service corresponding to the second system. The first system controls a hardware switching device to switch hardware paths based on the audio playback request, so that the second processor can connect to the speaker. The hardware switching device is used to switch the connection object of the speaker and is located between the processor and the speaker. The second system transmits second audio data to the speaker.

2. The method according to claim 1, characterized in that, The method further includes: When the second system finishes playing audio, the second system sends a playback end command to the first system; Based on the playback end command, the first system switches the audio focus from the second audio playback service to the first audio playback service; Based on the playback end command, the first system controls the hardware switching device to perform hardware path switching so that the first processor can connect to the speaker; The first system continues to transmit the first audio data to the speaker.

3. The method according to claim 1, characterized in that, When the second system has an audio playback requirement, the second system sends an audio playback request to the first system, including: When the second system has an audio playback requirement, the second system determines the connection status between the second processor and the speaker; When the connection is disconnected, the second system sends the audio playback request to the first system.

4. The method according to claim 3, characterized in that, After the first system transmits the first audio data to the speaker, the method further includes: When the first system finishes playing audio, the first system controls the hardware switching device to switch hardware paths so that the second processor can connect to the speaker; After the second system determines the connection status between the second processor and the speaker, the method includes: When the connection state is connected, the second system transmits the second audio data to the speaker.

5. The method according to claim 1, characterized in that, The method further includes: Upon completion of the hardware path switch, the first system sends a switch success response to the second system; The second system transmits second audio data to the speaker, including: Upon receiving the successful switching response, the second system transmits the second audio data to the speaker.

6. The method according to claim 1, characterized in that, When the hardware switching device is in the initialization state, the speaker is connected to the second processor; Before the first system transmits the first audio data to the speaker when the first processor is connected to the speaker, the method further includes: When the first system has an audio playback requirement, the first system controls the hardware switching device to switch hardware paths so that the first processor can connect to the speaker.

7. The method according to claim 1, characterized in that, After the second system transmits the second audio data to the speaker, the method further includes: When the first system has an audio playback requirement and the second system is in an audio playback state, the first system sends a progress recording instruction to the second system. The second system records the audio playback progress based on the progress recording instruction and stops transmitting the second audio data; The first system controls the hardware switching device to perform hardware path switching so that the first processor can communicate with the speaker; The first system transmits third audio data to the speaker; When the first system finishes playing audio, the first system controls the hardware switching device to switch hardware paths so that the second processor can connect to the speaker; The first system sends a playback command to the second system; The second system continues to transmit the second audio data to the speaker based on the playback command and the audio playback progress.

8. The method according to any one of claims 1 to 7, characterized in that, The power consumption of the first system is higher than that of the second system.

9. An audio playback device, characterized in that, The device includes: The first system module is used to transmit first audio data to the speaker when the first processor is connected to the speaker; The second system module is used to send an audio playback request to the first system module when there is an audio playback requirement. The first system module is used to switch the audio focus from the first audio playback service to the second audio playback service based on the audio playback request. The first audio playback service is the player service corresponding to the player in the first system module, and the second audio playback service is the virtual player service corresponding to the second system module. The first system module is used to control a hardware switching device to perform hardware path switching based on the audio playback request. The switching device is used to switch the connected object of the speaker, and after the path switching, the second processor is connected to the speaker. The hardware switching device is located between the processor and the speaker. The second system module is used to transmit second audio data to the speaker.

10. An electronic device, characterized in that, The electronic device includes a processor, a memory, a hardware switching device, and a speaker; the memory stores at least one instruction, which is executed by the processor to implement the audio playback method as described in any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that, The storage medium stores at least one instruction, which is executed by a processor to implement the audio playback method as described in any one of claims 1 to 8.

12. A computer program product, characterized in that, The computer program product includes computer instructions stored in a computer-readable storage medium; a processor of an electronic device reads the computer instructions from the computer-readable storage medium and executes the computer instructions to cause the electronic device to implement the audio playback method as described in any one of claims 1 to 8.

Citation Information

Patent Citations

  • System switching method and device, electronic equipment and readable storage medium

    CN112492564A