Terminal equipment and audio data processing method
By configuring two headphone sockets in the terminal device and using logic switches and main control chips to control it, the problem that traditional devices cannot be compatible with headphones with and without headphones is solved, and a higher product range and normal audio functions are achieved.
Patent Information
- Application Number
- CN202311682834.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-07
- Publication Date
- 2025-06-10
AI Technical Summary
Traditional terminal devices can only be equipped with one headphone socket, and cannot be compatible with headphones with and without headphones, resulting in insufficient usability of headphone products.
Design a terminal device, configure two headphone sockets, and realize dynamic control of the headphone socket through logic switches and main control chips to ensure that both headphones with and without headphones can work normally.
The compatibility of terminal devices for headphones with and without headphones with microphones is achieved, the convenience of headphone products is improved, and the normal operation of audio playback and entry is ensured.
Smart Images

Figure CN120128852A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of terminal audio, and particularly to a terminal device and a method for processing audio data. Background Art
[0002] The headphone jack is a physical headphone connector that is widely used on the terminal devices of various electronic products. Currently, most of the terminal devices on the market are only equipped with one headphone jack, and two headphones are connected to the headphone jack through a one-to-two adapter cable to achieve signal parallel connection and thus work simultaneously.
[0003] Headphones are further divided into headphones with a microphone and headphones without a microphone. The pin of the headphone with a microphone has 4 segments, and the pin of the headphone without a microphone has 3 segments. The existing terminal devices can only support headphones of one pin type through a single headphone jack, and there is a deficiency in the versatility of headphone products. Summary of the Invention
[0004] The purpose of this application is to provide a terminal device and a method for processing audio data, which can solve the problem that the traditional terminal device equipped with a single headphone jack cannot be compatible with headphones with a microphone and headphones without a microphone at the same time.
[0005] To achieve the above purpose, the embodiments of this application are implemented as follows:
[0006] In a first aspect, a terminal device is provided, including: a first headphone jack, a second headphone jack, a logic switch, an audio codec chip, and a main control chip; the channel pins of the first headphone jack and the channel pins of the second headphone jack are connected in parallel to the audio output end of the audio codec chip;
[0007] Wherein, the main control chip is used for:
[0008] When a headphone with a microphone is inserted into the first headphone jack, based on a first microphone enabling instruction initiated for the first headphone jack, controlling the logic switch to connect the microphone pin of the first headphone jack to the audio input end of the audio codec chip; and / or,
[0009] When a headphone with a microphone is inserted into the second headphone jack, based on a second microphone enabling instruction initiated for the second headphone jack, controlling the logic switch to connect the microphone pin of the second headphone jack to the audio input end.
[0010] In a second aspect, a method for processing audio data is provided, including:
[0011] When it is determined that devices are plugged into both the first headphone socket and the second headphone socket according to the plugging and unplugging detection results corresponding to the first headphone socket and the second headphone socket, actual channel impedance is read to compare with a preset theoretical impedance of a mono headphone to determine whether the devices plugged into the first headphone socket and the second headphone socket include headphones;
[0012] When it is determined that the devices corresponding to the first headphone socket and the second headphone socket include headphones, and when it is determined, based on the plugging and unplugging detection results corresponding to the first headphone socket and the second headphone socket, that the first headphone socket and the second headphone socket are changed from both being plugged with devices to only one of them being plugged with a device, re-reading the actual channel impedance to compare it with the preset theoretical impedance of the mono headphone, and determining the type of the device corresponding to the one of them being plugged in;
[0013] When it is determined that the type of the device corresponding to one of the inserted devices is headphones, signal gain is performed on the audio data output from the audio output terminal; wherein the magnitude of the signal gain is determined based on the ratio between the actual channel impedance previously read and the actual channel impedance re-read.
[0014] In a third aspect, a method for processing audio data is provided, comprising:
[0015] When it is determined that only one of the first headphone socket and the second headphone socket has a device plugged in according to the plug-in and unplug-out detection results corresponding to the first headphone socket and the second headphone socket, reading the impedance of the left channel or the right channel to compare with a preset theoretical impedance of a mono headphone to determine the type of the plugged in device;
[0016] When it is determined that the type of the inserted device is a headset, and when it is determined, based on the plugging and unplugging detection results corresponding to the first headset socket and the second headset socket, that the first headset socket and the second headset socket are both plugged with devices instead of one of them being plugged with a device, re-read the left channel impedance or the right channel impedance to compare with a preset theoretical impedance of a mono headset, to determine whether the devices corresponding to the first headset socket and the second headset socket are both headsets;
[0017] When it is determined that the types of devices inserted into the first headphone socket and the second headphone socket are both headphones, signal gain reduction is performed on the audio data output by the audio output end; wherein the amplitude of the signal gain reduction is determined based on the ratio between the actual channel impedance previously read and the actual channel impedance re-read.
[0018] This application configures a first headphone jack and a second headphone jack on a terminal device. Among them, the channel pins of the first headphone jack and the channel pins of the second headphone jack are connected in parallel to the audio output end of the audio codec chip, so that when a headphone is plugged into the first headphone jack and / or the second headphone jack, it can ensure that the headphone can receive the audio data provided by the audio codec chip to achieve normal audio playback. At the same time, when a headset with a microphone is inserted into the first headphone jack and / or the second headphone jack, the main control chip can control the logic switch to connect the microphone pin of the corresponding headphone jack to the audio output end of the audio codec chip to achieve normal audio recording. Description of the Drawings
[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments recorded in the embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0020] Figure 1 It is the first structural schematic diagram of the terminal device according to the embodiment of the present application.
[0021] Figure 2 It is the second structural schematic diagram of the terminal device according to the embodiment of the present application.
[0022] Figure 3 It is the third structural schematic diagram of the terminal device according to the embodiment of the present application.
[0023] Figure 4 It is the first schematic diagram of the terminal device according to the embodiment of the present application for detecting the device of the headphone to control the microphone function.
[0024] Figure 5 It is the second schematic diagram of the terminal device according to the embodiment of the present application for detecting the device of the headphone to control the microphone function.
[0025] Figure 6 It is the first working logic schematic diagram of the signal booster according to the embodiment of the present application.
[0026] Figure 7 It is the flow schematic diagram of the signal booster in the first scenario according to the embodiment of the present application.
[0027] Figure 8 It is the second working logic schematic diagram of the signal booster according to the embodiment of the present application.
[0028] Figure 9 It is the flow schematic diagram of the signal booster in the first scenario according to the embodiment of the present application.
[0029] Figure 10 This is a schematic diagram of the terminal device in the present application embodiment for controlling the headphone microphone in a call scenario.
[0030] Figure 11 This is a schematic flowchart of the method for processing audio data in the present application embodiment. Detailed implementation manners
[0031] As mentioned above, most of the terminal devices on the market currently only configure one headphone jack, supporting the access of headphones of one pin type, resulting in insufficient versatility in headphone products.
[0032] For example, if the terminal device is configured with a headphone jack supporting a three - segment headphone, when a user inserts a four - segment headphone (with a microphone) and a three - segment headphone (without a microphone) into the headphone jack, the microphone on the four - segment headphone cannot be used at this time, and there may even be misdetection when the button on the four - segment headphone is long - pressed. In addition, the power corresponding to the parallel connection of the three - segment headphone and the four - segment headphone is inconsistent, resulting in different sound effects and thus affecting the user experience.
[0033] In view of the above problems, the present application aims to propose at least a terminal device solution that can simultaneously be compatible with four - segment headphones and three - segment headphones, which can improve the versatility of the terminal device for headphone products.
[0034] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of this specification, rather than all the embodiments. Based on the embodiments in this specification, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the scope of protection of this specification.
[0035] The embodiments of the present application provide a terminal device. Figure 1 As a schematic diagram of the structure of the terminal device, it may include: a first headphone jack 110, a second headphone jack 120, a logic switch 130, an audio codec chip 140, and a main control chip 150.
[0036] Among them:
[0037] The channel pins of the first headphone jack 110 and the channel pins of the second headphone jack 120 are connected in parallel to the audio output end of the audio codec chip 140.
[0038] The main control chip 150 can be used to: when a headset with a microphone is inserted into the first headset jack 110, based on the first microphone enabling instruction initiated for the first headset jack 110, control the logic switch 130 to connect the microphone pin of the first headset jack 110 to the audio input end of the audio codec chip 140; in addition, when a headset with a microphone is inserted into the second headset jack 120, based on the second microphone enabling instruction initiated for the second headset jack 120, control the logic switch 130 to connect the microphone pin of the second headset jack 120 to the audio input end.
[0039] It should be noted that the above first microphone enabling instruction and second microphone enabling instruction can be issued by the user.
[0040] As an exemplary introduction, on the display screen (built-in or external) of the terminal device in this embodiment, there is an interaction interface that can control the peripherals inserted into the first headset jack 110 or the second headset jack 120. This interaction interface can be a user interface (User Interface, UI) of related software that includes audio playback / control functions (such as mute, increase volume / decrease volume, etc.). The user can operate on the interaction interface to control whether the microphone of the headset corresponding to the first headset jack 110 or the second headset jack 120 needs to be enabled according to the usage requirements of the microphone.
[0041] For example: when starting the microphone of the headset corresponding to the first headset jack 110, a first microphone enabling instruction can be generated to control the logic switch 130 to connect the microphone pin of the first headset jack 110 to the audio input end; when starting the microphone of the headset corresponding to the second headset jack 120, a second microphone enabling instruction can be generated to control the logic switch 130 to connect the microphone pin of the second headset jack 120 to the audio input end.
[0042] Compared with the traditional solution, the terminal device in this embodiment is configured with two headset jacks, namely the first headset jack and the second headset jack. Among them, the channel pins of the first headset jack and the channel pins of the second headset jack are connected in parallel to the audio output end of the audio codec chip, which can ensure that when a headset is inserted into the first headset jack and / or the second headset jack, the headset can receive the audio data provided by the audio codec chip to achieve normal audio playback.
[0043] In some exemplary embodiments, the main control chip can separately control the connection and disconnection between the microphone pin of the first headset jack and the audio output end of the audio codec chip, and the connection and disconnection between the microphone pin of the first headset jack and the audio output end of the audio codec chip, so as to ensure that when there is a usage requirement for the microphone of the headset with a microphone, the audio data can be transmitted to the audio codec chip through the headset jack into which it is inserted to achieve normal audio recording.
[0044] In summary, for the terminal device based on this embodiment, the first headphone jack and the second headphone jack can be independently inserted with different types of headphones, such as headphones with a microphone, headphones without a microphone, or other types of headphones, and the functions of both types of headphones can work properly, thus improving the versatility of the headphone product.
[0045] Figure 2 It is a schematic structural diagram of the sound channels of the terminal device in this embodiment. The sound channels of the terminal device can be divided into a left sound channel and a right sound channel. Here, the audio data output at the audio output end in the left sound channel is defined as HPH_L, and the audio data output by the right sound channel is defined as HPH_R.
[0046] Wherein:
[0047] The left-channel pins of the first headphone jack and the left-channel pins of the second headphone jack are connected in parallel to the corresponding audio output end of the left channel of the audio decoder chip, and can receive the signal of HPH_L simultaneously.
[0048] The right-channel pins of the first headphone jack and the right-channel pins of the second headphone jack are connected in parallel to the corresponding audio output end of the right channel of the audio decoder chip, and can receive the signal of HPH_R simultaneously.
[0049] In addition, a signal booster can be provided on the audio decoder chip, which can be used to perform signal gain or signal attenuation on HPH_L and HPH_R.
[0050] Figure 3 It is a schematic circuit diagram of the terminal device in this embodiment. The terminal device can include: a first plug-in detector provided on the audio codec chip and a second plug-in detector implemented by the main control chip based on a reserved port.
[0051] Wherein:
[0052] The plug-in detection pin of the first headphone jack is connected to the first plug-in detector on the audio codec chip, and the first plug-in detector can perform plug-in detection on the first headphone jack according to the high and low level changes of the Headset_int1 signal in the circuit it accesses.
[0053] Similarly, the plug-in detection pin of the second headphone jack is connected to the second plug-in detector of the main control chip, and the second plug-in detector can perform plug-in detection on the second headphone jack according to the high and low level changes of the Headset_int2 signal in the circuit it accesses.
[0054] In addition, the terminal device can further include: a device detector provided on the audio codec chip.
[0055] When the main control chip determines that a device is inserted into the first headphone jack based on the plugging and unplugging detection result corresponding to the first headphone jack (i.e., the result of the plugging and unplugging detection operation performed by the first plugging and unplugging detector), it controls the logic switch to connect the microphone pin of the first headphone jack to the device detector to complete device detection; and when it determines that a device is inserted into the second headphone jack based on the plugging and unplugging detection result corresponding to the second headphone jack (i.e., the result of the plugging and unplugging detection operation performed by the second plugging and unplugging detector), it controls the logic switch to connect the microphone pin of the second headphone jack to the device detector to complete device detection. Herein, the device detection mentioned here refers to the identification of different device types such as a headset with a microphone, a headset without a microphone, a selfie stick, and an extension cable for the connected device.
[0056] The control of the main control chip will be introduced in detail below in combination with the specific circuit structure of the logic switch.
[0057] Continue to refer Figure 3 As shown, the logic switch of this embodiment may include: a first switch S1, a second switch S2, a third switch S3, and a fourth switch S4.
[0058] Among them:
[0059] S1 and S2 are arranged on the circuit between the microphone pin of the first headphone socket and the device detector; in addition, S2 is also arranged on the circuit between the microphone pin of the first headphone socket and the audio output terminal, and on the circuit between the microphone pin of the first headphone socket and the microphone (MIC) power supply of the audio codec chip.
[0060] S4 and S3 are arranged on the circuit between the microphone pin of the second headphone socket and the device detector; in addition, S4 is also arranged on the circuit between the microphone pin of the second headphone socket and the audio output terminal, and on the circuit between the microphone pin of the second headphone socket and the MIC power supply of the audio codec chip.
[0061] Correspondingly, the main control chip realizes the switch control of S1 - S4 through its reserved ports and can realize the following functions:
[0062] I. Device Detection Control
[0063] 1) When it is determined that a device is inserted into the first headphone jack based on the plugging and unplugging detection result corresponding to the first headphone jack, control S1 and S2 to close and control S3 to open. At this time, the microphone of the first headphone jack is connected to the MIC power supply Vmic_bias through the pull-up resistors R1 and R2, and the microphone pin of the first headphone jack is connected to the device detector to complete device detection, while the microphone pin of the second headphone jack will not be connected to the device detector when S3 is open.
[0064] 2) When it is determined that a device is inserted into the second headphone jack based on the plug and unplug detection result corresponding to the second headphone jack, control S3 and S4 to close and control S1 to open. At this time, the microphone of the second headphone jack is connected to the MIC power supply Vmic_bias through the pull-up resistors R1 and R2, and the microphone pin of the second headphone jack is connected to the device detector to complete device detection, while the microphone pin of the first headphone jack will not be connected to the device detector when S1 is open.
[0065] II. Microphone Enable Control
[0066] 1) When the device detection result corresponding to the first headphone jack indicates that no headset with a microphone is inserted into the first headphone jack, or when a first microphone disable instruction is received for the first headphone jack, control S1 and S2 to open to block the microphone pin of the first headphone jack from accessing the audio output terminal;
[0067] 2) When the device detection result corresponding to the second headphone jack indicates that no headset with a microphone is inserted into the second headphone jack, or when a second microphone disable instruction is received for the second headphone jack, control S3 and S4 to open to block the microphone pin of the second headphone jack from accessing the audio output terminal.
[0068] Based on the above design of the logic switch, when using a single headphone, after detecting the insertion of the headphone through Headset_int1 or headset_int2, the MIC power supply Vmic_bias is powered on, and the switches S1S2 or S3S4 are closed. Then, the headphone type is determined through headmic_in_det, whether it is a 3-segment or 4-segment headphone, or a selfie stick or an extension cable. When headphones are inserted into both jacks, the switches S1 / S2 or S3 / S4 are controlled to close in the order of headphone insertion, and the types of the two headphones are detected separately. If one of the headphones is a 3-segment headphone, the corresponding switch is controlled to open. If both headphones are 3-segment headphones, all four switches are open. If both headphones are 4-segment headphones, all four switches are closed to supply power to the microphones of the two headphones, and the button detection of the two 4-segment headphones is realized. At this time, the resistors R3 and R4 play a role in isolating the MIC signals of the two headphones.
[0069] Figure 4It is a schematic diagram of circuit control for inserting a second earphone after inserting a three - segment earphone. When the second earphone is inserted, the corresponding switch (S1 / S2 or S3 / S4) of the first earphone is disconnected, and the corresponding switch (S1 / S2 or S3 / S4) of the second earphone is closed to initiate device detection for the second earphone. When it is determined that the second earphone is a three - segment earphone, the corresponding switch (S1S2 or S3S4) of the second earphone is disconnected; when it is determined that the second earphone is a four - segment earphone, the corresponding switch (S1S2 or S3S4) of the second earphone remains closed.
[0070] Figure 5 It is a schematic diagram of detection control process for inserting a second earphone after inserting a four - segment earphone. When the second earphone is inserted, the corresponding switch (S1 or S3) of the first earphone is disconnected, and the corresponding switch (S1 / S2 or S3 / S4) of the second earphone is closed to initiate device detection for the second earphone. When it is determined that the second earphone is a three - segment earphone, the corresponding switch (S1S2 or S3S4) of the second earphone is disconnected; when it is determined that the second earphone is a four - segment earphone, the corresponding switch (S1S2 or S3S4) of the second earphone remains closed.
[0071] In addition, as shown in Figure 3 the audio decoder chip can also be provided with a mixer. The mixer is used for: when the microphone pins of the first earphone socket and the second earphone socket are simultaneously connected to the audio input terminal, synthesizing the audio data collected by the microphone pin corresponding to the first earphone socket and the audio data collected by the microphone pin corresponding to the second earphone socket and then outputting them to the audio input terminal, so as to complete recording for two earphones with microphones simultaneously.
[0072] In addition, as shown in Figure 2 the audio decoder chip can also be provided with a signal booster. The signal booster is used for performing signal gain or signal attenuation on the audio data output from the audio output terminal to ensure power compensation when different earphones are connected to the first earphone socket and the second earphone socket, or when the connection changes, and to avoid a large difference in volume between the two earphones.
[0073] The signal booster in this embodiment can detect changes in the headphone type and the number of headphones through headphone impedance detection, and thus automatically call the signal gain parameters for single - earphone or dual - earphone, bringing a better experience to users.
[0074] The following details the adjustment of the signal gain parameters by the signal booster.
[0075] Figure 6 It is a schematic diagram of the working logic of the signal booster in this embodiment, which is applied to the scenario of changing from inserting a single earphone to inserting a dual - earphone, and may include:
[0076] S602, when only one of the first headphone socket and the second headphone socket has a device inserted therein, read the left-channel impedance or the right-channel impedance, and compare it with the theoretically preset impedance of a mono headphone to determine the type of the inserted device.
[0077] Among them, in this embodiment, it can be determined whether a device is inserted into the first headphone socket and the second headphone socket according to the plugging and unplugging detection operations corresponding to the first headphone socket and the second headphone socket, which will not be elaborated hereinafter.
[0078] S604, when it is determined that the type of the inserted device is a headphone and the situation changes from one of the first headphone socket and the second headphone socket having a device inserted therein to both having devices inserted therein, read the left-channel impedance or the right-channel impedance again, and compare it with the theoretically preset impedance of a mono headphone to determine whether the types of the devices inserted into the first headphone socket and the second headphone socket are both headphones.
[0079] S606, when it is determined that the types of the devices inserted into the first headphone socket and the second headphone socket are both headphones, perform signal gain on the audio data output from the audio output terminal; wherein, the amplitude of the signal gain is determined based on the ratio between the actually read channel impedance and the re-read actually channel impedance.
[0080] As an exemplary introduction, taking the change from a single-device insertion to a double-device insertion as an example, refer to Figure 7 as shown:
[0081] In the case of a single-device insertion, first read the impedances R_HPH1 of the left and right channels. If R_HPH1 < R_REF1 is satisfied, it indicates that the currently connected device is a headphone, and at this time the signal booster uses the default signal gain parameters; if R_HPH1 < R_REF1 is not satisfied, it indicates that the currently connected device may be a selfie stick or an extension cable. Among them, R_REF1 is the discrimination threshold between the impedance of a selfie stick or an extension cable and the impedance of a normal headphone, such as a large impedance value of 10 kohm or 20 Kohm, etc.
[0082] When a second device is inserted, the left and right channel impedances R_HPH2 are read again. When the first device is a headset, the signal gain amplitude gain = 20lg(R_HPH1 / R_HPH2) is determined to complete the signal gain according to gain; if the first device is a selfie stick or a long cable and R_HPH2 < R_REF1 is satisfied, it means that the second device is also a headset. At this time, the signal booster uses the default signal gain parameters; if the first device is a selfie stick or a long cable and R_HPH2 < R_REF1 is not satisfied, and the inserted second device is also a selfie stick or an extension cable, the signal booster does not need to work.
[0083] In addition, Figure 8 is another schematic diagram of the working logic of the signal booster, which is applied to the scenario of changing from dual headset insertion to single headset insertion and may include:
[0084] S802, when devices are inserted into both the first headset socket and the second headset socket, read the actual channel impedance to compare it with the theoretically preset monaural headset impedance to determine whether the types of devices inserted into the first headset socket and the second headset socket include headsets.
[0085] S804, when it is determined that the types of devices inserted into the first headset socket and the second headset socket include headsets and the situation changes from having devices inserted into both the first headset socket and the second headset socket to having a device inserted into only one of them, re-read the actual channel impedance to compare it with the theoretically preset monaural headset impedance to determine the type of the device inserted into the one of them.
[0086] S806, when it is determined that the type of the device inserted into the one of them is a headset, reduce the signal gain of the audio data output from the audio output end; wherein, the reduction amplitude of the signal gain is determined based on the ratio between the previously read actual channel impedance and the re-read actual channel impedance.
[0087] As an exemplary introduction, taking the change from dual-device insertion to single-device insertion as an example, refer to Figure 9 as shown:
[0088] When dual devices are inserted, the left and right channel impedances R_HPH2 are read once first. If R_HPH2 < R_REF1, it means that at least one of the two devices is a headset. At this time, the signal booster uses the default signal gain parameters; if R_HPH2 < R_REF1 is not satisfied, it means that both headset devices are selfie sticks or extension cables.
[0089] Next, if you unplug a device, read the left and right channel impedance R_HPH1. If R_HPH1 <R_REF1,说明剩下的设备为耳机,确定信号增益的减少幅度gain=20lg(R_HPH1 / R_REF1),以根据gain调低信号增益的效果;如果不满足R_HPH1<R_REF1,说明剩余设备为自拍杆或延长线,此时信号增益器不需工作。
[0090] In summary, the signal amplifier of this embodiment can automatically switch the appropriate signal gain parameters of the audio data when a single earphone is changed into a dual earphone, or when dual earphones are changed into a single earphone, thereby avoiding a bad user experience caused by sudden changes in the earphone sound.
[0091] Figure 10 It is a schematic diagram of the control of the microphones of the dual-headphone devices by the terminal device during a call.
[0092] If both the headsets are 3-band headsets, that is, there is no microphone on the headset, the main microphone on the terminal is used. If one of the headsets is a 4-band headset, the microphone on the 4-band headset is used by default.
[0093] If both earphones are 4-band earphones, the microphones on both earphones can be used. By default, both microphones work and the mixer mixes the two audio channels. In addition, you can also mute one of the earphone microphones by clicking the mute button on the call UI interface. At this time, the mixer only outputs the audio of one microphone.
[0094] The above is an introduction to the terminal device of this embodiment. It should be understood that, since the terminal device of the conventional solution is only equipped with one headphone socket, the audio encoder chip is usually only equipped with one plug-in detector and one device detector.
[0095] The terminal device of this embodiment can continue to use the existing audio encoder chip, that is, use a plug-in detector that comes with the audio encoder chip as the first plug-in detector, and the other second plug-in detector is implemented by the main control chip through a reserved port. In addition, under the control of the main control chip for the logic switch, the first headphone jack and the second headphone jack can be connected to the device detector in time-sharing to complete their respective device detections. The entire solution does not require hardware changes to the audio encoder chip, and the cost is controlled.
[0096] In addition, another embodiment of the present application also provides a method for processing audio data. Figure 11 The flowchart of the method for processing audio data includes:
[0097] S1102, when it is determined that a headset with a microphone is inserted into the first headset jack, generate a first microphone activation instruction to control the microphone pin of the first headset jack to access the audio input terminal of the audio codec chip of the terminal device.
[0098] S1104, when it is determined that a headset with a microphone is inserted into the second headset jack, generate a second microphone activation instruction to control the microphone pin of the second headset jack to access the audio input terminal of the audio codec chip of the terminal device.
[0099] It should be understood that Figure 1 the terminal device shown can be the execution subject of the audio data processing method in this embodiment. Therefore, the audio data processing method in this embodiment can also implement Figure 6 and / or Figure 8 the steps shown.
[0100] Those skilled in the art should understand that the embodiments of this specification can be provided as a method, a system, or a computer program product. Therefore, this specification can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, this specification can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0101] The above describes specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be executed in a different order than in the embodiments and still achieve the desired results. Additionally, the processes depicted in the drawings do not necessarily require the specific order or sequential order shown to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0102] The above is only the embodiments of this specification and is not used to limit this specification. For those skilled in the art, this specification can have various changes and modifications. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this specification shall be included within the scope of the claims of this specification. In addition, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of this document.
Claims
1. A terminal device, characterized in that, it includes: a first headphone jack, a second headphone jack, a logic switch, an audio codec chip, and a main control chip; the channel pins of the first headphone jack and the channel pins of the second headphone jack are connected in parallel to the audio output end of the audio codec chip; wherein, the main control chip is used for: when a headset with a microphone is inserted into the first headphone jack, based on a first microphone enabling instruction initiated for the first headphone jack, controlling the logic switch to connect the microphone pin of the first headphone jack to the audio input end of the audio codec chip; and / or, when a headset with a microphone is inserted into the second headphone jack, based on a second microphone enabling instruction initiated for the second headphone jack, controlling the logic switch to connect the microphone pin of the second headphone jack to the audio input end.
2. The terminal device according to claim 1, characterized in that, it further includes: a mixer disposed on the audio codec chip; wherein, the mixer is used for: when the microphone pins of the first headphone jack and the second headphone jack are simultaneously connected to the audio input end, synthesizing the audio data collected by the microphone pin corresponding to the first headphone jack and the audio data collected by the microphone pin corresponding to the second headphone jack and outputting the synthesized data to the audio input end.
3. The terminal device according to claim 1, characterized in that, it further includes: a display screen; wherein, an interaction interface for controlling a peripheral device inserted into the first headphone jack or the second headphone jack is displayed on the display screen, and the interaction interface is used to generate the first microphone enabling instruction and / or the second microphone enabling instruction based on user operations.
4. The terminal device according to claim 1, characterized in that, it further includes: a device detector disposed on the audio codec chip; wherein, the main control chip is further used for: when it is determined that a device is inserted into the first headphone jack according to a plugging and unplugging detection operation corresponding to the first headphone jack, controlling the logic switch to connect the microphone pin of the first headphone jack to the device detector to complete device detection, and the device detection result corresponding to the first headphone jack is used to indicate whether a headset with a microphone is inserted into the first headphone jack; and / or, when it is determined that a device is inserted into the second headphone jack according to a plugging and unplugging detection operation corresponding to the second headphone jack, controlling the logic switch to connect the microphone pin of the second headphone jack to the device detector to complete device detection, and the device detection result corresponding to the second headphone jack is used to indicate whether a headset with a microphone is inserted into the second headphone jack.
5. The terminal device according to claim 4, characterized in that, the logic switch includes a first switch, a second switch, a third switch, and a fourth switch; Wherein, the first switch and the second switch are arranged on the circuit between the microphone pin of the first earphone socket and the device detector, and the second switch is arranged on the circuit between the microphone pin of the first earphone socket and the audio output end; the fourth switch and the third switch are arranged on the circuit between the microphone pin of the second earphone socket and the device detector, and the fourth switch is arranged on the circuit between the microphone pin of the second earphone socket and the audio output end.
6. The terminal device according to claim 5, wherein, the control chip is further configured to: when it is determined that a device is inserted into the first earphone socket according to the plugging and unplugging detection operation corresponding to the first earphone socket, control the first switch and the second switch to be closed, and control the third switch to be opened, so that the microphone pin of the first earphone socket accesses the device detector to complete device detection; and / or, when it is determined that a device is inserted into the second earphone socket according to the plugging and unplugging detection operation corresponding to the second earphone socket, control the third switch and the fourth switch to be closed, and control the first switch to be opened, so that the microphone pin of the second earphone socket accesses the device detector to complete device detection.
7. The terminal device according to claim 5, wherein, the control chip is further configured to: when the device detection result corresponding to the first earphone socket indicates that the first earphone socket is not connected to a headset with a microphone, or a first microphone disabling instruction is received for the first earphone socket, control the first switch and the second switch to be opened to block the microphone pin of the first earphone socket from accessing the audio output end; and / or when the device detection result corresponding to the second earphone socket indicates that the second earphone socket is not connected to a headset with a microphone, or a second microphone disabling instruction is received for the second earphone socket, control the third switch and the fourth switch to be opened to block the microphone pin of the second earphone socket from accessing the audio output end.
8. The terminal device according to any one of claims 4 to 7, wherein, it further includes: a signal booster arranged on the audio codec chip; the signal booster is configured to: when it is determined that only one of the first earphone socket and the second earphone socket has a device inserted according to the plugging and unplugging detection operations corresponding to the first earphone socket and the second earphone socket, read the left channel impedance or the right channel impedance to compare with the pre-set theoretical impedance of the mono earphone to determine the type of the inserted device; After determining that the type of the inserted device is a headset, and based on the new plugging and unplugging detection operations corresponding to the first headset socket and the second headset socket, when it is determined that the situation where one of the first headset socket and the second headset socket has a device inserted changes to both having devices inserted, the left-channel impedance or the right-channel impedance is read again to compare with the pre-set theoretical impedance of a mono headset, so as to determine whether the types of the devices inserted into the first headset socket and the second headset socket are both headsets; When it is determined that the types of the devices inserted into the first headset socket and the second headset socket are both headsets, signal gain is performed on the audio data output by the audio output end; wherein, the amplitude of the signal gain is determined based on the ratio between the actually read channel impedance before and the actually read channel impedance read again.
9. The terminal device according to claim 8 , Characterized in that wherein, the signal gain device is further configured to: When it is determined, according to the plugging and unplugging detection operations corresponding to the first headset socket and the second headset socket, that both the first headset socket and the second headset socket have devices inserted, read the actual channel impedance to compare with the pre-set theoretical impedance of a mono headset, so as to determine the types of the devices inserted into the first headset socket and the second headset socket; After determining that the types of the devices inserted into the first headset socket and the second headset socket include a headset, and based on the new plugging and unplugging detection operations corresponding to the first headset socket and the second headset socket, when it is determined that the situation where both the first headset socket and the second headset socket have devices inserted changes to only one of them having a device inserted, read the actual channel impedance again to compare with the pre-set theoretical impedance of a mono headset, so as to determine the type of the device inserted into the one of them; When it is determined that the type of the device inserted into the one of them is a headset, reduce the signal gain for the audio data output by the audio output end; wherein, the reduction amplitude of the signal gain is determined based on the ratio between the actually read channel impedance before and the actually read channel impedance read again.
10. A method for processing audio data, applied to a terminal device including a first headset socket and a second headset socket, Characterized in that it includes: When it is determined that a headset with a microphone is inserted into the first headset socket, generate a first microphone start instruction to control the microphone pin of the first headset socket to access the audio input end of the audio codec chip of the terminal device; and / or When it is determined that a headset with a microphone is inserted into the second headset socket, generate a second microphone start instruction to control the microphone pin of the second headset socket to access the audio input end of the audio codec chip of the terminal device.
11. The method according to claim 10 Characterized in that it further includes: When only one of the first headphone jack and the second headphone jack has a device inserted, read the left-channel impedance or the right-channel impedance, and compare it with the pre-set theoretical impedance of a mono headphone to determine the type of the inserted device; When it is determined that the type of the inserted device is a headphone, and the situation changes from one of the first headphone jack and the second headphone jack having a device inserted to both having devices inserted, re-read the left-channel impedance or the right-channel impedance, and compare it with the pre-set theoretical impedance of a mono headphone to determine whether the types of the devices inserted into the first headphone jack and the second headphone jack are both headphones; When it is determined that the types of the devices inserted into the first headphone jack and the second headphone jack are both headphones, perform signal gain on the audio data output by the audio output terminal; wherein, the amplitude of the signal gain is determined based on the ratio between the previously read actual channel impedance and the re-read actual channel impedance.
12. The method according to claim 10, characterized in that, further comprising: When both the first headphone jack and the second headphone jack have devices inserted, read the actual channel impedance, and compare it with the pre-set theoretical impedance of a mono headphone to determine whether the types of the devices inserted into the first headphone jack and the second headphone jack include headphones; When it is determined that the types of the devices inserted into the first headphone jack and the second headphone jack include headphones, and the situation changes from both having devices inserted to only one of them having a device inserted, re-read the actual channel impedance, and compare it with the pre-set theoretical impedance of a mono headphone to determine the type of the device inserted into the one of them; When it is determined that the type of the device inserted into the one of them is a headphone, reduce the signal gain for the audio data output by the audio output terminal; wherein, the reduction amplitude of the signal gain is determined based on the ratio between the previously read actual channel impedance and the re-read actual channel impedance.