Method and related device for driving a sound-generating device to generate sound
By controlling the screen sound-generating device and speakers in electronic equipment through one chip, time-division multiplexing technology is used to solve the problem of sound leakage and cost increase in electronic equipment, and achieve more efficient sound control and resource utilization.
Patent Information
- Application Number
- CN202310593982.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-23
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2043-05-23
AI Technical Summary
In electronic devices, due to sound leakage problems caused by changes in the position of the earpiece, adding a screen sound function requires additional chips, which increases cost and weight.
A chip is used to control the screen sound-generating device and the speaker to produce sound respectively, and time-sharing multiplexing is used to reduce the number of chips, cost and weight.
It achieves effective control of sound-generating devices in different audio scenarios, reduces the number of chips, reduces material costs and the weight of the entire machine, and improves the efficiency of hardware layout.
Smart Images

Figure CN117692848B
Abstract
Description
Technical Field
[0001] The present application relates to the field of audio playback, and in particular to a method and a related device for driving a sound-generating device to generate sound. Background Art
[0002] Electronic devices generally have voice communication functions, such as mobile phones and tablets. In order to realize the voice communication function, a sound-generating device needs to be installed in the electronic device so that the user can hear the other party's voice. As the screen-to-body ratio requirements of electronic devices increase, the distance between the screen and the side frame is getting smaller and smaller, and the earpiece is getting closer and closer to the side frame. The side frame and the front of some electronic devices are connected by a curved surface, and the earpiece can even be placed on the connecting curved surface. Due to the change in the position of the earpiece, the sound output position may deviate from the position of the user's ear. In this case, part of the sound output by the earpiece will leak into the environment, resulting in sound leakage.
[0003] In order to deal with the problem of receiver sound leakage, a screen sound function can be added to the electronic device. In this way, in the call scenario, it can be ensured that the user's call content will not be leaked due to the receiver sound leakage problem. Generally, an additional chip is added to drive the screen sound device in the call scenario to realize the screen sound function. The addition of an additional chip will increase the material cost and the weight of the electronic device. Summary of the invention
[0004] The embodiment of the present application provides a method for driving a sound-generating device to generate sound and a related device, which can control the screen sound-generating device and the speaker to generate sound respectively through one chip, thereby reducing the number of chips and lowering costs.
[0005] In a first aspect, the present application provides a method for driving a sound-generating device to generate sound, which is applied to an electronic device, wherein the electronic device includes a first sound-generating device, a second sound-generating device, and a first chip, wherein the first sound-generating device and the second sound-generating device are connected to the first chip; the method includes:
[0006] At a first moment, controlling the first sound-emitting device to emit sound through the first chip;
[0007] At a second moment, the second sound-emitting device is controlled by the first chip to emit sound;
[0008] Among them, when the first sound-emitting device is a screen sound-emitting device, the second sound-emitting device is a speaker; when the first sound-emitting device is the speaker, the second sound-emitting device is a screen sound-emitting device.
[0009] It can be seen that in this application, the screen sound device and the speaker are connected to the same chip (that is, the first chip), so that the sound device connected to the first chip is controlled to make sound by time-division multiplexing. Compared with the prior art of adding an extra chip to control the screen sound device, this application reduces one chip and can remove the required peripheral additional circuits, thereby reducing the material cost and the weight of the electronic device.
[0010] In a possible implementation, at the second moment, controlling the second sound-emitting device to emit sound by using the first chip includes:
[0011] Determine the audio scene based on the running application;
[0012] Loading a configuration file about the second sound-emitting device in the first chip according to the audio scene;
[0013] According to the configuration file of the second sound-emitting device, the second sound-emitting device is controlled by the first chip to emit sound.
[0014] In the embodiment of the present application, corresponding configuration files can be loaded for different audio scenes, so that different sound-generating devices can be controlled to produce sound through the same chip. Since the number of chips is reduced, costs can be saved.
[0015] In a possible implementation manner, loading a configuration file about the second sound-emitting device in the first chip according to the audio scene includes:
[0016] Determine a sound card control of the second sound-emitting device according to the audio scene;
[0017] The configuration file about the second sound device in the first chip is loaded through the sound card control of the second sound device.
[0018] In this application, for different audio scenes, the corresponding sound card can be used to control the selection of configuration files for loading, so as to reuse the first chip and control the sound device to make sound through the same chip. Since the number of chips is reduced, the cost can be saved.
[0019] In a possible implementation, controlling the second sound-emitting device to emit sound by the first chip according to the configuration file of the second sound-emitting device includes:
[0020] According to the configuration file of the second sound-emitting device, the first chip controls the switch circuit to switch to the hardware circuit of the second sound-emitting device, and drives the second sound-emitting device to produce sound.
[0021] In the embodiment of the present application, the control switch circuit is switched to the corresponding hardware circuit of the sound device connected to the first chip, which can reduce the hardware space occupation and reduce the layout pressure.
[0022] In a possible implementation, according to the configuration file of the second sound device, controlling the switch circuit by the first chip to switch to the hardware circuit of the second sound device to drive the second sound device to make a sound includes:
[0023] Determine the output of a general purpose input / output port GPIO signal according to a configuration file of the second sound-emitting device;
[0024] Controlling the switch circuit by the first chip according to the GPIO signal to switch the sound path to the hardware path of the second sound device;
[0025] The second sound-emitting device is driven to emit sound through the hardware path of the second sound-emitting device.
[0026] In the embodiment of the present application, for the selection of the sound device, the output of the GPIO signal can be controlled by the control, thereby controlling the switch circuit to switch to the corresponding hardware path to enable the correct sound device. Since the switch circuit is used, the peripheral additional circuit required by the chip can be removed, reducing the hardware space occupied and reducing the layout pressure.
[0027] In a possible implementation, the audio scene corresponding to the screen sound device is a voice call scene, and the audio scene corresponding to the speaker is an audio file playback scene.
[0028] In a possible implementation, at the first moment, controlling the first sound-emitting device to emit sound by the first chip; and at the second moment, controlling the second sound-emitting device to emit sound by the first chip, includes:
[0029] At a first moment, the electronic device determines that the voice call scenario is the voice call scenario, and controls the screen sound device to make a sound through the first chip;
[0030] At the second moment, the electronic device determines the audio file playback scenario and switches the sound path from the hardware path of the screen sound device to the hardware path of the speaker through the first chip.
[0031] In a possible implementation, at the first moment, controlling the first sound-emitting device to emit sound by the first chip; and at the second moment, controlling the second sound-emitting device to emit sound by the first chip, includes:
[0032] At a first moment, the electronic device determines the audio file playing scene and controls the speaker to sound through the first chip;
[0033] At the second moment, the electronic device determines that it is the voice call scenario, and switches the sound path from the hardware path of the speaker to the hardware path of the screen sound device through the first chip.
[0034] It is understandable that the sound-emitting device of the electronic device also includes a handset. Since the handset will cause sound leakage during a voice call, a screen sound-emitting device is added to the voice call. It is also understandable that voice calls and audio file playback are two different audio scenes, that is, when a voice call is made, audio files will not be played. The sound-emitting devices corresponding to the audio file playback scene include speakers and handsets. Therefore, there is no temporal overlap in the working scenes of the speaker and the screen sound-emitting device, that is, there is no shared scene. Therefore, the screen sound-emitting device and the speaker can share a chip through time-sharing multiplexing, thereby reducing one chip and removing the peripheral additional circuits required for the chip.
[0035] In a possible implementation manner, the audio scene is a parallel sounding scene, and the method further includes:
[0036] At a third moment, the electronic device is determined to be in a parallel sound emission scenario;
[0037] Determine a target sound device corresponding to the parallel sound scene according to a preset priority, wherein the target sound device is a sound device corresponding to a high priority audio scene in the audio scenes included in the parallel sound scene;
[0038] The target sound-emitting device is controlled to emit sound through the first chip.
[0039] In this application, for the parallel sounding scene, the configuration selection can be made according to the preset priority. After the determination is made, the corresponding configuration file can be loaded through the registered sound card control to support the sounding function of the corresponding scene.
[0040] In a second aspect, an embodiment of the present application provides an electronic device, including a chip system and a sound device, wherein the chip system includes a system-level chip SoC, an audio digital signal processor ADSP and a first chip, and the sound device includes a first sound device and a second sound device, wherein:
[0041] At a first moment, the system-on-chip SoC is used to determine the first sound-emitting device;
[0042] The ADSP is used to control the first sound-generating device to generate sound through the first chip;
[0043] At a second moment, the system-on-chip SoC is used to determine the second sound-emitting device;
[0044] The ADSP is used to control the second sound-generating device to generate sound through the first chip;
[0045] Among them, when the first sound-emitting device is a screen sound-emitting device, the second sound-emitting device is a speaker; when the first sound-emitting device is the speaker, the second sound-emitting device is a screen sound-emitting device.
[0046] In a possible implementation, the system-on-chip SoC is specifically used to determine an audio scene according to a running application;
[0047] The ADSP is specifically used to load a configuration file about the second sound device in the first chip according to the audio scene;
[0048] The ADSP is specifically used to control the second sound-emitting device to emit sound through the first chip according to the configuration file of the second sound-emitting device.
[0049] In a possible implementation manner, the system-on-chip (SoC) is specifically configured to determine a sound card control of the second sound-emitting device according to the audio scene;
[0050] The ADSP is specifically used to load the configuration file about the second sound device in the first chip through the sound card control of the second sound device.
[0051] In a possible implementation, the ADSP is specifically used to control the switch circuit of the first chip to switch to the hardware circuit of the second sound device according to the configuration file of the second sound device, so as to drive the second sound device to produce sound.
[0052] In a possible implementation manner, the ADSP is specifically used to determine the output of a general purpose input / output port GPIO signal according to a configuration file of the second sound generating device;
[0053] Controlling the switch circuit by the first chip according to the GPIO signal to switch the sound path to the hardware path of the second sound device;
[0054] The second sound-emitting device is driven to emit sound through the hardware path of the second sound-emitting device.
[0055] In a possible implementation, at a first moment, the SoC is used to determine that the electronic device is in the voice call scenario, and the sound-generating device corresponding to the voice call scenario includes a screen sound-generating device;
[0056] The ADSP is specifically used to control the screen sound device to make sound through the first chip;
[0057] At the second moment, the SoC is used to determine that the electronic device is in the audio file playback scenario, and the sound-generating device corresponding to the audio file playback scenario includes a speaker;
[0058] The ADSP is specifically used to switch the sound path from the hardware path of the screen sound device to the hardware path of the speaker through the first chip.
[0059] In a possible implementation, at a first moment, the SoC is used to determine that the electronic device is in the audio file playback scenario, and the sound-generating device corresponding to the audio file playback scenario includes a speaker;
[0060] The ADSP chip is specifically used to control the speaker to make sound through the first chip;
[0061] At the second moment, the SoC is used to determine that the electronic device is in the voice call scenario, and the sound device corresponding to the voice call scenario includes a screen sound device;
[0062] The ADSP chip is specifically used to switch the sound path from the hardware path of the speaker to the hardware path of the screen sound device through the first chip.
[0063] In a possible implementation, at a third moment, the electronic device is determined to be in a parallel sound emission scenario;
[0064] The SoC is further configured to determine a target sound device corresponding to the parallel sound scene according to a preset priority, wherein the target sound device is a sound device corresponding to an audio scene with a high priority among the audio scenes included in the parallel sound scene;
[0065] The ADSP chip is also used to control the target sound-emitting device to emit sound through the first chip.
[0066] In a third aspect, an electronic device is provided by an embodiment of the present application, the electronic device comprising: a plurality of sound-emitting devices; one or more processors; a memory; wherein the plurality of sound-emitting devices are used to play sound signals of the electronic device; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code comprises computer instructions, the one or more processors call the computer instructions to enable the electronic device to execute the method of driving the sound-emitting device to produce sound described in the first aspect or any possible implementation of the first aspect.
[0067] In a fourth aspect, the present application provides a chip or a chip system, the chip or chip system comprising at least one processor and a communication interface, the communication interface and the at least one processor are interconnected through a line, and the at least one processor is used to run a computer program or instruction to execute the method of driving a sound-generating device to generate sound as described in the first aspect or any possible implementation of the first aspect. The communication interface in the chip may be an input / output interface, a pin, or a circuit, etc.
[0068] In a possible implementation, the chip or chip system described above in the embodiment of the present application further includes at least one memory, in which instructions are stored. The memory may be a storage unit inside the chip, such as a register, a cache, etc., or a storage unit of the chip (e.g., a read-only memory, a random access memory, etc.).
[0069] In a fifth aspect, an embodiment of the present application provides a computer storage medium, which stores a computer program. When the computer program is executed by a processor, the computer executes a method of driving a sound-emitting device to produce sound as described in the first aspect or any possible implementation of the first aspect.
[0070] In a sixth aspect, an embodiment of the present application provides a computer program product, which, when executed on a communication device, enables the communication device to execute a method of driving a sound-generating device to generate sound as described in the first aspect or any possible implementation of the first aspect.
[0071] It should be understood that the description of technical features, technical solutions, beneficial effects or similar language in this application does not imply that all features and advantages can be realized in any single embodiment. On the contrary, it is understood that the description of features or beneficial effects means that specific technical features, technical solutions or beneficial effects are included in at least one embodiment. Therefore, the description of technical features, technical solutions or beneficial effects in this specification does not necessarily refer to the same embodiment. Furthermore, the technical features, technical solutions and beneficial effects described in the present embodiment can also be combined in any appropriate manner. Those skilled in the art will understand that the embodiment can be realized without one or more specific technical features, technical solutions or beneficial effects of a specific embodiment. In other embodiments, additional technical features and beneficial effects can also be identified in a specific embodiment that does not embody all embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0072] The following is an introduction to the drawings used in the embodiments of the present application.
[0073] Figure 1A is a schematic diagram of voice communication through a handset provided in an embodiment of the present application;
[0074] Figure 1B It is a structural schematic diagram of an electronic device provided in an embodiment of the present application;
[0075] Figure 2A It is a connection diagram of a hardware circuit of a sound-generating device provided in an embodiment of the present application;
[0076] Figure 2B It is a schematic diagram of the connection of a hardware circuit of a plurality of sound-generating devices provided in an embodiment of the present application;
[0077] Figure 3 A schematic diagram of the structure of another electronic device provided in an embodiment of the present application is shown;
[0078] Figure 4A is a schematic diagram of the software architecture of the electronic device provided in the embodiment of the present application;
[0079] Figure 4B This is a hardware connection diagram of an electronic device provided in an embodiment of the present application;
[0080] Figure 5A This is an interactive schematic diagram of driving a sound device to make sound based on a sound card control provided by an embodiment of the present application;
[0081] Figure 5B It is a UI schematic diagram provided in an embodiment of the present application;
[0082] Figure 6 It is a flow chart of a method for driving a sound-generating device to generate sound provided by an embodiment of the present application;
[0083] Figure 7 It is a schematic diagram of a configuration file selection logic provided in an embodiment of the present application. DETAILED DESCRIPTION
[0084] The terms used in the following embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to be used as limitations to the present application. As used in the specification and appended claims of the present application, the singular expressions "one", "a kind of", "said", "above", "the" and "this" are intended to also include plural expressions, unless there is a clear indication to the contrary in the context. It should also be understood that the term "and / or" used in the present application refers to and includes any or all possible combinations of one or more listed items.
[0085] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as suggesting or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features, and in the description of the embodiments of the present application, unless otherwise specified, "plurality" means two or more.
[0086] The term "user interface (UI)" in the following embodiments of the present application refers to a medium interface for interaction and information exchange between an application or operating system and a user, which realizes the conversion between the internal form of information and the form acceptable to the user. The user interface is a source code written in a specific computer language such as Java and extensible markup language (XML). The interface source code is parsed and rendered on an electronic device, and finally presented as content that can be recognized by the user. The commonly used form of user interface is a graphical user interface (GUI), which refers to a user interface related to computer operation displayed in a graphical manner. It can be a visual interface element such as text, icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, widgets, etc. displayed on the display screen of an electronic device.
[0087] At present, many electronic devices have voice communication functions or audio playback functions. In order to realize the voice communication function, a sound-generating device needs to be installed in the electronic device so that the user can hear the other party's voice during voice communication. Similarly, in order to realize the audio playback function, the electronic device also needs to install a sound-generating device. Taking the realization of the voice communication function of electronic devices such as mobile phones as an example, a handset (also called a receiver) is set on the top of the mobile phone as a sound-generating device for voice communication to realize the voice communication function. Usually, the handset is set inside the mobile phone, and a hole needs to be opened on the front panel of the mobile phone to form a sound outlet. When the handset sounds, the sound energy emitted by the handset can be transmitted through the sound outlet so that the user can hear the sound emitted by the handset. However, with the continuous development of mobile phones, in order to provide users with a better screen viewing experience, the screen-to-body ratio of mobile phone screens is getting higher and higher. Since the sound outlet hole set on the front panel occupies part of the front panel area of the mobile phone, the width of the mobile phone frame will be increased, which will affect the improvement of the screen-to-body ratio of the mobile phone.
[0088] With the development of large-screen and full-screen mobile phones, in order to increase the screen-to-body ratio of mobile phones, it is necessary to reduce the area occupied by the sound hole of the earpiece on the front panel of the mobile phone. For example, the sound hole of the mobile phone earpiece is designed to be in the form of a long slit, and the sound hole is located at the connection between the middle frame and the front panel of the mobile phone (also known as the side slit of the mobile phone). In some cases, in order to ensure that the sound hole of the mobile phone earpiece has a good sound effect, a hole can also be opened at the top of the middle frame of the mobile phone as a sound hole. In this case, when the user uses the mobile phone for voice communication, the user's auricle cannot completely cover and wrap the sound hole, and the sound energy of the mobile phone earpiece cannot be completely transmitted to the user's auricle, resulting in sound leakage. In public places, such as elevators, offices or buses, users will worry about sound leakage and the content of the call will be heard by people around them, which may leak the user's privacy.
[0089] For example, taking a mobile phone as an example, when a user holds a mobile phone and uses a handset to communicate with the user, the handset is used to play the voice signal of the other user during the voice communication (i.e., the handset is the speaker used for voice communication). Figure 1A , Figure 1A Schematic diagram of a voice communication through a handset provided by an embodiment of the present application. Figure 1A As shown, the sound hole 001 of the mobile phone receiver is close to the user's ear (or auricle). At this time, since the sound hole 001 of the mobile phone receiver (such as the sound hole located at the side seam of the mobile phone and the sound hole at the top of the middle frame) cannot be completely covered by the user's ear, the sound signal emitted by the sound hole 001 can be heard not only by the user, but also by other users in a quiet environment, resulting in sound leakage.
[0090] In order to avoid sound leakage when the receiver is sounding, some electronic devices use screen sound to replace the receiver sound, or use screen sound and receiver sound at the same time. For example, see Figure 1B , Figure 1B 1 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device 100 includes a housing structure 101. The housing structure 101 is formed by a front panel (including a display screen 101A and a frame 101B), a rear panel for supporting an internal circuit, and a middle frame. Figure 1B As shown, a receiver 1011 , a speaker 1012 and a screen sound device 1013 are disposed in the housing structure 101 of the electronic device 100 .
[0091] The earpiece 1011 is a speaker for making voice calls in voice communication, also known as a receiver, and is usually arranged at the top of the housing structure 101. When the electronic device receives a call or voice message, the voice can be heard through the sound outlet 001 of the earpiece 1011 close to the human ear.
[0092] The speaker 1012, also called a horn, is usually disposed at the bottom of the housing structure and is used to convert an audio electrical signal into a sound signal. The electronic device can listen to music, video or a hands-free call through the speaker 1012.
[0093] The screen sound device 1013 is arranged on the back of the front panel of the housing structure 101 and the upper part of the front panel of the housing structure, and can be a vibration source connected to the bottom of the screen. In this way, the display screen 101A can be driven to vibrate and emit sound during operation.
[0094] In this way, in the call scenario, the Figure 1B The electronic device shown can emit sound through the earpiece, or through the screen, or through the earpiece and the screen at the same time, so as to avoid sound leakage caused by the earpiece alone. Figure 1B The electronic device shown is capable of producing sound through a speaker, or through an earpiece, or through both the speaker and the earpiece.
[0095] The screen sound device 1013 may be disposed in the upper half of the housing structure 101, for example, at a position 1 / 3 of the distance from the top edge of the electronic device in the length direction of the housing structure 101. When the user holds the electronic device close to the face or head to receive sound, the screen sound device 1013 is located close to the user's ear, and the sound generated by the vibration of the display screen 101A is largely received by the user.
[0096] The screen sound device 1013 can be set in the center of the display screen 101A, or the screen sound device 1013 can also be set not in the center. Regardless of the setting method, the position where the display screen 101A vibrates and makes sounds is close to the user's ears, so that most of the sound will be received by the user, and the sound that is not received will also be mostly blocked by the user's head, reducing sound leakage.
[0097] See also Figure 2A , Figure 2A 1 is a schematic diagram of the connection of the hardware circuit of a sound-generating device provided in an embodiment of the present application. Figure 2A As shown, in order to drive the sound device 204 to make sound, the hardware circuit of the sound device 204 includes one or more of a system on chip (SoC) 201, an audio digital signal processor (ADSP) 202, and a smart power amplifier (smart PA) 203. The sound device 204 includes a speaker, a receiver, or a screen sound device.
[0098] It can be seen that the smart PA 203 can be connected to the ADSP 202 and the sound-generating device 204 respectively, and is used to control the sound-generating device 204 to generate sound according to the instructions of the SoC 201 and / or the ADSP 202 .
[0099] See also Figure 2B , Figure 2B 1 is a schematic diagram of the connection of a hardware circuit of a plurality of sound generating devices provided in an embodiment of the present application. Figure 2B As shown, the sound device 204 includes one or more of an earpiece 1011, a speaker 1012, and a screen sound device 1013. In order to drive the earpiece 1011, the speaker 1012, and the screen sound device 1013 to make sounds, each sound device is connected to a smart PA 203, so that the sound device connected thereto can be controlled to make sounds according to the instructions of the SoC 201 and / or the ADSP 202.
[0100] from Figure 2B It can be seen that in order to realize the screen sound function, a smart PA chip is needed to drive the screen sound device 103 to make sound. Therefore, it is necessary to add an additional smart PA chip to the original hardware circuit, which will increase the material cost and the weight of the whole machine. Because a smart PA chip is added, all related hardware circuits need to be added, which will increase the complexity of the hardware peripheral circuit and the difficulty of hardware layout.
[0101] from Figure 2A and Figure 2B It can be seen that the smart PA chip used to drive the screen sound device 1013 to make sound and the smart PA chip used to drive the speaker 1012 to make sound are the same chips, but the working configurations of the sound-making scenes are different. For example, the smart PA chip used to drive the screen sound device 1013 drives the screen sound device 1013 to make sound in a call scene, and the smart PA chip used to drive the speaker 1012 drives the speaker 1012 to play music in a music playing scene.
[0102] In addition, the working scenarios of the smart PA chip that drives the screen sound device and the smart PA chip that drives the speaker do not overlap in time, that is, there is no shared scenario. For example, the smart PA chip that drives the screen sound device is used in the call scenario, and the smart PA chip that drives the speaker is used in the music playback scenario.
[0103] In view of this, an embodiment of the present application provides a method and related apparatus for driving a sound-emitting device to emit sound, wherein a first sound-emitting device and a second sound-emitting device are connected to a first chip, and the first chip can control the first sound-emitting device and the second sound-emitting device to emit sound in different sound-emitting scenarios in a time-division multiplexing manner. For example, the first sound-emitting device and the second sound-emitting device are respectively a screen sound-emitting device and a speaker. It can be understood that the chip for driving the first sound-emitting device and the chip for driving the second sound-emitting device are combined for use without adding additional chips. This not only ensures the normal use of the screen sound-emitting function, but also avoids the problems caused by adding additional chips.
[0104] In a possible implementation, at a first moment, the electronic device is determined to be a first audio scene, the first audio scene corresponds to a first sound emitter, and the first chip controls the first sound device to emit sound. At a second moment, the electronic device is determined to be a second audio scene, the second audio scene corresponds to a second sound device, and the first chip controls the second sound device to emit sound. The first sound device and the second sound device are different sound devices, that is, the sound scenes corresponding to the first sound device and the second sound device do not overlap in time. For example, when the first sound device is a screen sound device, the second sound device is a speaker; when the first sound device is a speaker, the second sound device is a screen sound device.
[0105] Therefore, using one chip to control two sound-generating devices to generate sound can improve the utilization rate of the devices, reduce costs and hardware layout pressure, and also reduce the weight of the entire machine.
[0106] Next, the method of driving a sound-generating device to generate sound provided in an embodiment of the present application will be described with reference to the accompanying drawings.
[0107] Exemplarily, the electronic device in the embodiments of the present application may be a mobile phone, a tablet computer, an ultra-mobile personal computer (UMPC), a netbook, a cellular phone, a personal digital assistant (PDA), a wearable device (such as a smart watch, a smart bracelet), and other devices with voice communication functions. The embodiments of the present application do not impose any special restrictions on the specific form of the electronic device.
[0108] For example, taking the electronic device as a mobile phone, Figure 3 1 is a schematic diagram of the structure of another electronic device 100 provided in an embodiment of the present application. That is, exemplarily, Figure 3 The electronic device shown may be a mobile phone.
[0109] like Figure 3As shown, the electronic device 100 may include: a processor 310, an external memory interface 320, an internal memory 321, a universal serial bus (USB) interface 330, a charging management module 340, a power management module 341, a battery 342, an antenna 1, an antenna 2, a mobile communication module 350, a wireless communication module 360, an audio module 370, a speaker 370A, a receiver (i.e., an earpiece) 370B, a microphone 370C, an earphone interface 370D, a sensor module 380, a button 390, a motor 391, an indicator 392, a camera 393, a display screen 394, and a subscriber identification module (SIM) card interface 395, a screen sound device 396, etc.
[0110] Among them, the above-mentioned sensor module may include sensors such as pressure sensor, gyroscope sensor, air pressure sensor, magnetic sensor, acceleration sensor, distance sensor, proximity light sensor, fingerprint sensor, temperature sensor, touch sensor, ambient light sensor and bone conduction sensor.
[0111] It is to be understood that the structure illustrated in this embodiment does not constitute a specific limitation on the electronic device 100. In other embodiments, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or separate some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0112] The processor 310 may include one or more processing units, for example: the processor 310 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 processing unit (neural-network processing unit, NPU), etc. Among them, different processing units can be independent devices or integrated into one or more processors. For example, the multiple processing units shown above are all integrated into a system on chip (system on chip, SoC), or the DSP is a separate semiconductor chip, and the other processing units are integrated into a SoC, which is not limited in this application.
[0113] The controller may be the nerve center and command center of the electronic device 100. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.
[0114] The processor 310 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 310 is a cache memory. The memory may store instructions or data that the processor 310 has just used or cyclically used. If the processor 310 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 310, and thus improves the efficiency of the system.
[0115] In some embodiments, the processor 310 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0116] It is understandable that the interface connection relationship between the modules shown in this embodiment is only a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0117] The charging management module 340 is used to receive charging input from a charger (such as a wireless charger or a wired charger) to charge the battery 342. The power management module 341 is used to connect the battery 342, the charging management module 340 and the processor 310. The power management module 341 receives input from the battery 342 and / or the charging management module 340 to power various components of the electronic device.
[0118] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 350, the wireless communication module 360, the modem processor and the baseband processor.
[0119] 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 communication frequency bands. Different antennas can also be reused to improve the utilization of 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.
[0120] In some embodiments, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 350, and the antenna 2 is coupled to the wireless communication module 360, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology. The above-mentioned mobile communication module 350 can provide solutions for wireless communications including 2G / 3G / 4G / 5G applied to the electronic device 100. The mobile communication module 350 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 350 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.
[0121] The mobile communication module 350 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some functional modules of the mobile communication module 350 can be set in the processor 310. In some embodiments, at least some functional modules of the mobile communication module 350 can be set in the same device as at least some modules of the processor 310.
[0122] The wireless communication module 360 can provide wireless communication solutions for application in the electronic device 100, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication technology (NFC), infrared technology (IR), etc.
[0123] The wireless communication module 360 may be one or more devices integrating at least one communication processing module. The wireless communication module 360 receives electromagnetic waves via the antenna 2, modulates the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 310. The wireless communication module 360 may also receive a signal to be sent from the processor 310, modulate the signal, amplify the signal, and convert it into an electromagnetic wave for radiation via the antenna 2.
[0124] Of course, the wireless communication module 360 can also support the electronic device 100 for voice communication. For example, the electronic device 100 can access the Wi-Fi network through the wireless communication module 360, and then use any application that can provide voice communication services to interact with other devices to provide voice communication services for users. For example, the application that can provide voice communication services can be an instant messaging application.
[0125] The electronic device 100 can realize the display function through a GPU, a display screen 394, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 394 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 310 may include one or more GPUs, which execute program instructions to generate or change display information. The display screen 394 is used to display images, videos, etc.
[0126] The electronic device 100 can realize the shooting function through the ISP, the camera 393, the video codec, the GPU, the display screen 394 and the application processor. The ISP is used to process the data fed back by the camera 393. In some embodiments, the ISP can be set in the camera 393. The camera 393 is used to capture a static image or a video. In some embodiments, the electronic device 100 can include 1 or N cameras 393, where N is a positive integer greater than 1.
[0127] The external memory interface 320 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The internal memory 321 can be used to store computer executable program codes, which include instructions. The processor 310 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 321. For example, in an embodiment of the present application, the processor 310 can execute instructions stored in the internal memory 321, and the internal memory 321 may include a program storage area and a data storage area.
[0128] The electronic device 100 can implement audio functions such as music playing and recording through the audio module 370, the speaker 370A, the receiver (ie, the handset) 370B, the microphone 370C, the headphone jack 370D, and the application processor.
[0129] The audio module 370 is used to convert digital audio signals into analog audio signals for output, and is also used to convert analog audio inputs into digital audio signals. The audio module 370 can also be used to encode and decode audio signals. In some embodiments, the audio module 370 can be arranged in the processor 310, or some functional modules of the audio module 370 can be arranged in the processor 310. The speaker 370A, also known as the "speaker", is used to convert audio electrical signals into sound signals. The receiver 370B, also known as the "earpiece", is used to convert audio electrical signals into sound signals. The microphone 370C, also known as the "microphone" or "microphone", is used to convert sound signals into electrical signals. The headphone interface 370D is used to connect wired headphones. The headphone interface 370D can be a USB interface 330, or it can be a 3.5mm open mobile electronic device platform (open mobile terminal platform, OMTP) standard interface, and the cellular telecommunications industry association of the USA (cellular telecommunications industry association of the USA, CTIA) standard interface.
[0130] The receiver 370B (i.e., the "earpiece") may be a Figure 1B The receiver 370B may be a device having the same function as the handset 1011 shown in FIG. Figure 1B The speaker 1012 shown has the same function as the device.
[0131] Exemplarily, in the embodiment of the present application, the audio module 370 can convert the audio electrical signals received by the mobile communication module 350 and the wireless communication module 360 into sound signals. The receiver 370B (i.e., "earpiece") of the audio module 370 plays the sound signal, and / or the screen sound device 396 drives the screen (i.e., the display screen) to make screen sound to play the sound signal. The screen sound device 396 can be connected to Figure 1B The screen sound device 1013 shown is a device with the same function.
[0132] It should be understood that for different screen sounding schemes, the specific structure of the screen sounding device 396 in the electronic device is different. For example, the screen sounding device 396 can be a vibration source (such as piezoelectric ceramics, motor vibrators, exciters or other vibration units) connected to the back of the screen. The vibration source can vibrate under the control of the current signal to drive the screen to vibrate, thereby realizing the screen sounding. For another example, the screen sounding device 396 can also be a piezoelectric ceramic fixed to the middle frame of the electronic device through a cantilever beam structure. The piezoelectric ceramic can vibrate under the control of the current signal, and use the middle frame of the electronic device 100 to transfer the vibration to the screen to drive the screen to vibrate, thereby realizing the screen sounding. For another example, the screen sounding device 396 can also be an exciter fixed to the middle frame of the electronic device. The exciter can vibrate under the control of the current signal, and use the middle frame of the electronic device 100 to transfer the vibration to the screen to drive the screen to vibrate, thereby realizing the screen sounding. For another example, the screen sounding device 396 can also be a split magnetic suspension vibrator. One of the split magnetic levitation vibrators is fixed on the middle frame of the electronic device, and the other vibrator is fixed on the screen. Under the control of the current signal, the vibrator fixed on the screen vibrates relative to the vibrator fixed on the middle frame of the electronic device, thereby driving the screen to vibrate and realize screen sound.
[0133] It should be noted that the chip that drives the speaker 370A and the screen sound device 396 to produce sound is the same chip.
[0134] The buttons 390 include a power button, a volume button, etc. The motor 391 can generate a vibration prompt. The indicator 392 can be an indicator light, which can be used to indicate the charging status, power change, messages, missed calls, notifications, etc. The SIM card interface 395 is used to connect a SIM card. The electronic device 100 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1.
[0135] Of course, it is understandable that the above Figure 3 The figure is only an exemplary description of the electronic device 100. If the electronic device is a tablet computer, a handheld computer, a PDA, a wearable device (such as a smart watch, a smart bracelet) or other device forms, the structure of the electronic device may include more than Figure 3 The structure shown in the figure is less than Figure 3 More structures are shown in the figure, which are not limited here.
[0136] The software system of an electronic device (such as a mobile phone) can adopt a layered architecture, a transaction-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture. This application embodiment takes the Android system with a layered architecture as an example to illustrate the software architecture of a mobile phone. Figure 4A , Figure 4AIt is a schematic diagram of the software architecture of the electronic device provided in the embodiment of the present application.
[0137] The layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom: the application layer, the application framework layer (frame), the hardware abstraction layer (HAL), and the kernel layer.
[0138] The application layer may include a series of application packages.
[0139] like Figure 4A As shown, the application may include a camera, a gallery, a social application, a browser, a short message, music, a video application, a call application, and the like.
[0140] The call application is a call application. When the call application is turned on, the user can make a call through the electronic device. The electronic device can determine that the audio scene is a voice call scene according to the running application. For example, in response to the user's operation of answering a call on the phone application, the phone application can determine that the call is connected through the phone manager of the application framework layer. Then, the phone manager can call the audio hardware abstraction of the abstract layer to start the hardware involved in the call process such as the microphone, the receiver, and the screen sound device, so that the electronic device starts the call application, and the user can start the call.
[0141] By opening music applications and video applications, users can play audio through electronic devices, and the electronic devices can determine the audio scene as an audio file playback scene based on the running application. For example, in response to the user's operation of playing a music file on a music application, the music application can determine the audio file through the audio playback management service of the application framework layer. Then, the audio playback management service can call the audio hardware of the abstract layer to start the hardware involved in the music playback process such as speakers and earpieces, so that the electronic device starts the music application and starts playing the music file.
[0142] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined functions.
[0143] Therefore, the electronic device can determine the output device scenario through the application and the application framework layer.
[0144] like Figure 4AAs shown, the application framework layer is provided with an audio playback management service and a phone manager. The audio playback management service can be used to initialize the audio player, obtain the volume of the current audio file, adjust the volume of the audio playback, add sound effects, etc. The phone manager is used to provide communication functions for electronic devices, such as the management of call status (including connected, hung up, etc.).
[0145] In addition, the application framework layer may also include a window manager, a content provider, a view system, a resource manager, a notification manager, and the like.
[0146] The window manager is used to manage window programs. The window management service can obtain the size of the display screen, determine whether there is a status bar, lock the screen, capture the screen, etc. The above-mentioned content provision service is used to store and obtain data and make these data accessible to applications. The data may include video, images, audio, calls made and received, browsing history and bookmarks, phone books, etc. The above-mentioned view system can be used to build the display interface of the application. Each display interface can be composed of one or more controls. Generally speaking, controls can include icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, widgets, and other interface elements. The above-mentioned resource management service provides various resources for applications, such as localized strings, icons, pictures, layout files, video files, etc. The above-mentioned notification management service 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. For example, the notification management service is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as a notification of an application running in the background, or a notification that appears on the screen in the form of a dialog window. For example, displaying text messages in the status bar, making beep sounds, vibrating, or flashing indicator lights, etc.
[0147] The hardware abstraction layer (HAL) is an interface layer between the operating system kernel and the hardware circuit, providing HAL corresponding to different application modules of electronic devices. Figure 4A As shown, HAL includes but is not limited to an audio hardware abstraction layer (audio HAL) and a camera hardware abstraction layer (camera HAL).
[0148] In the embodiment of the present application, the electronic device can determine the audio path through the hardware abstraction layer.
[0149] The kernel layer is the layer between the hardware and the above software layer. The kernel layer includes at least display driver, camera driver, audio driver, and sensor driver.
[0150] The audio driver of the kernel layer can correspond to the sound device of the hardware layer (such as a screen sound device, a speaker or a receiver). When the electronic device is provided with multiple sound devices (such as multiple speakers or multiple screen sound devices or multiple receivers), the multiple sound devices correspond to multiple audio drivers of the kernel layer respectively.
[0151] In the embodiment of the present application, the multiplexing of the electronic device 100 in different audio scenarios mainly includes switching of two parts: the selection of the sound device and the selection of the configuration of the first chip. The electronic device calls the advanced Linux sound architecture (ALSA) through the kernel layer and registers the sound card control, such as kcontrol. Then, the method of driving the sound device to make a sound is executed, so that the configuration file of the sound device in the smart PA chip can be loaded through the sound card control, so as to control the selection of the sound device and the configuration of the smart PA chip in real time in the corresponding audio scene.
[0152] For example, when the audio scene is a voice call scene, the sound device corresponding to the voice call scene includes a screen sound device. The system-level chip SoC determines the sound card control of the screen sound device according to the audio scene, and then the SoC loads the configuration file of the screen sound device in the smart PA chip through the corresponding sound card control. According to the configuration file of the screen sound device, the smart PA chip controls the screen sound device to make sound.
[0153] When the audio scene is an audio file playback scene, the sound-generating device corresponding to the audio file playback scene includes a speaker. The system-level chip SoC determines the sound card control of the speaker according to the audio scene, and then the SoC loads the configuration file of the speaker in the smart PA chip through the corresponding sound card control. According to the configuration file of the speaker, the smart PA chip controls the speaker to produce sound.
[0154] See also Figure 4B , Figure 4B Schematic diagram of hardware connection of an electronic device provided in an embodiment of the present application. Figure 4BIt can be seen that the hardware structure of the electronic device 100 may include a chip system 410 and a sound device 420. Among them, the chip system 410 may include one or more of a system-level chip SoC4101, an audio digital signal processor (Audio DSP) 4102, a first chip 4031, a second chip 4032, a switch circuit 4104, or related peripheral additional circuits. The sound device 420 may include one or more of a speaker 4201, a screen sound device 4202, an earpiece 4203, a display screen 422, a sound outlet 421, or a sound outlet 423. In some embodiments, the ADSP4102 may be integrated in the SoC4101, and the display screen 422 may be Figure 3 Display screen 394 is shown.
[0155] Among them, SoC4101 is respectively connected to ADSP4102 and switch circuit 4104. ADSP4102 is respectively connected to the first chip 4031 and the second chip 4032 through the integrated circuit built-in audio bus (Inter-IC Sound, I2S). The first chip 4031 is respectively connected to the speaker 4201 and the screen sound device 4202 through the switch circuit 4104, and the second chip 4032 is connected to the earpiece 4203, so that the earpiece 4203 can be driven to make sound.
[0156] SoC4101 analyzes the running application and determines the audio scene where the electronic device 100 is located based on the running application. The sound device corresponding to the audio scene is one of the first sound device and the second sound device, and different audio scenes may correspond to different sound devices. When the first sound device is the screen sound device 4202, the second sound device is the speaker 4201; when the first sound device is the speaker 4201, the second sound device is the screen sound device 4202. ADSP4102 loads the configuration file of the corresponding sound device in the first chip 4031 according to the audio scene, and then controls the sound device to make sound through the first chip according to the configuration file of the sound device.
[0157] In a possible implementation, a chip configuration algorithm is stored in ADSP4102, and a sound device selection algorithm is stored in SoC4101. The electronic device 100 runs the chip configuration algorithm stored in ADSP4102 to load the configuration file about the sound device in the first chip 4031 according to the audio scene, such as firmware configuration. The electronic device 100 runs the sound device selection algorithm stored in SoC4101 to control the output of the signal according to the configuration of the sound device, thereby controlling the switch circuit 4104 to switch to the hardware path corresponding to the sound device corresponding to the audio scene, so that the first chip 4031 can be reused in different scenes to determine the sound device to make sound.
[0158] For example, at the first moment, the electronic device 100 is determined to be in a voice call scenario, and the sound devices corresponding to the voice call scenario include the screen sound device 4202 and the earpiece 4203. The electronic device runs the chip configuration algorithm stored in ADSP4102 to load the configuration file about the screen sound device 4202 in the first chip 4031 according to the voice call scenario, and controls the second chip 4032 to load the configuration file of the earpiece 4203. The electronic device runs the sound device selection algorithm stored in SoC4101 to control the output of the signal, thereby controlling the switch circuit 4104 to switch to the hardware path corresponding to the screen sound device 4202.
[0159] Furthermore, ADSP4102 controls the switch circuit 4104 to switch to the screen sound device 4202 to make sound through the first chip 4031 according to the configuration file of the screen sound device 4202, and the display screen 422 corresponding to the screen sound device 4202 vibrates to emit a sound signal heard by the user. The second chip 4032 drives the earpiece 4203 to make sound, and the sound outlet 421 corresponding to the earpiece 4203 emits a sound signal heard by the user.
[0160] For another example, at the second moment, the electronic device 100 determines that the audio file playback scene corresponds to the speaker 4201 and the earpiece 4203. The ADSP 4102 runs the stored chip configuration algorithm to load the configuration file for the speaker 4201 in the first chip 4031 according to the audio file playback scene, and loads the configuration file for the earpiece 4203 in the second chip 4032. The electronic device 100 runs the sound device selection algorithm stored in the SoC 4101 to control the output of the signal, thereby controlling the switch circuit 4104 to switch to the hardware path corresponding to the speaker 4201.
[0161] Furthermore, ADSP4102 controls the switch circuit 4104 to switch to the speaker 4201 through the first chip 4031 according to the configuration file of the speaker 4201, and the sound signal is emitted by the sound outlet 423 corresponding to the speaker 4201 and heard by the user. The second chip 4032 drives the receiver 4203 to emit sound, and the sound outlet 421 corresponding to the receiver 4203 emits a sound signal and heard by the user.
[0162] That is, at the second moment after the first moment, ADSP4102 switches the sound path from the hardware path of the screen sound device 4202 connected to the first chip 4031 to the hardware path of the speaker 4201 connected to the first chip 4031 through the switching circuit 4104 according to the configuration file of the speaker 4201.
[0163] In another possible implementation, if SoC4101 determines that the scene is a parallel sounding scene of a voice call scene and an audio file playing scene, the target audio scene is determined according to a preset priority. SoC4101 determines the target sounding device according to the target audio scene, and the target sounding device is the sounding device corresponding to the scene with a higher priority in the voice call scene and the audio file playing scene. ADSP4102 loads the configuration file of the target sounding device in the first chip 4031.
[0164] It should be noted that if the priority of the voice call scenario is higher than the audio file playback scenario, the target sound device is the screen sound device 4202, and the ADSP4102 controls the screen sound device 4202 to make sound through the first chip 4031. If the priority of the audio file playback scenario is higher than the voice call scenario, the target sound device is the speaker 4201, and the ADSP4102 controls the speaker 4201 through the first chip 4031 to make sound.
[0165] In one possible implementation, SoC4101 can control the output of the GPIO signal corresponding to the screen sound device 4202, thereby controlling the switch circuit 4104 through the GPIO signal to switch the sound path from the hardware path of the speaker 4201 to the hardware path of the screen sound device 4202, and drive the screen sound device 4202 to make sound through the hardware path of the screen sound device 4202.
[0166] In another possible implementation, SoC4101 can control the output of the GPIO signal corresponding to the speaker 4201, thereby controlling the switch circuit 4104 through the GPIO signal to switch the sound path from the hardware circuit of the screen sound device 4202 to the hardware circuit of the speaker 4201, and drive the speaker 4201 to make sound through the hardware path of the speaker 4201.
[0167] In some embodiments, the first chip 4031 may be a smart PA chip, and the second chip 4032 may also be a smart PA chip. Without limitation thereto, the first chip 4031 and the second chip 4032 may be any chip used to drive a sound-generating device to generate sound, and the embodiments of the present application do not impose any limitation thereto.
[0168] In other embodiments, at the first moment, the electronic device 100 determines that the audio file is played; at the second moment, the electronic device 100 determines that the voice call is in progress. In this case, after the second moment, the sound path can be switched from the hardware path of the screen sound device 4202 to the hardware path of the speaker 4201 through the switch circuit 4104.
[0169] See also Figure 5A and Figure 5B , Figure 5A is an interactive schematic diagram of driving a sound device to make sound based on a sound card control provided in an embodiment of the present application, Figure 5B It is a UI schematic diagram provided in an embodiment of the present application.
[0170] In the embodiment of the present application, the chip configuration algorithm is stored in the ADSP, and the sound device selection algorithm is stored in the SoC. The electronic device opens the corresponding algorithm path through the kernel layer, runs the chip configuration algorithm stored in the ADSP and the sound device selection algorithm stored in the SoC, and completes the control of the chip and the sound device in the corresponding audio scene through the sound card control registered based on the ALSA architecture to drive the corresponding sound device to make sound.
[0171] like Figure 5A As shown, the electronic device can determine the output device scene according to the application or application framework layer. In a possible implementation, at the first moment, the electronic device determines the audio file playback scene according to the running music application. At the second moment, the electronic device determines the voice call scene according to the running call application.
[0172] For example, if Figure 5B As shown, at the first moment, a music application is started, and the audio scene determined by the electronic device is an audio file playback scene; at the second moment, a call application is started, and the audio scene determined by the electronic device is a voice call scene.
[0173] like Figure 5A As shown, the electronic device can select the audio path through the hardware abstraction layer. In one possible implementation, the audio file playback scene corresponds to the first sound device, and the voice call scene corresponds to the second sound device. For example, at the first moment, the audio scene determined by the electronic device is the audio file playback scene, and the sound devices corresponding to the audio file playback scene include the speaker and the receiver, so that the audio path corresponding to the speaker and the receiver can be selected through the hardware abstraction layer. At the second moment, the audio scene determined by the electronic device is the voice call scene, and the sound devices corresponding to the voice call scene include the screen sound device and the receiver, so that the audio path corresponding to the screen sound device and the receiver can be selected through the hardware abstraction layer.
[0174] like Figure 5AAs shown, at the kernel layer, the electronic device can implement audio driver, apply for general purpose input / output (GPIO) resources and perform initialization configuration. The electronic device calls ALSA through the kernel layer, initializes ALSA and registers the sound card control (also known as kcontrol). The electronic device determines the sound card control of the target sound device according to the audio scene sent by the hardware abstraction layer, selects the sound device connected to the chip by controlling the corresponding sound card control, and loads the configuration file about the target sound device in the first chip through the sound card control of the target sound device.
[0175] Among them, the chip includes a first chip and a second chip. In a possible implementation, at a first moment, the electronic device is based on an audio file of a screen sound device sent from a hardware abstraction layer, wherein the audio file may include an audio path corresponding to the screen sound device. The electronic device controls the sound card control to select the screen sound device connected to the first chip, and loads a configuration file corresponding to the screen sound device in the first chip. At a second moment, the electronic device is based on an audio file of a speaker sent from a hardware abstraction layer, wherein the audio file may include an audio path corresponding to the speaker. The electronic device controls the sound card control to select the speaker connected to the first chip, and loads a configuration file corresponding to the speaker in the first chip.
[0176] For example, if Figure 5B As shown, at the first moment, the electronic device is determined to be an audio file playback scene, and the electronic device can select the speaker 7012 connected to the first chip 4013 by controlling the corresponding sound card control, and select the earpiece connected to the second chip by controlling the corresponding sound card control. Next, the electronic device loads the configuration file about the speaker 7012 through the first chip 4013, and loads the configuration file about the earpiece through the second chip. At the second moment after the first moment, the electronic device is determined to be a voice call scene, and the electronic device can select the screen sound device 7013 connected to the first chip 4013 through the corresponding control sound card control, and select the earpiece connected to the second chip through the sound card control. Next, the electronic device loads the configuration file about the screen sound device 7013 through the first chip 4013, and loads the configuration file about the earpiece through the second chip.
[0177] For example Figure 5A As shown, the electronic device can control the GPIO output through the sound card control based on ALSA, and then operate the hardware circuit to switch to the corresponding sound device, thereby completing the multiplexing of the first chip in different audio scenarios.
[0178] In a possible implementation manner, the electronic device decomposes the configuration file of the target sound-emitting device, controls the switch circuit to switch to the hardware circuit of the target sound-emitting device connected to the first chip, and drives the target sound-emitting device to emit sound.
[0179] In one possible implementation, the electronic device determines the output of the GPIO signal based on the configuration file of the target sound-emitting device, and controls the switching circuit through the GPIO signal to switch the sound path to the hardware path of the target sound-emitting device connected to the first chip, so that the target sound-emitting device can be determined to make sound through the hardware path of the target sound-emitting device.
[0180] For example, see Figure 5B At the first moment, the electronic device determines the output of the GPIO signal according to the configuration file of the speaker 7012, and controls the switch circuit 4104 through the GPIO signal to switch the sound path to the hardware path of the speaker 7012 connected to the first chip 4031, and drives the speaker 7012 to make sound through the hardware path of the speaker 7012.
[0181] At the second moment, the electronic device determines the output of the GPIO signal according to the configuration file of the screen sound device 7013, and switches the sound path to the hardware path of the screen sound device 7013 connected to the first chip 4031 through the GPIO signal control switch circuit 4104, and drives the screen sound device 7013 to make sound through the hardware path of the screen sound device 7013.
[0182] It should be noted that Figure 5B This is an illustration provided by the present application, and the present application does not impose any restrictions on the audio playback scenarios at the first moment and the second moment.
[0183] Based on the embodiments shown above, the method of driving the sound-generating device to generate sound provided by the embodiments of the present application is described below.
[0184] See also Figure 6 , Figure 6 : is a flow chart of a method for driving a sound-generating device to generate sound provided by an embodiment of the present application. The method can be applied to Figure 3 The electronic device 100 shown, Figure 4B The electronic device 100 is shown. The method may include but is not limited to the following steps:
[0185] Step S601, at a first moment, controlling a first sound-emitting device to emit sound through a first chip.
[0186] Step S602, at the second moment, controlling the second sound-emitting device to emit sound through the first chip.
[0187] The first sound device and the second sound device are connected to the same chip. When the first sound device is a screen sound device, the second sound device is a speaker; when the first sound device is the speaker, the second sound device is a screen sound device.
[0188] In a possible implementation, the electronic device determines an audio scene according to a running application, and the audio scene corresponds to a sound-generating device.
[0189] The audio scenes include voice call scenes, audio file playback scenes, and parallel sound scenes. The sound device corresponding to the voice call scene includes the screen sound device, and the sound device corresponding to the audio file playback scene includes the speaker. The parallel sound scene corresponds to the sound device corresponding to a scene with a high priority.
[0190] In a possible implementation, at a first moment, the electronic device determines that the audio scene is a voice call scene according to the running application. At a second moment, the electronic device determines that the audio scene is an audio file playback scene according to the running application. At a third moment, the electronic device determines that the audio scene is a parallel sounding scene, that is, a voice call scene and an audio file playback scene, according to the running multiple applications.
[0191] In a possible implementation, at a first moment, the electronic device loads a configuration file for the first sound device in the first chip according to the audio scene. At a second moment, the electronic device loads a configuration file for the second sound device in the first chip according to the audio scene. At a third moment, the electronic device determines the target sound device corresponding to the parallel sound scene according to a preset priority, the target sound device being the sound device corresponding to a high priority audio scene included in the parallel sound scene, and loads the configuration file for the target sound device in the first chip.
[0192] Specifically, the electronic device can register the sound card control based on the ALSA architecture, so as to complete the control of the first chip and the control of the selection of the sound device in a specific audio scene.
[0193] In a possible implementation, at a first moment, the electronic device determines the sound card control of the first sound-emitting device according to the audio scene, and loads the configuration file of the first sound-emitting device in the first chip through the sound card control of the first sound-emitting device. At a second moment, the electronic device determines the sound card control of the second sound-emitting device according to the audio scene, and loads the configuration file of the second sound-emitting device in the first chip through the sound card control of the second sound-emitting device. At a third moment, the electronic device determines the sound card control of the target sound-emitting device according to the parallel sound-emitting scene, and loads the configuration file of the target sound-emitting device in the first chip through the sound card control of the target sound-emitting device.
[0194] For example, see Figure 7 , Figure 7 It is a schematic diagram of a configuration file selection logic provided by an embodiment of the present application. At the first moment, the electronic device determines that the audio scene is a voice call scene A, starts the Audioserver process through the set(call state) function, and sends parameters to the Audio HAL in the Audioserver process, such as set Parameter(call state). Therefore, the electronic device determines the sound card control of the screen sound device according to the voice call scene, and loads the voice call scene configuration item through the sound card control of the screen sound device, that is, loads the configuration file for the screen sound device in the first chip.
[0195] At the second moment, the electronic device determines that the audio scene is the audio file playback scene B, starts the Audioserver process through the createAudioTrack function, and sends parameters to the Audio HAL in the Audioserver process to select the audio path according to the audio file playback scene, such as adev_open_output_stream(flag, params). Therefore, the electronic device determines the sound card control of the speaker according to the audio file playback scene, and loads the audio file scene configuration item through the sound card control of the speaker, that is, loads the configuration file about the speaker in the first chip.
[0196] At the third moment, the electronic device determines that the audio scene is a parallel sounding scene, that is, it includes a voice call scene A and an audio file playback scene B, and sends the electronic device to the Audio HAL that it is in a parallel sounding scene. The electronic device determines the corresponding target sounding device in the parallel sounding scene according to the preset priority. If the priority of the voice call scene A is greater than the priority of the audio file playback scene B, the configuration item of the voice call scene in the first chip is loaded. If the priority of the audio file playback scene B is greater than the priority of the voice call scene A, the configuration item of the audio file playback scene in the first chip is loaded.
[0197] In a possible implementation, the first chip may be a smart PA chip.
[0198] In a possible implementation, at a first moment, the electronic device controls the switch circuit to switch to the hardware circuit of the first sound-emitting device through the first chip according to the configuration file of the first sound-emitting device, and drives the first sound-emitting device to emit sound. At a second moment, the electronic device controls the switch circuit to switch to the hardware circuit of the second sound-emitting device through the first chip according to the configuration file of the second sound-emitting device, and drives the second sound-emitting device to emit sound. At a third moment, the electronic device controls the switch circuit to switch to the hardware circuit of the target sound-emitting device through the first chip according to the configuration file of the target sound-emitting device, and drives the first sound-emitting device to emit sound.
[0199] In another possible implementation, at the first moment, the electronic device determines the output of the GPIO signal of the general input / output port according to the configuration file of the first sound-emitting device, controls the switch circuit to switch the sound path to the hardware path of the first sound-emitting device through the GPIO signal, and drives the first sound-emitting device to emit sound through the hardware path of the first sound-emitting device. At the second moment, the electronic device determines the output of the GPIO signal of the general input / output port according to the configuration file of the second sound-emitting device, controls the switch circuit to switch the sound path to the hardware path of the second sound-emitting device through the GPIO signal, and drives the second sound-emitting device to emit sound through the hardware path of the second sound-emitting device. At the third moment, the electronic device determines the output of the GPIO signal of the general input / output port according to the configuration file of the target sound-emitting device, controls the switch circuit to switch the sound path to the hardware path of the target sound-emitting device through the GPIO signal, and drives the target sound-emitting device to emit sound through the hardware path of the target sound-emitting device.
[0200] It is understandable that, because multiple sound devices are connected to the first chip, the switch circuit can be controlled to switch to the corresponding sound device according to the configuration file of the corresponding sound device. For example, the switch circuit is controlled to switch from the first sound device to the second sound device; or the switch circuit is controlled to switch from the second sound device to the first sound device.
[0201] One or more of the above modules or units may be implemented in software, hardware, or a combination of both.
[0202] When any of the above modules or units are implemented in software, the software exists in the form of computer program instructions and is stored in a memory, and the processor can be used to execute the program instructions to implement the above method flow. The processor may include but is not limited to at least one of the following: a central processing unit (CPU), a microprocessor, a digital signal processor (DSP), a microcontroller unit (MCU), or an artificial intelligence processor and other types of computing devices that run software, each of which may include one or more cores for executing software instructions to perform operations or processing. The processor may be a separate semiconductor chip, or it may be integrated into a semiconductor chip together with other circuits. For example, it may form a SoC (system on chip) with other circuits (such as a codec circuit, a hardware acceleration circuit, or various buses and interface circuits), or it may be integrated into the ASIC as a built-in processor of an ASIC. The ASIC with an integrated processor may be packaged separately or with other circuits. In addition to the core for executing software instructions for operations or processing, the processor may further include necessary hardware accelerators, such as field programmable gate arrays (FPGAs), PLDs (programmable logic devices), or logic circuits that implement dedicated logic operations.
[0203] When the above modules or units are implemented in hardware, the hardware can be any one or any combination of a CPU, a microprocessor, a DSP, an MCU, an artificial intelligence processor, an ASIC, a SoC, an FPGA, a PLD, a dedicated digital circuit, a hardware accelerator or a non-integrated discrete device, which can run the necessary software or not rely on the software to execute the above method flow.
Claims
1. A method for driving a sound-generating device to generate sound, characterized in that: Applied to an electronic device, the electronic device comprises a first sound-generating device, a second sound-generating device, and an intelligent power amplifier, the first sound-generating device and the second sound-generating device are connected to the intelligent power amplifier; the method comprises: At a first moment, controlling the first sound-emitting device to emit sound through the intelligent power amplifier; At a second moment, controlling the second sound-emitting device to emit sound through the intelligent power amplifier; Among them, when the first sound-emitting device is a screen sound-emitting device, the second sound-emitting device is a speaker; when the first sound-emitting device is the speaker, the second sound-emitting device is a screen sound-emitting device.
2. The method according to claim 1, characterized in that At the second moment, controlling the second sound-emitting device to emit sound through the intelligent power amplifier includes: Determine the audio scene based on the running application; Loading a configuration file about the second sound-emitting device in the smart power amplifier according to the audio scene; According to the configuration file of the second sound-emitting device, the second sound-emitting device is controlled by the intelligent power amplifier to emit sound.
3. The method according to claim 2, characterized in that The step of loading a configuration file about the second sound-emitting device in the smart power amplifier according to the audio scene includes: Determine a sound card control of the second sound-emitting device according to the audio scene; The configuration file about the second sound-emitting device in the smart power amplifier is loaded through the sound card control of the second sound-emitting device.
4. The method according to claim 2 or 3, characterized in that: The step of controlling the second sound emitting device to emit sound by the intelligent power amplifier according to the configuration file of the second sound emitting device comprises: According to the configuration file of the second sound-emitting device, the intelligent power amplifier controls the switch circuit to switch to the hardware circuit of the second sound-emitting device, and drives the second sound-emitting device to produce sound.
5. The method according to claim 4, characterized in that According to the configuration file of the second sound-emitting device, the intelligent power amplifier controls the switch circuit to switch to the hardware circuit of the second sound-emitting device, and drives the second sound-emitting device to emit sound, including: Determine the output of a general purpose input / output port GPIO signal according to a configuration file of the second sound-emitting device; Controlling the switch circuit by the intelligent power amplifier according to the GPIO signal to switch the sound path to the hardware path of the second sound device; The second sound-emitting device is driven to emit sound through the hardware path of the second sound-emitting device.
6. The method according to claim 1, characterized in that The audio scene corresponding to the screen sound device is a voice call scene, and the audio scene corresponding to the speaker is an audio file playback scene.
7. The method according to claim 6, characterized in that At the first moment, controlling the first sound-emitting device to emit sound through the intelligent power amplifier; At the second moment, controlling the second sound-emitting device to emit sound through the intelligent power amplifier includes: At a first moment, the electronic device determines that the voice call scenario is the voice call scenario, and controls the screen sound device to make a sound through the smart power amplifier; At the second moment, the electronic device determines the audio file playback scenario and switches the sound path from the hardware path of the screen sound device to the hardware path of the speaker through the intelligent power amplifier.
8. The method according to claim 6, characterized in that At the first moment, controlling the first sound-emitting device to emit sound through the intelligent power amplifier; At the second moment, controlling the second sound-emitting device to emit sound through the intelligent power amplifier includes: At a first moment, the electronic device determines the audio file playing scene and controls the speaker to sound through the smart power amplifier; At the second moment, the electronic device determines that it is the voice call scenario, and switches the sound path from the hardware path of the speaker to the hardware path of the screen sound device through the intelligent power amplifier.
9. The method according to claim 1, characterized in that: The method further comprises: At a third moment, the electronic device is determined to be in a parallel sound emission scenario; Determine a target sound device corresponding to the parallel sound scene according to a preset priority, wherein the target sound device is a sound device corresponding to a high priority audio scene in the audio scenes included in the parallel sound scene; The target sound-emitting device is controlled to emit sound through the intelligent power amplifier.
10. An electronic device, characterized in that: The invention comprises a chip system and a sound-generating device, wherein the chip system comprises a system-level chip SoC, an audio digital signal processor ADSP and an intelligent power amplifier, and the sound-generating device comprises a first sound-generating device and a second sound-generating device, wherein: At a first moment, the system-on-chip SoC is used to determine the first sound-emitting device; The ADSP is used to control the first sound-generating device to generate sound through the intelligent power amplifier; At a second moment, the system-on-chip SoC is used to determine the second sound-emitting device; The ADSP is used to control the second sound-emitting device to emit sound through the intelligent power amplifier; Among them, when the first sound-emitting device is a screen sound-emitting device, the second sound-emitting device is a speaker; when the first sound-emitting device is the speaker, the second sound-emitting device is a screen sound-emitting device.
11. An electronic device, characterized in that: The electronic device comprises: a plurality of sound-emitting devices; one or more processors; a memory; wherein the plurality of sound-emitting devices are used to play the sound signals of the electronic device; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code comprises computer instructions, the one or more processors call the computer instructions so that the electronic device executes the method as described in any one of claims 1-9.
12. A chip system, characterized in that: The chip system is applied to an electronic device, and the chip system includes one or more processors, and the processor is used to call computer instructions so that the electronic device executes the method as described in any one of claims 1-9.
13. A computer program product comprising instructions, characterized in that When the computer program product is run on an electronic device, the electronic device is enabled to execute the method according to any one of claims 1 to 9.
14. A computer-readable storage medium comprising instructions, characterized in that: When the instructions are executed on an electronic device, the electronic device is caused to execute the method as claimed in any one of claims 1 to 9.
