Audio playing processing method and system, electronic device and storage medium
By predefined audio attributes and focus control, the audio stream is activated and written to different channels for processing, solving the problem of mixed noise in car audio playback systems that cannot meet the needs of various audio sources and special scenarios, and achieving a better audio playback experience.
Patent Information
- Application Number
- CN202410585476.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-11
- Publication Date
- 2025-11-11
AI Technical Summary
Existing car audio playback systems cannot meet the needs of various audio sources, are prone to mixing and noise, and cannot handle audio playback needs in special scenarios.
By defining predefined audio attribute types and focus control methods, audio attributes are created, audio focus is acquired, audio streams are activated using audio policy files and written to different audio playback channels, and then processed by digital signal processors and signal amplifiers.
It achieves unified tagging processing for multiple audio sources, reduces mixing and noise issues, and meets various audio playback needs, especially audio playback needs in special scenarios.
Smart Images

Figure CN120932689A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of automotive technology, and in particular to an audio playback processing method, system, electronic device, and storage medium. Background Technology
[0002] With the continuous upgrading of automobiles, society has gradually entered the era of intelligent vehicles. Among the related technologies of intelligent vehicles, audio playback is undoubtedly an important research area. People are pursuing a more ultimate audio playback experience. However, current automobiles are gradually failing to keep up with people's needs in terms of audio playback. Summary of the Invention
[0003] This invention provides an audio playback processing method, system, electronic device, and storage medium, aiming to effectively solve the technical problem that existing technologies in automobiles are gradually failing to meet people's needs for audio playback.
[0004] According to a first aspect of the present invention, an audio playback processing method is provided, comprising: acquiring an audio to be played; creating attributes of the audio to be played using a predefined audio attribute type; acquiring audio focus for the audio to be played having the attributes according to a predefined audio focus control method; creating a thread for playing the audio; activating an audio playback channel through which the audio stream of the audio to be played is written using the thread and a pre-created audio strategy file; writing the audio stream of the audio to be played to an audio device node through the audio playback channel; and processing the audio stream using a digital signal processor and / or a signal amplifier on the device node to drive a car player to play the audio to be played.
[0005] Furthermore, the predefinition step of the audio attribute type includes: obtaining the audio attribute types that the car can process, including the attribute types of the car's built-in audio and the attribute types of external audio; redefining all audio types so that all audio types have the same category label.
[0006] Furthermore, the audio focus control method includes: determining whether there is audio being played; if not, assigning audio focus to the audio to be played; if so, obtaining the attributes of the audio to be played and the attributes of the audio being played, and using the attributes of the audio to be played and the attributes of the audio being played to compare with a predefined audio focus preemption behavior table to obtain the audio focus allocation result.
[0007] Furthermore, after obtaining the audio allocation result, the audio playback processing method further includes: requesting focus for the audio to be played by calling a first service; sending a stop playback broadcast to the currently playing audio using the focus allocation result, so that the currently playing audio loses audio focus and stops playing, and the audio to be played gains audio focus and starts playing; or, requesting focus for the audio to be played by calling a second service; sending a volume reduction playback broadcast to the currently playing audio using the focus allocation result, so that the currently playing audio lowers its volume and the audio to be played plays at normal volume; or, requesting focus for the audio to be played by calling a third service; sending a pause playback broadcast to the currently playing audio using the focus allocation result, so that the currently playing audio temporarily loses audio focus and pauses playing, and the audio to be played gains audio focus and starts playing, and after the audio to be played finishes playing, restoring audio focus to the currently playing audio that has temporarily lost audio focus and continuing playback.
[0008] Furthermore, the pre-creation step of the audio policy file includes: describing all audio devices connected to the vehicle; specifying one of all audio devices as the default device; defining configuration information for audio playback and input streams; defining information on how different audio streams are played on the corresponding audio devices; and defining audio playback channels to describe different audio streams connected to different endpoints from different sources.
[0009] Furthermore, there are 8 pre-created audio playback channels, and audio streams of different types of audio to be played will be written into different audio playback channels; the step of activating the audio playback channel written to the audio stream of the audio to be played using the thread and the pre-created audio strategy file includes: using the strategy file to determine the audio playback channel of the audio to be played; and activating the determined audio playback channel.
[0010] Furthermore, the step of writing the audio stream of the audio to be played into the audio device node through the audio playback channel includes: transmitting the audio stream of the audio to be played from the source of the corresponding audio playback channel to the corresponding endpoint; and mapping the audio stream to the audio device node of the sound card at the endpoint.
[0011] According to a second aspect of the present invention, an audio playback processing system is also provided, comprising: an audio attribute creation module for acquiring audio to be played and creating attributes of the audio to be played using predefined audio attribute types; an audio focus acquisition module for acquiring audio focus for the audio to be played having the attributes according to a predefined audio focus control method; a thread creation module for creating a thread for playing audio; an audio channel activation module for activating an audio playback channel through which the audio stream of the audio to be played is written using the thread and a pre-created audio strategy file; a device node writing module for writing the audio stream of the audio to be played to an audio device node through the audio playback channel; and an audio stream processing module for processing the audio stream at the device node using a digital signal processor and / or a signal amplifier to drive a car player to play the audio to be played.
[0012] According to a third aspect of the present invention, the present invention also provides an electronic device, comprising: a memory and a processor, wherein the memory stores a computer program executable on the processor, and the processor, when executing the computer program, implements the audio playback processing method described in any one of the above.
[0013] According to another aspect of the present invention, the present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the audio playback processing method described in any one of the above.
[0014] Through one or more embodiments of the above embodiments of the present invention, at least the following technical effects can be achieved:
[0015] In the technical solution disclosed in this invention, by creating attributes for the audio to be played, external audio can also be created, so that the audio type is not limited by the car's built-in audio type, thus meeting people's needs for multiple audio sources; and only the audio with audio focus can be played, which largely solves the problems of mixing and noise that occur when multiple audios are played, further meeting people's needs for audio playback; and different audio to be played can write their audio streams into different audio playback channels, which can meet people's mixing needs for audio playback in special scenarios. Attached Figure Description
[0016] The technical solution and other beneficial effects of the present invention will become apparent from the following detailed description of specific embodiments of the invention, in conjunction with the accompanying drawings.
[0017] Figure 1 A flowchart of an audio playback processing method provided in an embodiment of the present invention;
[0018] Figure 2 This is an application scenario diagram of the audio playback processing method provided in an embodiment of the present invention;
[0019] Figure 3 This is another application scenario diagram of the audio playback processing method provided in the embodiments of the present invention;
[0020] Figure 4 This is a framework diagram of an audio playback processing system provided in an embodiment of the present invention;
[0021] Figure 5 A schematic block diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0022] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.
[0023] In the description of this invention, it should be noted that, unless otherwise explicitly specified and limited, the term "and / or" in this document is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Furthermore, the character " / " in this document, unless otherwise specified, generally indicates that the preceding and following related objects have an "or" relationship.
[0024] There are many types of audio that need to be processed in cars. At the same time, modern smart cars are endowed with intelligent playback processes for various audio types and the pursuit of the ultimate music experience. This requires us to develop an advanced audio playback strategy that involves hierarchical processing and channel-specific playback.
[0025] The current native Android audio playback strategy cannot meet the needs of automotive audio for the following reasons:
[0026] a. Android's native audio playback types (AudioAttributes.USAGEs) are limited and cannot express the rich audio source requirements of the in-vehicle system;
[0027] b. Noise is easily generated when multiple audio files are played simultaneously.
[0028] c. There are many application scenarios for in-vehicle audio requirements. In many overlapping scenarios (such as music + RVC reversing camera, TOD standby + music), the native audio logic cannot handle these special scenarios.
[0029] Therefore, current cars are gradually falling behind people's needs in terms of audio playback.
[0030] To address the aforementioned problems, this application provides an audio playback processing method, system, electronic device, and storage medium, which can solve at least one of the problems mentioned above, thereby improving people's demand for car audio playback.
[0031] Figure 1 The image shows an audio playback processing method provided by an embodiment of the present invention, including:
[0032] S101. Obtain the audio to be played and create the attributes of the audio to be played using the predefined audio attribute types;
[0033] S102. Obtain audio focus for the audio to be played with attributes according to the predefined audio focus control method;
[0034] S103, Create a thread for playing audio;
[0035] S104. Activate the audio playback channel written to the audio stream of the audio to be played using threads and a pre-created audio strategy file.
[0036] S105. Write the audio stream of the audio to be played to the audio device node through the audio playback channel;
[0037] S106. At the device node, a digital signal processor and / or signal amplifier are used to process the audio stream to drive the car's player to play the audio to be played.
[0038] In step S101, the predefined audio attribute types include redefining the car's native audio source type and redefining the car's external audio source type, so that all audio types have the same category label. In step S102, the attributes of the audio to be played can be created by selecting the label according to the audio to be played, and the external audio is also uniformly labeled, enriching the types of audio that the car can play.
[0039] In step S102, this embodiment pre-sets an audio focus control method, so that only the audio to be played that has obtained audio focus can be played, which can greatly reduce the probability of noise when multiple audios are played at the same time.
[0040] In step S104, by reading the audio strategy file, the processing of the audio to be played can be read, including writing the audio stream of the audio to be played into the audio playback channel.
[0041] In addition, the logic of all steps in this application is implemented in the AptivCarAudioService service of the vehicle's Android system. The communication method is AIDL, and the AptivCarAudioManager is used to call the HMI to solve the problem of inter-process communication.
[0042] In step S105, the device node is a virtual node within the Android system, but each virtual device node corresponds to an actual node in the physical layer. In step S106, after processing the audio stream using a digital signal processor and / or a signal amplifier, the audio stream on the virtual node can be played on the player.
[0043] Therefore, the audio playback processing method provided in this embodiment, by creating attributes of the audio to be played, enables the creation of external audio as well, so that the audio type is not limited by the car's built-in audio type, thereby meeting people's needs for multiple audio sources; and only the audio with audio focus can be played, which largely solves the problems of mixing and noise that occur when multiple audios are played, further meeting people's needs for audio playback; and different audios to be played can write their audio streams to different audio playback channels, which can meet people's mixing needs for audio playback in special scenarios.
[0044] In one embodiment, the predefinition step of audio attribute types includes: obtaining the audio attribute types that the vehicle can process, including the attribute types of the vehicle's built-in audio and the attribute types of external audio; and redefining all audio source types so that all audio source types have the same category label.
[0045] In this embodiment, the audio attribute types that the car can process can be obtained from the vehicle's product manual, and the various audio sources to be processed by the vehicle's system can be redefined. The original audio sources are then remapped to meet the requirements of the rich audio source types on the vehicle's system. Table 1 lists the redefined audio stream types in this embodiment, as follows:
[0046] Table 1 Audio Type Definition Table
[0047]
[0048] In this embodiment, AudioAttributes.USAGE_type is the label of the audio stream in audio processing, which is ultimately mapped to the audio playback channel. This invention retains the originally defined audio type and redefines the USAGE_type required by the in-vehicle system.
[0049] In one embodiment, the audio focus control method includes: determining whether there is audio being played; if not, assigning audio focus to the audio to be played; if so, obtaining the attributes of the audio to be played and the attributes of the audio being played, and using the attributes of the audio to be played and the attributes of the audio being played to compare with a predefined audio focus preemption behavior table to obtain the audio focus allocation result.
[0050] In this embodiment, all audio source types are given priority. Audio source playback requires acquiring focus, and only audio sources with focus will be played. This can solve the problem of disordered audio source playback and noise from multiple audio sources on the vehicle's infotainment system.
[0051] In one embodiment, after obtaining the audio allocation result, the audio playback processing method further includes:
[0052] The first approach: Request focus from the first service for the audio to be played; use the focus allocation result to send a stop playback broadcast to the currently playing audio, causing it to lose focus and stop playing, while the audio to be played gains focus and begins playback; or...
[0053] The second approach: Request focus from the second service for the audio to be played; use the focus allocation result to send a broadcast to the currently playing audio to lower its volume, thus reducing the volume of the currently playing audio and allowing the audio to be played at its normal volume; or...
[0054] The third approach is to request focus from a third service for the audio to be played; use the focus allocation result to send a pause broadcast to the currently playing audio, so that the currently playing audio temporarily loses audio focus and pauses playback, while the audio to be played gains audio focus and starts playing. After the audio to be played finishes playing, the currently playing audio, which has temporarily lost audio focus, is restored to audio focus and playback continues.
[0055] In this embodiment, if the first processing method is used, and different audio apps APP0, APP1, APP2, and APP3 are being played sequentially, when a new audio app APP4 is to be played, the Android system requests focus for APP4. After arbitration, the Android system sends a system broadcast AUDIOFOCUS_LOSS. Upon receiving AUDIOFOCUS_LOSS, APP0, APP1, APP2, and APP3 will stop their current playback behavior.
[0056] If the second approach is used, when a new application requests focus, the Android system will continue the current application's playback, but will adjust its volume. For example, app0 is playing music, and app1 is playing navigation. App0 is in the background, and app1 is in the foreground. When app1 wants to play navigation sounds, it will request background focus from the system, and then app0 can continue playing music, but its volume should be reduced.
[0057] If the third approach is used, for example, when app0 is playing music and then a phone call occurs, assuming app1 is the phone, then app1 needs to obtain audio focus for a short period of time. It requests audio focus from the system and pauses app0's audio focus. The system broadcasts a message to app0 to pause focus, and app0 pauses playback. When the call ends, app0 will resume its current playback.
[0058] The above three situations are the three situations listed in this embodiment. Based on the description of the above three situations, we summarize the audio focus arbitration of the present invention in detail as follows:
[0059] • "G":AUDIOFOCUS_GAIN
[0060] ·"GT":AUDIOFOCUS_GAIN_TRANSIENT
[0061] ·"GTE":AUDIOFOCUS_GAIN_TRANSIENT_EXCLUSIVE
[0062] ·"GTMD":AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK
[0063] The arbitration results are as follows:
[0064] ·"G":AUDIOFOCUS_REQUEST_GRANTED
[0065] ·"F":AUDIOFOCUS_REQUEST_FAILED
[0066] ·"D":AUDIOFOCUS_REQUEST_DELAYED.
[0067] The result of the arbitration of the current audio source is as follows:
[0068] • “L”:AUDIOFOCUS_LOSS
[0069] ·"LT":AUDIOFOCUS_LOSS_TRANSIENT
[0070] ·"LTD":AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK
[0071] ·"LTN":AUDIOFOCUS_LOSS_TRANSIENT_NORMAL_PLAY
[0072] ·"-":not lose focus,continue last status
[0073] Based on the above parameters, the behaviors of various in-vehicle audio sources predefined in this application after they compete for audio focus are shown in Table 2. When predefining the audio focus control method, you can refer to Table 2:
[0074] Table 2 Audio Focus Acquisition Behavior Table
[0075]
[0076] In one embodiment, the pre-creation step of the audio policy file includes: describing all audio devices connected to the vehicle; designating one of all audio devices as the default device; defining configuration information for audio playback and input streams; defining information on how different audio streams are played on the corresponding audio devices; and defining audio playback channels to describe different audio streams connected from different sources to different endpoints.
[0077] In this embodiment, the audio strategy file is interpreted. This file describes the topology of the vehicle audio system. Using XML file format to define the audio topology makes the file easier to read and can describe complex audio topologies. The audio strategy file in this application defines the audio devices connected to the vehicle's infotainment system, specifies which of the aforementioned audio devices is the default device, defines the configuration information for audio playback and input streams, specifies which audio device is used to play the aforementioned audio stream information (corresponding to the definition of different audio stream information played on the corresponding audio devices), and specifies which audio device is played on which terminal (corresponding to the definition of audio playback channels). In addition, this application can also define other information according to actual conditions, thereby enabling the audio strategy file to describe the audio topology more conveniently and accurately.
[0078] In one embodiment, there are 8 pre-created audio playback channels, and audio streams of different types of audio to be played are written to different audio playback channels; the steps of activating the audio playback channels to which the audio streams of the audio to be played are written using threads and pre-created audio policy files include: determining the audio playback channels of the audio to be played using the policy file; and activating the determined audio playback channels.
[0079] This embodiment defines 8 audio playback channels, which can be allocated to different channels of the sound card according to the mixing logic of various audio sources, thus solving the mixing needs of the vehicle system in special scenarios.
[0080] In this embodiment, the step of pre-creating the playback channel is written into the Audiohal file, which provides an operation interface and device to AudioFlinger, and is responsible for creating and activating the audio playback channel. IDevice (hardware / interfaces / audio / 2.0 / IDevice.hal) is used to provide the audio server with input and output audio streams, and to control volume and mute & unmute operations. IStream (hardware / interfaces / audio / 2.0 / IStream.hal) is used to manage the stream input and output to the audio driver layer.
[0081] In this embodiment, when the audio stream flows into AudioFlinger, AudioFlinger creates a playback thread. This thread writes the audio stream to the corresponding audio playback channel according to the audio policy of AudioPolicyManager. The creation and activation of audio playback channels are handled by AudioHal. This embodiment defines 8 audio playback channels, and different audio types are written to different audio playback channels.
[0082] In one embodiment, the step of writing the audio stream of the audio to be played to the audio device node via the audio playback channel includes: transmitting the audio stream of the audio to be played from the source of the corresponding audio playback channel to the corresponding endpoint; and mapping the audio stream to the audio device node of the sound card at the endpoint.
[0083] In this embodiment, the sound card output relies on the main chip, which is the Renesas H3 in-vehicle control chip. The H3's SSI0 sound card (slot 0) supports time-division multiplexing of 8 audio streams in TDM8 format. This embodiment defines 8 audio playback channels; theoretically, each channel has two channels (left and right). Therefore, considering the requirements of the SSI0 sound card and the actual audio mixing requirements, the design of this invention rationally allocates 8 slots to 4 audio device nodes. After the audio stream is written to the sound card's audio device nodes, it can be played back after passing through a DSP digital signal processor and / or a power amplifier.
[0084] Please see Figure 2 and Figure 3 This application also provides two audio playback scenarios in its embodiments. Figure 3In the scenario of a car playing music via a USB interface, when a USB device plays music through the car's infotainment system, the car's audio manager (AptivCarAudioManager) calls the car's audio service (AptivCarAudioService) to output the music's audio stream through the output channel (AptivBusManager). This stream then interacts with the car's hardware layer (DSP, Digital Signal Processor; Amplifier) via a small library (TinyALSA) that interacts with Linux's ALSA, thereby playing the sound (speaker). During the process of the vehicle's audio manager calling the vehicle's audio service, according to the content in Table 1, the audio stream type representing music is the second row of Table 1, namely CAR_AUDIO_USAGE_MUSIC=1. During this process, the audio manager of the vehicle's audio system creates an audio stream type of CAR_AUDIO_USAGE_MUSIC=1. In addition, during the process of outputting the music audio stream through the output channel, the audio stream is transmitted through the first channel of the 8 audio stream transmission channels, namely the bus0_media_out channel.
[0085] Figure 4 In a scenario where audio is played for a car's map app, when the map app is selected and voice navigation is used, the car's audio manager (AptivCarAudioManager) calls the car's audio service (AptivCarAudioService) to output the music audio stream through the output channel (AptivBusManager). This stream then interacts with the car's hardware layer (DSP, Digital Signal Processor; Amplifier) through a small library (TinyALSA) that interacts with Linux's ALSA, thereby playing the sound (speaker). During the process of the vehicle's audio manager calling the vehicle's audio service, according to the content in Table 1, the audio stream type representing map navigation is the third row of Table 1, namely CAR_AUDIO_USAGE_MUSIC=1. During this process, the audio manager of the vehicle's audio system creates an audio stream type of CAR_AUDIO_USAGE_NAVIGATION_GUIDANCE=2. In addition, during the process of outputting the navigation audio stream through the output channel, the audio stream is transmitted through the second channel of the 8 audio stream transmission channels, namely the bus1_navigation_out channel.
[0086] Please see Figure 4This application also provides an audio playback processing system, including: an audio attribute creation module, an audio focus acquisition module, a thread creation module, an audio channel activation module, a device node writing module, and an audio stream processing module; the audio attribute creation module is used to acquire the audio to be played and create attributes of the audio to be played using predefined audio attribute types; the audio focus acquisition module is used to acquire audio focus for the audio to be played with attributes according to a predefined audio focus control method; the thread creation module is used to create a thread for playing audio; the audio channel activation module is used to activate the audio playback channel written to the audio stream of the audio to be played using the thread and a pre-created audio strategy file; the device node writing module is used to write the audio stream of the audio to be played to the audio device node through the audio playback channel; the audio stream processing module is used to process the audio stream at the device node using a digital signal processor and / or a signal amplifier to drive the car's player to play the audio to be played.
[0087] This application provides an audio playback processing system that, by creating attributes for the audio to be played, enables the creation of external audio sources, thus freeing the audio type from the limitations of the car's built-in audio types and satisfying people's needs for multiple audio sources. Furthermore, only the audio with the audio focus can be played, largely solving problems such as mixing and noise that occur when multiple audios are played, further satisfying people's audio playback needs. Additionally, different audio streams can be written to different audio playback channels, meeting people's mixing needs for audio playback in special scenarios.
[0088] The audio attribute creation module includes an audio attribute type acquisition unit and an audio type definition unit. The audio attribute type acquisition unit is used to acquire the audio attribute types that the car can process, including the attribute types of the car's built-in audio and the attribute types of external audio. The audio type definition unit is used to redefine all audio types so that all audio types have the same category label.
[0089] In one embodiment, the audio focus acquisition module includes: a judgment unit and an execution unit; the judgment unit is used to determine whether there is audio being played; the execution unit is used to, if not, assign audio focus to the audio to be played; if yes, obtain the attributes of the audio to be played and the attributes of the audio being played, and use the attributes of the audio to be played and the attributes of the audio being played to compare with a predefined audio focus preemption behavior table to obtain the audio focus allocation result.
[0090] In one embodiment, the audio playback processing system further includes: a focus request module, configured to, after the execution unit obtains the audio allocation result, call a first service to request focus for the audio to be played; use the focus allocation result to send a stop playback broadcast to the currently playing audio, so that the currently playing audio loses audio focus and stops playing, and the audio to be played gains audio focus and starts playing; or, call a second service to request focus for the audio to be played; use the focus allocation result to send a volume reduction playback broadcast to the currently playing audio, so that the volume of the currently playing audio is reduced, and the audio to be played plays at normal volume; or, call a third service to request focus for the audio to be played; use the focus allocation result to send a pause playback broadcast to the currently playing audio, so that the currently playing audio temporarily loses audio focus and pauses playing, and the audio to be played gains audio focus and starts playing, and after the audio to be played finishes playing, restore the audio focus of the currently playing audio that has temporarily lost audio focus and continue playing.
[0091] In one embodiment, the audio playback processing system further includes: an audio policy file creation module for describing all audio devices connected to the vehicle; specifying one of all audio devices as the default device; defining configuration information for audio playback and input streams; defining information for different audio streams to be played in the corresponding audio devices; and defining audio playback channels to describe different audio streams connected to different endpoints from different sources.
[0092] In one embodiment, there are 8 pre-created audio playback channels, and audio streams of different types of audio to be played are written into different audio playback channels; the audio channel activation module includes: an audio stream transmission unit and an audio stream mapping unit. The audio stream transmission unit is used to transmit the audio stream of the audio to be played from the source of the corresponding audio playback channel to the corresponding endpoint; the audio stream mapping unit is used to map the audio stream to the audio device node of the sound card at the endpoint.
[0093] This application provides an electronic device; please refer to [link / reference]. Figure 5 The electronic device includes a memory 601, a processor 602, and a computer program stored in the memory 601 and executable on the processor 602. When the processor 602 executes the computer program, it implements the audio playback processing method described above.
[0094] Furthermore, the electronic device also includes at least one input device 603 and at least one output device 604.
[0095] The aforementioned memory 601, processor 602, input device 603, and output device 604 are connected via bus 605.
[0096] The input device 603 can specifically be a camera, touch panel, physical buttons, or mouse, etc. The output device 604 can specifically be a display screen.
[0097] The memory 601 can be a high-speed random access memory (RAM) or a non-volatile memory, such as a disk storage device. The memory 601 is used to store a set of executable program code, and the processor 602 is coupled to the memory 601.
[0098] Furthermore, this application embodiment also provides a computer-readable storage medium, which may be disposed in the electronic device of the above embodiments, and may be the memory 601 in the foregoing embodiments. The computer-readable storage medium stores a computer program, which, when executed by the processor 602, implements the audio playback processing method described in the foregoing method embodiments.
[0099] Furthermore, the storage medium of the computer can also be a USB flash drive, a portable hard drive, a read-only memory (ROM), RAM, a magnetic disk, or an optical disk, or any other medium that can store program code.
[0100] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or modules may be electrical, mechanical, or other forms.
[0101] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical modules; that is, they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0102] Furthermore, the functional modules in the various embodiments of the present invention can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated modules described above can be implemented in hardware or as software functional modules.
[0103] If the integrated module is implemented as a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention.
[0104] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that the present invention is not limited to the described order of actions, because according to the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to the present invention.
[0105] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0106] In summary, although the present invention has been disclosed above with reference to preferred embodiments, the above preferred embodiments are not intended to limit the present invention. Those skilled in the art can make various modifications and refinements without departing from the spirit and scope of the present invention. Therefore, the scope of protection of the present invention shall be determined by the scope defined in the claims.
Claims
1. An audio playback processing method, characterized in that, include: Obtain the audio to be played, and create the attributes of the audio to be played using predefined audio attribute types; According to the predefined audio focus control method, the audio to be played with the aforementioned attributes is obtained; Create a thread to play audio; The audio playback channel is activated by writing the audio stream of the audio to be played using the thread and the pre-created audio strategy file. The audio stream of the audio to be played is written to the audio device node through the audio playback channel; At the device node, the audio stream is processed using a digital signal processor and / or a signal amplifier to drive the car's player to play the audio to be played.
2. The audio playback processing method as described in claim 1, characterized in that, The predefinition steps for the audio attribute type include: Obtain the audio attribute types that the car can process, including the attribute types of the car's built-in audio and the attribute types of external audio. Redefine all audio types so that all audio types have the same category label.
3. The audio playback processing method as described in claim 1, characterized in that, The audio focus control methods include: Determine if audio is playing; If not, then apply audio focus to the audio to be played; If so, obtain the attributes of the audio to be played and the attributes of the audio currently being played, and use the attributes of the audio to be played and the attributes of the audio currently being played to compare with a predefined audio focus preemption behavior table to obtain the audio focus allocation result.
4. The audio playback processing method as described in claim 3, characterized in that, After obtaining the audio allocation result, the audio playback processing method further includes: The system requests focus from the first service for the audio to be played; using the focus allocation result, it sends a stop playback broadcast to the currently playing audio, causing the currently playing audio to lose audio focus and stop playing, while the audio to be played gains audio focus and begins playback; or, The system requests focus from a second service for the audio to be played; using the focus allocation result, it broadcasts a message to the currently playing audio to lower its volume, thus reducing the volume of the currently playing audio and allowing the audio to be played at its normal volume; or... The system calls a third service to request focus for the audio to be played; it uses the focus allocation result to send a pause broadcast to the currently playing audio, so that the currently playing audio temporarily loses audio focus and pauses playback, while the audio to be played gains audio focus and starts playing; and after the audio to be played finishes playing, it restores audio focus to the currently playing audio that has temporarily lost audio focus and resumes playback.
5. The audio playback processing method as described in claim 1, characterized in that, The pre-creation steps for the audio policy file include: Describe all audio devices connected to the car; Specify one of all audio devices as the default device; Defines the configuration information for audio playback and input streams; Define the information on which different audio streams are played on the corresponding audio devices; Define audio playback channels to describe different audio sources connected to different endpoints.
6. The audio playback processing method as described in claim 5, characterized in that, There are 8 pre-created audio playback channels, and audio streams of different types of audio to be played will be written into different audio playback channels; The step of activating the audio playback channel by writing the audio stream of the audio to be played using the thread and the pre-created audio strategy file includes: The audio playback channel of the audio to be played is determined using the strategy file; Activate the selected audio playback channel.
7. The audio playback processing method as described in claim 5, characterized in that, The step of writing the audio stream of the audio to be played into the audio device node through the audio playback channel includes: Transmit the audio stream to be played from the source of the corresponding audio playback channel to the corresponding endpoint; At the endpoint, the audio stream is mapped to the audio device node of the sound card.
8. An audio playback processing system, characterized in that, include: The audio attribute creation module is used to obtain the audio to be played and create the attributes of the audio to be played using predefined audio attribute types; An audio focus acquisition module is used to acquire audio focus for the audio to be played that has the aforementioned attributes, according to a predefined audio focus control method. The thread creation module is used to create threads for playing audio. An audio channel activation module is used to activate the audio playback channel on which the audio stream of the audio to be played is written, using the thread and a pre-created audio strategy file. The device node writing module is used to write the audio stream of the audio to be played into the audio device node through the audio playback channel; An audio stream processing module is used at the device node to process the audio stream using a digital signal processor and / or a signal amplifier to drive the car's player to play the audio to be played.
9. An electronic device, characterized in that, include: A memory and a processor, wherein the memory stores a computer program that can run on the processor, characterized in that, when the processor executes the computer program, it implements the audio playback processing method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the audio playback processing method according to any one of claims 1 to 7.