WO2020097914A1 - 一种音频模式调节的方法、装置及电子设备 - Google Patents

一种音频模式调节的方法、装置及电子设备 Download PDF

Info

Publication number
WO2020097914A1
WO2020097914A1 PCT/CN2018/115903 CN2018115903W WO2020097914A1 WO 2020097914 A1 WO2020097914 A1 WO 2020097914A1 CN 2018115903 W CN2018115903 W CN 2018115903W WO 2020097914 A1 WO2020097914 A1 WO 2020097914A1
Authority
WO
WIPO (PCT)
Prior art keywords
audio
mode
call
application program
audio mode
Prior art date
Application number
PCT/CN2018/115903
Other languages
English (en)
French (fr)
Inventor
李亚军
Original Assignee
深圳市欢太科技有限公司
Oppo广东移动通信有限公司
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 深圳市欢太科技有限公司, Oppo广东移动通信有限公司 filed Critical 深圳市欢太科技有限公司
Priority to PCT/CN2018/115903 priority Critical patent/WO2020097914A1/zh
Priority to CN201880098215.8A priority patent/CN112771495B/zh
Publication of WO2020097914A1 publication Critical patent/WO2020097914A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/16Sound input; Sound output

Definitions

  • the invention relates to the field of information technology, in particular to a method, device and electronic device for adjusting an audio mode.
  • its audio resources can be called through different applications, for example, the audio resources of the mobile terminal can be called through the music application software to achieve music playback, the ringtone can be played through the calling software, or the recording software Realize the call of microphone and other resources.
  • audio modes will be used to play or record audio resources. For example, in mobile terminals, ordinary Normal mode, headset Headset mode, and hands-free Freehand mode will be used. However, for mobile terminals, if the audio mode is adjusted when the current application calls the audio resource and will not be restored in time, the current audio mode is found to be abnormal when the next application calls the audio resource, resulting in playback or recording failure, resulting in the system Poor stability.
  • An embodiment of the present application provides a method for adjusting an audio mode, including:
  • the audio mode will be adjusted to the preset mode after the call ends.
  • An embodiment of the present application further provides an apparatus for adjusting an audio mode.
  • the apparatus includes:
  • the monitoring module is used to monitor the audio resource calling behavior of the application
  • An obtaining module used to obtain the audio mode of the application in the process of calling audio resources
  • the adjustment module is used to adjust the audio mode to the preset mode after the call ends if the application program adjusts the audio mode to a non-preset mode during the audio resource call.
  • An electronic device includes a memory and a processor.
  • a computer program is stored in the memory.
  • the processor causes the processor to perform the above-mentioned audio mode adjustment steps.
  • Embodiments of the present application also provide a computer non-volatile readable storage medium on which a computer program is stored.
  • the computer program is executed by a processor, the steps of adjusting the audio mode as described above are implemented.
  • the electronic device and the computer-readable storage medium implement the above method, if the audio mode is changed during the audio resource call, the audio mode is set to the preset mode after the audio resource call ends, which solves the system in the prior art
  • the problem of poor stability improves system stability.
  • FIG. 1 is a flowchart of an audio mode adjustment method according to an embodiment
  • FIG. 2 is a schematic structural diagram of an audio mode adjustment device according to an embodiment
  • FIG. 3 is a schematic diagram of the internal structure of an electronic device in an embodiment
  • FIG. 4 is a block diagram of a partial structure of an electronic device related to a computer device provided by an embodiment of the present invention.
  • an embodiment of the present application provides a method for calling an audio resource, which is applied to an electronic device.
  • the method includes:
  • Audio resources in the embodiments of the present application may be resources required for playing audio, such as speakers, audio channels, audio files, etc., or resources required for recording, such as microphones, audio circuits, recording data storage, audio
  • the recording processor, etc. can also be the audio file itself, such as mp3 files, wav files, etc.
  • the embodiments of the present application do not limit this.
  • the audio resource of the application can be called through the electronic device, and the audio resource can be called through the processing function built in the electronic device.
  • a brand-new monitoring mechanism is creatively proposed, that is, a system-level monitoring module is created at the system framework layer, and the state of the audio resource is monitored by the monitoring module, or a monitoring is independently created.
  • the process monitors the audio resource status of the application through a message transmission mechanism.
  • the electronic device can monitor the adjustment of the audio mode of the application through the built-in monitoring function.
  • a system-level monitoring module can be created at the system framework layer (native local framework layer or framework layer) , Monitor the audio mode of the application through the monitoring module, or create a monitoring process independently and monitor the audio mode of the application through a message transmission mechanism.
  • system_server system service program
  • the audio mode can be divided into normal Normal, headset Headset, and hands-free Handfree mode, where Normal mode is the default mode, and the headset mode is switched to this mode when the headset is plugged in, while the hands-free mode is It is the audio mode of voice call, and the audio is output through the speaker.
  • the audio mode can also be divided into music mode, alarm mode RINGSTONE and voice mode INCALL.
  • Different audio modes can be switched between each other, corresponding to different audio resources, the audio mode can be adjusted, in addition, corresponding to different applications, can be set to different audio modes. For example, for music playback applications, the corresponding audio mode is music mode, for alarm software, the corresponding audio mode is alarm mode, and for voice communication software, the corresponding audio mode can be normal Normal One of the mode, headphone mode or hands-free mode.
  • the QICQ software can make digital voice calls. For example, after the QICQ software performs a voice group chat, even if the phone is hung up, the recording channel has not been released. If the new QICQ software needs to occupy the recording channel at this time Send voice, although the system can start recording at this time, the system only supports one recording channel, which will cause the new QICQ software to fail to send voice;
  • the audio mode is set to voice mode, after the voice call ends, it switches to the background operation The system did not return to the default audio mode.
  • the new QICQ software sends voice, the selected input device can only be the secondary MIC, resulting in poor quality of the recorded sound, which causes the other party to sound low and noisy.
  • such a correction mode is adopted: when an application changes the audio mode during the audio resource call, the default audio mode (that is, the preset audio mode) is adjusted to other Audio mode (ie non-preset audio mode). Among them, the audio mode can be monitored through the monitoring mechanism mentioned in S110. If the corresponding parameter of the audio mode changes, it is determined that the audio mode has been adjusted. After the audio resource is called, the audio mode is adjusted to the original The default mode (ie preset mode). Such as Normal audio mode, alarm mode, music mode or voice mode.
  • different audio modes can be switched or called by different functions in the Android software development kit (SDK).
  • SDK Android software development kit
  • the audio mode can be switched by the following different functions.
  • the Android SDK development kit :
  • AdjustStreamVolume (int streamType, int direction, int flags) represents the specified type of sound for adjusting electronic equipment.
  • the first parameter streamType specifies the sound type (or audio mode), the parameter includes one of the following:
  • intSTREAM_ALARM the sound of mobile phone alarm
  • intSTREAM_DTMF DTMF tone sound
  • intSTREAM_MUSIC the sound of mobile phone music
  • intSTREAM_NOTIFICATION the sound of the system prompt
  • intSTREAM_RING The sound of the phone ringtone
  • intSTREAM_SYSTEM the sound of the mobile phone system
  • intSTREAM_VOICE_CALL Voice call voice.
  • the second parameter specifies to increase or decrease the sound.
  • This parameter can accept the following values:
  • ADJUST_LOWER lowers the volume
  • ADJUST_RAISE increases the volume
  • the third parameter is the flag when adjusting the sound. For example, if you specify FLAG_SHOW_UI, you can specify that the volume progress bar is displayed when adjusting the sound.
  • Function 2 void setMicrophoneMute (booleanon) sets whether to mute the microphone. Set to true to mute the microphone; false to turn off the mute.
  • Function 3 void setMode (intmode): Set the sound mode.
  • the values that can be set are NORMAL, RINGTONE, and IN_CALL.
  • void setRingerMode sets the ringtone mode of the mobile phone.
  • the following attribute values can be supported:
  • int RINGER_MODE_SILENT The ringtone of the mobile phone is muted.
  • Function 5 void setSpeakerphoneOn (booleanon): Set the speaker on or off. Set to true to enable hands-free calling; false to disable hands-free calling.
  • Function 6 void setStreamMute (intstreamType, booleanstate): mute the specified type of sound of the mobile phone.
  • the streamType parameter has the same meaning as the first parameter in the adjustStreamVolume method.
  • Function 7 void setStreamVolume (int streamType, int index, int flags): directly set the volume value of the specified type of the mobile phone.
  • the streamType parameter has the same meaning as the first parameter in the adjustStreamVolume method.
  • the audio mode is set to the preset mode. That is, if the audio mode is the preset mode during the audio resource call, there is no need to change the audio mode after the audio resource call is completed, and no processing is required; and if the audio mode is the non-preset mode during the audio resource call, After the audio resource is called, the audio mode is changed to the preset mode. Use the above method to set the audio mode.
  • the audio mode is set to the normal Normal mode after the call ends, that is, for the above-mentioned existing Technical example, when the application program calls the audio resource, it has been switched to the voice mode, and then the mode is switched to the preset mode after the audio resource is called, for example, the Normal mode.
  • the audio mode is set to the normal Normal mode after the call is completed.
  • the headset mode will automatically switch when the headset is plugged in, and automatically switch to the normal mode when the headset is unplugged.
  • the headset mode is also related to the current application.
  • the current application has the permission to adjust the headset mode, that is, by running The application can be adjusted to the headset mode without waiting for the headset to be plugged in, but when the application is adjusted to the headset mode, the audio resource is not released, resulting in the headset mode cannot be restored, and the next application needs to call the audio resource Can only be called in headset mode, resulting in abnormal output of system audio. Therefore, it is necessary to set the audio mode to normal Normal mode after the application program calls the audio resource, so that the next application program can call the audio resource.
  • the audio mode is set to the normal Normal mode after the call is completed.
  • the method further includes: acquiring current environmental state information of the electronic device; during the audio resource invocation process of the application, adaptively adjusting the audio mode to an audio mode corresponding to the environmental state And set the audio mode to normal normal mode after the call.
  • the environmental status information of the electronic device may be one or several different combinations of playback, voice, hands-free, headphones, or recording.
  • there is a corresponding relationship between the environmental state and the audio mode for example, the audio mode is a voice call mode or a hands-free mode in the voice state.
  • the environment state is adaptively changed. Corresponding environmental status, and set to Normal mode after the end of the call.
  • the method further includes: acquiring audio resource call permission information of the application program, the permission information including an audio mode corresponding to the application program; calling permission information according to the audio resource of the application program ,
  • the application program adaptively adjusts to the corresponding audio mode during the call of the audio resource, and sets the audio mode to the normal Normal mode after the call ends.
  • different audio modes can be selected.
  • the permission information may include multiple audio modes suitable for the application. For example, the permission information of the application A includes the voice mode and Alarm mode, and the permission information of application B only includes voice mode.
  • the permission information of the application can be determined according to the priority of the application, for example, the system-level application has a high priority, and the non-system-level application has a low priority.
  • the audio resource call of the application program is monitored. If the application program adjusts the audio mode to a non-preset mode during the call process, the audio mode will be adjusted to the preset mode after the call is completed. To prevent the abnormal situation of the audio resource call of the electronic device, and improve the stability of the system.
  • an embodiment of the present application further provides an apparatus 20 for adjusting an audio mode.
  • the apparatus 20 includes:
  • the monitoring module 21 is used for monitoring the audio resource calling behavior of the application program
  • Audio resources in the embodiments of the present application may be resources required for playing audio, such as speakers, audio channels, audio files, etc., or resources required for recording, such as microphones, audio circuits, recording data storage, audio
  • the recording processor, etc. can also be the audio file itself, such as mp3 files, wav files, etc.
  • the embodiments of the present application do not limit this.
  • the audio resource of the application can be called through the electronic device, and the audio resource can be called through the processing function built in the electronic device.
  • a brand-new monitoring mechanism is creatively proposed, that is, a system-level monitoring module 21 is created at the system framework layer, and the audio resource status is monitored by the monitoring module 21, or
  • the module 21 is not created in the system framework layer, but creates a monitoring process independently, and monitors the audio resource status of the application through a message transmission mechanism.
  • the monitoring module 21 can monitor the audio mode adjustment of the application through the built-in monitoring function.
  • a system-level monitoring can be created at the system framework layer (native local framework layer or framework layer)
  • the module monitors the audio mode of the application through the monitoring module, or independently creates a monitoring process and monitors the audio mode of the application through a message transmission mechanism.
  • system_server system service program
  • the obtaining module 22 is used to obtain the audio mode of the application program during the audio resource invocation process
  • the audio mode can be divided into normal Normal, headset Headset, and hands-free Handfree mode, where Normal mode is the default mode, and the headset mode is switched to this mode when the headset is plugged in, and the hands-free Mode is the audio mode of voice call, audio output through the speaker.
  • the audio mode can also be divided into music mode, alarm mode RINGSTONE and voice mode INCALL.
  • Different audio modes can be switched between each other, corresponding to different audio resources, the audio mode can be adjusted, in addition, corresponding to different applications, can be set to different audio modes. For example, for music playback applications, the corresponding audio mode is music mode, for alarm software, the corresponding audio mode is alarm mode, and for voice communication software, the corresponding audio mode can be normal Normal One of the mode, headphone mode or hands-free mode.
  • the adjustment module 23 is configured to adjust the audio mode to a preset mode after the call ends if the application program adjusts the audio mode to a non-preset mode during the audio resource call.
  • the adjustment module changes the audio mode when an application is in the process of invoking audio resources, and can be adjusted from the default audio mode (ie, preset audio mode) to other audio modes (ie, not preset Audio mode).
  • the audio mode can be monitored by the monitoring module 21. If the corresponding parameter of the audio mode changes, it is determined that the audio mode has been adjusted. After the audio resource is called, the audio mode is adjusted to the original by the adjustment module 23
  • the default mode ie preset mode). Such as Normal audio mode, alarm mode, music mode or voice mode.
  • different audio modes can be switched or called by different functions in the Android software development kit (SDK).
  • SDK Android software development kit
  • the audio mode can be switched through the following different functions.
  • the Android SDK development kit :
  • AdjustStreamVolume (int streamType, int direction, int flags) represents the specified type of sound for adjusting electronic equipment.
  • the first parameter streamType specifies the sound type (or audio mode), the parameter includes one of the following:
  • intSTREAM_ALARM the sound of mobile phone alarm
  • intSTREAM_DTMF DTMF tone sound
  • intSTREAM_MUSIC the sound of mobile phone music
  • intSTREAM_NOTIFICATION the sound of the system prompt
  • intSTREAM_RING The sound of the phone ringtone
  • intSTREAM_SYSTEM the sound of the mobile phone system
  • intSTREAM_VOICE_CALL Voice call voice.
  • the second parameter specifies to increase or decrease the sound.
  • This parameter can accept the following values:
  • ADJUST_LOWER lowers the volume
  • ADJUST_RAISE increases the volume
  • the third parameter is the flag when adjusting the sound. For example, if you specify FLAG_SHOW_UI, you can specify that the volume progress bar is displayed when adjusting the sound.
  • Function 2 void setMicrophoneMute (booleanon) sets whether to mute the microphone. Set to true to mute the microphone; false to turn off the mute.
  • Function 3 void setMode (intmode): Set the sound mode.
  • the values that can be set are NORMAL, RINGTONE, and IN_CALL.
  • void setRingerMode sets the ringtone mode of the mobile phone.
  • the following attribute values can be supported:
  • int RINGER_MODE_SILENT The ringtone of the mobile phone is muted.
  • Function 5 void setSpeakerphoneOn (booleanon): Set the speaker on or off. Set to true to enable hands-free calling; false to disable hands-free calling.
  • Function 6 void setStreamMute (intstreamType, booleanstate): mute the specified type of sound of the mobile phone.
  • the streamType parameter has the same meaning as the first parameter in the adjustStreamVolume method.
  • Function 7 void setStreamVolume (int streamType, int index, int flags): directly set the volume value of the specified type of the mobile phone.
  • the streamType parameter has the same meaning as the first parameter in the adjustStreamVolume method.
  • the audio mode is set to the preset mode. That is: if the audio mode is the preset mode during the audio resource call, there is no need to change the audio mode after the audio resource call is completed, and no processing is required; and if the audio mode is the non-preset mode during the audio resource call, After the audio resource is called, the audio mode is changed to the preset mode. Use the above method to set the audio mode.
  • the audio mode is set to the normal Normal mode after the call is completed, that is, during the process of the application calling the audio resource In the mode, the voice module has been switched to, and the adjustment module 23 switches the mode to a preset mode after the audio resource is called, for example, the Normal mode.
  • the audio mode is set to the normal Normal mode after the call is completed.
  • the headset mode will automatically switch when the headset is plugged in, and automatically switch to the normal mode when the headset is unplugged.
  • the headset mode is also related to the current application.
  • the current application has the permission to adjust the headset mode, that is, by running The application can be adjusted to the headset mode without waiting for the headset to be plugged in, but when the application is adjusted to the headset mode, the audio resource is not released, resulting in the headset mode cannot be restored, and the next application needs to call the audio resource Can only be called in headset mode, resulting in abnormal output of system audio. Therefore, the audio mode needs to be set to the normal Normal mode after the application program calls the audio resource, so that the next application program can call the audio resource.
  • the adjustment module 23 sets the audio mode to the normal Normal mode after the call is completed.
  • the obtaining module 22 is further used to: obtain the current environmental state information of the device 30; then, during the call of the audio resource by the application, the adjusting module 23 is also used to adaptively adjust the audio mode It is an audio mode corresponding to the environmental state, and the audio mode is set to a normal Normal mode after the call is completed.
  • the environmental status information of the device 30 may be one or several different combinations of playback, voice, hands-free, headphones, or recording.
  • there is a corresponding relationship between the environmental state and the audio mode for example, the audio mode is a voice call mode or a hands-free mode in the voice state.
  • the adjustment module 23 adaptively changes The environment state corresponding to this environment state is set to Normal mode after the call is completed.
  • the obtaining module 22 is further configured to obtain audio resource call permission information of the application program, where the permission information includes an audio mode corresponding to the application program, and the adjustment module 23 is based on the application program
  • the audio resource calling authority information is adaptively adjusted to the corresponding audio mode during the audio resource calling process of the application, and the audio mode is set to the normal Normal mode after the calling ends.
  • different audio modes can be selected.
  • the permission information may include multiple audio modes suitable for the application. For example, the permission information of the application A includes the voice mode and Alarm mode, and the permission information of application B only includes voice mode.
  • the permission information of the application can be determined according to the priority of the application, for example, the system-level application has a high priority, and the non-system-level application has a low priority.
  • the monitoring module 21 monitors the audio resource call of the application program. If the application program adjusts the audio mode to a non-preset mode during the calling process, the adjustment module 23 adjusts the audio mode to The preset mode can effectively prevent the abnormal situation of the audio resource call of the electronic device, and improve the stability of the system.
  • the electronic device includes a processor connected through a system bus, a non-volatile storage medium, an internal memory and a network interface, a sound collection device, a speaker, a display screen, and an input device.
  • the non-volatile storage medium of the terminal stores an operating system and computer-readable instructions.
  • the computer-readable instructions are executed by the processor to implement an audio mode adjustment method of an electronic device.
  • the processor is used to provide computing and control capabilities to support the operation of the entire electronic device.
  • the internal memory in the electronic device provides an environment for the execution of computer-readable instructions in the non-volatile storage medium.
  • the display screen of the electronic device may be a liquid crystal display screen or an electronic ink display screen, etc.
  • the input device may be a touch layer covered on the display screen, a button, a trackball or a touch pad provided on the housing of the electronic device, or External keyboard, touchpad or mouse, etc.
  • the electronic device may be a mobile phone, a tablet computer, a personal digital assistant or a wearable device.
  • FIG. 3 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the electronic device to which the solution of the present application is applied.
  • the specific electronic device may It includes more or fewer components than shown in the figure, or some components are combined, or have a different component arrangement.
  • the above mentioned audio mode adjustment method may specifically be:
  • the audio mode will be adjusted to the preset mode after the call ends.
  • the processor is further configured to: if the application program does not change the audio mode during the audio resource call, and the audio mode is a non-preset mode, then change the audio mode Set to preset mode.
  • the monitoring of the audio resource calling behavior of the application program specifically includes:
  • the audio mode will be adjusted to the preset mode after the call ends, specifically:
  • the audio mode is set to the normal Normal mode after the call is completed.
  • the audio mode will be adjusted to the preset mode after the call ends, specifically:
  • the audio mode is set to the normal Normal mode after the call is completed.
  • the audio mode will be adjusted to the preset mode after the call ends, specifically:
  • the audio mode is set to the normal normal mode after the call is completed.
  • the processor is also used to execute:
  • the audio mode is adaptively adjusted to the audio mode corresponding to the environmental state, and the audio mode is set to the normal Normal mode after the call is completed.
  • the processor is also used to execute:
  • the application program adaptively adjusts to the corresponding audio mode during the audio resource call process, and sets the audio mode to the normal Normal mode after the call is completed.
  • embodiments of the present application further provide a computer non-volatile readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of adjusting the audio mode as described above are implemented.
  • An embodiment of the present invention also provides a computer device. As shown in FIG. 4, for ease of description, only parts related to the embodiments of the present invention are shown, and specific technical details are not disclosed, please refer to the method part of the embodiments of the present invention.
  • the computer device may be any terminal device including an electronic device, a tablet computer, a PDA (Personal Digital Assistant), a POS (Point of Sales), an in-vehicle computer, a wearable device, etc.
  • the computer device is an electronic device For example:
  • the electronic device includes: a radio frequency (Radio Frequency) circuit 410, a memory 420, an input unit 430, a display unit 440, a sensor 450, an audio circuit 460, a wireless fidelity (WiFi) module 470, a processor 480, and power supply 490 and other components.
  • a radio frequency (Radio Frequency) circuit 410 for detecting radio frequency (Radio Frequency)
  • a memory 420 for a digital signal
  • an input unit 430 a keyboard
  • a display unit 440 a sensor 450
  • an audio circuit 460 a wireless fidelity (WiFi) module
  • WiFi wireless fidelity
  • processor 480 and power supply 490 and other components.
  • power supply 490 other components.
  • the structure of the electronic device shown in FIG. 4 does not constitute a limitation on the electronic device, and may include more or fewer components than shown, or combine some components, or arrange different components.
  • the RF circuit 410 can be used to receive and send signals during the sending and receiving of information or during a call. It can receive the downlink information of the base station and process it to the processor 480; it can also send the uplink data to the base station.
  • RF circuits include but are not limited to antennas, at least one amplifier, transceiver, coupler, low noise amplifier (Low Noise Amplifier, LNA), duplexer, and so on.
  • the RF circuit 410 can also communicate with other devices through a wireless communication network.
  • the above wireless communication can use any communication standard or protocol, including but not limited to Global System of Mobile (GSM), General Packet Radio Service (GPRS), and Code Division Multiple Access (Code Division) Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), e-mail, Short Message Service (SMS), etc.
  • GSM Global System of Mobile
  • GPRS General Packet Radio Service
  • CDMA Code Division Multiple Access
  • WCDMA Wideband Code Division Multiple Access
  • LTE Long Term Evolution
  • SMS Short Message Service
  • the memory 420 may be used to store software programs and modules.
  • the processor 480 executes various functional applications and data processing of the electronic device by running the software programs and modules stored in the memory 420.
  • the memory 420 may mainly include a program storage area and a data storage area, where the program storage area may store an operating system and at least one function-required application program (such as a sound playback function application program, an image playback function application program, etc.), etc .;
  • the data storage area can store data (such as audio data, address book, etc.) created according to the use of electronic devices.
  • the memory 420 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other volatile solid-state storage devices.
  • the input unit 430 may be used to receive input digital or character information, and generate key signal input related to user settings and function control of the electronic device 400.
  • the input unit 430 may include a touch panel 431 and other input devices 432.
  • the touch panel 431 also known as a touch screen, can collect user's touch operations on or near it (for example, the user uses any suitable objects or accessories such as fingers or stylus on or near the touch panel 431 Operation), and drive the corresponding connection device according to the preset program.
  • the touch panel 431 may include a touch monitoring device and a touch controller.
  • the touch monitoring device monitors the user's touch orientation, and monitors the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives touch information from the touch monitoring device, and converts it into contact coordinates, and then sends To the processor 480, and can receive the command sent by the processor 480 and execute it.
  • the touch panel 431 may be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves.
  • the input unit 430 may also include other input devices 432.
  • the other input devices 432 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.).
  • the display unit 440 may be used to display information input by the user or information provided to the user and various menus of the electronic device.
  • the display unit 440 may include a display panel 441.
  • the display panel 441 may be configured in the form of a liquid crystal display (Liquid Crystal) (LCD), an organic light-emitting diode (Organic Light-Emitting Diode, OLED), or the like.
  • the touch panel 431 may cover the display panel 441. After the touch panel 431 detects a touch operation on or near it, it is transmitted to the processor 480 to determine the type of touch event, and then the processor 480 may The type of touch event provides corresponding visual output on the display panel 441.
  • the touch panel 431 and the display panel 441 are implemented as two independent components to realize the input and input functions of the electronic device, in some embodiments, the touch panel 431 and the display panel 441 may be integrated And realize the input and output functions of electronic equipment.
  • the electronic device 400 may further include at least one sensor 450, such as a light sensor, a motion sensor, and other sensors.
  • the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 441 according to the brightness of the ambient light, and the proximity sensor may close the display panel 441 and the electronic device when moving to the ear / Or backlight.
  • the motion sensor may include an acceleration sensor. The acceleration sensor can monitor the magnitude of acceleration in various directions, and can monitor the magnitude and direction of gravity when at rest.
  • electronic devices can be used for applications that recognize the posture of electronic devices (such as horizontal and vertical screen switching), and vibration recognition related functions ( For example, pedometer, percussion, etc .; in addition, electronic devices can also be equipped with other sensors such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc.
  • sensors such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc.
  • the audio circuit 460, the speaker 461, and the microphone 462 may provide an audio interface between the user and the electronic device.
  • the audio circuit 460 can transmit the converted electrical signal of the received audio data to the speaker 461, which converts the speaker 461 into a sound signal for output; on the other hand, the microphone 462 converts the collected sound signal into an electrical signal, which is converted by the audio circuit 460 After receiving, it is converted into audio data, and then processed by the audio data output processor 480, and then sent to another electronic device via the RF circuit 410, or the audio data is output to the memory 420 for subsequent processing.
  • WiFi is a short-range wireless transmission technology. Electronic devices can help users send and receive emails, browse web pages, and access streaming media through the WiFi module 470. It provides users with wireless broadband Internet access.
  • FIG. 4 shows the WiFi module 470, it can be understood that it is not a necessary component of the electronic device 400, and may be omitted as needed.
  • the processor 480 is a control center of the electronic device, and uses various interfaces and lines to connect various parts of the entire electronic device, by running or executing software programs and / or modules stored in the memory 420, and calling data stored in the memory 420 , Perform various functions of electronic devices and process data, so as to monitor the electronic devices as a whole.
  • the processor 480 may include one or more processing units.
  • the processor 480 may integrate an application processor and a modem processor, where the application processor mainly processes an operating system, user interface, application programs, and the like; the modem processor mainly processes wireless communication. It can be understood that the foregoing modem processor may not be integrated into the processor 480.
  • the electronic device 400 further includes a power supply 490 (such as a battery) that supplies power to various components.
  • a power supply 490 (such as a battery) that supplies power to various components.
  • the power supply can be logically connected to the processor 480 through the power management system, so as to implement functions such as charging, discharging, and power management through the power management system .
  • the electronic device 400 may further include a camera, a Bluetooth module, and the like.
  • the processor 480 included in the computer device implements the method of the foregoing embodiments when executing the computer program stored on the memory, for example, including the audio mode adjustment method shown in FIG. 1.
  • the program may be stored in a non-volatile computer-readable storage medium
  • the storage medium may be a magnetic disk, an optical disk, a read-only memory (Read-Only Memory, ROM), etc.
  • An embodiment of the present invention also provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the methods of the foregoing embodiments.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • General Health & Medical Sciences (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Telephone Function (AREA)

Abstract

一种音频模式调节的方法,装置及电子设备,解决了现有技术中系统稳定性差的问题,提升了系统稳定性。该方法包括:对应用程序的音频资源调用行为进行监测(S110);获取所述应用程序在音频资源调用过程中的音频模式(S120);若所述应用程序在音频资源调用过程中将音频模式调节为非预设模式,则在调用结束后将音频模式调节为预设模式(S130)。

Description

一种音频模式调节的方法、装置及电子设备 技术领域
本发明涉及信息技术领域,特别是涉及一种音频模式调节的方法、装置及电子设备。
背景技术
目前的移动终端中,其音频资源可通过不同的应用程序调用,例如,可通过音乐应用软件调用移动终端的音频资源以实现音乐的播放,可通过通话软件实现铃声的播放,也可通过录音软件实现麦克风等资源的调用。
在音频资源调用过程中,会采用不同的音频模式对音频资源进行播放或者录音操作,例如,在移动终端中会采用普通Normal模式、耳机Headset模式及免提Freehand模式。然而,对于移动终端而言,若当前应用程序调用音频资源时调节了音频模式而不会及时恢复,在下一个应用程序调用音频资源时会发现当前音频模式异常,从而导致播放或录音失败,导致系统稳定性差。
发明内容
本申请实施例提供一种音频模式调节的方法,包括:
对应用程序的音频资源调用行为进行监测;
获取所述应用程序在音频资源调用过程中的音频模式;
若所述应用程序在音频资源调用过程中将音频模式调节为非预设模式,则将在调用结束后将音频模式调节为预设模式。
本申请实施例还提供一种音频模式调节的装置,所述装置包括:
监测模块,用于对应用程序的音频资源调用行为进行监测;
获取模块,用于获取所述应用程序在音频资源调用过程中的音频模式;
调节模块,用于若所述应用程序在音频资源调用过程中将音频模式调节为非预设模式,则将在调用结束后将音频模式调节为预设模式。
一种电子设备,包括存储器及处理器,所述存储器中储存有计算机程序,所述计算机程序被所述处理器执行时,使得所述处理器执行上述的音频模式调节的步骤。
本申请实施例还提供一种计算机非易失性可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现如上述的音频模式调节的步骤。
电子设备和计算机可读存储介质在实现上述方法时,若在音频资源调用过程中改变了音频模式,则在音频资源调用结束后将该音频模式设置为预设模式,解决了现有技术中系统稳定性差的问题,提升了系统稳定性。
附图说明
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他实施例的附图。
图1为一实施例的音频模式调节方法流程图;
图2为一实施例的音频模式调节装置结构示意图;
图3为一实施例中电子设备的内部结构示意图;
图4为与本发明实施例提供的计算机设备相关的电子设备的部分结构的框图。
具体实施方式
为了便于理解本发明,下面将参照相关附图对本发明进行更全面的描述。附图中给出了本发明的较佳实施例。但是,本发明可以以许多不同的形式来实现,并不限于本文所描述的实施例。相反地,提供这些实施例的目的是使对本发明的公开内容的理解更加透彻全面。
如图1所示,本申请实施例提供了一种音频资源调用的方法,应用于电子设备,该方法包括:
S110、对应用程序的音频资源调用行为进行监测;
音频资源在本申请实施例中,可以是播放音频所需要的资源,例如扬声器、声道、音频文件等,也可以是进行录音时所需要的资源,例如麦克风、音频电路、录制数据存储器、音频录制处理器等,还可以是音频文件本身,例如mp3文件、wav文件等。本申请实施例对此并无限制。其中,可通过电子设备实现对应用程序的音频资源调用,对音频资源调用可以通过电子设备内置的处理函数进行,以安装了安卓系统的电子设备为例,在安卓系统中定义了不同种类的函数以实现不同方式的音频资源调用,包括音频的输入输出操作,如音乐播放、通话、语音提示、录音等操作,因此,音频资源调用只需要在使用对应的音频调用函数即可实现该操作。
在本申请实施例中,创造性地提出了一种全新的监测机制,即:在系统框架层创建系统级的监测模块,通过所述监测模块对所述音频资源状态进行监测,或,独立创建监听进程,通过消息传输机制监测所述应用程序的音频资源状态。具体地,电子设备可通过内置的监听函数对应用程序的音频模式调节进行监听,以安卓系统的电子设备为例,可在系统框架层(native本地框架层或framework层)创建系统级的监听模块,通过所述监听模块对所述应用程序的音频模式进行监听,或,独立创建监听进程,通过消息传输机制监听所述应用程序的音频模式。例如,可在框架层设立监听模块并运行在系统服务程序(system_server)中,由于该监听模块设立在系统级的服务框架层中,可方便与其他系统服务进行交互,同时无需担心系统调用时的权限问题。此外,也可以创建独立的监听进程,在该进程中设立并调用单独的监听函数,可设置为开机自启动,并实时对其他任何一个应用程序的音频模式调节进行监控,具体地,可实时抓取当前调用的音频资源对应应用程序的ID信息、状态信息和/或优先权信息等,以此确定当前调用行为对应的应用程序及其状态,可独立开发,不与系统进行耦合,方便后续的开发和升级。
S120、获取所述应用程序在音频资源调用过程中的音频模式;
在电子设备中,可选择不同的音频模式供应用程序使用。例如安卓操作系统的电子设备中,音频模式可以分为正常Normal、耳机Headset及免提 Handfree模式,其中,Normal模式为默认模式,耳机模式在插入耳机时会切换为该模式,而免提模式则是语音通话中的音频模式,通过扬声器进行音频输出。此外,音频模式还可以分为音乐模式、闹铃模式RINGSTONE及语音模式INCALL等。不同的音频模式之间可相互切换,对应于不同的音频资源,音频模式可进行调节,此外,对应于不同的应用程序,可设置为不同的音频模式。例如对于音乐播放应用程序,其对应的音频模式为音乐模式,对于闹铃软件而言,对应的音频模式则为闹铃模式,而对于语音通信类软件而言,对应的音频模式可为正常Normal模式、耳机模式或免提模式的其中一种。
S130、若所述应用程序在音频资源调用过程中将音频模式调节为非预设模式,则在调用结束后将音频模式调节为预设模式。
在现有技术中,QICQ软件可进行数字语音通话,例如,QICQ软件在进行语音群聊后,即使挂断电话,却一直没有释放录音通路,若此时新的QICQ软件需要占用该录音通路并发送语音,此时虽然系统可启动录音,但系统只支持一路录音通路,会导致新的QICQ软件发送语音失败;
另,若电子设备支持双路(主通路和副通路,简称为主MIC和副MIC)QICQ软件进行语音群聊时,音频模式设置为语音模式,语音通话结束后即切换到后台运行,但此时系统并没有恢复到默认的音频模式,此时新的QICQ软件发送语音时,选择的输入设备只能为副MIC,导致录入的声音质量差,导致对方听起来声音小且有杂音。
因此,在本申请实施例中,采取了这样的一种纠偏模式:当某一个应用程序在音频资源调用过程中改变了音频模式,从默认的音频模式(即预设的音频模式)调节为其他音频模式(即非预设音频模式)。其中,可通过S110提及的监测机制对音频模式进行监测,若该音频模式对应参数发生变化,即确定该音频模式已进行调节,则在音频资源调用结束后,将该音频模式调节为原来的默认模式(即预设模式)。如Normal音频模式、闹铃模式、音乐模式或语音模式等。
其中,不同的音频模式可通过安卓软件开发工具(software development kit,SDK)中的不同函数进行切换或调用。具体地,可通过下列的不同函数进 行音频模式的切换。例如,在安卓的SDK开发包中的:
函数1:void adjustStreamVolume(int streamType,int direction,int flags)表示为调节电子设备指定类型的声音。其中第一个参数streamType指定声音类型(或音频模式),该参数包括下列之一:
int STREAM_ALARM:手机闹铃的声音;
int STREAM_DTMF:DTMF音调的声音;
int STREAM_MUSIC:手机音乐的声音;
int STREAM_NOTIFICATION:系统提示的声音;
int STREAM_RING The:电话铃声的声音;
int STREAM_SYSTEM:手机系统的声音;
int STREAM_VOICE_CALL:语音电话的声音。
第二个参数指定对声音进行增大或减小该参数可接受如下几个值:
ADJUST_LOWER降低音量;
ADJUST_RAISE升高音量;
ADJUST_SAME保持不变。
第三个参数是调节声音时的标志,例如指定FLAG_SHOW_UI,则指定调节声音时显示音量进度条。
函数2:void setMicrophoneMute(booleanon)设置是否让麦克风静音。设置为true将麦克风静音;false关闭静音。
函数3:void setMode(intmode):设置声音模式。可设置的值有NORMAL,RINGTONE,和IN_CALL。
函数4:void setRingerMode(intringerMode)设置手机电话铃声的模式。可支持如下几个属性值:
int RINGER_MODE_NORMAL:正常的手机铃声。
int RINGER_MODE_SILENT:手机铃声静音。
int RINGER_MODE_VIBRATE:手机震动。
函数5:void setSpeakerphoneOn(booleanon):设置扬声器打开或关闭。设置为true开启免提通话;false关闭免提。
函数6:void setStreamMute(intstreamType,booleanstate):将手机的指定类型的声音调节为静音。其中streamType参数与adjustStreamVolume方法中第一个参数的意义相同。
函数7:void setStreamVolume(int streamType,int index,int flags):直接设置手机的指定类型的音量值。其中streamType参数与adjustStreamVolume方法中第一个参数的意义相同。
在其中一个实施例中,若所述应用程序在音频资源调用过程中未改变音频模式,且所述音频模式为非预设模式,则将所述音频模式设置为预设模式。即,若在音频资源调用过程中音频模式为预设模式,则在音频资源调用结束后无需改变该音频模式,不作处理即可;而若在音频资源调用过程中音频模式为非预设模式,则在音频资源调用结束后将音频模式更改为预设模式。采取如上方式进行设置音频模式,由于音频模式和音频资源/应用程序的对应性,可保证不影响下一个应用程序调用该音频资源时的音频模式,防止出现音频模式不正确导致下一个应用程序无法调用该音频资源,出现异常的情况,增强系统的稳定性。
在其中的一个实施例中,若所述应用程序在音频资源调用过程中将音频模式调节为语音模式,则在调用结束后将音频模式设置为普通Normal模式,即,针对上述提及的现有技术示例,在应用程序调用音频资源过程中,已切换为语音模式,则在音频资源调用结束后将该模式切换为预设模式,例如Normal模式。
若所述应用程序在音频资源调用过程中将音频模式调节为耳机Headset模式,则在调用结束后将音频模式设置为普通Normal模式。耳机模式会在插入耳机时自动进行切换,在耳机拔出时自动切换为普通模式,但是,耳机模式也和当前的应用程序相关,例如,当前的应用程序具备调节耳机模式的权限,即通过运行该应用程序即可调节为耳机模式,无需等到耳机插入与否,但当该应用程序调节为耳机模式后却并没有释放音频资源,导致耳机模式无法恢复,而下一个应用程序需要调用该音频资源时,只能在耳机模式下调用,导致系统音频异常输出。因此,需要在该应用程序调用该音频资源结束后将 音频模式设置为普通Normal模式,以便进行下一应用程序对该音频资源的调用。
同上,若所述应用程序在音频资源调用过程中将音频模式调节为免提Handfree模式,则在调用结束后将音频模式设置为普通Normal模式。
在其中一个实施例中,该方法还包括:获取电子设备当前环境状态信息;在所述应用程序在音频资源调用过程中,将所述音频模式自适应调节为与所述环境状态对应的音频模式,并在调用结束后将所述音频模式设置为普通Normal模式。具体地,电子设备的环境状态信息可以为播放、语音、免提、耳机或录音等一种或几种不同的组合。在本申请实施例中,环境状态与音频模式存在对应关系,例如语音状态下音频模式为语音通话模式或免提模式等,在获取当前电子设备的环境状态信息后,自适应改变与该环境状态对应的环境状态,并在调用结束后设置为Normal模式。
在本申请实施例中,该方法还包括:获取所述应用程序的音频资源调用权限信息,所述权限信息包括与所述应用程序对应的音频模式;根据所述应用程序的音频资源调用权限信息,在所述应用程序在音频资源调用过程中自适应调节为对应的音频模式,并在调用结束后将所述音频模式设置为普通Normal模式。在本申请实施例中,应用程序由于权限不同,可选择的音频模式也不同,权限信息可包括适用于适配于该应用程序的多种音频模式,例如应用程序A的权限信息包括语音模式和闹铃模式,而应用程序B的权限信息只包括语音模式。在音频调用过程中,不同的应用程序可在不同时间段自动或手动切换为权限范围内的音频模式,禁止该应用程序切换为非自身权限范围内的音频模式。可选地,可根据该应用程序的优先级确定该应用程序的权限信息,例如系统级的应用程序具备高优先级,而非系统级的应用程序具备低优先级。
在本申请实施例中,对应用程序的音频资源调用进行监测,若应用程序在调用过程中将音频模式调节为非预设模式,则将在调用结束后将音频模式调节为预设模式,有效地防止电子设备音频资源调用的异常情况出现,提升了系统的稳定性。
如图2所示,本申请实施例还提供一种音频模式调节的装置20,该装置20包括:
监测模块21,用于对应用程序的音频资源调用行为进行监测;
音频资源在本申请实施例中,可以是播放音频所需要的资源,例如扬声器、声道、音频文件等,也可以是进行录音时所需要的资源,例如麦克风、音频电路、录制数据存储器、音频录制处理器等,还可以是音频文件本身,例如mp3文件、wav文件等。本申请实施例对此并无限制。其中,可通过电子设备实现对应用程序的音频资源调用,对音频资源调用可以通过电子设备内置的处理函数进行,以安装了安卓系统的电子设备为例,在安卓系统中定义了不同种类的函数以实现不同方式的音频资源调用,包括音频的输入输出操作,如音乐播放、通话、语音提示、录音等操作,因此,音频资源调用只需要在使用对应的音频调用函数即可实现该操作。
在本申请实施例中,创造性地提出了一种全新的监测机制,即:在系统框架层创建系统级的监测模块21,通过所述监测模块21对所述音频资源状态进行监测,或,监测模块21不在系统框架层创建,而是独立创建监听进程,通过消息传输机制监测所述应用程序的音频资源状态。
具体地,监测模块21可通过内置的监听函数对应用程序的音频模式调节进行监听,以安卓系统的电子设备为例,可在系统框架层(native本地框架层或framework层)创建系统级的监听模块,通过所述监听模块对所述应用程序的音频模式进行监听,或,独立创建监听进程,通过消息传输机制监听所述应用程序的音频模式。例如,可在框架层设立监听模块并运行在系统服务程序(system_server)中,由于该监听模块设立在系统级的服务框架层中,可方便与其他系统服务进行交互,同时无需担心系统调用时的权限问题。此外,也可以创建独立的监听进程,在该进程中设立并调用单独的监听函数,可设置为开机自启动,并实时对其他任何一个应用程序的音频模式调节进行监控,具体地,可实时抓取当前调用的音频资源对应应用程序的ID信息、状态信息和/或优先权信息等,以此确定当前调用行为对应的应用程序及其状态,可独立开发,不与系统进行耦合,方便后续的开发和升级。
获取模块22,用于获取所述应用程序在音频资源调用过程中的音频模式;
在音频模式调节装置中,可选择不同的音频模式供应用程序使用。例如安卓操作系统的音频模式调节装置中,音频模式可以分为正常Normal、耳机Headset及免提Handfree模式,其中,Normal模式为默认模式,耳机模式在插入耳机时会切换为该模式,而免提模式则是语音通话中的音频模式,通过扬声器进行音频输出。此外,音频模式还可以分为音乐模式、闹铃模式RINGSTONE及语音模式INCALL等。不同的音频模式之间可相互切换,对应于不同的音频资源,音频模式可进行调节,此外,对应于不同的应用程序,可设置为不同的音频模式。例如对于音乐播放应用程序,其对应的音频模式为音乐模式,对于闹铃软件而言,对应的音频模式则为闹铃模式,而对于语音通信类软件而言,对应的音频模式可为正常Normal模式、耳机模式或免提模式的其中一种。
调节模块23,用于若所述应用程序在音频资源调用过程中将音频模式调节为非预设模式,则在调用结束后将音频模式调节为预设模式。
在本申请实施例中,调节模块在当某一个应用程序在音频资源调用过程中改变了音频模式,可从默认的音频模式(即预设的音频模式)调节为其他音频模式(即非预设音频模式)。其中,可通过监测模块21对音频模式进行监测,若该音频模式对应参数发生变化,即确定该音频模式已进行调节,则在音频资源调用结束后,通过调节模块23将该音频模式调节为原来的默认模式(即预设模式)。如Normal音频模式、闹铃模式、音乐模式或语音模式等。
其中,不同的音频模式可通过安卓软件开发工具(software development kit,SDK)中的不同函数进行切换或调用。具体地,可通过下列的不同函数进行音频模式的切换。例如,在安卓的SDK开发包中的:
函数1:void adjustStreamVolume(int streamType,int direction,int flags)表示为调节电子设备指定类型的声音。其中第一个参数streamType指定声音类型(或音频模式),该参数包括下列之一:
int STREAM_ALARM:手机闹铃的声音;
int STREAM_DTMF:DTMF音调的声音;
int STREAM_MUSIC:手机音乐的声音;
int STREAM_NOTIFICATION:系统提示的声音;
int STREAM_RING The:电话铃声的声音;
int STREAM_SYSTEM:手机系统的声音;
int STREAM_VOICE_CALL:语音电话的声音。
第二个参数指定对声音进行增大或减小该参数可接受如下几个值:
ADJUST_LOWER降低音量;
ADJUST_RAISE升高音量;
ADJUST_SAME保持不变。
第三个参数是调节声音时的标志,例如指定FLAG_SHOW_UI,则指定调节声音时显示音量进度条。
函数2:void setMicrophoneMute(booleanon)设置是否让麦克风静音。设置为true将麦克风静音;false关闭静音。
函数3:void setMode(intmode):设置声音模式。可设置的值有NORMAL,RINGTONE,和IN_CALL。
函数4:void setRingerMode(intringerMode)设置手机电话铃声的模式。可支持如下几个属性值:
int RINGER_MODE_NORMAL:正常的手机铃声。
int RINGER_MODE_SILENT:手机铃声静音。
int RINGER_MODE_VIBRATE:手机震动。
函数5:void setSpeakerphoneOn(booleanon):设置扬声器打开或关闭。设置为true开启免提通话;false关闭免提。
函数6:void setStreamMute(intstreamType,booleanstate):将手机的指定类型的声音调节为静音。其中streamType参数与adjustStreamVolume方法中第一个参数的意义相同。
函数7:void setStreamVolume(int streamType,int index,int flags):直接设置手机的指定类型的音量值。其中streamType参数与adjustStreamVolume方法中第一个参数的意义相同。
在其中一个实施例中,若所述应用程序在音频资源调用过程中未改变音频模式,且所述音频模式为非预设模式,则将所述音频模式设置为预设模式。即:若在音频资源调用过程中音频模式为预设模式,则在音频资源调用结束后无需改变该音频模式,不作处理即可;而若在音频资源调用过程中音频模式为非预设模式,则在音频资源调用结束后将音频模式更改为预设模式。采取如上方式进行设置音频模式,由于音频模式和音频资源/应用程序的对应性,可保证不影响下一个应用程序调用该音频资源时的音频模式,防止出现音频模式不正确导致下一个应用程序无法调用该音频资源,出现异常的情况,增强系统的稳定性。
在其中的一个实施例中,若所述应用程序在音频资源调用过程中将音频模式调节为语音模式,则在调用结束后将音频模式设置为普通Normal模式,即,在应用程序调用音频资源过程中,已切换为语音模式,则调节模块23在音频资源调用结束后将该模式切换为预设模式,例如Normal模式。
若所述应用程序在音频资源调用过程中将音频模式调节为耳机Headset模式,则在调用结束后将音频模式设置为普通Normal模式。耳机模式会在插入耳机时自动进行切换,在耳机拔出时自动切换为普通模式,但是,耳机模式也和当前的应用程序相关,例如,当前的应用程序具备调节耳机模式的权限,即通过运行该应用程序即可调节为耳机模式,无需等到耳机插入与否,但当该应用程序调节为耳机模式后却并没有释放音频资源,导致耳机模式无法恢复,而下一个应用程序需要调用该音频资源时,只能在耳机模式下调用,导致系统音频异常输出。因此,需要在该应用程序调用该音频资源结束后将音频模式设置为普通Normal模式,以便进行下一应用程序对该音频资源的调用。
同上,若所述应用程序在音频资源调用过程中将音频模式调节为免提Handfree模式,则调节模块23在调用结束后将音频模式设置为普通Normal模式。
在其中一个实施例中,获取模块22还用于:获取该装置30当前环境状态信息;则在所述应用程序在音频资源调用过程中,调节模块23还用于将所 述音频模式自适应调节为与所述环境状态对应的音频模式,并在调用结束后将所述音频模式设置为普通Normal模式。具体地,该装置30的环境状态信息可以为播放、语音、免提、耳机或录音等一种或几种不同的组合。在本申请实施例中,环境状态与音频模式存在对应关系,例如语音状态下音频模式为语音通话模式或免提模式等,在获取当前电子设备的环境状态信息后,调节模块23自适应改变与该环境状态对应的环境状态,并在调用结束后设置为Normal模式。
在本申请实施例中,获取模块22还用于:获取所述应用程序的音频资源调用权限信息,所述权限信息包括与所述应用程序对应的音频模式,则调节模块23根据所述应用程序的音频资源调用权限信息,在所述应用程序在音频资源调用过程中自适应调节为对应的音频模式,并在调用结束后将所述音频模式设置为普通Normal模式。在本申请实施例中,应用程序由于权限不同,可选择的音频模式也不同,权限信息可包括适用于适配于该应用程序的多种音频模式,例如应用程序A的权限信息包括语音模式和闹铃模式,而应用程序B的权限信息只包括语音模式。在音频调用过程中,不同的应用程序可在不同时间段自动或手动切换为权限范围内的音频模式,禁止该应用程序切换为非自身权限范围内的音频模式。可选地,可根据该应用程序的优先级确定该应用程序的权限信息,例如系统级的应用程序具备高优先级,而非系统级的应用程序具备低优先级。
在本申请实施例中,监测模块21对应用程序的音频资源调用进行监测,若应用程序在调用过程中将音频模式调节为非预设模式,则调节模块23在调用结束后将音频模式调节为预设模式,有效地防止电子设备音频资源调用的异常情况出现,提升了系统的稳定性。
图3为一实施例中电子设备的内部结构示意图。如图3所示,该电子设备包括通过系统总线连接的处理器、非易失性存储介质、内存储器和网络接口、声音采集装置、扬声器、显示屏和输入装置。其中,终端的非易失性存储介质存储有操作系统和计算机可读指令。该计算机可读指令被处理器执行时以实现一种电子设备的音频模式调节方法。该处理器用于提供计算和控制能力, 支撑整个电子设备的运行。电子设备中的内存储器为非易失性存储介质中的计算机可读指令的运行提供环境。电子设备的显示屏可以是液晶显示屏或者电子墨水显示屏等,输入装置可以是显示屏上覆盖的触摸层,也可以是电子设备外壳上设置的按键、轨迹球或触控板,也可以是外接的键盘、触控板或鼠标等。该电子设备可以是手机、平板电脑或者个人数字助理或穿戴式设备等。本领域技术人员可以理解,图3中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的电子设备的限定,具体的电子设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。
其中,上述提及的音频模式调节方法具体可以为:
对应用程序的音频资源调用行为进行监测;
获取所述应用程序在音频资源调用过程中的音频模式;
若所述应用程序在音频资源调用过程中将音频模式调节为非预设模式,则将在调用结束后将音频模式调节为预设模式。
在其中的一个实施例中,所述处理器还用于执行:若所述应用程序在音频资源调用过程中未改变音频模式,且所述音频模式为非预设模式,则将所述音频模式设置为预设模式。
在其中的一个实施例中,所述对应用程序的音频资源调用行为进行监测,具体为:
在系统框架层创建系统级的监测模块,通过所述监测模块对所述音频资源状态进行监测,或,
独立创建监听进程,通过消息传输机制监测所述应用程序的音频资源状态。
在其中的一个实施例中,若所述应用程序在音频资源调用过程中将音频模式调节为非预设模式,则将在调用结束后将音频模式调节为预设模式,具体为:
若所述应用程序在音频资源调用过程中将音频模式调节为语音模式,则在调用结束后将音频模式设置为普通Normal模式。
在其中的一个实施例中,若所述应用程序在音频资源调用过程中将音频模式调节为非预设模式,则将在调用结束后将音频模式调节为预设模式,具体为:
若所述应用程序在音频资源调用过程中将音频模式调节为耳机Headset模式,则在调用结束后将音频模式设置为普通Normal模式。
在其中的一个实施例中,若所述应用程序在音频资源调用过程中将音频模式调节为非预设模式,则将在调用结束后将音频模式调节为预设模式,具体为:
若所述应用程序在音频资源调用过程中将音频模式调节为免提Handfree模式,则在调用结束后将音频模式设置为普通Normal模式。
在其中的一个实施例中,所述处理器还用于执行:
获取电子设备当前环境状态信息;
在所述应用程序在音频资源调用过程中,将所述音频模式自适应调节为与所述环境状态对应的音频模式,并在调用结束后将所述音频模式设置为普通Normal模式。
在其中的一个实施例中,所述处理器还用于执行:
获取所述应用程序的音频资源调用权限信息,所述权限信息包括与所述应用程序对应的音频模式;
根据所述应用程序的音频资源调用权限信息,在所述应用程序在音频资源调用过程中自适应调节为对应的音频模式,并在调用结束后将所述音频模式设置为普通Normal模式。
此外,本申请实施例还提供了一种计算机非易失性可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现如上述音频模式调节的步骤。
本发明实施例还提供了一种计算机设备。如图4所示,为了便于说明,仅示出了与本发明实施例相关的部分,具体技术细节未揭示的,请参照本发明实施例方法部分。该计算机设备可以为包括电子设备、平板电脑、PDA(Personal Digital Assistant,个人数字助理)、POS(Point of Sales,销售 终端)、车载电脑、穿戴式设备等任意终端设备,以计算机设备为电子设备为例:
图4为与本发明实施例提供的计算机设备相关的电子设备的部分结构的框图。参考图4,电子设备包括:射频(Radio Frequency,RF)电路410、存储器420、输入单元430、显示单元440、传感器450、音频电路460、无线保真(wireless fidelity,WiFi)模块470、处理器480、以及电源490等部件。本领域技术人员可以理解,图4所示的电子设备结构并不构成对电子设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。
其中,RF电路410可用于收发信息或通话过程中,信号的接收和发送,可将基站的下行信息接收后,给处理器480处理;也可以将上行的数据发送给基站。通常,RF电路包括但不限于天线、至少一个放大器、收发信机、耦合器、低噪声放大器(Low Noise Amplifier,LNA)、双工器等。此外,RF电路410还可以通过无线通信与网络和其他设备通信。上述无线通信可以使用任一通信标准或协议,包括但不限于全球移动通讯系统(Global System of Mobile communication,GSM)、通用分组无线服务(General Packet Radio Service,GPRS)、码分多址(Code Division Multiple Access,CDMA)、宽带码分多址(Wideband Code Division Multiple Access,WCDMA)、长期演进(Long Term Evolution,LTE))、电子邮件、短消息服务(Short Messaging Service,SMS)等。
存储器420可用于存储软件程序以及模块,处理器480通过运行存储在存储器420的软件程序以及模块,从而执行电子设备的各种功能应用以及数据处理。存储器420可主要包括程序存储区和数据存储区,其中,程序存储区可存储操作系统、至少一个功能所需的应用程序(比如声音播放功能的应用程序、图像播放功能的应用程序等)等;数据存储区可存储根据电子设备的使用所创建的数据(比如音频数据、通讯录等)等。此外,存储器420可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。
输入单元430可用于接收输入的数字或字符信息,以及产生与电子设备400的用户设置以及功能控制有关的键信号输入。具体地,输入单元430可包括触控面板431以及其他输入设备432。触控面板431,也可称为触摸屏,可收集用户在其上或附近的触摸操作(比如用户使用手指、触笔等任何适合的物体或附件在触控面板431上或在触控面板431附近的操作),并根据预先设定的程式驱动相应的连接装置。在一个实施例中,触控面板431可包括触摸监测装置和触摸控制器两个部分。其中,触摸监测装置监测用户的触摸方位,并监测触摸操作带来的信号,将信号传送给触摸控制器;触摸控制器从触摸监测装置上接收触摸信息,并将它转换成触点坐标,再送给处理器480,并能接收处理器480发来的命令并加以执行。此外,可以采用电阻式、电容式、红外线以及表面声波等多种类型实现触控面板431。除了触控面板431,输入单元430还可以包括其他输入设备432。具体地,其他输入设备432可以包括但不限于物理键盘、功能键(比如音量控制按键、开关按键等)等中的一种或多种。
显示单元440可用于显示由用户输入的信息或提供给用户的信息以及电子设备的各种菜单。显示单元440可包括显示面板441。在一个实施例中,可以采用液晶显示器(Liquid Crystal Display,LCD)、有机发光二极管(Organic Light-Emitting Diode,OLED)等形式来配置显示面板441。在一个实施例中,触控面板431可覆盖显示面板441,当触控面板431监测到在其上或附近的触摸操作后,传送给处理器480以确定触摸事件的类型,随后处理器480根据触摸事件的类型在显示面板441上提供相应的视觉输出。虽然在图4中,触控面板431与显示面板441是作为两个独立的部件来实现电子设备的输入和输入功能,但是在某些实施例中,可以将触控面板431与显示面板441集成而实现电子设备的输入和输出功能。
电子设备400还可包括至少一种传感器450,比如光传感器、运动传感器以及其他传感器。具体地,光传感器可包括环境光传感器及接近传感器,其中,环境光传感器可根据环境光线的明暗来调节显示面板441的亮度,接近传感器可在电子设备移动到耳边时,关闭显示面板441和/或背光。 运动传感器可包括加速度传感器,通过加速度传感器可监测各个方向上加速度的大小,静止时可监测出重力的大小及方向,可用于识别电子设备姿态的应用(比如横竖屏切换)、振动识别相关功能(比如计步器、敲击)等;此外,电子设备还可配置陀螺仪、气压计、湿度计、温度计、红外线传感器等其他传感器等。
音频电路460、扬声器461和传声器462可提供用户与电子设备之间的音频接口。音频电路460可将接收到的音频数据转换后的电信号,传输到扬声器461,由扬声器461转换为声音信号输出;另一方面,传声器462将收集的声音信号转换为电信号,由音频电路460接收后转换为音频数据,再将音频数据输出处理器480处理后,经RF电路410可以发送给另一电子设备,或者将音频数据输出至存储器420以便后续处理。
WiFi属于短距离无线传输技术,电子设备通过WiFi模块470可以帮助用户收发电子邮件、浏览网页和访问流式媒体等,它为用户提供了无线的宽带互联网访问。虽然图4示出了WiFi模块470,但是可以理解的是,其并不属于电子设备400的必须构成,可以根据需要而省略。
处理器480是电子设备的控制中心,利用各种接口和线路连接整个电子设备的各个部分,通过运行或执行存储在存储器420内的软件程序和/或模块,以及调用存储在存储器420内的数据,执行电子设备的各种功能和处理数据,从而对电子设备进行整体监控。在一个实施例中,处理器480可包括一个或多个处理单元。在一个实施例中,处理器480可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作系统、用户界面和应用程序等;调制解调处理器主要处理无线通信。可以理解的是,上述调制解调处理器也可以不集成到处理器480中。
电子设备400还包括给各个部件供电的电源490(比如电池),优选的,电源可以通过电源管理系统与处理器480逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。
在一个实施例中,电子设备400还可以包括摄像头、蓝牙模块等。
在本发明实施例中,该计算机设备所包括的处理器480执行存储在存储 器上的计算机程序时实现上述各实施例的方法,例如,包括图1所示的音频模式调节的方法。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一非易失性计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)等。本发明实施例还提供了一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时上述各实施例的方法。
以上所述实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。以上所述实施例仅表达了本发明的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本发明构思的前提下,还可以做出若干变形和改进,这些都属于本发明的保护范围。因此,本发明专利的保护范围应以所附权利要求为准。

Claims (11)

  1. 一种音频模式调节的方法,应用于电子设备,其特征在于,包括:
    对应用程序的音频资源调用行为进行监测;
    获取所述应用程序在音频资源调用过程中的音频模式;
    若所述应用程序在音频资源调用过程中将音频模式调节为非预设模式,则在调用结束后将音频模式调节为预设模式。
  2. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    若所述应用程序在音频资源调用过程中未改变音频模式,且所述音频模式为非预设模式,则将所述音频模式设置为预设模式。
  3. 根据权利要求1所述的方法,其特征在于,所述对应用程序的音频资源调用行为进行监测,包括:
    在系统框架层创建系统级的监测模块,通过所述监测模块对所述音频资源状态进行监测,或,
    独立创建监听进程,通过消息传输机制监测所述应用程序的音频资源状态。
  4. 根据权利要求1所述的方法,其特征在于,若所述应用程序在音频资源调用过程中将音频模式调节为非预设模式,则将在调用结束后将音频模式调节为预设模式,包括:
    若所述应用程序在音频资源调用过程中将音频模式调节为语音模式,则在调用结束后将音频模式设置为普通Normal模式。
  5. 根据权利要求1所述的方法,其特征在于,若所述应用程序在音频资源调用过程中将音频模式调节为非预设模式,则将在调用结束后将音频模式调节为预设模式,包括:
    若所述应用程序在音频资源调用过程中将音频模式调节为耳机Headset模式,则在调用结束后将音频模式设置为普通Normal模式。
  6. 根据权利要求1所述的方法,其特征在于,若所述应用程序在音频资源调用过程中将音频模式调节为非预设模式,则将在调用结束后将音频模式调节为预设模式,包括:
    若所述应用程序在音频资源调用过程中将音频模式调节为免提Handfree模式,则在调用结束后将音频模式设置为普通Normal模式。
  7. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    获取电子设备当前环境状态信息;
    在所述应用程序在音频资源调用过程中,将所述音频模式自适应调节为与所述环境状态对应的音频模式,并在调用结束后将所述音频模式设置为普通Normal模式。
  8. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    获取所述应用程序的音频资源调用权限信息,所述权限信息包括与所述应用程序对应的音频模式;
    根据所述应用程序的音频资源调用权限信息,在所述应用程序在音频资源调用过程中自适应调节为对应的音频模式,并在调用结束后将所述音频模式设置为普通Normal模式。
  9. 一种音频模式调节的装置,其特征在于,所述装置包括:
    监测模块,用于对应用程序的音频资源调用行为进行监测;
    获取模块,用于获取所述应用程序在音频资源调用过程中的音频模式;
    调节模块,用于若所述应用程序在音频资源调用过程中将音频模式调节为非预设模式,则将在调用结束后将音频模式调节为预设模式。
  10. 一种电子设备,包括存储器及处理器,所述存储器中储存有计算机程序,其特征在于,所述计算机程序被所述处理器执行时,使得所述处理器执行如权利要求1-8中任一项所述的音频模式调节的步骤。
  11. 一种计算机非易失性可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1-8中任一项所述的音频模式调节的步骤。
PCT/CN2018/115903 2018-11-16 2018-11-16 一种音频模式调节的方法、装置及电子设备 WO2020097914A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2018/115903 WO2020097914A1 (zh) 2018-11-16 2018-11-16 一种音频模式调节的方法、装置及电子设备
CN201880098215.8A CN112771495B (zh) 2018-11-16 2018-11-16 一种音频模式调节的方法、装置及电子设备

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2018/115903 WO2020097914A1 (zh) 2018-11-16 2018-11-16 一种音频模式调节的方法、装置及电子设备

Publications (1)

Publication Number Publication Date
WO2020097914A1 true WO2020097914A1 (zh) 2020-05-22

Family

ID=70731935

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/115903 WO2020097914A1 (zh) 2018-11-16 2018-11-16 一种音频模式调节的方法、装置及电子设备

Country Status (2)

Country Link
CN (1) CN112771495B (zh)
WO (1) WO2020097914A1 (zh)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103354587A (zh) * 2013-06-27 2013-10-16 天津三星通信技术研究有限公司 用于便携式终端中管理应用音频输出的方法、装置及终端
CN103841495A (zh) * 2014-03-03 2014-06-04 联想(北京)有限公司 一种音频参数调整方法及装置
CN104660818A (zh) * 2015-02-25 2015-05-27 惠州Tcl移动通信有限公司 基于移动终端的音频参数配置方法、系统及移动终端
CN107562405A (zh) * 2017-08-18 2018-01-09 广东欧珀移动通信有限公司 音频播放控制方法、装置及存储介质和移动终端

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005150993A (ja) * 2003-11-13 2005-06-09 Sony Corp オーディオデータ処理装置、およびオーディオデータ処理方法、並びにコンピュータ・プログラム
CN107870759A (zh) * 2016-09-26 2018-04-03 中兴通讯股份有限公司 一种音频控制方法和装置
CN106534497A (zh) * 2016-10-31 2017-03-22 努比亚技术有限公司 一种自适应切换音效输出通道的方法及终端
CN107231473B (zh) * 2017-05-23 2020-02-18 盐城睿泰数字科技有限公司 一种音频输出调控方法、设备及计算机可读存储介质

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103354587A (zh) * 2013-06-27 2013-10-16 天津三星通信技术研究有限公司 用于便携式终端中管理应用音频输出的方法、装置及终端
CN103841495A (zh) * 2014-03-03 2014-06-04 联想(北京)有限公司 一种音频参数调整方法及装置
CN104660818A (zh) * 2015-02-25 2015-05-27 惠州Tcl移动通信有限公司 基于移动终端的音频参数配置方法、系统及移动终端
CN107562405A (zh) * 2017-08-18 2018-01-09 广东欧珀移动通信有限公司 音频播放控制方法、装置及存储介质和移动终端

Also Published As

Publication number Publication date
CN112771495A (zh) 2021-05-07
CN112771495B (zh) 2024-06-18

Similar Documents

Publication Publication Date Title
CN103414982B (zh) 一种提供声音的方法和装置
CA2740581C (en) System and method for resuming media
WO2019090726A1 (zh) 选择蓝牙设备的方法、终端和系统
US20160105418A1 (en) Method, system, device, and terminal for network initialization of multimedia playback device
CN108781236B (zh) 音频播放方法及电子设备
WO2020107290A1 (zh) 音频输出控制方法和装置、计算机可读存储介质、电子设备
WO2020103070A1 (zh) 一种对应用程序进行处理的方法、装置和电子设备
WO2017215661A1 (zh) 一种场景音效的控制方法、及电子设备
BR112016018783B1 (pt) Método, aparelho, dispositivo e sistema de intercomunicação
JP7252259B2 (ja) アクセス制御方法、メッセージ放送方法及び関連装置
WO2020118496A1 (zh) 音频通路切换方法和装置、可读存储介质、电子设备
WO2020103045A1 (zh) 一种对应用程序进行处理的方法、装置和电子设备
WO2020097927A1 (zh) 通话控制方法和装置、计算机可读存储介质、电子设备
WO2015078349A1 (zh) 麦克风收音状态的切换方法和装置
WO2014086292A1 (zh) 一种由被叫终端决定主叫终端回铃音的方法及终端
WO2018035868A1 (zh) 输出音频的方法、电子设备以及存储介质
WO2020107177A1 (zh) 一种音频资源调用的方法、装置及电子设备
WO2020124541A1 (zh) 音频处理方法和装置、计算机可读存储介质、电子设备
WO2023284403A1 (zh) 一种音频处理方法及设备
US20210286588A1 (en) Method and apparatus for playing alarm and electronic device
WO2020113525A1 (zh) 播放控制方法和装置、计算机可读存储介质、电子设备
US11477591B2 (en) Audio data processing method, terminal device, and storage medium
CN106210325B (zh) 一种设置社交应用来电铃声的方法、装置及终端
WO2020107169A1 (zh) 一种音频模式校正的方法、装置及电子设备
WO2020097914A1 (zh) 一种音频模式调节的方法、装置及电子设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18940129

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18940129

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 15.09.2021)

122 Ep: pct application non-entry in european phase

Ref document number: 18940129

Country of ref document: EP

Kind code of ref document: A1