CN-119883176-B - Recording method, recording device, electronic equipment and readable storage medium
Abstract
The application provides a recording method, a device, electronic equipment and a readable storage medium, wherein the method is applied to the technical field of voice, and comprises the steps of determining whether a first application is a first type application needing to occupy an audio focus or not if a microphone is started by a second application under the condition of receiving a recording request sent by the first application; if the second application is the second type application, the recording authority of the first application is started, so that the first application and the second application jointly acquire the audio data currently acquired by the microphone. The application can enable a plurality of applications to share microphone resources, thereby improving user experience.
Inventors
- LI WENSHENG
Assignees
- 长城汽车股份有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20241224
Claims (7)
- 1.A method of recording, the method comprising: Under the condition that a recording request sent by a first application is received, if a microphone is started by a second application, determining whether the first application is a first type application needing to occupy an audio focus; if the first application is the first type application, determining whether the second application is a second type application which does not need to occupy the audio focus; if the second application is the second type application, starting the recording authority of the first application so that the first application and the second application jointly acquire the audio data currently acquired by the microphone; determining whether the first application needs to monopolize the audio data collected by the microphone; If the first application needs to monopolize the audio data collected by the microphone, closing the recording authority of the second application so that the second application stops obtaining the audio data collected by the microphone, and storing the audio data collected by the microphone in a target storage space; Determining a first address after closing the recording authority of the second application, wherein the first address is an address when the second application reads audio data from the target storage space when the recording authority is closed, and determining a second address, wherein the second address is an address when the first application starts to read audio data from the target storage space when the recording authority is opened; restarting the recording authority of the second application after the recording authority of the first application is closed; providing audio data located between the first address and the second address to the second application that resumes recording rights.
- 2. The method of claim 1, wherein audio data collected by the microphone is stored in a target storage space, and wherein after the opening of the recording rights of the first application, the method further comprises: determining a real-time reading address when the first application reads audio data from the target storage space; When deviation exists between the real-time storage address and the real-time reading address, the real-time reading address is corrected according to the real-time storage address, wherein the real-time storage address is the address where the audio data stored in the target storage space at the current moment are located.
- 3. The method of claim 2, wherein correcting the real-time read address based on the real-time storage address when there is a deviation between the real-time storage address and the real-time read address comprises: Determining a reading speed of the first application when the first application reads the audio data from the target storage space; determining a storage speed when audio data acquired by the microphone are stored in the target storage space; And when the storage speed is greater than the reading speed and the real-time storage address is greater than the real-time reading address, taking the real-time storage address as the real-time reading address.
- 4. A method according to claim 3, wherein the target storage space is a ring storage space, and wherein said taking the real-time storage address as the real-time read address when the storage speed is greater than the read speed and the real-time storage address is greater than the real-time read address comprises: determining the storage overflow times and the reading overflow times of the annular storage space after the recording permission of the first application is opened under the condition that the storage speed is larger than the reading speed; and if the storage overflow times are larger than the reading overflow times and the real-time storage address is larger than the real-time reading address, taking the real-time storage address as the real-time reading address.
- 5. The method of claim 2, wherein said modifying said real-time read address based on said real-time storage address comprises: Determining a reading speed of the first application when the first application reads the audio data from the target storage space; determining a storage speed when audio data acquired by the microphone are stored in the target storage space; And when the reading speed is greater than the storage speed, determining a waiting time length according to a speed difference between the reading speed and the storage speed, and controlling the first application to read the audio data from the target storage space after waiting the waiting time length.
- 6. A sound recording apparatus, the apparatus comprising: the first determining module is used for determining whether the first application is a first type application needing to occupy an audio focus or not if the microphone is started by the second application under the condition that a recording request sent by the first application is received; the second determining module is used for determining whether the second application is a second type application which does not need to occupy the audio focus if the first application is the first type application; The starting module is used for starting the recording authority of the first application if the second application is the second type application, so that the first application and the second application jointly acquire the audio data currently acquired by the microphone; A third determining module, configured to determine whether the first application needs to monopolize audio data collected by the microphone; the closing module is used for closing the recording authority of the second application if the first application needs to monopolize the audio data collected by the microphone, so that the second application stops obtaining the audio data collected by the microphone, and the audio data collected by the microphone is stored in a target storage space; The closing module is specifically configured to determine a first address after closing the recording authority of the second application, wherein the first address is an address when the second application reads audio data from the target storage space when the recording authority is closed, determine a second address, wherein the second address is an address when the first application starts to read audio data from the target storage space when the recording authority is opened, restart the recording authority of the second application after the recording authority of the first application is closed, and provide the second application restarting the recording authority with the audio data between the first address and the second address.
- 7. An electronic device, the electronic device comprising: a memory for storing executable program code; a processor for calling and running the executable program code from the memory, causing the electronic device to perform the method of any one of claims 1 to 5.
Description
Recording method, recording device, electronic equipment and readable storage medium Technical Field The present application relates to the field of speech technology, and more particularly, to a recording method, apparatus, electronic device, and readable storage medium in the field of speech technology. Background Currently, there may be recording functions in different applications. Simultaneous recording by multiple applications may preempt the audio focus of the microphone. For example, a user may need to wake up a voice assistant while recording using navigation, which may result in the voice assistant not waking up. Therefore, a method for ensuring that multiple applications can record simultaneously is needed to improve user experience. Disclosure of Invention The application provides a recording method, a recording device, electronic equipment and a readable storage medium. In a first aspect, a recording method is provided, the method comprising: under the condition that a recording request sent by a first application is received, if the microphone is started by a second application, determining whether the first application is a first type application needing to occupy an audio focus; if the first application is the first type application, determining whether the second application is the second type application which does not occupy the audio focus; if the second application is the second type application, starting the recording authority of the first application so that the first application and the second application jointly acquire the audio data currently acquired by the microphone. In the embodiment of the application, the electronic control unit determines whether the microphone is started by a second application which does not need to occupy the audio focus under the condition of receiving a recording request sent by a first application which needs to occupy the audio focus, and if the microphone is started by the second application which does not need to occupy the audio focus, the recording authority of the first application is started, so that the first application acquires the audio data currently acquired by the microphone. Therefore, after the fact that the microphone is started by the second application which does not need to occupy the focus is determined, the electronic control unit controls the recording authority of the first application to be started, so that the first application and the second application jointly use the audio data collected by the microphone, a plurality of applications can share microphone resources, and user experience is improved. With reference to the first aspect, in some possible implementations, the method further includes: determining whether the first application needs to monopolize audio data collected by the microphone; if the first application needs to monopolize the audio data collected by the microphone, the recording authority of the second application is closed, so that the second application stops obtaining the audio data collected by the microphone. In the embodiment of the application, after receiving the recording request sent by the first application and determining that the microphone is started by the second application, if the first application is determined to need to monopolize the audio data collected by the microphone, the electronic control unit closes the recording authority of the second application, so that the second application stops obtaining the audio data collected by the microphone. Because the security and the real-time requirements of the voice telephone are high, the first application can be ensured to acquire the audio data acquired by the microphone in real time by closing the recording authority of the second application, thereby meeting the real-time requirements of the voice call. And meanwhile, the recording authority of other applications is closed, so that the risk of communication information leakage can be reduced. With reference to the first aspect, in some possible implementations, the audio data collected by the microphone is stored in the target storage space, and after the recording authority of the second application is closed, the method further includes: Determining a first address, wherein the first address is an address when the second application reads audio data from the target storage space when the recording authority is closed; determining a second address, wherein the second address is an address when the first application starts to read the audio data from the target storage space when the recording authority is opened; The audio data is provided to the second application between the first address and the second address. In the embodiment of the application, the electronic control unit determines the first address and the second address after closing the recording authority of the second application, and provides the audio data between the first address and the second address for the second