CN109195058B - Earphone sound channel switching method, earphone sound channel switching device, terminal and storage medium - Google Patents

Earphone sound channel switching method, earphone sound channel switching device, terminal and storage medium Download PDF

Info

Publication number
CN109195058B
CN109195058B CN201811448376.3A CN201811448376A CN109195058B CN 109195058 B CN109195058 B CN 109195058B CN 201811448376 A CN201811448376 A CN 201811448376A CN 109195058 B CN109195058 B CN 109195058B
Authority
CN
China
Prior art keywords
earphone
output mode
terminal
triangle
preset
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811448376.3A
Other languages
Chinese (zh)
Other versions
CN109195058A (en
Inventor
王蕾
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nubia Technology Co Ltd
Original Assignee
Nubia Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nubia Technology Co Ltd filed Critical Nubia Technology Co Ltd
Priority to CN201811448376.3A priority Critical patent/CN109195058B/en
Publication of CN109195058A publication Critical patent/CN109195058A/en
Application granted granted Critical
Publication of CN109195058B publication Critical patent/CN109195058B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04RLOUDSPEAKERS, MICROPHONES, GRAMOPHONE PICK-UPS OR LIKE ACOUSTIC ELECTROMECHANICAL TRANSDUCERS; DEAF-AID SETS; PUBLIC ADDRESS SYSTEMS
    • H04R1/00Details of transducers, loudspeakers or microphones
    • H04R1/10Earpieces; Attachments therefor ; Earphones; Monophonic headphones
    • H04R1/1041Mechanical or electronic switches, or control elements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04RLOUDSPEAKERS, MICROPHONES, GRAMOPHONE PICK-UPS OR LIKE ACOUSTIC ELECTROMECHANICAL TRANSDUCERS; DEAF-AID SETS; PUBLIC ADDRESS SYSTEMS
    • H04R3/00Circuits for transducers, loudspeakers or microphones
    • H04R3/12Circuits for transducers, loudspeakers or microphones for distributing signals to two or more loudspeakers
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04RLOUDSPEAKERS, MICROPHONES, GRAMOPHONE PICK-UPS OR LIKE ACOUSTIC ELECTROMECHANICAL TRANSDUCERS; DEAF-AID SETS; PUBLIC ADDRESS SYSTEMS
    • H04R2201/00Details of transducers, loudspeakers or microphones covered by H04R1/00 but not provided for in any of its subgroups
    • H04R2201/10Details of earpieces, attachments therefor, earphones or monophonic headphones covered by H04R1/10 but not provided for in any of its subgroups
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04RLOUDSPEAKERS, MICROPHONES, GRAMOPHONE PICK-UPS OR LIKE ACOUSTIC ELECTROMECHANICAL TRANSDUCERS; DEAF-AID SETS; PUBLIC ADDRESS SYSTEMS
    • H04R2430/00Signal processing covered by H04R, not provided for in its groups

Landscapes

  • Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Acoustics & Sound (AREA)
  • Signal Processing (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Otolaryngology (AREA)
  • Telephone Function (AREA)

Abstract

The invention discloses a method for switching earphone sound channels, which comprises the following steps: when the earphone is connected with the terminal, detecting a sound source output mode of the current running application of the terminal; when the sound source output mode is detected to be a stereo output mode, acquiring a first spatial position of a left earphone of the earphone and a second spatial position of a right earphone of the earphone; detecting a relative positional distance of the first spatial position and the second spatial position with respect to each other; and switching the output sound channel and the sound source output mode of the earphone according to the relative position parameter. In addition, the invention also discloses a switching device of the earphone sound channels, a terminal and a readable storage medium, solves the technical problem that when a user wears a left earphone and a right earphone reversely or only wears one earphone, the effect of listening to the audio by the user is poor, automatically completes the switching of the earphone output sound channels and the sound source output mode based on detection, and improves the use experience of the user.

Description

Earphone sound channel switching method, earphone sound channel switching device, terminal and storage medium
Technical Field
The present invention relates to the field of audio output technologies, and in particular, to a method and an apparatus for switching a headphone sound channel, a terminal, and a computer-readable storage medium.
Background
With the rapid development of science and technology and the rapid progress of the technical era, the life of people is greatly improved. More and more people are happy to listen to music and watch videos by using the terminal equipment, in order to enjoy better listening experience and avoid influencing other people, the user generally uses the earphone to listen to the audio, in the prior art, in order to provide more real audio listening experience for the user, the audio is stereophonic, and the left and right earphones are output by corresponding the earphone through the left and right sound channels. However, if the user does not pay attention to distinguish the left and right earphones of the earphones when listening to the audio, and the left and right earphones are worn reversely or only one earphone is worn, the audio output effect and the audio-visual experience received by the user are greatly deteriorated, so that the user experience is reduced.
Disclosure of Invention
The invention mainly aims to provide a method, a device, a terminal and a computer readable storage medium for switching earphone sound channels, and aims to solve the technical problem that when a user wears left and right earphones reversely or only wears one earphone, the effect of listening to audio by the user is poor.
In order to achieve the above object, an embodiment of the present invention provides a method for switching an earphone sound channel, where the method for switching an earphone sound channel is applied to an earphone having a position sensor mounted in an earphone, where the earphone includes the position sensor disposed in a left earphone and the position sensor disposed in a right earphone, and the method for switching an earphone sound channel includes:
when the earphone is connected with the terminal, detecting a sound source output mode of the current running application of the terminal;
when the sound source output mode is detected to be a stereo output mode, acquiring a first spatial position of a left earphone of the earphone and a second spatial position of a right earphone of the earphone;
detecting a relative positional distance of the first spatial position and the second spatial position with respect to each other;
and switching the output sound channel and the sound source output mode of the earphone according to the relative position parameter.
Optionally, when the earphone is connected to the terminal, the step of detecting a sound source output mode of the currently running application of the terminal includes:
when the terminal is detected to be accessed into the earphone device, detecting a target application of audio data output from all applications currently running by the terminal;
analyzing a sound source output mode of the audio data output by the target application, wherein the sound source output mode comprises the following steps: a stereo output mode and a mono output mode.
Optionally, when it is detected that the sound source output mode is a stereo output mode, the step of obtaining the first spatial position of the left earphone and the second spatial position of the right earphone includes:
when detecting that the sound source mode of the audio data output by the target application is a stereo output mode, establishing a space coordinate system according to the position of the terminal in the current space environment;
marking the position of a position sensor in the left earphone of the earphone in the space coordinate system as a first space position, and acquiring the first space position;
and marking the position of a position sensor in the right earphone of the earphone in the space coordinate system as a second space position, and acquiring the second space position.
Optionally, before the step of detecting the relative position distance between the first spatial position and the second spatial position, the method further comprises:
and establishing a virtual triangle in the current space environment by taking the position of the terminal in the current space environment as a vertex and the first space position and the second space position as bottom points respectively, and matching the virtual triangle with a preset triangle.
Optionally, the step of detecting a relative position distance between the second spatial position and the third spatial position includes:
acquiring a first coordinate of the first space position in the space coordinate system and a second coordinate of the second space position in the space coordinate system;
and calculating the relative position distance between the first coordinate and the second coordinate to obtain the first length of the bottom edge of the virtual triangle.
Optionally, the preset triangle is a triangle model created by taking the terminal as a vertex, taking a left earphone of the earphone as a left bottom point, and taking a right earphone of the earphone as a right bottom point,
the step of switching the output sound channel and the sound source output mode of the earphone according to the relative position parameters comprises the following steps:
when detecting that the difference value between the first length and the second length of the bottom side of the preset triangle is larger than a preset threshold value, switching the stereo output mode to a mono output mode;
when detecting that the difference value between the first length and the second length of the bottom edge of the preset triangle is smaller than or equal to the preset threshold value and the corresponding receivers of the virtual triangle and the bottom point of the preset triangle are not matched, switching preset output sound channels of the stereo output mode;
and when the difference value between the first length and the second length of the bottom edge of the preset triangle is smaller than or equal to the preset threshold value and the virtual triangle is matched with the receiver corresponding to the bottom point of the preset triangle, keeping the preset output sound channel.
Optionally, before the step of acquiring the first spatial position of the left earpiece and the second spatial position of the right earpiece when the sound source output mode is detected to be the stereo output mode, the method further includes:
and when detecting that the sound source mode of the audio data output by the target application is a single sound channel output mode, keeping the single sound channel output mode, and stopping executing the current and subsequent steps.
In addition, to achieve the above object, the present invention provides a switching device for earphone sound channels, including:
the application detection module is used for detecting the sound source output mode of the current running application of the terminal when the earphone is connected with the terminal;
the acquisition module is used for acquiring a first spatial position of the left earphone and a second spatial position of the right earphone when the sound source output mode is detected to be a stereo output mode;
the distance detection module is used for detecting the relative position distance between the first space position and the second space position;
and the switching module is used for switching the output sound channel and the sound source output mode of the earphone according to the relative position parameter.
In addition, in order to achieve the above object, the present invention also provides a terminal;
the terminal includes: a memory, a processor and a switching program of earphone channels stored on the memory and operable on the processor, wherein the switching program of earphone channels realizes the steps of the switching method of earphone channels as described above when executed by the processor.
In addition, to achieve the above object, the present invention also provides a storage medium;
the storage medium stores a switching program of earphone channels, and the switching program of earphone channels is executed by a processor to realize the steps of the switching method of earphone channels.
According to the switching method, the switching device, the switching terminal and the computer readable storage medium of the earphone sound channel, provided by the embodiment of the invention, when the earphone is connected with the terminal, a sound source output mode of the current running application of the terminal is detected; when the sound source output mode is detected to be a stereo output mode, acquiring a first spatial position of a left earphone of the earphone and a second spatial position of a right earphone of the earphone; detecting a relative positional distance of the first spatial position and the second spatial position with respect to each other; and switching the output sound channel and the sound source output mode of the earphone according to the relative position parameter.
The invention sets position sensors in the left and right earphones of the earphone respectively, when the earphone is connected with terminal equipment, detects the application of outputting audio data in the current running application of the terminal connected with the earphone and the sound source output mode of the application, when the sound source output mode of the application is detected to be a stereo output mode, in the current space environment, a space coordinate system is established by taking the position of the terminal as the original point, the coordinate positions of the left earphone and the right earphone in the established space coordinate system are obtained by the position sensors arranged in the left and right earphones of the earphone, the relative position distance between the left earphone and the right earphone is calculated by calculating the obtained coordinates of the left earphone and the right earphone, and a virtual triangle is established by the terminal position, the first space position of the left earphone and the second space position of the right earphone in the space coordinate system, and whether the left and right earphone marks corresponding to the bottom points of the virtual triangle are matched with the left and right earphone marks corresponding to the left and right bottom points of the preset triangle or not is determined, and according to the matching result of the corresponding marks, the first length of the bottom edge of the virtual triangle, namely the relative position distance between the left and right earphones of the earphone, and the error value between the second length of the bottom edge of the preset triangle, the sound source output mode of the terminal and the left and right output sound channels corresponding to the left and right earphones of the earphone are switched.
The automatic detection user wears the relative position of the left earphone and the right earphone of the earphone, and the switching of the earphone output sound channel and the sound source output mode is automatically completed by detecting the relative position distance between the left earphone and the right earphone, so that the user can obtain a good audio listening effect when wearing the earphone or only wearing one earphone, and the user can wear the earphone at will and enjoy higher use experience.
Drawings
Fig. 1 is a schematic diagram of a hardware structure of an alternative mobile terminal according to an embodiment of the present invention;
FIG. 2 is a diagram of a wireless communication device of the mobile terminal of FIG. 1;
FIG. 3 is a flowchart illustrating a switching method of earphone channels according to a first embodiment of the present invention;
FIG. 4 is a flowchart illustrating a switching method of earphone channels according to a second embodiment of the present invention;
FIG. 5 is a schematic diagram of a switching device for earphone channels according to the present invention;
FIG. 6 is a schematic view of an application scenario of the method for switching the earphone channels according to the present invention;
FIG. 7 is a diagram illustrating a terminal screen interface according to the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
In the following description, suffixes such as "module", "component", or "unit" used to denote elements are used only for facilitating the explanation of the present invention, and have no specific meaning in itself. Thus, "module", "component" or "unit" may be used mixedly.
The terminal may be implemented in various forms. For example, the terminal described in the present invention may include a mobile terminal such as a mobile phone, a tablet computer, a notebook computer, a palmtop computer, a Personal Digital Assistant (PDA), a Portable Media Player (PMP), a navigation device, a wearable device, a smart band, a pedometer, and the like, and a fixed terminal such as a Digital TV, a desktop computer, and the like.
The following description will be given by way of example of a mobile terminal, and it will be understood by those skilled in the art that the construction according to the embodiment of the present invention can be applied to a fixed type terminal, in addition to elements particularly used for mobile purposes.
Referring to fig. 1, which is a schematic diagram of a hardware structure of a mobile terminal for implementing various embodiments of the present invention, the mobile terminal 100 may include: RF (Radio Frequency) unit 101, WiFi module 102, audio output unit 103, a/V (audio/video) input unit 104, sensor 105, display unit 106, user input unit 107, interface unit 108, memory 109, processor 110, and power supply 111. Those skilled in the art will appreciate that the mobile terminal architecture shown in fig. 1 is not intended to be limiting of mobile terminals, which may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
The following describes each component of the mobile terminal in detail with reference to fig. 1:
the radio frequency unit 101 may be configured to receive and transmit signals during information transmission and reception or during a call, and specifically, receive downlink information of a base station and then process the downlink information to the processor 110; in addition, the uplink data is transmitted to the base station. Typically, radio frequency unit 101 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier, a duplexer, and the like. In addition, the radio frequency unit 101 can also communicate with a network and other devices through wireless communication. The wireless communication may use any communication standard or protocol, including but not limited to GSM (Global System for Mobile communications), GPRS (General Packet Radio Service), CDMA2000(Code Division Multiple Access 2000), WCDMA (Wideband Code Division Multiple Access), TD-SCDMA (Time Division-Synchronous Code Division Multiple Access), FDD-LTE (Frequency Division duplex Long Term Evolution), and TDD-LTE (Time Division duplex Long Term Evolution).
WiFi belongs to short-distance wireless transmission technology, and the mobile terminal can help a user to receive and send e-mails, browse webpages, access streaming media and the like through the WiFi module 102, and provides wireless broadband internet access for the user. Although fig. 1 shows the WiFi module 102, it is understood that it does not belong to the essential constitution of the mobile terminal, and may be omitted entirely as needed within the scope not changing the essence of the invention.
The audio output unit 103 may convert audio data received by the radio frequency unit 101 or the WiFi module 102 or stored in the memory 109 into an audio signal and output as sound when the mobile terminal 100 is in a call signal reception mode, a call mode, a recording mode, a voice recognition mode, a broadcast reception mode, or the like. Also, the audio output unit 103 may also provide audio output related to a specific function performed by the mobile terminal 100 (e.g., a call signal reception sound, a message reception sound, etc.). The audio output unit 103 may include a speaker, a buzzer, and the like.
The a/V input unit 104 is used to receive audio or video signals. The a/V input Unit 104 may include a Graphics Processing Unit (GPU) 1041 and a microphone 1042, the Graphics processor 1041 Processing image data of still pictures or video obtained by an image capturing device (e.g., a camera) in a video capturing mode or an image capturing mode. The processed image frames may be displayed on the display unit 106. The image frames processed by the graphic processor 1041 may be stored in the memory 109 (or other storage medium) or transmitted via the radio frequency unit 101 or the WiFi module 102. The microphone 1042 may receive sounds (audio data) via the microphone 1042 in a phone call mode, a recording mode, a voice recognition mode, or the like, and may be capable of processing such sounds into audio data. The processed audio (voice) data may be converted into a format output transmittable to a mobile communication base station via the radio frequency unit 101 in case of a phone call mode. The microphone 1042 may implement various types of noise cancellation (or suppression) algorithms to cancel (or suppress) noise or interference generated in the course of receiving and transmitting audio signals.
The mobile terminal 100 also includes at least one sensor 105, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor includes an ambient light sensor that can adjust the brightness of the display panel 1061 according to the brightness of ambient light, and a proximity sensor that can turn off the display panel 1061 and/or a backlight when the mobile terminal 100 is moved to the ear. As one of the motion sensors, the accelerometer sensor can detect the magnitude of acceleration in each direction (generally, three axes), can detect the magnitude and direction of gravity when stationary, and can be used for applications of recognizing the posture of a mobile phone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer and tapping), and the like; as for other sensors such as a fingerprint sensor, a pressure sensor, an iris sensor, a molecular sensor, a gyroscope, a barometer, a hygrometer, a thermometer, and an infrared sensor, which can be configured on the mobile phone, further description is omitted here.
The display unit 106 is used to display information input by a user or information provided to the user. The Display unit 106 may include a Display panel 1061, and the Display panel 1061 may be configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), or the like.
The user input unit 107 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the mobile terminal. Specifically, the user input unit 107 may include a touch panel 1071 and other input devices 1072. The touch panel 1071, also referred to as a touch screen, may collect a touch operation performed by a user on or near the touch panel 1071 (e.g., an operation performed by the user on or near the touch panel 1071 using a finger, a stylus, or any other suitable object or accessory), and drive a corresponding connection device according to a predetermined program. The touch panel 1071 may include two parts of a touch detection device and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts the touch information into touch point coordinates, sends the touch point coordinates to the processor 110, and can receive and execute commands sent by the processor 110. In addition, the touch panel 1071 may be implemented in various types, such as a resistive type, a capacitive type, an infrared ray, and a surface acoustic wave. In addition to the touch panel 1071, the user input unit 107 may include other input devices 1072. In particular, other input devices 1072 may include, but are not limited to, one or more of a physical keyboard, function keys (e.g., volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, and the like, and are not limited to these specific examples.
Further, the touch panel 1071 may cover the display panel 1061, and when the touch panel 1071 detects a touch operation thereon or nearby, the touch panel 1071 transmits the touch operation to the processor 110 to determine the type of the touch event, and then the processor 110 provides a corresponding visual output on the display panel 1061 according to the type of the touch event. Although the touch panel 1071 and the display panel 1061 are shown in fig. 1 as two separate components to implement the input and output functions of the mobile terminal, in some embodiments, the touch panel 1071 and the display panel 1061 may be integrated to implement the input and output functions of the mobile terminal, and is not limited herein.
The interface unit 108 serves as an interface through which at least one external device is connected to the mobile terminal 100. For example, the external device may include a wired or wireless headset port, an external power supply (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device having an identification module, an audio input/output (I/O) port, a video I/O port, an earphone port, and the like. The interface unit 108 may be used to receive input (e.g., data information, power, etc.) from external devices and transmit the received input to one or more elements within the mobile terminal 100 or may be used to transmit data between the mobile terminal 100 and external devices.
The memory 109 may be used to store a software program and various data, and the memory 109 may be a computer storage medium, and the memory 109 stores a switching program of the headphone channel according to the present invention. The memory 109 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the cellular phone, and the like. Further, the memory 109 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
The processor 110 is a control center of the mobile terminal, connects various parts of the entire mobile terminal using various interfaces and lines, and performs various functions of the mobile terminal and processes data by operating or executing software programs and/or modules stored in the memory 109 and calling data stored in the memory 109, thereby performing overall monitoring of the mobile terminal. For example, the processor 110 executes the switching program of the headphone channel in the memory 109 to implement the steps of the embodiments of the switching method of the headphone channel of the present invention.
Processor 110 may include one or more processing units; alternatively, the processor 110 may integrate an application processor, which mainly handles operating systems, user interfaces, application programs, etc., and a modem processor, which mainly handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 110.
The mobile terminal 100 may further include a power supply 111 (e.g., a battery) for supplying power to various components, and optionally, the power supply 111 may be logically connected to the processor 110 through a power management system, so as to implement functions of managing charging, discharging, and power consumption through the power management system.
Although not shown in fig. 1, the mobile terminal 100 may further include a bluetooth module or the like, which is not described in detail herein.
In order to facilitate understanding of the embodiments of the present invention, a communication network system on which the mobile terminal of the present invention is based is described below.
Referring to fig. 2, fig. 2 is an architecture diagram of a communication Network system according to an embodiment of the present invention, where the communication Network system is an LTE system of a universal mobile telecommunications technology, and the LTE system includes a UE (User Equipment) 201, an E-UTRAN (Evolved UMTS Terrestrial Radio Access Network) 202, an EPC (Evolved Packet Core) 203, and an IP service 204 of an operator, which are in communication connection in sequence.
Specifically, the UE201 may be the terminal 100 described above, and is not described herein again.
The E-UTRAN202 includes eNodeB2021 and other eNodeBs 2022, among others. Among them, the eNodeB2021 may be connected with other eNodeB2022 through backhaul (e.g., X2 interface), the eNodeB2021 is connected to the EPC203, and the eNodeB2021 may provide the UE201 access to the EPC 203.
The EPC203 may include an MME (Mobility Management Entity) 2031, an HSS (Home Subscriber Server) 2032, other MMEs 2033, an SGW (Serving gateway) 2034, a PGW (PDN gateway) 2035, and a PCRF (Policy and Charging Rules Function) 2036, and the like. The MME2031 is a control node that handles signaling between the UE201 and the EPC203, and provides bearer and connection management. HSS2032 is used to provide registers to manage functions such as home location register (not shown) and holds subscriber specific information about service characteristics, data rates, etc. All user data may be sent through SGW2034, PGW2035 may provide IP address assignment for UE201 and other functions, and PCRF2036 is a policy and charging control policy decision point for traffic data flow and IP bearer resources, which selects and provides available policy and charging control decisions for a policy and charging enforcement function (not shown).
The IP services 204 may include the internet, intranets, IMS (IP Multimedia Subsystem), or other IP services, among others.
Although the LTE system is described as an example, it should be understood by those skilled in the art that the present invention is not limited to the LTE system, but may also be applied to other wireless communication systems, such as GSM, CDMA2000, WCDMA, TD-SCDMA, and future new network systems.
Based on the hardware structure of the mobile terminal and the communication network system, the invention provides various embodiments of the switching method of the earphone sound channel.
The invention provides a switching method of earphone sound channels, which is applied to earphones provided with position sensors, wherein the earphones comprise a position sensor arranged on a left earphone and a position sensor arranged on a right earphone, and the switching method of the earphone sound channels comprises the following steps:
when the earphone is connected with the terminal, detecting a sound source output mode of the current running application of the terminal; when the sound source output mode is detected to be a stereo output mode, acquiring a first spatial position of a left earphone of the earphone and a second spatial position of a right earphone of the earphone; detecting a relative positional distance of the first spatial position and the second spatial position with respect to each other; and switching the output sound channel and the sound source output mode of the earphone according to the relative position parameter.
Specifically, in a first embodiment of the switching method of headphone channels of the present invention, referring to fig. 3, the method includes:
and step S10, when the earphone is connected with the terminal, detecting the sound source output mode of the current running application of the terminal.
When the terminal detects that the earphone device is connected, detecting an application which outputs audio data in the currently running application, and analyzing a sound source output mode when the application outputs audio.
The sound source output method for outputting audio includes, but is not limited to: a stereo output mode and a mono output mode.
Specifically, for example, the terminal system constantly monitors the current operating status of the terminal and the condition of the external device connected to the terminal, and when the terminal system detects that the terminal is currently connected to the earphone device, the terminal system obtains an application that is outputting audio data in the application currently running at the current time of the terminal, and analyzes whether the audio output by the application at the current time is stereo or mono, and determines that the sound source output mode of the application that is currently outputting the audio data is a stereo output mode or a mono output mode.
Further, step S10 includes:
step a, when detecting that the terminal is accessed into the earphone device, detecting a target application of the output audio data in all the currently running applications of the terminal.
When the terminal detects that the earphone device is connected at the current moment, all the applications running at the current moment are further detected, and the applications are classified, so that the target application for outputting audio data in all the applications is obtained.
Specifically, for example, when the terminal system detects that the terminal is connected to the earphone device at the current time, an application list of all applications that the terminal is running at the current time is obtained from the terminal system, all applications are classified according to categories of application output data in the application list, and a target application that outputs audio data in all the applications is obtained.
Step b, analyzing a sound source output mode of the audio data output by the target application, wherein the sound source output mode comprises the following steps: a stereo output mode and a mono output mode.
And detecting and analyzing a target application of the output audio data obtained from all the applications running at the current moment of the terminal, wherein the output audio data adopts a stereo output mode or a mono output mode.
Specifically, for example, a target application of the acquired output audio data is detected, whether the audio data output at the current time contains a stereo output effect flag or a mono output effect flag is detected, when the stereo output effect flag is contained, the sound source output mode of the target application is determined to be a stereo output mode, and when the mono output effect flag is contained, the sound source output mode of the target application is determined to be a mono output mode.
Step S20, when it is detected that the sound source output mode is a stereo output mode, acquiring a first spatial position of the left earpiece and a second spatial position of the right earpiece of the headset.
When the sound source output mode of the application outputting the audio data at the current moment through the detection terminal is a stereo output mode, a first space position of a left receiver and a second space position of a right receiver, which are sent by a position sensor in a left receiver and a position sensor in a right receiver of the earphone, are obtained.
Specifically, for example, when a target application of the acquired output audio data is detected, and a stereo output effect flag is included in the audio data output at the present time, a position sensor installed in a left earpiece of the headphone apparatus, a first spatial position in the present spatial environment transmitted at the present time, and a position sensor installed in a right earpiece of the headphone apparatus, a second spatial position in the present spatial environment transmitted at the present time are acquired.
Further, step S20 includes:
and c, when detecting that the sound source mode of the audio data output by the target application is a stereo output mode, establishing a space coordinate system according to the position of the terminal in the current space environment.
When the sound source output mode of the application for outputting the audio data at the current moment of the terminal is detected to be a stereo output mode, the position of the terminal is used as an original point, and a space coordinate system is established in the current space environment.
Specifically, for example, when a target application of the acquired output audio data is detected, and a stereo output effect flag is included in the audio data output at the current time, in the current spatial environment, the three-dimensional coordinate position of the terminal is marked as P (0, 0), and a spatial coordinate system is established in the current spatial environment with the three-dimensional coordinate position P (0, 0) of the terminal as an origin.
And d, marking the position of a position sensor in the left earphone of the earphone in the space coordinate system as a first space position, and acquiring the first space position.
And marking the position of the left earphone in a space coordinate system which is established by taking the terminal position as an origin as a first space position and is sent by a position sensor arranged in the left earphone of the earphone as the first space position, and acquiring the first space position.
Specifically, for example, in an application scenario as shown in fig. 6, the position sensors installed in the left and right earpieces of the headset may be ultrasonic sensors, the ultrasonic sensor installed in the right earpiece of the headset transmits a section of sound wave to the terminal, and by calculating sound wave parameters such as a beam deflection angle and a reflection time length of the sound wave reflected back by the terminal, a relative position of the ultrasonic sensor in a spatial coordinate system created by using the terminal position as an origin is obtained, the relative position is marked as a first spatial position, and the first spatial position is obtained.
And e, marking the position of the position sensor in the right earphone of the earphone in the space coordinate system as a second space position, and acquiring the second space position.
And marking the position of the right earphone in a space coordinate system which is established by taking the terminal position as an origin as a second space position and is sent by a position sensor arranged in the right earphone of the earphone as the second space position, and acquiring the second space position.
Specifically, for example, in an application scenario as shown in fig. 6, the position sensors installed in the left and right earpieces of the headset may be ultrasonic sensors, the ultrasonic sensor installed in the right earpiece of the headset transmits a section of sound wave to the terminal, and by calculating sound wave parameters such as a beam deflection angle and a reflection time length of the sound wave reflected back by the terminal, a relative position of the ultrasonic sensor in a spatial coordinate system created by using the terminal position as an origin is obtained, the relative position is marked as a first spatial position, and the first spatial position is obtained.
Step S30, detecting a relative position distance between the first spatial position and the second spatial position.
And in the acquired left and right earphones of the earphone, calculating the distance between the two position coordinates by using the first space position coordinate and the second space position coordinate sent by the respective position sensors, thereby obtaining the relative position distance between the left earphone and the right earphone of the earphone.
Specifically, for example, in the application scenario shown in fig. 6, a first spatial position and a second spatial position sent by position sensors in left and right earpieces of the headset are obtained, position coordinates in a spatial coordinate system created with the terminal position as an origin are obtained, and a relative position distance between the first spatial position and the second spatial position corresponding to the left and right earpieces of the headset in a current spatial coordinate system is calculated according to the respective position coordinates.
Further, step S30 includes:
and f, acquiring a first coordinate of the first space position in the space coordinate system and a second coordinate of the second space position in the space coordinate system.
In a space coordinate system established by taking the terminal position as an origin, a first coordinate of a left earphone position sensor of the earphone corresponding to a first space position and a second coordinate of a right earphone position sensor of the earphone corresponding to a second space position are obtained.
Specifically, for example, in the current spatial environment, with the three-dimensional coordinate position of the terminal as the origin point P (0, 0), in the established spatial coordinate system, the coordinates P (4, -4, 5) of the first spatial position transmitted by the position sensor installed in the left earpiece of the headset are acquired, the coordinates P (4, -4, 5) of the first spatial position are marked as the first coordinates, the coordinates P (-2, -5, 14) of the second spatial position transmitted by the position sensor installed in the right earpiece of the headset are acquired, and the coordinates P (-2, -5, 14) of the second spatial position are marked as the second coordinates.
And g, calculating the relative position distance between the first coordinate and the second coordinate to obtain the first length of the bottom side of the virtual triangle.
And calculating a relative position distance between a first coordinate of the earphone left earphone position sensor corresponding to the first space position and a second coordinate of the earphone right earphone position sensor corresponding to the second space position through a space coordinate distance algorithm, wherein the relative position distance is the length of the bottom side of a virtual triangle which is created by taking the terminal position, the first space position and the second space position as the top point and the bottom point, and the length is marked as the first length.
Specifically, for example, in the application scenario shown in fig. 6, by using the pythagorean theorem algorithm of the spatial coordinate distance, the relative position distance between the first coordinate P (4, -4, 5) of the left earpiece position sensor corresponding to the first spatial position and the second coordinate P (-2, -5, 14) of the right earpiece position sensor corresponding to the second spatial position is calculated to be 10.86 unit distances, and then the 10.86 unit distances are the length of the bottom side of a virtual triangle constructed by using the origin P (0, 0) as the vertex and using the two bottom points of the first coordinate P (4, -4, 5) and the second coordinate P (-2, -5, 14), and the length is marked as the first length, which is 10.86 unit lengths.
Step S40, switching the output channels and audio source output modes of the headphones according to the relative position parameters.
And switching and adjusting the output sound channel or sound source output mode of the earphone according to the comparison result between the detected relative position distance between the first space position and the second space position and the length of the connecting line between the left bottom point and the right bottom point of the preset triangle, namely the length of the bottom side of the preset triangle, and the matching result between the virtual triangle which is created by respectively taking the terminal position, the first space position and the second space position as the top point and each bottom point and the left and right earphone marks of the earphone corresponding to each bottom point of the preset triangle.
It should be noted that, a triangle is preset as a triangle model created by using the terminal as a vertex, the left earpiece of the earphone as a left bottom point, and the right earpiece of the earphone as a right bottom point, and the bottom edge length of the triangle model is a standard distance length between the left ear and the right ear of the human head.
Specifically, for example, according to the application scenario shown in fig. 6, when the comparison result between the relative position distance between the first spatial position and the second spatial position and the first length, that is, the length of the bottom side of the virtual triangle, and the connection line between the left bottom point and the right bottom point of the preset triangle and the second length, that is, the length of the bottom side is detected, the audio source output mode of the audio application output by the terminal is switched, or the comparison result between the first length of the bottom side of the virtual triangle, that is, the first length of the bottom side of the virtual triangle, and the second length of the bottom side of the preset triangle is combined with the matching result of the headphone marks corresponding to the virtual triangle, the preset triangle, and each of the left and right bottom points, so as to switch and adjust the left and right output channels of the headphones.
Further, step S40 includes:
and h, when detecting that the difference value between the first length and the second length of the bottom edge of the preset triangle is larger than a preset threshold value, switching the stereo output mode to a mono output mode.
And when the difference value between the first length of the bottom edge of the virtual triangle corresponding to the first spatial position and the second length of the bottom edge of the preset triangle is larger than the preset threshold value, switching the stereo output mode applied by the current audio output of the terminal to a mono output mode.
It should be noted that the preset threshold is a maximum allowable difference value set according to the distance difference between the left ear and the right ear of different human heads.
Specifically, for example, in the application scenario shown in fig. 6, if a difference between a relative position distance between a first spatial position sent by a position sensor in a left earphone of the headset and a second spatial position sent by a position sensor in a right earphone of the headset, that is, a first length of a bottom side of a virtual triangle is 10.86 unit lengths, and a second length of a bottom side of a preset triangle, that is, a standard distance length between a left ear and a right ear of a human head is 5.86 unit lengths (one unit is approximately equal to 2.33 centimeters), is 5 unit lengths, and is greater than a preset threshold value of 1.2 unit lengths, it is determined that the user currently wears only one earphone, and at this time, the terminal device connected to the current earphone outputs audio application, and a stereo output mode for outputting audio data is switched to a mono output mode.
And i, when detecting that the difference value between the first length and the second length of the bottom edge of the preset triangle is smaller than or equal to the preset threshold value and the corresponding earphones of the virtual triangle and the bottom point of the preset triangle are not matched, switching preset output sound channels of the stereo output mode.
And when the difference value between the first length of the virtual triangle bottom side corresponding to the first space position and the second length of the preset triangle bottom side is smaller than the preset threshold value, but the left and right earphone marks of the earphone corresponding to the left and right bottom points of the virtual triangle and the preset triangle are not matched, switching the preset output sound channels of the current stereo output of the earphone between each other.
It should be noted that, when the terminal outputs audio in a stereo output mode, the preset output channel is a left channel in which a left earpiece of the headset device outputs stereo, and a right channel in which a right earpiece of the headset device outputs stereo.
Specifically, for example, when the relative positional distance between a first spatial position transmitted by a position sensor in the left earpiece of the headset and a second spatial position transmitted by a position sensor in the right earpiece of the headset, namely a first length of the base of the virtual triangle and a second length of the base of the preset triangle, namely the difference value between the standard lengths which are equal to the left ear and the right ear of the head of the human body is less than a preset threshold value of 1.2 unit lengths, but when the left bottom point of the virtual triangle corresponds to the earphone mark of the earphone device and is not matched with the earphone mark of the earphone device corresponding to the left bottom point of the preset triangle, the user is determined to wear two earphones currently, however, the positions of the left and right earphones corresponding to the left and right ears of the earphone currently worn by the user are just opposite, at this time, the left channel of the stereo output of the left earphone of the preset earphone device is switched to the right channel, and the right channel of the stereo output of the right earphone of the earphone device is switched to the left channel.
And j, when detecting that the difference value between the first length and the second length of the bottom edge of the preset triangle is smaller than or equal to the preset threshold value and the virtual triangle is matched with a receiver corresponding to the bottom point of the preset triangle, keeping the preset output sound channel.
And when the difference value between the first length of the bottom edge of the virtual triangle corresponding to the first space position and the second length of the bottom edge of the preset triangle is smaller than the preset threshold value, and the virtual triangle is matched with the left and right earphone marks of the earphone corresponding to the left and right bottom points of the preset triangle, keeping the preset output sound channel of the current output stereo of the earphone.
Specifically, for example, when the relative positional distance between a first spatial position transmitted by a position sensor in the left earpiece of the headset and a second spatial position transmitted by a position sensor in the right earpiece of the headset, namely a first length of the base of the virtual triangle and a second length of the base of the preset triangle, namely the difference value between the standard lengths which are equal to the left ear and the right ear of the head of the human body is less than a preset threshold value of 1.2 unit lengths, and the bottom point of the virtual triangle corresponds to the earphone mark of the earphone device, when the bottom point of the virtual triangle is matched with the earphone mark of the earphone device corresponding to the bottom point of the preset triangle, the user is determined to wear two earphones currently, and the left and right earphones of the earphone worn by the user currently correspond to the left and right ear positions correctly, at the moment, the left earphone of the preset earphone equipment is kept to output a stereo left sound channel, and the right earphone of the earphone equipment outputs a stereo right sound channel.
In this embodiment, when the earphone is connected with the terminal, a sound source output mode of the current running application of the terminal is detected; when the sound source output mode is detected to be a stereo output mode, acquiring a first spatial position of a left earphone of the earphone and a second spatial position of a right earphone of the earphone; detecting a relative positional distance of the first spatial position and the second spatial position with respect to each other; and switching the output sound channel and the sound source output mode of the earphone according to the relative position parameter.
When the terminal detects that the earphone equipment is connected, detecting the application of outputting audio data in the currently running application, analyzing the audio source output mode when the application outputs audio, and when the audio source output mode of the application of outputting audio data at the current moment by detecting the terminal is a stereo output mode, acquiring a first spatial position of a left earphone and a second spatial position of a right earphone which are sent by a position sensor in the left earphone and the right earphone of the earphone, acquiring a first spatial position coordinate and a second spatial position coordinate which are sent by respective position sensors in the left earphone and the right earphone of the earphone, calculating the distance between the two position coordinates, thereby acquiring the relative position distance between the left earphone and the right earphone of the earphone, and according to the detected relative position distance between the first spatial position and the second position and the length of a connecting line between a left bottom point and a right bottom point of a preset triangle, the method comprises the steps of presetting a comparison result among the lengths of the bottom sides of a triangle, and switching and adjusting an output sound channel or a sound source output mode of the earphone according to a matching result between a virtual triangle which is created by respectively taking a terminal position, a first space position and a second space position as a vertex and each bottom point and a left earphone mark and a right earphone mark of the earphone corresponding to each bottom point of the preset triangle.
Realizes the automatic detection of the relative position of the left receiver and the right receiver of the earphone worn by the user, matches the relative position of the left receiver and the right receiver of the earphone worn by the user with the relative position of the left receiver and the right receiver of the preset earphone, and automatically determines whether the user normally wears the left and right earphones of the earphone or not by detecting the relative position distance between the left earphone and the right earphone corresponding to the bottom point of the constructed virtual triangle and the preset triangle, or whether the left and right receiver positions of the earphone are correct or not, and when the user wears one earphone receiver or the left and right receiver positions of the earphone are incorrect, the switching of the earphone output sound channel and the sound source output mode is automatically completed, the user can obtain a good audio listening effect when wearing the left earphone and the right earphone of the earphone reversely or only wearing one earphone, so that the user can wear the earphone at will and enjoy higher use experience.
Further, on the basis of the first embodiment of the present invention, a second embodiment of the method for switching an earphone sound channel of the present invention is provided, and referring to fig. 4, before the step of detecting a relative position distance between the first spatial position and the second spatial position, and before the step of acquiring the first spatial position of the left earpiece and the second spatial position of the right earpiece when the sound source output mode is detected to be a stereo output mode, the method for switching an earphone sound channel of the present invention further includes:
step S50, with the position of the terminal in the current spatial environment as a vertex and the first spatial position and the second spatial position as bottom points, creating a virtual triangle in the current spatial environment, and matching the virtual triangle with a preset triangle.
In the current space environment, the position of the terminal equipment in the current space is taken as a vertex, the first spatial position of the left earphone in the space environment and the second spatial position of the right earphone in the space environment are taken as bottom points, a virtual triangle is created in the current space, and the virtual triangle is matched with the corresponding position of each point of a preset triangle which is pre-established in a terminal system.
Specifically, for example, in the application scenario shown in fig. 6, the position of the terminal device connected to the earphone in the current spatial environment is taken as the vertex, the three-dimensional coordinate position in the spatial coordinate system established with the terminal position as the origin, which is sent by the position sensor in the left earphone of the earphone, and the virtual triangle established with the three-dimensional coordinate position in the current spatial coordinate system as the bottom, which is sent by the position sensor in the right earphone of the earphone, are taken as the vertices, the left earphone of the earphone device is taken as the left bottom, the left earphone device left and right earphone marks corresponding to the left and right bottom points of the triangle model established with the right earphone of the earphone device as the right bottom are matched with each other as shown in the terminal interface of fig. 7, and when the left and right earphone device left and right earphone marks corresponding to the left and right bottom points of the virtual triangle are matched with the left and right earphone device left and right earphone positions corresponding to the preset left and right bottom points of the earphone device When the left and right earphone marks of the earphone equipment corresponding to the left and right bottom points of the virtual triangle are not matched with the left and right earphone marks of the earphone equipment corresponding to the left and right bottom points of the preset triangle, the left and right earphones corresponding to the left and right earphones of the user are determined to be in wrong positions, namely the left earphone and the right earphone are worn by the left ear and the right earphone.
Step S60, when it is detected that the sound source mode of the audio data output by the target application is a mono output mode, the mono output mode is maintained, and the current and subsequent steps are stopped.
When the terminal system detects that the terminal is connected with the earphone device and the sound source output mode of the audio output application in the current running application is a single sound channel output mode, the single sound channel output mode is kept to output audio, and the current and subsequent steps are stopped to be executed.
Specifically, for example, when the terminal system detects that the terminal is currently connected to the earphone device, all applications currently running at the current time of the terminal are acquired, whether the output audio at the current time is stereo or mono is analyzed, when it is determined that the sound source output mode of the application outputting the audio currently running at the current time is a mono output mode, the earphone device is kept outputting audio data in the mono output mode, and the step of acquiring the first spatial position of the left earphone of the earphone and the second spatial position of the right earphone of the earphone is stopped, and the subsequent step of detecting and switching the output channels of the earphone is stopped.
In this embodiment, a virtual triangle is created in the current spatial environment by taking the position of the terminal in the current spatial environment as a vertex and the first spatial position and the second spatial position as bottom points, and the virtual triangle is matched with a preset triangle; and when detecting that the sound source mode of the audio data output by the target application is a single sound channel output mode, keeping the single sound channel output mode, and stopping executing the current and subsequent steps. In the current space environment, the position of the terminal equipment in the current space is taken as a vertex, the first spatial position of the left earphone in the space environment and the second spatial position of the right earphone in the space environment are taken as bottom points, a virtual triangle is created in the current space, and the virtual triangle is matched with the corresponding position of each point of a preset triangle which is pre-established in a terminal system; when the terminal system detects that the terminal is connected with the earphone device and the sound source output mode of the audio output application in the current running application is a single sound channel output mode, the single sound channel output mode is kept to output audio, and the current and subsequent steps are stopped to be executed.
When the user accesses the earphone into the terminal equipment, the terminal automatically detects the sound source output mode of the running application outputting the audio, when the application is detected to output the audio in a single sound channel output mode, the single sound channel output mode is maintained without switching the left and right output sound channels of the earphone equipment, and the execution of the series steps of switching the sound channels of the earphone is stopped, so that unnecessary background running is avoided, and running resources are saved; when the earphone is connected to the terminal equipment, in the current space environment, the virtual triangle is constructed by the left and right earphones of the earphone and the terminal equipment, the positions of the left and right earphones corresponding to each point of the virtual triangle and the positions of the corresponding earphones of each point of the preset triangle are matched, the mode that the user wears the earphone is determined constantly, the accuracy rate of detecting the position of the user wearing the earphone is improved, and the detection efficiency is further improved.
In addition, referring to fig. 5, an embodiment of the present invention further provides a switching device for earphone sound channels, where the switching device for earphone sound channels includes:
the application detection module is used for detecting the sound source output mode of the current running application of the terminal when the earphone is connected with the terminal;
the acquisition module is used for acquiring a first spatial position of the left earphone and a second spatial position of the right earphone when the sound source output mode is detected to be a stereo output mode;
the distance detection module is used for detecting the relative position distance between the first space position and the second space position;
and the switching module is used for switching the output sound channel and the sound source output mode of the earphone according to the relative position parameter.
Optionally, the application detection module includes:
the application determining unit is used for detecting all current running applications of the terminal and outputting a target application of audio data when the terminal is detected to be accessed into the earphone device;
an analysis unit configured to analyze a sound source output mode of the target application outputting the audio data, the sound source output mode including: a stereo output mode and a mono output mode.
Optionally, the obtaining module includes:
the system establishing unit is used for establishing a space coordinate system according to the position of the terminal in the current space environment when detecting that the sound source mode of the audio data output by the target application is a stereo output mode;
the position acquisition unit marks the position of a position sensor in the left earphone of the earphone in the space coordinate system as a first space position and acquires the first space position;
and the position acquisition unit marks the position of the position sensor in the right earphone of the earphone in the space coordinate system as a second space position and acquires the second space position.
Optionally, before the distance detecting module, the method further includes:
and the graph construction module is used for creating a virtual triangle in the current space environment by taking the position of the terminal in the current space environment as a vertex and the first space position and the second space position as bottom points respectively, and matching the virtual triangle with a preset triangle.
Optionally, the distance detection module includes:
a coordinate acquisition unit that acquires a first coordinate of the first spatial position in the spatial coordinate system and a second coordinate of the second spatial position in the spatial coordinate system;
and the calculating unit is used for calculating the relative position distance between the first coordinate and the second coordinate so as to obtain the first length of the bottom side of the virtual triangle.
Optionally, the switching module includes:
the output mode switching unit is used for switching the stereo output mode to a mono output mode when detecting that the difference value between the first length and the second length of the bottom edge of the preset triangle is greater than a preset threshold value;
the output sound channel switching unit is used for switching preset output sound channels of the stereo output mode when detecting that the difference value between the first length and the second length of the bottom edge of the preset triangle is smaller than or equal to the preset threshold value and the bottom points of the virtual triangle and the preset triangle are not matched with corresponding receivers;
and the output sound channel holding unit is used for holding the preset output sound channel when detecting that the difference value between the first length and the second length of the bottom edge of the preset triangle is smaller than or equal to the preset threshold value and the virtual triangle is matched with the receiver corresponding to the bottom point of the preset triangle.
Optionally, the distance detection module further includes:
and the step break stopping unit is used for keeping the single sound channel output mode and stopping executing the current and subsequent steps when detecting that the sound source mode of the audio data output by the target application is the single sound channel output mode.
The steps implemented by the functional modules of the switching device for earphone sound channels may refer to the embodiments of the switching method for earphone sound channels of the present invention, and are not described herein again.
The present invention also provides a terminal, including: memory, processor, communication bus and a switching program of headphone channels stored on the memory:
the communication bus is used for realizing connection communication between the processor and the memory;
the processor is configured to execute the program for switching the headphone channels to implement the steps of the embodiments of the method for switching the headphone channels.
The present invention also provides a computer readable storage medium storing one or more programs, which are further executable by one or more processors for implementing the steps of the embodiments of the switching method of headphone channels described above.
The specific implementation of the computer readable storage medium of the present invention is substantially the same as the embodiments of the method for switching the earphone channels, and will not be described herein again.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
While the present invention has been described with reference to the embodiments shown in the drawings, the present invention is not limited to the embodiments, which are illustrative and not restrictive, and it will be apparent to those skilled in the art that various changes and modifications can be made therein without departing from the spirit and scope of the invention as defined in the appended claims.

Claims (7)

1. A method for switching earphone sound channels is applied to an earphone with a position sensor mounted on a receiver, and comprises the following steps:
when the earphone is connected with the terminal, detecting a sound source output mode of the current running application of the terminal;
when the sound source output mode is detected to be a stereo output mode, acquiring a first spatial position of a left earphone of the earphone and a second spatial position of a right earphone of the earphone;
creating a virtual triangle in the current space environment by taking the position of the terminal in the current space environment as a vertex and the first space position and the second space position as bottom points respectively, and matching the virtual triangle with a preset triangle, wherein the preset triangle is a triangle model created by taking the terminal as the vertex, a left earphone of the earphone as a left bottom point and a right earphone of the earphone as a right bottom point;
acquiring a first coordinate of the first space position in a space coordinate system and a second coordinate of the second space position in the space coordinate system;
calculating the relative position distance between the first coordinate and the second coordinate to obtain a first length of the bottom edge of the virtual triangle;
when detecting that the difference value between the first length and the second length of the bottom side of the preset triangle is larger than a preset threshold value, switching the stereo output mode to a mono output mode;
when detecting that the difference value between the first length and the second length of the bottom edge of the preset triangle is smaller than or equal to the preset threshold value and the corresponding receivers of the virtual triangle and the bottom point of the preset triangle are not matched, switching preset output sound channels of the stereo output mode;
and when the difference value between the first length and the second length of the bottom edge of the preset triangle is smaller than or equal to the preset threshold value and the virtual triangle is matched with the receiver corresponding to the bottom point of the preset triangle, keeping the preset output sound channel.
2. The method for switching the audio channels of the headphones according to claim 1, wherein the step of detecting the audio output mode of the currently running application of the terminal when the headphones are connected to the terminal comprises:
when the terminal is detected to be accessed into the earphone device, detecting a target application of audio data output from all applications currently running by the terminal;
analyzing a sound source output mode of the audio data output by the target application, wherein the sound source output mode comprises the following steps: a stereo output mode and a mono output mode.
3. The method for switching the channel of a headphone as claimed in claim 2, wherein the step of obtaining the first spatial position of the left headphone and the second spatial position of the right headphone when the audio source output mode is detected as the stereo output mode comprises:
when detecting that the sound source mode of the audio data output by the target application is a stereo output mode, establishing a space coordinate system according to the position of the terminal in the current space environment;
marking the position of a position sensor in the left earphone of the earphone in the space coordinate system as a first space position, and acquiring the first space position;
and marking the position of a position sensor in the right earphone of the earphone in the space coordinate system as a second space position, and acquiring the second space position.
4. The method for switching the channel of a headphone as claimed in claim 1, wherein before the step of obtaining the first spatial position of the left headphone and the second spatial position of the right headphone when the audio source output mode is detected as the stereo output mode, the method further comprises:
and when detecting that the sound source mode of the audio data output by the target application is a single sound channel output mode, keeping the single sound channel output mode, and stopping executing the current step and the subsequent steps.
5. A switching apparatus of headphone channels, characterized in that the switching apparatus of headphone channels comprises:
the application detection module is used for detecting the sound source output mode of the current running application of the terminal when the earphone is connected with the terminal;
the acquisition module is used for acquiring a first spatial position of the left earphone and a second spatial position of the right earphone when the sound source output mode is detected to be a stereo output mode;
the image construction module is used for creating a virtual triangle in the current space environment by taking the position of the terminal in the current space environment as a vertex and the first space position and the second space position as bottom points respectively, and matching the virtual triangle with a preset triangle, wherein the preset triangle is a triangle model created by taking the terminal as the vertex, a left earphone of the earphone as a left bottom point and a right earphone of the earphone as a right bottom point;
the distance detection module is used for acquiring a first coordinate of the first space position in a space coordinate system and a second coordinate of the second space position in the space coordinate system; calculating a relative position distance between the first coordinate and the second coordinate to obtain a first length of the bottom side of the virtual triangle;
the switching module is used for switching the stereo output mode to a mono output mode when detecting that the difference value between the first length and the second length of the bottom edge of the preset triangle is greater than a preset threshold value; or when detecting that the difference value between the first length and the second length of the bottom edge of the preset triangle is smaller than or equal to the preset threshold value and the corresponding earphones of the virtual triangle and the bottom point of the preset triangle are not matched, switching preset output sound channels of the stereo output mode; or when the difference value between the first length and the second length of the bottom edge of the preset triangle is smaller than or equal to the preset threshold value and the virtual triangle is matched with the receiver corresponding to the bottom point of the preset triangle, the preset output sound channel is kept.
6. A terminal, characterized in that the terminal comprises: memory, processor and a switching program of headphone channels stored on the memory and executable on the processor, the switching program of headphone channels when executed by the processor implementing the steps of the switching method of headphone channels according to any one of claims 1 to 4.
7. A storage medium having a headphone channel switching program stored thereon, the headphone channel switching program being executed by a processor to implement the steps of the headphone channel switching method according to any one of claims 1 to 4.
CN201811448376.3A 2018-11-29 2018-11-29 Earphone sound channel switching method, earphone sound channel switching device, terminal and storage medium Active CN109195058B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811448376.3A CN109195058B (en) 2018-11-29 2018-11-29 Earphone sound channel switching method, earphone sound channel switching device, terminal and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811448376.3A CN109195058B (en) 2018-11-29 2018-11-29 Earphone sound channel switching method, earphone sound channel switching device, terminal and storage medium

Publications (2)

Publication Number Publication Date
CN109195058A CN109195058A (en) 2019-01-11
CN109195058B true CN109195058B (en) 2022-01-14

Family

ID=64938433

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811448376.3A Active CN109195058B (en) 2018-11-29 2018-11-29 Earphone sound channel switching method, earphone sound channel switching device, terminal and storage medium

Country Status (1)

Country Link
CN (1) CN109195058B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111031432A (en) * 2019-12-20 2020-04-17 歌尔股份有限公司 Neck-wearing earphone, function switching method, system, device and computer medium
CN111372166B (en) * 2020-02-21 2021-10-01 华为技术有限公司 Intelligent left and right ear identification method and related equipment
CN113411702B (en) * 2020-03-16 2024-05-14 维沃移动通信有限公司 Sound channel configuration method and electronic equipment
CN111464906A (en) * 2020-04-10 2020-07-28 歌尔科技有限公司 Headset and left and right sound channel switching device and method thereof
CN112733840A (en) * 2020-12-28 2021-04-30 歌尔光学科技有限公司 Earphone positioning method, terminal equipment and storage medium

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102026082A (en) * 2009-09-21 2011-04-20 联想(北京)有限公司 Track self-adaptive method and device for sound producing device
CN103245337A (en) * 2012-02-14 2013-08-14 联想(北京)有限公司 Method for acquiring position of mobile terminal, mobile terminal and position detection system
CN104101341A (en) * 2013-04-02 2014-10-15 广州三星通信技术研究有限公司 Method for positioning between mobile terminals and mobile terminal using the same
CN105491469A (en) * 2014-09-15 2016-04-13 Tcl集团股份有限公司 Method and system for controlling audio output mode based on wearing earphone state
CN106162444A (en) * 2016-09-08 2016-11-23 三星电子(中国)研发中心 Channel configuration method and apparatus, terminal and audio amplifier for audio frequency broadcast system
CN106454588A (en) * 2016-09-30 2017-02-22 维沃移动通信有限公司 Earphone and earphone channel switching method
CN106775571A (en) * 2017-03-21 2017-05-31 北京小米移动软件有限公司 Audio frequency playing method and device
CN108307261A (en) * 2017-01-11 2018-07-20 中兴通讯股份有限公司 A kind of adaptive earphone sound channel switching method and apparatus

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102026082A (en) * 2009-09-21 2011-04-20 联想(北京)有限公司 Track self-adaptive method and device for sound producing device
CN103245337A (en) * 2012-02-14 2013-08-14 联想(北京)有限公司 Method for acquiring position of mobile terminal, mobile terminal and position detection system
CN104101341A (en) * 2013-04-02 2014-10-15 广州三星通信技术研究有限公司 Method for positioning between mobile terminals and mobile terminal using the same
CN105491469A (en) * 2014-09-15 2016-04-13 Tcl集团股份有限公司 Method and system for controlling audio output mode based on wearing earphone state
CN106162444A (en) * 2016-09-08 2016-11-23 三星电子(中国)研发中心 Channel configuration method and apparatus, terminal and audio amplifier for audio frequency broadcast system
CN106454588A (en) * 2016-09-30 2017-02-22 维沃移动通信有限公司 Earphone and earphone channel switching method
CN108307261A (en) * 2017-01-11 2018-07-20 中兴通讯股份有限公司 A kind of adaptive earphone sound channel switching method and apparatus
CN106775571A (en) * 2017-03-21 2017-05-31 北京小米移动软件有限公司 Audio frequency playing method and device

Also Published As

Publication number Publication date
CN109195058A (en) 2019-01-11

Similar Documents

Publication Publication Date Title
CN109195058B (en) Earphone sound channel switching method, earphone sound channel switching device, terminal and storage medium
CN109511037B (en) Earphone volume adjusting method and device and computer readable storage medium
CN108037845B (en) Display control method, mobile terminal and computer-readable storage medium
CN108566479B (en) Screen state control method, mobile terminal and computer readable storage medium
CN109144441B (en) Screen adjusting method, terminal and computer readable storage medium
CN108184023B (en) Screen state control method, mobile terminal and computer readable storage medium
CN107465239B (en) Charging control method, charger, terminal, and computer-readable storage medium
CN108038834B (en) Method, terminal and computer readable storage medium for reducing noise
CN109710159B (en) Flexible screen response method and device and computer readable storage medium
CN112019929A (en) Volume adjusting method and device
CN108600489B (en) Earphone, calibration method of loudspeaker, mobile terminal and readable storage medium
CN112261535A (en) Major-minor switching method and device for wireless earphone and readable storage medium
CN109491577B (en) Holding interaction method and device and computer readable storage medium
CN109683778B (en) Flexible screen control method and device and computer readable storage medium
CN113805837A (en) Audio processing method, mobile terminal and storage medium
CN107517487B (en) Call control method and mobile terminal
CN112102780B (en) Display frame rate regulation and control method, device and computer readable storage medium
CN109561221B (en) Call control method, device and computer readable storage medium
CN108040311B (en) Audio playing method, terminal and computer readable storage medium
CN112437472A (en) Network switching method, equipment and computer readable storage medium
CN109669616B (en) Side screen interaction control method and device and computer readable storage medium
CN107728789B (en) Starting method of one-hand operation mode, terminal and storage medium
CN111443818A (en) Screen brightness regulation and control method and device and computer readable storage medium
CN108897417B (en) Working mode adjusting method, mobile terminal and computer readable storage medium
CN109842718B (en) Call adjustment method, terminal and computer readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant