Audio playing method, electronic equipment and chip system
By switching the speaker's data routing when the audio stream of the electronic device is turned on or switched, the speaker sound leakage problem caused by codec chip design defects is solved, improving user experience and versatility.
Patent Information
- Application Number
- CN202410873614.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-28
- Publication Date
- 2024-11-05
- Estimated Expiration
- 2044-06-28
AI Technical Summary
In some electronic devices, due to the defects in the software and hardware design of the codec chip, the speaker will reuse the audio path of the analog headphones, causing the speaker to leak when the ringtone sounds. After the ringtone is turned off, the audio sound will leak out of the speaker for a short time, causing the electronic device to leak sound. The problem.
By determining whether it is a sound leakage scene caused by double ringing when the audio stream is turned on or switched, according to the audio component type of the electronic device and the target output device, and switching the data route of the first speaker to the audio path of the second speaker, so that the data route of the first speaker is changed. Both output the same audio data, thereby preventing the audio from leaking through the first speaker after being turned off.
It effectively solves the problem of speaker leakage after ringtone is turned off, protects user privacy, improves user experience, and is suitable for all types of electronic devices without modifying code.
Smart Images

Figure CN118900381A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of audio technology, and in particular relates to an audio playback method, an electronic device, a chip system, a computer-readable storage medium, and a computer program product. Background Art
[0002] In some electronic devices with audio playback functions (such as smart phones), stereo effects can be achieved through dual speakers. In some electronic devices that use analog power amplifiers (PA) to amplify audio signals, since analog PAs do not have digital-to-analog conversion capabilities, codec chips are required to convert digital audio signals into analog audio signals, and then the analog audio signals are input to the analog PA for amplification and then output through audio output devices (headphones, speakers, etc.).
[0003] In the related art, for some types of codec chips, due to the design defects of their software and hardware, a speaker of an electronic device will reuse the audio path of an analog headset. Therefore, when the analog headset is in place to play audio, a ringtone sounds and the analog headset and the speaker are playing at the same time. In this scenario, the audio playback in the analog headset will be restored after the ringtone is turned off, but the audio sound in the headset path will also briefly leak out from the speaker at this time, causing the electronic device to leak sound. Summary of the invention
[0004] The embodiments of the present application provide an audio playback method, an electronic device, a chip system, a computer-readable storage medium, and a computer program product, which can solve the problem that, for some types of codec chips, due to the design defects of their software and hardware, a speaker of an electronic device will reuse the audio path of an analog headset. Therefore, in a scenario where the analog headset is in place to play audio and the ringtone is ringing in both the analog headset and the speaker, the audio sound in the headset path will briefly leak out from the speaker after the ringtone is turned off, thereby causing sound leakage in the electronic device.
[0005] In a first aspect, an embodiment of the present application provides an audio playback method, comprising: when an audio stream start instruction or an audio stream device switching instruction of an electronic device is obtained, determining the audio component type corresponding to the electronic device; when the audio component type is a preset type, determining the target output device corresponding to the audio to be played; when the target output device includes analog headphones and speakers, switching the data route corresponding to the first speaker from the default audio path to the audio path corresponding to the second speaker, wherein the speakers include a first speaker and a second speaker, and the first speaker refers to a speaker that reuses the default audio path with the analog headphones; and outputting the audio to be played through the target output device.
[0006] In this way, when the audio stream is turned on or the audio stream device is switched, it is determined whether the current scenario is a sound leakage caused by double ringing according to the audio component type corresponding to the electronic device and the target output device corresponding to the audio to be played. If the current scenario is a sound leakage caused by double ringing, the data routing of the first speaker can be switched from the default audio path multiplexed with the analog headset to the audio path corresponding to the second speaker, so that the first speaker and the second speaker output the same audio data. Therefore, after the audio to be played is turned off, other audio output through the analog headset will not leak out through the first speaker, which solves the problem of sound leakage from the speaker of the electronic device after the ringtone is turned off in the double ringtone scenario, protects user privacy, and improves user experience.
[0007] In a possible implementation manner of the first aspect, the switching of the data route corresponding to the first speaker from a default audio path to an audio path corresponding to the second speaker includes:
[0008] Read audio path configuration parameters;
[0009] When the audio path configuration parameter includes a preset character string, a data route switching instruction is sent to the codec chip, so that the codec chip switches the data route corresponding to the first speaker from the default audio path to the audio path corresponding to the second speaker.
[0010] In this way, by using a preset string to identify whether it is necessary to switch the data route of the first speaker in the set audio path configuration parameters to avoid speaker sound leakage, the speaker sound leakage elimination solution can be applied to all types of electronic devices without modifying the code, thereby improving the versatility and practicality of the speaker sound leakage elimination solution.
[0011] Optionally, in another possible implementation manner of the first aspect, when the audio path configuration parameter includes a preset character string, sending a data route switching instruction to the codec chip so that the codec chip switches the data route corresponding to the first speaker from the default audio path to the audio path corresponding to the second speaker, includes:
[0012] In the case where the audio path configuration parameter includes a preset character string, determining the audio stream type corresponding to the audio to be played;
[0013] When the audio stream type corresponding to the audio to be played is a preset audio stream type, a data route switching instruction is sent to the codec chip so that the codec chip switches the data route corresponding to the first speaker from the default audio path to the audio path corresponding to the second speaker.
[0014] In this way, since the audio streams that need to be played simultaneously in the speaker and the earphone are usually several specific audio stream types, such as incoming call ringtones, alarm ringtones, etc., when it is determined that the audio stream type corresponding to the audio to be played is the preset audio stream type, the data route corresponding to the first speaker can be switched from the default audio path to the audio path corresponding to the second speaker, so as to further improve the accuracy of sound leakage scene judgment, prevent frequent switching of speaker data routes in unnecessary scenarios, and affect the stability of audio playback, thereby further improving the accuracy and reliability of speaker leakage elimination, and further improving the user experience.
[0015] Optionally, in another possible implementation of the first aspect, the determining the type of audio component corresponding to the electronic device includes:
[0016] Query the device tree file corresponding to the electronic device to determine the configuration items corresponding to the audio component type;
[0017] According to the configuration items corresponding to the audio component type, the audio component type corresponding to the electronic device is determined.
[0018] In this way, by pre-defining the configuration items corresponding to the audio component types of the electronic device in the device tree file corresponding to the electronic device, it is possible to directly determine whether the audio component type corresponding to the electronic device belongs to the audio component type of the sound leakage scenario through the value of the configuration item, and then determine whether to execute the sound leakage elimination scheme of the present application based on the determination result. Therefore, regardless of whether the audio component type corresponding to the electronic device is the preset audio component type belonging to the sound leakage scenario, it can be compatible with the speaker sound leakage elimination scheme of the present application, thereby improving the versatility and practicality of the speaker sound leakage elimination scheme.
[0019] Optionally, in another possible implementation of the first aspect, the audio to be played includes left channel audio to be played and right channel audio to be played; accordingly, before the audio to be played is output through the target output device, the method further includes:
[0020] Mixing the left channel audio to be played and the right channel audio to be played to generate mixed audio to be played;
[0021] Accordingly, the above-mentioned outputting the audio to be played through the target output device includes:
[0022] Output the mixed audio to be played through the target output device.
[0023] In this way, since the user may adjust the audio path corresponding to the second speaker to silent in some usage scenarios, in this case, if the data route of the first speaker is switched to the audio path corresponding to the second speaker, both the first speaker and the second speaker will play silent data, thereby making it impossible for the audio to be played to be played normally. Therefore, in order to prevent this situation, after switching the data route of the first speaker, the left and right channel data of the audio to be played can be mixed, and the first speaker and the second speaker will output the mixed audio to prevent the situation where the external speaker is silent when the ringtone rings twice. This not only eliminates the speaker leakage in the double ringing scenario, but also prevents the speaker silence when the ringtone rings twice, further improving the reliability of sound leakage elimination and further improving the user experience.
[0024] Optionally, in yet another possible implementation of the first aspect, the mixing of the left channel audio to be played and the right channel audio to be played to generate the mixed audio to be played includes:
[0025] Read audio path configuration parameters;
[0026] When the audio path configuration parameter includes a preset character string, a speaker mixing instruction is sent to a digital signal processing (DSP) chip, so that the DSP chip mixes the left channel audio to be played and the right channel audio to be played according to the speaker mixing instruction to generate mixed audio to be played.
[0027] In this way, by using a preset string to identify whether it is necessary to switch the data route of the first speaker in the set audio path configuration parameters to avoid speaker sound leakage, and issuing the speaker mixing processing method through the speaker mixing instruction, the speaker sound leakage elimination solution can be applied to all types of electronic devices without modifying the code, thereby improving the versatility and practicality of the speaker sound leakage elimination solution.
[0028] Optionally, in another possible implementation of the first aspect, when the audio path configuration parameter includes a preset character string, sending a speaker mixing instruction to the DSP chip, so that the DSP chip mixes the left channel audio to be played and the right channel audio to be played according to the speaker mixing instruction to generate mixed audio to be played, including:
[0029] In the case where the audio path configuration parameter includes a preset character string, determining the audio stream type corresponding to the audio to be played;
[0030] When the audio stream type corresponding to the audio to be played is a preset audio stream type, a speaker mixing instruction is sent to the DSP chip, so that the DSP chip mixes the left channel audio to be played and the right channel audio to be played according to the speaker mixing instruction to generate mixed audio to be played.
[0031] In this way, since the audio streams that need to be played simultaneously in the speaker and the earphone are usually several specific audio stream types, such as incoming call ringtones, alarm ringtones, etc., it is possible to switch the data route corresponding to the first speaker from the default audio path to the audio path corresponding to the second speaker when it is determined that the audio stream type corresponding to the audio to be played is the preset audio stream type, and mix the audio data of the left and right channels to further improve the accuracy of sound leakage scene discrimination, prevent mixing in unnecessary scenes, affect the stability of audio playback, and waste computing power, thereby further improving the accuracy and reliability of speaker sound leakage elimination, reducing the power consumption of electronic equipment, and further improving the user experience.
[0032] In a second aspect, an embodiment of the present application provides an audio playback device, comprising: a first determination module, used to determine the audio component type corresponding to the electronic device when an audio stream start instruction or an audio stream device switching instruction of the electronic device is obtained; a second determination module, used to determine the target output device corresponding to the audio to be played when the audio component type is a preset type; a switching module, used to switch the data route corresponding to the first speaker from the default audio path to the audio path corresponding to the second speaker when the target output device includes analog headphones and speakers, wherein the speakers include a first speaker and a second speaker, and the first speaker refers to a speaker that multiplexes the default audio path with the analog headphones; an output module, used to output the audio to be played through the target output device.
[0033] In this way, when the audio stream is turned on or the audio stream device is switched, it is determined whether the current scenario is a sound leakage caused by double ringing according to the audio component type corresponding to the electronic device and the target output device corresponding to the audio to be played. If the current scenario is a sound leakage caused by double ringing, the data routing of the first speaker can be switched from the default audio path multiplexed with the analog headset to the audio path corresponding to the second speaker, so that the first speaker and the second speaker output the same audio data. Therefore, after the audio to be played is turned off, other audio output through the analog headset will not leak out through the first speaker, which solves the problem of sound leakage from the speaker of the electronic device after the ringtone is turned off in the double ringtone scenario, protects user privacy, and improves user experience.
[0034] In a possible implementation manner of the second aspect, the switching module includes:
[0035] A first reading unit, used for reading audio path configuration parameters;
[0036] The first switching unit is used to send a data route switching instruction to the codec chip when the audio path configuration parameter includes a preset character string, so that the codec chip switches the data route corresponding to the first speaker from the default audio path to the audio path corresponding to the second speaker.
[0037] In this way, by using a preset string in the set audio path configuration parameters to identify whether it is necessary to switch the data route of the first speaker to avoid speaker sound leakage, the speaker sound leakage elimination solution can be applied to all types of electronic devices, thereby improving the versatility and practicality of the speaker sound leakage elimination solution.
[0038] Optionally, in another possible implementation manner of the second aspect, the first switching unit is specifically configured to:
[0039] In the case where the audio path configuration parameter includes a preset character string, determining the audio stream type corresponding to the audio to be played;
[0040] When the audio stream type corresponding to the audio to be played is a preset audio stream type, a data route switching instruction is sent to the codec chip so that the codec chip switches the data route corresponding to the first speaker from the default audio path to the audio path corresponding to the second speaker.
[0041] In this way, since the audio streams that need to be played simultaneously in the speaker and the earphone are usually several specific audio stream types, such as incoming call ringtones, alarm ringtones, etc., when it is determined that the audio stream type corresponding to the audio to be played is the preset audio stream type, the data route corresponding to the first speaker can be switched from the default audio path to the audio path corresponding to the second speaker, so as to further improve the accuracy of sound leakage scene judgment, prevent frequent switching of speaker data routes in unnecessary scenarios, and affect the stability of audio playback, thereby further improving the accuracy and reliability of speaker leakage elimination, and further improving the user experience.
[0042] Optionally, in another possible implementation of the second aspect, the first determining module includes:
[0043] A first query unit, configured to query a device tree file corresponding to the electronic device to determine a configuration item corresponding to the audio component type;
[0044] The first determining unit is used to determine the audio component type corresponding to the electronic device according to the configuration item corresponding to the audio component type.
[0045] In this way, by pre-defining the configuration items corresponding to the audio component types of the electronic device in the device tree file corresponding to the electronic device, it is possible to directly determine whether the audio component type corresponding to the electronic device belongs to the audio component type of the sound leakage scenario through the value of the configuration item, and then determine whether to execute the sound leakage elimination scheme of the present application based on the determination result. Therefore, regardless of whether the audio component type corresponding to the electronic device is the preset audio component type belonging to the sound leakage scenario, it can be compatible with the speaker sound leakage elimination scheme of the present application, thereby improving the versatility and practicality of the speaker sound leakage elimination scheme.
[0046] Optionally, in yet another possible implementation of the second aspect, the audio to be played includes left channel audio to be played and right channel audio to be played; accordingly, the apparatus further includes:
[0047] A mixing module, used for mixing the left channel audio to be played and the right channel audio to be played to generate mixed audio to be played;
[0048] Correspondingly, the above output module includes:
[0049] The first output unit is used to output the mixed audio to be played through a target output device.
[0050] In this way, since the user may adjust the audio path corresponding to the second speaker to silent in some usage scenarios, in this case, if the data route of the first speaker is switched to the audio path corresponding to the second speaker, both the first speaker and the second speaker will play silent data, thereby making it impossible for the audio to be played to be played normally. Therefore, in order to prevent this situation, after switching the data route of the first speaker, the left and right channel data of the audio to be played can be mixed, and the first speaker and the second speaker will output the mixed audio to prevent the situation where the external speaker is silent when the ringtone rings twice. This not only eliminates the speaker leakage in the double ringing scenario, but also prevents the speaker silence when the ringtone rings twice, further improving the reliability of sound leakage elimination and further improving the user experience.
[0051] Optionally, in yet another possible implementation of the second aspect, the mixing module includes:
[0052] A second reading unit, used for reading audio path configuration parameters;
[0053] The first mixing unit is used to send a speaker mixing instruction to the DSP chip when the audio path configuration parameter includes a preset character string, so that the DSP chip mixes the left channel audio to be played and the right channel audio to be played according to the speaker mixing instruction to generate mixed audio to be played.
[0054] In this way, by using a preset string to identify whether it is necessary to switch the data route of the first speaker in the set audio path configuration parameters to avoid speaker sound leakage, and issuing the speaker mixing processing method through the speaker mixing instruction, the speaker sound leakage elimination solution can be applied to all types of electronic devices, thereby improving the versatility and practicality of the speaker sound leakage elimination solution.
[0055] Optionally, in another possible implementation of the second aspect, the first audio mixing unit is specifically configured to:
[0056] In the case where the audio path configuration parameter includes a preset character string, determining the audio stream type corresponding to the audio to be played;
[0057] When the audio stream type corresponding to the audio to be played is a preset audio stream type, a speaker mixing instruction is sent to the DSP chip, so that the DSP chip mixes the left channel audio to be played and the right channel audio to be played according to the speaker mixing instruction to generate mixed audio to be played.
[0058] In this way, since the audio streams that need to be played simultaneously in the speaker and the earphone are usually several specific audio stream types, such as incoming call ringtones, alarm ringtones, etc., it is possible to switch the data route corresponding to the first speaker from the default audio path to the audio path corresponding to the second speaker when it is determined that the audio stream type corresponding to the audio to be played is the preset audio stream type, and mix the audio data of the left and right channels to further improve the accuracy of sound leakage scene discrimination, prevent mixing in unnecessary scenes, affect the stability of audio playback, and waste computing power, thereby further improving the accuracy and reliability of speaker sound leakage elimination, reducing the power consumption of electronic equipment, and further improving the user experience.
[0059] In a third aspect, an embodiment of the present application provides an electronic device, comprising: one or more processors, and a memory; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code includes computer instructions, and the one or more processors call the computer instructions to enable the electronic device to execute the audio playback method as described above.
[0060] In a fourth aspect, an embodiment of the present application provides a chip system, which is applied to an electronic device. The chip system includes one or more processors, and the one or more processors are used to call computer instructions so that the electronic device executes the audio playback method as described above.
[0061] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, which includes instructions. When the instructions are executed on an electronic device, the electronic device executes the audio playback method as described above.
[0062] In a sixth aspect, an embodiment of the present application provides a computer program product, which, when executed on an electronic device, enables the electronic device to execute the audio playback method as described above.
[0063] The technical effects obtained by the above-mentioned second, third, fourth, fifth and sixth aspects are similar to the technical effects obtained by the corresponding technical means in the above-mentioned first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0065] Figure 1 is a flowchart of an audio playback method provided by an embodiment of the present application;
[0066] Figure 2 It is a structural schematic diagram of a codec chip provided in one embodiment of the present application;
[0067] Figure 3 It is a schematic diagram of a multiplexed audio path of an upper speaker and a left channel of an earphone provided by an embodiment of the present application;
[0068] Figure 4 It is a schematic diagram of performing routing switching on an upper speaker provided by an embodiment of the present application;
[0069] Figure 5 This is a schematic diagram of an audio stream after the audio to be played is turned off, provided in an embodiment of the present application;
[0070] Figure 6 is a flowchart of an audio playback method provided by another embodiment of the present application;
[0071] Figure 7 This is a flowchart of mixing left and right channels of a speaker provided in an embodiment of the present application;
[0072] Figure 8 is a flowchart of an audio playback method provided in yet another embodiment of the present application;
[0073] Fig. 9 is a structural diagram of an audio playback device provided in an embodiment of the present application;
[0074] Fig.10It is a schematic diagram of the structure of an electronic device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0075] The audio playback method, device, electronic device, chip system, storage medium and computer program provided in the present application are described in detail below with reference to the accompanying drawings.
[0076] Please refer to Figure 1 , Figure 1 : is a flowchart of an audio playback method provided by an embodiment of the present application, and the method may include part or all of the following contents:
[0077] Step 101: when an audio stream start instruction or an audio stream device switch instruction of an electronic device is obtained, determine the audio component type corresponding to the electronic device.
[0078] It should be noted that the audio playback method of the embodiment of the present application can be performed by the audio playback device of the embodiment of the present application. The audio playback device of the embodiment of the present application can be configured in any electronic device with a display function to perform the audio playback method of the embodiment of the present application. For example, the audio playback device of the embodiment of the present application can be configured in electronic devices such as mobile phones, computers, wearable devices, etc., to eliminate sound leakage from speakers.
[0079] It should be noted that the embodiment of the present application does not limit the operating system loaded in the electronic device, which may be an Android system, a Windows Phone (WP) operating system, or an IOS system, etc. For example, for ease of description, the embodiment of the present application uses the Android system for subsequent description.
[0080] First, the causes of the technical problems to be solved by this application and the applicable scenarios of this application are explained:
[0081] In some electronic devices that use analog PA to amplify audio signals, since analog PA does not have the ability to convert digital to analog, a codec chip is also needed to convert digital audio signals into analog audio signals, and the analog audio signals are input to the analog PA for amplification before being output through audio output devices (headphones, speakers, etc.). For electronic devices that combine codec chips with dual analog PAs to achieve stereo design, speaker leakage problems may occur when using certain types of codec chips. For example, when analog headphones are playing music, the alarm will sound and the music will be played simultaneously in the headphones and speakers. When the alarm is turned off, the music will resume playing in the headphones, and the music will briefly leak out of the upper speaker. This problem is caused by both hardware and software limitations.
[0082] In terms of hardware, some types of codec chips have hardware design defects, such as Figure 2 As shown in FIG. 1 , the codec chip has only three input ports: headphone left channel input (IN1_HPHL), headphone right channel input (IN2_HPHR) and speaker input (IN3_AUX), but supports four output ports: earpiece (EAR), headphone left channel output (HPHL), headphone right channel output (HPHR) and speaker output (AUX) (wherein the earpiece in the embodiment of the present application may also be referred to as the upper speaker, and the speaker may also be referred to as the lower speaker). In order to achieve stereo characteristics, the upper speaker (EAR) may be as follows Figure 2 The audio path is multiplexed with the headphone left channel (HPHL).
[0083] In software, analog headphones and speakers have different backends (BE). Due to other features and framework customization policy limitations, analog headphone devices and speaker devices cannot be configured as the same BE in DSP. Since the two BEs are different, they will not compete for DSP ports. Therefore, when switching between analog headphones and speakers, only the required device will be switched, and the other device channel will not be forcibly closed, but will be automatically closed after waiting for a period of time (such as 3 seconds) according to the Android mechanism.
[0084] Therefore, due to the limitations of the above-mentioned software and hardware, the upper speaker may leak sound in the dual ringing scenario. For example, the alarm ringtone is played through the analog headset and the speaker at the same time. After the alarm is turned off, the music resumes playing on the analog headset. At this time, there is no audio stream on the speaker, but because the BE of the upper speaker is different from that of the analog headset, it will not be forced to close and will still be turned on for 3 seconds. Figure 3 As shown, during this time period, since the audio paths of the upper speaker and the left channel of the earphone are multiplexed, the audio data 310 (ie, music) of the left channel of the earphone will be played simultaneously on the left channel of the earphone and the upper speaker, resulting in sound leakage.
[0085] Among them, the audio stream start instruction may refer to the instruction to start the audio stream received when there is no audio being played in the electronic device. For example, when the electronic device is not currently playing any audio, if the user opens the music software to play music, opens the video software to play videos, opens the short video software to play short videos, plays voice information or video information in the social software, or plays the recorded data stored in the electronic device, etc., then it can be determined that the audio stream start instruction of the electronic device has been obtained. Alternatively, when the electronic device is not currently playing any audio, it triggers an alarm ringing, an incoming call ringing, a message notification, etc., and it can also be determined that the audio stream start instruction of the electronic device has been obtained.
[0086] The audio stream device switching instruction may refer to an instruction received to switch the output device of the audio stream when there is audio being played in the electronic device. For example, when playing music through a speaker, the user connects headphones, and the output device of the music is switched from the speaker to the headphones, and it can be determined that the audio stream device switching instruction is obtained; for another example, when the alarm rings while playing music through headphones, the audio stream corresponding to the alarm ringtone needs to be played through the speaker and the headphones at the same time, that is, the output device of the audio stream is switched from the headphones to the headphones and the speaker, and it can be determined that the audio stream device switching instruction is obtained.
[0087] It should be noted that the types and triggering scenarios of the audio stream start instruction and the audio stream device switching instruction listed above are only exemplary and cannot be regarded as limitations of the present application. In actual use, the types and triggering scenarios of the audio stream start instruction and the audio stream device switching instruction can be determined according to actual needs and specific application scenarios, and the embodiments of the present application do not limit this.
[0088] The audio component type may include the type of codec chip and the type of PA.
[0089] In an embodiment of the present application, each time an audio stream start instruction and an audio stream device switching instruction are obtained, that is, each time audio playback is started or an audio output device is switched, the audio component type corresponding to the electronic device can be determined to determine whether the audio component type corresponding to the electronic device is the audio component type that causes speaker sound leakage, so as to determine whether it is necessary to perform speaker sound leakage elimination processing according to subsequent steps of the embodiment of the present application.
[0090] Furthermore, the configuration item corresponding to the audio component type of the electronic device can be pre-defined in the device tree file corresponding to the electronic device, so as to directly determine whether the audio component type corresponding to the electronic device belongs to the audio component type of the sound leakage scenario through the value of the configuration item, and then determine whether to execute the sound leakage elimination solution of the present application based on the determination result. Therefore, regardless of whether the audio component type corresponding to the electronic device is the preset audio component type belonging to the sound leakage scenario, it can be compatible with the speaker sound leakage elimination solution of the present application, thereby improving the versatility and practicality of the speaker sound leakage elimination solution. That is, in a possible implementation method of the present application embodiment, the above step 101 may include:
[0091] Query the device tree file corresponding to the electronic device to determine the configuration items corresponding to the audio component type;
[0092] According to the configuration items corresponding to the audio component type, the audio component type corresponding to the electronic device is determined.
[0093] As a possible implementation method, the configuration item corresponding to the audio component type can be customized in the device tree file corresponding to the electronic device, and the value of the configuration item can be determined in advance according to whether the type of the audio component installed in the electronic device is a preset type that causes the speaker to leak sound; for example, if the type of the audio component installed in the electronic device is a preset type, the value of the configuration item can be pre-determined as a first preset value (such as 1); if the type of the audio component installed in the electronic device is not a preset type, the value of the configuration item can be pre-determined as a first preset value (such as 0). Every time the electronic device plays audio or switches the audio output device, the value of the configuration item can be queried, and the type of audio component corresponding to the electronic device can be determined according to the value of the configuration item; for example, if the value of the configuration item is the first preset value, it can be determined that the type of audio component corresponding to the electronic device is a preset type, which may currently cause a sound leakage problem; if the value of the configuration item is the second preset value, it can be determined that the type of audio component corresponding to the electronic device is not a preset type, and currently will not cause a sound leakage problem.
[0094] For example, if Figure 2 When the type A codec chip shown is combined with dual analog PAs to realize speaker stereo, it will cause speaker leakage problems. The type of codec chip can be set to type A and the type of PA can be set to analog PA as the preset type. Therefore, when the type of codec chip installed in the electronic device is type A and the type of PA is analog PA, the value of the configuration item corresponding to the audio component type in the device tree file is determined to be 1; when the codec chip installed in the electronic device is not type A or the type of PA is not analog PA, the value of the configuration item corresponding to the audio component type in the device tree file is determined to be 0.
[0095] It should be noted that the above examples are only exemplary and cannot be regarded as limitations of the present application. In actual use, any type of audio component that may cause speaker leakage can be determined as a preset type according to actual needs and specific application scenarios, and the present application embodiment does not limit this.
[0096] Step 102: When the audio component type is a preset type, determine a target output device corresponding to the audio to be played.
[0097] The preset type may refer to the type of audio components that may cause the speaker leakage problem in the electronic device.
[0098] The audio to be played may refer to audio data that needs to be output through an audio output device in the electronic device. For example, if a user currently opens a music player to play music, the audio to be played may be the music currently played by the user; if the electronic device currently receives an incoming call, the audio to be played may be the incoming call ringtone; if the alarm set in the electronic device currently reaches the ringing time, the audio to be played may be the alarm ringtone, and so on.
[0099] Among them, the target output device may refer to the audio output device currently used to output the audio to be played in the electronic device. For example, if the user currently opens the music player software to play music, and the electronic device is not connected to headphones, the target output device corresponding to the audio to be played may be a speaker; for another example, if the user currently opens the music player software to play music, and the electronic device is connected to headphones, the target output device corresponding to the audio to be played may be headphones; for another example, if the alarm clock set in the electronic device currently reaches the ringing time, and the electronic device is not connected to headphones, the target output device corresponding to the audio to be played may be a speaker; for another example, if the alarm clock set in the electronic device currently reaches the ringing time, and the electronic device is connected to headphones, the target output device corresponding to the audio to be played may be both speakers and headphones.
[0100] It should be noted that the above examples are only exemplary and cannot be regarded as limitations of the present application. In actual use, any audio that needs to be played in the electronic device can be determined as the audio to be played according to actual needs and specific application scenarios, and the present application embodiment does not limit this.
[0101] In an embodiment of the present application, if the audio component type corresponding to the electronic device is a preset type, it can be determined that the electronic device may have a speaker sound leakage problem, and the subsequent steps of the embodiment of the present application can be continued to eliminate the speaker sound leakage when necessary; if the audio component type corresponding to the electronic device is not a preset type, it can be determined that the electronic device does not have a speaker sound leakage problem, and the subsequent steps of the embodiment of the present application may not be executed, and the audio to be played can be processed and output according to the default audio processing flow of the electronic device.
[0102] As a possible implementation method, through the above analysis of the technical problems to be solved by the present application, it can be known that when the audio component type corresponding to the electronic device is a combination of a codec chip and a dual analog PA, if the audio needs to be played through a speaker and an analog headset at the same time, then when the audio is turned off, it will cause the speaker that multiplexes the audio path with the headset to leak sound. Therefore, after determining that the audio component type corresponding to the electronic device is a preset type, it is possible to continue to determine the target output device corresponding to the audio to be played to determine whether the audio to be played needs to be played through a speaker and an analog headset at the same time. If it is determined that the audio to be played needs to be played through a speaker and an analog headset at the same time, it can be determined that the speaker may leak sound when the audio to be played is turned off; if it is determined that the audio to be played does not need to be played through a speaker and an analog headset at the same time, it can be determined that the speaker will not leak sound when the audio to be played is turned off.
[0103] Step 103, when the target output device includes an analog headset and a speaker, the data route corresponding to the first speaker is switched from the default audio path to the audio path corresponding to the second speaker, wherein the speaker includes a first speaker and a second speaker, and the first speaker refers to a speaker that reuses the default audio path with the analog headset.
[0104] Among them, the analog earphones can include three-stage analog earphones and four-stage analog earphones.
[0105] The electronic device may include two speakers, a first speaker and a second speaker, and the first speaker is a speaker that multiplexes an audio path with an analog headset, and the default audio path is the audio path multiplexed between the first speaker and the analog headset. Figure 2 As shown, since the upper speaker and the left channel of the earphone multiplex the audio path, the first speaker can be the upper speaker, the second speaker can be the lower speaker, and the default audio path can be the left channel of the earphone.
[0106] In the embodiment of the present application, if the target output device corresponding to the audio to be played is one of an analog headset or a speaker, or the target output device includes both a headset and a speaker, but the headset is a digital headset, it can be determined that the electronic device does not have a speaker leakage problem, and the subsequent steps of the embodiment of the present application can be omitted, and the audio to be played can be processed and output according to the default audio processing flow of the electronic device. If the target output device corresponding to the audio to be played includes an analog headset and a speaker, it can be determined that the audio to be played currently needs to be played simultaneously through the analog headset and the speaker, which is a double ringing ringtone scenario. After the audio to be played is turned off, the first speaker that reuses the default audio path with the analog headset may leak sound, so that the connection between the first speaker and the default audio path can be cut off, and the data routing of the first speaker is switched to the audio path corresponding to the second speaker, so that the first speaker and the second speaker reuse the audio path, so that after the audio to be played is turned off, since there is no data in the audio path corresponding to the second speaker, even if the device path of the first speaker is not closed, the first speaker has no audio data to output, and there will be no leakage, thereby eliminating the speaker leakage in the double ringing ringtone scenario.
[0107] For example, if Figure 4 As shown, since the upper speaker and the left channel of the headphone share the same audio path, the first speaker is the upper speaker, the second speaker is the lower speaker, and the default audio path is the left channel of the headphone. When it is determined that the target output device corresponding to the audio to be played includes analog headphones and speakers, the path between the upper speaker and the left channel of the headphone can be cut off, and switched to the path shared with the second speaker, and the data route of the lower speaker is copied to the path of the upper speaker. Finally, the upper and lower speakers will play the same audio. And, as Figure 5 As shown, after the audio to be played ends, the device channels of the upper and lower speakers can remain open for 3 seconds. At this time, if there is an audio stream that needs to be played (such as music) in the analog headphones, it will continue to play, and the audio stream will be played normally from HPHL and HPHR; due to the change of the data route of the upper speaker and the decoupling of the device channel, there is no data in the upper speaker channel during these 3 seconds, and the problem of upward sound leakage will no longer occur.
[0108] Furthermore, whether the data route of the first speaker needs to be switched can be identified by a preset string in the set audio path configuration parameters to avoid speaker sound leakage, so that the speaker sound leakage elimination solution can be applied to all types of electronic devices without modifying the code, thereby improving the versatility and practicality of the speaker sound leakage elimination solution. That is, in a possible implementation of the embodiment of the present application, the above step 103 may include:
[0109] Read audio path configuration parameters;
[0110] When the audio path configuration parameter includes a preset character string, a data route switching instruction is sent to the codec chip, so that the codec chip switches the data route corresponding to the first speaker from the default audio path to the audio path corresponding to the second speaker.
[0111] The audio path configuration parameter may refer to a parameter inherent in the electronic device system that allows customization of the audio path configuration of the audio output device. For example, the audio path configuration parameter may be a custom key.
[0112] As a possible implementation method, when it is determined that the audio component type corresponding to the electronic device is a preset type and the target output device corresponding to the audio to be played includes analog headphones and speakers, a preset string can be written into the audio path configuration parameter. Afterwards, the electronic device can read the audio path configuration parameter in the hardware abstraction layer (HAL) to determine whether the audio path configuration parameter contains the preset string; if the audio path configuration parameter contains the preset string, it can be determined that the current scene is a speaker leakage scene, and a data routing switching instruction can be sent to the codec chip, so that the codec chip switches the data route corresponding to the first speaker from the default audio path to the audio path corresponding to the second speaker according to the data routing switching instruction.
[0113] Furthermore, since the audio streams that need to be played simultaneously in the speaker and the headset are usually several specific audio stream types, such as incoming call ringtones, alarm ringtones, etc., when it is determined that the audio stream type corresponding to the audio to be played is a preset audio stream type, the data route corresponding to the first speaker can be switched from the default audio path to the audio path corresponding to the second speaker, so as to further improve the accuracy of sound leakage scene discrimination, prevent the frequent switching of the speaker data route in unnecessary scenes, and affect the stability of audio playback, thereby further improving the accuracy and reliability of speaker sound leakage elimination, and further improving the user experience. That is, in a possible implementation method of the embodiment of the present application, when the audio path configuration parameters contain a preset string, sending a data route switching instruction to the codec chip so that the codec chip switches the data route corresponding to the first speaker from the default audio path to the audio path corresponding to the second speaker, can include:
[0114] In the case where the audio path configuration parameter includes a preset character string, determining the audio stream type corresponding to the audio to be played;
[0115] When the audio stream type corresponding to the audio to be played is a preset audio stream type, a data route switching instruction is sent to the codec chip so that the codec chip switches the data route corresponding to the first speaker from the default audio path to the audio path corresponding to the second speaker.
[0116] The preset audio stream type may refer to the audio stream type that is played simultaneously through the analog headset and the speaker when the electronic device is connected to the analog headset, for example, the audio stream type lowlatency corresponding to the alarm ringtone, the audio stream type deepbuffer corresponding to the incoming call ringtone, etc., but is not limited thereto.
[0117] As a possible implementation method, if it is determined that the audio path configuration parameter contains a preset string, and the audio stream type corresponding to the audio to be played is the preset audio stream type, it can be determined that the current ringtone is a double ringing scene, which may cause the speaker leakage problem, and a data route switching instruction can be sent to the codec, and the data route switching instruction is made effective, so that the codec chip can switch the data route corresponding to the first speaker from the default audio path to the audio path corresponding to the second speaker according to the data route switching instruction. If the audio path configuration parameter does not contain a preset string, or the audio stream type corresponding to the audio to be played is not the preset audio stream type, it can be determined that there will be no speaker leakage problem at present, that is, there is no need to switch the data route corresponding to the first speaker, then the data route switching instruction may not be sent to the codec chip, and the subsequent steps of the embodiment of the present application may not be performed, and the audio to be played may be processed and output according to the default audio processing flow of the electronic device.
[0118] Step 104: output the audio to be played through the target output device.
[0119] In an embodiment of the present application, when it is determined that the electronic device may currently have a speaker leakage problem, after switching the data route of the first speaker to decouple the first speaker from the headphone path and multiplexing the audio path with the first speaker and the second speaker, the audio to be played can be output through the target output device (such as analog headphones and the first speaker and the second speaker), so that the audio to be played is played simultaneously through the analog headphones and the speakers, and after the audio to be played is finished, since there is no data in the audio path corresponding to the second speaker, the first speaker will not leak sound when the device path is not cut off.
[0120] The audio playback method provided in the embodiment of the present application determines whether the current scenario is a sound leakage caused by double ringing of the ringtone according to the audio component type corresponding to the electronic device and the target output device corresponding to the audio to be played when the audio stream is turned on or the audio stream device is switched. If the current scenario is a sound leakage caused by double ringing of the ringtone, the data routing of the first speaker can be switched from the default audio path multiplexed with the analog headset to the audio path corresponding to the second speaker, so that the first speaker and the second speaker output the same audio data. Therefore, after the audio to be played is turned off, other audio output through the analog headset will not leak out through the first speaker, thereby solving the problem of sound leakage of the speaker of the electronic device after the ringtone is turned off in the double ringtone scenario, protecting user privacy, and improving user experience.
[0121] Please refer to Figure 6 , Figure 6 : is a flowchart of an audio playback method provided by another embodiment of the present application, and the method may include part or all of the following contents:
[0122] Step 601: when an audio stream start instruction or an audio stream device switch instruction of an electronic device is obtained, determine the audio component type corresponding to the electronic device.
[0123] Step 602: When the audio component type is a preset type, determine a target output device corresponding to the audio to be played, wherein the audio to be played includes left channel audio to be played and right channel audio to be played.
[0124] Step 603, when the target output device includes an analog headset and a speaker, the data route corresponding to the first speaker is switched from the default audio path to the audio path corresponding to the second speaker, wherein the speaker includes a first speaker and a second speaker, and the first speaker refers to a speaker that reuses the default audio path with the analog headset.
[0125] The specific implementation process and principle of the above steps 601-603 can be referred to the detailed description of the above embodiment, which will not be repeated here.
[0126] Step 604 , mixing the left channel audio to be played and the right channel audio to be played to generate mixed audio to be played.
[0127] In the embodiment of the present application, since the user may adjust the audio path corresponding to the second speaker to be silent in some usage scenarios (for example, adjust the channel equalization function to the most extreme situation to make the right channel silent), in this case, if the data route of the first speaker is switched to the audio path corresponding to the second speaker, both the first speaker and the second speaker will play silent data, thereby making it impossible to play the audio to be played normally. Therefore, in order to prevent this situation, after switching the data route of the first speaker, the left and right channel data of the audio to be played can be mixed, and the first speaker and the second speaker will output the mixed audio to be played, so as to prevent the situation where the external speaker is silent when the ringtone rings twice, thereby not only eliminating the speaker leakage in the double ringing scenario, but also preventing the speaker silence when the ringtone rings twice, further improving the reliability of leakage elimination, and further improving the user experience.
[0128] like Figure 7 As shown, it is a flowchart of mixing the left and right channels of the audio to be played. After the left channel audio to be played and the right channel audio to be played are mixed, since the generated mixed audio to be played includes the left channel audio to be played, even if the right channel audio to be played is silent, the mixed audio to be played will not be silent data, so that the mixed audio to be played is played through the first speaker and the second speaker, which can make the first speaker and the second speaker sound normally, ensuring that the ringtone will not be silent even when the channel balance is adjusted to the most extreme case.
[0129] Furthermore, it is possible to prevent speaker sound leakage by using a preset string to identify whether the data route of the first speaker needs to be switched in the set audio path configuration parameters, and to send the speaker mixing processing method through the speaker mixing instruction, so that the speaker sound leakage elimination solution can be applied to all types of electronic devices without modifying the code, thereby improving the versatility and practicality of the speaker sound leakage elimination solution. That is, in a possible implementation of the embodiment of the present application, the above step 604 may include:
[0130] Read audio path configuration parameters;
[0131] When the audio path configuration parameter includes a preset character string, a speaker mixing instruction is sent to the DSP chip, so that the DSP chip mixes the left channel audio to be played and the right channel audio to be played according to the speaker mixing instruction to generate mixed audio to be played.
[0132] The audio path configuration parameter may refer to a parameter inherent in the electronic device system that allows customization of the audio path configuration of the audio output device. For example, the audio path configuration parameter may be a custom key.
[0133] Among them, the speaker mixing instruction may refer to an instruction inherent in the electronic device system that allows customization of the configuration of the processing method of the audio path in the DSP. For example, the speaker mixing instruction may be implemented in the form of graph key-value. As an example, in the speaker mixing instruction, a pair of key-value pairs may be used to specify that the device to be mixed is a speaker, and another pair of key-value pairs may be used to specify the specific method of mixing the audio path corresponding to the speaker, that is, specifying that the left channel audio and the right channel audio corresponding to the speaker are mixed.
[0134] As a possible implementation method, when it is determined that the audio component type corresponding to the electronic device is a preset type and the target output device corresponding to the audio to be played includes analog headphones and speakers, a preset string can be written into the audio path configuration parameter. Afterwards, the electronic device can read the audio path configuration parameter at the HAL layer to determine whether the audio path configuration parameter contains the preset string; if the audio path configuration parameter contains the preset string, it can be determined that the current scene is a speaker leakage scene, and in the aforementioned steps, the data route corresponding to the first speaker has been switched from the default audio path to the audio path corresponding to the second speaker, so that the problem of external soundlessness may occur at present, so a speaker mixing instruction can be sent to the DSP chip, so that the DSP chip can mix the left channel audio to be played and the right channel audio to be played according to the audio output device and mixing method specified in the speaker mixing instruction to generate the mixed audio to be played.
[0135] Furthermore, since the audio streams that need to be played simultaneously in the speaker and the headset are usually several specific audio stream types, such as incoming call ringtones, alarm ringtones, etc., it is possible to switch the data route corresponding to the first speaker from the default audio path to the audio path corresponding to the second speaker when it is determined that the audio stream type corresponding to the audio to be played is the preset audio stream type, and perform mixing processing on the audio data of the left and right channels to further improve the accuracy of sound leakage scene discrimination, prevent mixing in unnecessary scenes, affect the stability of audio playback, and waste computing power, thereby further improving the accuracy and reliability of speaker sound leakage elimination, reducing the power consumption of electronic devices, and further improving the user experience. That is, in a possible implementation method of the embodiment of the present application, when the audio path configuration parameters contain a preset string, a speaker mixing instruction is sent to the DSP chip, so that the DSP chip performs mixing processing on the left channel audio to be played and the right channel audio to be played according to the speaker mixing instruction to generate mixed audio to be played, which may include:
[0136] In the case where the audio path configuration parameter includes a preset character string, determining the audio stream type corresponding to the audio to be played;
[0137] When the audio stream type corresponding to the audio to be played is a preset audio stream type, a speaker mixing instruction is sent to the DSP chip, so that the DSP chip mixes the left channel audio to be played and the right channel audio to be played according to the speaker mixing instruction to generate mixed audio to be played.
[0138] The preset audio stream type may refer to the audio stream type that is played simultaneously through the analog headset and the speaker when the electronic device is connected to the analog headset, for example, the audio stream type lowlatency corresponding to the alarm ringtone, the audio stream type deepbuffer corresponding to the incoming call ringtone, etc., but is not limited thereto.
[0139] As a possible implementation method, if it is determined that the audio path configuration parameter contains a preset string, and the audio stream type corresponding to the audio to be played is the preset audio stream type, it can be determined that the current ringtone double ring scene may cause a speaker leakage problem, and the aforementioned steps have switched the data route corresponding to the first speaker from the default audio path to the audio path corresponding to the second speaker, so that the current external speaker may be silent, so a speaker mixing instruction can be sent to the DSP chip, so that the DSP chip can mix the left channel audio to be played and the right channel audio to be played according to the audio output device and mixing method specified in the speaker mixing instruction to generate the mixed audio to be played. If the audio path configuration parameter does not contain a preset string, or the audio stream type corresponding to the audio to be played is not the preset audio stream type, it can be determined that there will be no speaker leakage problem at present, that is, there is no need to switch the data route corresponding to the first speaker, then the speaker mixing instruction can be not sent to the DSP chip, and the audio to be played can be processed and output according to the default audio processing flow of the electronic device.
[0140] Step 605: output the mixed audio to be played through the target output device.
[0141] In an embodiment of the present application, when it is determined that the electronic device may currently have a speaker leakage problem, after switching the data route of the first speaker so that the first speaker is decoupled from the headphone path, and the first speaker and the second speaker reuse the audio path, and after mixing the left channel audio to be played and the right channel audio to be played, the mixed audio to be played can be output through the target output device (such as the analog headphones and the first speaker and the second speaker), so that the audio to be played is played through the analog headphones and the speaker at the same time, and after the audio to be played is finished, since there is no data in the audio path corresponding to the second speaker, the first speaker will not leak sound when the device path is not cut off; and, since the generated mixed audio to be played includes the left channel audio to be played, even if the right channel audio to be played is silent, the mixed audio to be played will not be silent data, thereby ensuring that the ringtone will not be silent even when the channel balance is adjusted to the most extreme case.
[0142] The audio playback method provided in the embodiment of the present application is that since the user may adjust the audio path corresponding to the second speaker to be silent in some usage scenarios (for example, adjust the channel equalization function to the most extreme situation to make the right channel silent), in this case, if the data route of the first speaker is switched to the audio path corresponding to the second speaker, both the first speaker and the second speaker will play silent data, thereby making it impossible to play the audio to be played normally. Therefore, in order to prevent this situation, after switching the data route of the first speaker, the left and right channel data of the audio to be played can be mixed, and the first speaker and the second speaker will output the mixed audio to be played, so as to prevent the situation where the external speaker is silent when the ringtone rings twice. This not only eliminates the speaker leakage in the scenario where the ringtone rings twice, but also prevents the speaker from being silent when the ringtone rings twice, further improving the reliability of sound leakage elimination and further improving the user experience.
[0143] Please refer to Figure 8 , Figure 8 : is a flowchart of an audio playback method provided by another embodiment of the present application, comprising the following steps:
[0144] Step 801, obtaining an audio stream start instruction or an audio stream device switching instruction;
[0145] Step 802, check the configuration item to determine whether the audio component type corresponding to the electronic device is a preset type; if so, execute step 803; otherwise, end.
[0146] Step 803, check whether the target output device corresponding to the audio to be played includes analog headphones and speakers; if so, execute step 804; otherwise, end.
[0147] Step 804, issuing a data routing switching instruction and a speaker mixing instruction;
[0148] Step 805, checking whether the audio stream type corresponding to the audio to be played is a preset audio stream type; if so, executing steps 806 and 807; otherwise, ending;
[0149] Step 806, switching the data route corresponding to the first speaker to the audio path corresponding to the second speaker through the codec chip;
[0150] Step 807, mixing the left channel audio to be played and the right channel audio to be played by the DSP chip to generate mixed audio to be played;
[0151] Step 808: Play the mixed audio to be played through the speaker.
[0152] It should be noted that Figure 8 For other specific implementation processes and principles of the illustrated embodiment, reference may be made to the detailed description of the above embodiment, which will not be repeated here.
[0153] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0154] Corresponding to the audio playing method described in the above embodiment, Fig. 9 A structural block diagram of an audio playback device provided in an embodiment of the present application is shown. For ease of explanation, only the parts related to the embodiment of the present application are shown.
[0155] Reference Fig. 9 The device 90 comprises:
[0156] A first determination module 91 is used to determine the audio component type corresponding to the electronic device when an audio stream start instruction or an audio stream device switching instruction of the electronic device is obtained;
[0157] A second determination module 92, configured to determine a target output device corresponding to the audio to be played when the audio component type is a preset type;
[0158] a switching module 93, configured to switch the data route corresponding to the first speaker from the default audio path to the audio path corresponding to the second speaker when the target output device includes an analog headset and a speaker, wherein the speaker includes a first speaker and a second speaker, and the first speaker refers to a speaker that multiplexes the default audio path with the analog headset;
[0159] The output module 94 is used to output the audio to be played through a target output device.
[0160] In actual use, the audio playback device provided in the embodiment of the present application can be configured in any electronic device to execute the aforementioned audio playback method.
[0161] The audio playback device provided in the embodiment of the present application determines whether the current scenario is a sound leakage caused by double ringing of the ringtone according to the audio component type corresponding to the electronic device and the target output device corresponding to the audio to be played when the audio stream is turned on or the audio stream device is switched. If the current scenario is a sound leakage caused by double ringing of the ringtone, the data routing of the first speaker can be switched from the default audio path multiplexed with the analog headset to the audio path corresponding to the second speaker, so that the first speaker and the second speaker output the same audio data. Therefore, after the audio to be played is turned off, other audio output through the analog headset will not leak out through the first speaker, thereby solving the sound leakage problem of the speaker of the electronic device after the ringtone is turned off in the double ringtone scenario, protecting user privacy, and improving the user experience.
[0162] In a possible implementation of the present application, the switching module 93 includes:
[0163] A first reading unit, used for reading audio path configuration parameters;
[0164] The first switching unit is used to send a data route switching instruction to the codec chip when the audio path configuration parameter includes a preset character string, so that the codec chip switches the data route corresponding to the first speaker from the default audio path to the audio path corresponding to the second speaker.
[0165] In this way, by using a preset string in the set audio path configuration parameters to identify whether it is necessary to switch the data route of the first speaker to avoid speaker sound leakage, the speaker sound leakage elimination solution can be applied to all types of electronic devices, thereby improving the versatility and practicality of the speaker sound leakage elimination solution.
[0166] Furthermore, in another possible implementation of the present application, the first switching unit is specifically configured to:
[0167] In the case where the audio path configuration parameter includes a preset character string, determining the audio stream type corresponding to the audio to be played;
[0168] When the audio stream type corresponding to the audio to be played is a preset audio stream type, a data route switching instruction is sent to the codec chip so that the codec chip switches the data route corresponding to the first speaker from the default audio path to the audio path corresponding to the second speaker.
[0169] In this way, since the audio streams that need to be played simultaneously in the speaker and the earphone are usually several specific audio stream types, such as incoming call ringtones, alarm ringtones, etc., when it is determined that the audio stream type corresponding to the audio to be played is the preset audio stream type, the data route corresponding to the first speaker can be switched from the default audio path to the audio path corresponding to the second speaker, so as to further improve the accuracy of sound leakage scene judgment, prevent frequent switching of speaker data routes in unnecessary scenarios, and affect the stability of audio playback, thereby further improving the accuracy and reliability of speaker leakage elimination, and further improving the user experience.
[0170] Furthermore, in another possible implementation of the present application, the first determining module 91 includes:
[0171] A first query unit, configured to query a device tree file corresponding to the electronic device to determine a configuration item corresponding to the audio component type;
[0172] The first determining unit is used to determine the audio component type corresponding to the electronic device according to the configuration item corresponding to the audio component type.
[0173] In this way, by pre-defining the configuration items corresponding to the audio component types of the electronic device in the device tree file corresponding to the electronic device, it is possible to directly determine whether the audio component type corresponding to the electronic device belongs to the audio component type of the sound leakage scenario through the value of the configuration item, and then determine whether to execute the sound leakage elimination scheme of the present application based on the determination result. Therefore, regardless of whether the audio component type corresponding to the electronic device is the preset audio component type belonging to the sound leakage scenario, it can be compatible with the speaker sound leakage elimination scheme of the present application, thereby improving the versatility and practicality of the speaker sound leakage elimination scheme.
[0174] Furthermore, in another possible implementation of the present application, the audio to be played includes left channel audio to be played and right channel audio to be played; accordingly, the device 90 further includes:
[0175] A mixing module, used for mixing the left channel audio to be played and the right channel audio to be played to generate mixed audio to be played;
[0176] Accordingly, the output module 94 includes:
[0177] The first output unit is used to output the mixed audio to be played through a target output device.
[0178] In this way, since the user may adjust the audio path corresponding to the second speaker to silent in some usage scenarios, in this case, if the data route of the first speaker is switched to the audio path corresponding to the second speaker, both the first speaker and the second speaker will play silent data, thereby making it impossible for the audio to be played to be played normally. Therefore, in order to prevent this situation, after switching the data route of the first speaker, the left and right channel data of the audio to be played can be mixed, and the first speaker and the second speaker will output the mixed audio to prevent the situation where the external speaker is silent when the ringtone rings twice. This not only eliminates the speaker leakage in the double ringing scenario, but also prevents the speaker silence when the ringtone rings twice, further improving the reliability of sound leakage elimination and further improving the user experience.
[0179] Furthermore, in another possible implementation of the present application, the mixing module includes:
[0180] A second reading unit, used for reading audio path configuration parameters;
[0181] The first mixing unit is used to send a speaker mixing instruction to the DSP chip when the audio path configuration parameter includes a preset character string, so that the DSP chip mixes the left channel audio to be played and the right channel audio to be played according to the speaker mixing instruction to generate mixed audio to be played.
[0182] In this way, by using a preset string to identify whether it is necessary to switch the data route of the first speaker in the set audio path configuration parameters to avoid speaker sound leakage, and issuing the speaker mixing processing method through the speaker mixing instruction, the speaker sound leakage elimination solution can be applied to all types of electronic devices, thereby improving the versatility and practicality of the speaker sound leakage elimination solution.
[0183] Furthermore, in another possible implementation of the present application, the first audio mixing unit is specifically configured to:
[0184] In the case where the audio path configuration parameter includes a preset character string, determining the audio stream type corresponding to the audio to be played;
[0185] When the audio stream type corresponding to the audio to be played is a preset audio stream type, a speaker mixing instruction is sent to the DSP chip, so that the DSP chip mixes the left channel audio to be played and the right channel audio to be played according to the speaker mixing instruction to generate mixed audio to be played.
[0186] In this way, since the audio streams that need to be played simultaneously in the speaker and the earphone are usually several specific audio stream types, such as incoming call ringtones, alarm ringtones, etc., it is possible to switch the data route corresponding to the first speaker from the default audio path to the audio path corresponding to the second speaker when it is determined that the audio stream type corresponding to the audio to be played is the preset audio stream type, and mix the audio data of the left and right channels to further improve the accuracy of sound leakage scene discrimination, prevent mixing in unnecessary scenes, affect the stability of audio playback, and waste computing power, thereby further improving the accuracy and reliability of speaker sound leakage elimination, reducing the power consumption of electronic equipment, and further improving the user experience.
[0187] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.
[0188] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0189] In order to implement the above embodiments, the present application also proposes an electronic device.
[0190] Fig.10 A schematic diagram of the structure of an electronic device according to an embodiment of the present application.
[0191] See also Fig.10The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. Among them, the sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0192] It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or split 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.
[0193] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0194] 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.
[0195] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 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 110, and thus improves the efficiency of the system.
[0196] In some embodiments, the processor 110 may include one or more interfaces, such as 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.
[0197] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present application is only a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0198] The charging management module 140 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from a wired charger through the USB interface 130. In some wireless charging embodiments, the charging management module 140 may receive wireless charging input through a wireless charging coil of the electronic device 100. While the charging management module 140 is charging the battery 142, it may also power the electronic device 100 through the power management module 141.
[0199] The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and provides power to the processor 110, the internal memory 121, the external memory, the display screen 194, the camera 193 and the wireless communication module 160. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc. In some other embodiments, the power management module 141 can also be set in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.
[0200] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
[0201] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the 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 the antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
[0202] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.
[0203] The modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 170A, a receiver 170B, etc.), or displays an image or video through a display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.
[0204] The wireless communication module 160 can provide wireless communication solutions 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 (NFC), infrared (IR), etc., which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
[0205] In some embodiments, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology, etc. GNSS may include the global positioning system (GPS), the global navigation satellite system (GLONASS), the Beidou navigation satellite system (BDS), the quasi-zenith satellite system (QZSS) and / or the satellite based augmentation system (SBAS).
[0206] The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
[0207] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light emitting diode or an active-matrix organic light emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is an integer greater than 1.
[0208] The electronic device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.
[0209] ISP is used to process the data fed back by camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to ISP for processing and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, ISP can be set in camera 193.
[0210] The digital signal processor is used to process digital signals, and can process not only digital image signals but also other digital signals. For example, when the electronic device 100 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
[0211] Video codecs are used to compress or decompress digital videos. The electronic device 100 may support one or more video codecs. Thus, the electronic device 100 may play or record videos in various coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
[0212] NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and can also continuously self-learn. Through NPU, applications such as intelligent cognition of electronic device 100 can be realized, such as image recognition, face recognition, voice recognition, text understanding, etc.
[0213] The external memory interface 120 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 external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function, such as storing music, video and other files in the external memory card.
[0214] The internal memory 121 can be used to store computer executable program codes, which include instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created by the electronic device 100 during use (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.
[0215] The electronic device 100 can implement audio functions, such as music playback, recording, etc., through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone interface 170D and the application processor.
[0216] Microphone 170C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak by putting their mouth close to microphone 170C to input the sound signal into microphone 170C. The electronic device 100 can be provided with at least one microphone 170C. In other embodiments, the electronic device 100 can be provided with two microphones 170C, which can not only collect sound signals but also realize noise reduction function. In other embodiments, the electronic device 100 can also be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify the sound source, realize directional recording function, etc.
[0217] The distance sensor 180F is used to measure the distance. The electronic device 100 can measure the distance by infrared or laser. In some embodiments, in a shooting scene, the electronic device 100 can use the distance sensor 180F to measure the distance to achieve fast focusing.
[0218] The key 190 includes a power key, a volume key, etc. The key 190 may be a mechanical key or a touch key. The electronic device 100 may receive key inputs and generate key signal inputs related to user settings and function control of the electronic device 100.
[0219] It should be noted that the implementation process and technical principles of the electronic device of this embodiment refer to the aforementioned explanation of the audio playback method of the embodiment of the present application, and will not be repeated here.
[0220] An embodiment of the present application also provides a chip system, which is applied to an electronic device. The chip system includes one or more processors, and the one or more processors are used to call computer instructions so that the electronic device implements the steps in the above-mentioned method embodiments.
[0221] An embodiment of the present application further provides a computer-readable storage medium, which includes instructions. When the instructions are executed on an electronic device, the electronic device implements the steps in the above-mentioned method embodiments.
[0222] The embodiments of the present application also provide a computer program product. When the computer program product is executed on an electronic device, the electronic device implements the steps in the above-mentioned method embodiments.
[0223] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device that can carry the computer program code to the device / electronic device, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electric carrier signal, a telecommunication signal, and a software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.
[0224] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0225] In the above-described embodiments, specific details such as specific system structures, technologies, etc. are provided for illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0226] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0227] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0228] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.
[0229] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0230] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0231] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0232] In the embodiments provided in the present application, it should be understood that the disclosed devices / electronic devices and methods can be implemented in other ways. For example, the device / electronic device embodiments described above are merely schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0233] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0234] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. An audio playback method, characterized in that: include: When an audio stream start instruction or an audio stream device switching instruction of an electronic device is obtained, determining an audio component type corresponding to the electronic device; When the audio component type is a preset type, determining a target output device corresponding to the audio to be played; When the target output device includes an analog headset and a speaker, switching the data route corresponding to the first speaker from the default audio path to the audio path corresponding to the second speaker, wherein the speaker includes the first speaker and the second speaker, and the first speaker refers to a speaker that reuses the default audio path with the analog headset; The audio to be played is output through the target output device.
2. The method according to claim 1, characterized in that The step of switching the data route corresponding to the first speaker from a default audio path to an audio path corresponding to the second speaker includes: Read audio path configuration parameters; When the audio path configuration parameter includes a preset character string, a data route switching instruction is sent to the codec chip so that the codec chip switches the data route corresponding to the first speaker from the default audio path to the audio path corresponding to the second speaker.
3. The method according to claim 2, characterized in that When the audio path configuration parameter includes a preset character string, sending a data route switching instruction to the codec chip so that the codec chip switches the data route corresponding to the first speaker from the default audio path to the audio path corresponding to the second speaker, comprises: In a case where the audio path configuration parameter includes the preset character string, determining the audio stream type corresponding to the audio to be played; When the audio stream type corresponding to the audio to be played is a preset audio stream type, a data routing switching instruction is sent to the codec chip so that the codec chip switches the data routing corresponding to the first speaker from the default audio path to the audio path corresponding to the second speaker.
4. The method according to any one of claims 1 to 3, characterized in that: The determining the type of audio component corresponding to the electronic device includes: Querying a device tree file corresponding to the electronic device to determine a configuration item corresponding to the audio component type; The audio component type corresponding to the electronic device is determined according to the configuration item corresponding to the audio component type.
5. The method according to any one of claims 1 to 4, characterized in that: The audio to be played includes left channel audio to be played and right channel audio to be played, and before outputting the audio to be played through the target output device, the method further includes: Mixing the left channel audio to be played and the right channel audio to be played to generate mixed audio to be played; Outputting the to-be-played audio through the target output device includes: The mixed audio to be played is outputted through the target output device.
6. The method according to claim 5, characterized in that The mixing process of the left channel audio to be played and the right channel audio to be played to generate the mixed audio to be played includes: Read audio path configuration parameters; When the audio path configuration parameter includes a preset character string, a speaker mixing instruction is sent to a digital signal processing (DSP) chip, so that the DSP chip mixes the left channel audio to be played and the right channel audio to be played according to the speaker mixing instruction to generate the mixed audio to be played.
7. The method according to claim 6, characterized in that When the audio path configuration parameter includes a preset character string, sending a speaker mixing instruction to the DSP chip so that the DSP chip performs mixing processing on the left channel audio to be played and the right channel audio to be played according to the speaker mixing instruction to generate the mixed audio to be played, including: In a case where the audio path configuration parameter includes the preset character string, determining the audio stream type corresponding to the audio to be played; When the audio stream type corresponding to the audio to be played is a preset audio stream type, the speaker mixing instruction is sent to the DSP chip, so that the DSP chip mixes the left channel audio to be played and the right channel audio to be played according to the speaker mixing instruction to generate the mixed audio to be played.
8. An electronic device, characterized in that: The electronic device includes: one or more processors, and a memory; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code includes computer instructions, and the one or more processors call the computer instructions to enable the electronic device to execute the method as described in any one of claims 1-7.
9. 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 one or more processors are used to call computer instructions so that the electronic device executes the method as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes instructions, and when the instructions are executed on an electronic device, the electronic device executes the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
A mobile phone audio prompt method
CN101237483A
Earphone interface reusing method and apparatus
CN106231460A
Method for outputting audio, electronic device, and storage medium
CN108541370A
Audio output method and device, mobile terminal and storage medium
CN114567840A
Audio distribution circuit and method
CN117061948A
