An audio routing implementation method and apparatus

By defining audio data stream routing and configuration information in the Android HAL layer, constructing linked lists, and creating input/output ports, the problem of complex audio processing implementation in existing technologies is solved. This enables dynamic and specific processing of audio data streams, making it suitable for in-vehicle systems and karaoke systems.

CN116560612BActive Publication Date: 2026-11-17WUHAN KOTEI INFORMATICS
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310315765.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-28
Publication Date
2026-11-17
Estimated Expiration
2043-03-28

AI Technical Summary

Technical Problem

Adding audio processing functionality to the native Android HAL code is complex using existing techniques, requiring modifications to the native framework and making implementation difficult.

Method used

By defining audio data stream routing and configuration information in the XML file, the system parses the configuration information to build a linked list after startup. When the Audio application starts, it creates input and output ports and performs pre-processing on the audio data based on the functional modules to form an audio route.

Benefits of technology

Without modifying the original framework, the process of adding audio processing functions has been simplified, and dynamic and specific processing of audio data streams has been achieved, making it suitable for audio processing in in-vehicle systems and KTV systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116560612B_ABST
    Figure CN116560612B_ABST
Patent Text Reader

Abstract

This invention provides an audio routing implementation method and apparatus. The method includes: defining audio data stream routing information and configuration information in an XML file, wherein the routing information includes at least a route start point, an end point, and functional modules along the route; after system startup, a configuration parser parses the configuration information in the XML and constructs a linked list; when the Audio application starts, it searches for the corresponding routing information in the linked list based on the audio data stream attributes, creates objects based on the application, functional modules, and driver device information in the routing information, and creates input / output ports; connects the application, functional modules, and driver devices to form an audio route; and performs pre-defined processing on the audio data based on the functional modules in the audio route. This solution simplifies the process of adding functional processing modules without modifying the overall framework of the Android HAL layer, facilitating specific processing of audio data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of Android application development, and in particular relates to an audio routing implementation method and device. Background Technology

[0002] In the native Android HAL code, audio input / output streams do not process audio data; the HAL layer (Hardware Abstraction Layer) simply moves audio data around. Therefore, adding audio processing and enriching audio functionality often requires modifying the underlying native framework, making the process of adding audio processing features very complex. Summary of the Invention

[0003] In view of this, embodiments of the present invention provide an audio routing implementation method and apparatus to solve the problem that the existing implementation process for adding audio processing functions is relatively complex.

[0004] In a first aspect of the present invention, an audio routing implementation method is provided, comprising:

[0005] Define audio data stream routing information and configuration information in the XML file. The routing information shall include at least the route start point, end point and functional modules along the route.

[0006] After the system starts, the configuration parser parses the configuration information in the XML and builds a linked list;

[0007] When the Audio application starts, it looks up the corresponding routing information in the linked list based on the audio data stream attributes, creates objects based on the application, functional module and driver device information in the routing information, and creates input and output ports.

[0008] Connect applications, functional modules, and driver devices to form an audio route;

[0009] Audio data is pre-processed based on the functional modules in the audio routing.

[0010] In a second aspect of the present invention, an audio routing implementation apparatus is provided, comprising:

[0011] A definition module is used to define audio data stream routing information and configuration information in an XML file. The routing information includes at least the route start point, end point, and functional modules along the route.

[0012] The parsing module is used after the system starts up to parse the configuration information in the XML and build a linked list.

[0013] Create a module that, when the Audio application starts, looks up the corresponding routing information in the linked list based on the audio data stream attributes, creates objects based on the application, functional modules, and driver device information in the routing information, and creates input and output ports;

[0014] The connection module is used to connect applications, functional modules, and driver devices to form an audio route;

[0015] The processing module is used to perform pre-defined processing on audio data based on the functional modules in the audio routing.

[0016] In a third aspect of the present invention, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable by the processor, wherein the processor executes the computer program to implement the steps of the method as described in the first aspect of the present invention.

[0017] In a fourth aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the method provided in the first aspect of the present invention.

[0018] In this embodiment of the invention, by adding audio data stream routing to the Android HAL layer, dynamic processing of audio data stream routing can be achieved while maintaining the audio data transmission function of the native framework HAL layer. Without modifying the overall framework, the process of adding functional processing modules can be simplified, and it is convenient to perform specific processing on audio data. Attached Figure Description

[0019] To more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0020] Figure 1 A flowchart illustrating an audio routing implementation method according to an embodiment of the present invention;

[0021] Figure 2 This is a schematic diagram of an audio routing implementation device according to an embodiment of the present invention;

[0022] Figure 3 This is a schematic diagram of the structure of an electronic device provided in one embodiment of the present invention. Detailed Implementation

[0023] To make the objectives, features, and advantages of this invention more apparent and understandable, the technical solutions of the embodiments of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the embodiments described below are only some embodiments of this invention, and not all embodiments. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention.

[0024] It should be understood that the terms "comprising" and other similar expressions in the specification, claims, and accompanying drawings of this invention are intended to cover a non-exclusive inclusion, such as a process, method, system, or apparatus that includes a series of steps or units and is not limited to the listed steps or units. Furthermore, "first" and "second" are used to distinguish different objects and are not intended to describe a specific order.

[0025] Please see Figure 1 The present invention provides a flowchart illustrating an audio routing implementation method, comprising:

[0026] S101. Define audio data stream routing information and configuration information in an XML file. The routing information shall include at least the route start point, end point, and functional modules along the route.

[0027] In an XML file, one or more routing information can be defined. The routing information is a complete link composed of a starting point (from), an ending point (to), and a path functional module.

[0028] The configuration information is defined in the XML file, which includes at least the Audio application, functional modules, audio driver devices, and audio data routes. The route start point is configured as the Audio application or the audio driver device, and the route end point is configured as the audio driver device or the Audio application.

[0029] The XML file also requires configuration information for `from`, `to`, and `module`. The four defined configurations include audio application, functional module, audio driver device, and audio data route. In this embodiment, `from` can be configured as an audio application or an audio driver device, `to` can be configured as an audio driver device or an audio application, and `module` is configured as a functional module.

[0030] S102. After the system starts, the configuration parser parses the configuration information in the XML and builds a linked list;

[0031] After the system starts, the configuration parser parses the configuration information in the XML file and adds the parsed information to the corresponding linked lists. For example, the linked lists are named appList (the linked list of audio applications), moduleList (the linked list of functional modules), deviceList (the linked list of audio driver devices), and routeList (the linked list of routes).

[0032] When the S103 Audio application starts, it searches for the corresponding routing information in the linked list based on the audio data stream attributes, creates objects based on the application, functional module and driver device information in the routing information, and creates input and output ports.

[0033] When the audio application starts, an audio input or output stream is opened in the HAL layer. Based on the audio device type passed down from the application, the linked list of the audio application is traversed for matching and detection. If a match is successful, the audio route name corresponding to the audio application is obtained. Then, the linked list of routes is traversed for matching and checking to find the corresponding route information. Based on the from, to, and module types in the route information, the corresponding linked lists (appList, moduleList, deviceList) are traversed to find the corresponding application, functional module, and driver device information, and the corresponding objects are created. Input or output ports are created for the application, functional module, and driver device.

[0034] S104, connecting applications, functional modules and driver devices to form an audio route;

[0035] A complete audio route is formed by connecting the ports of the application, functional modules, and driver devices.

[0036] S105. Perform pre-processing on audio data based on the functional modules in the audio routing.

[0037] Once the frequency link is established, the router can be used to configure audio device parameters, read and write audio data, and control audio devices.

[0038] The predetermined processing includes one or more of the following: audio device parameter configuration, audio data reading and writing, and audio device control.

[0039] Preferably, after the audio application ends, the audio stream is closed at the HAL layer, the audio route is disconnected, the node objects in the route are destroyed, and the related resources are reclaimed.

[0040] In this embodiment, an audio data routing framework is built at the Android HAL layer. This maintains the functionality of the native framework code for data reading and writing, and also allows for special processing of audio data. This simplifies the process of adding audio processing functionality to the HAL layer, avoiding the need to modify the existing, stable HAL layer audio code framework when implementing specific functions. For example, the sound effects in CarPlay in a car system, and the audio captured from the microphone in a karaoke room that needs to be output to an amplifier, can all be implemented in SmartRoute (audio data stream routing).

[0041] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0042] Figure 2 This is a schematic diagram of an audio routing implementation device provided in an embodiment of the present invention. The device includes:

[0043] Definition module 210 is used to define audio data stream routing information and configuration information in an XML file. The routing information includes at least the route start point, end point, and functional modules along the route.

[0044] The configuration information is defined in the XML file, which includes at least the Audio application, functional modules, audio driver devices, and audio data routing.

[0045] The route start point is configured as an audio application or audio driver device, and the route end point is configured as an audio driver device or audio application.

[0046] Parsing module 220 is used to parse the configuration information in the XML after the system starts and build a linked list;

[0047] Specifically, the corresponding routing information is searched in the linked list based on the audio device type passed by the Audio application.

[0048] Create module 230, which is used when the Audio application starts to look up the corresponding routing information in the linked list according to the audio data stream attributes, create objects based on the application, functional module and driver device information in the routing information, and create input and output ports;

[0049] Connection module 240 is used to connect applications, functional modules and driver devices to form an audio route;

[0050] Processing module 250 is used to perform pre-processing on audio data based on the functional modules in the audio routing.

[0051] The predetermined processing includes one or more of the following: audio device parameter configuration, audio data reading and writing, and audio device control.

[0052] Preferably, the processing module 250 further includes:

[0053] The recycling module is used to close the audio data stream at the HAL layer, disconnect the audio route, destroy the node objects in the route, and reclaim related resources after the audio application is closed or exited.

[0054] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the systems and modules described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0055] Figure 3 This is a schematic diagram of an electronic device according to an embodiment of the present invention. The electronic device is used to implement audio data routing in the Android HAL. Figure 3 As shown, the electronic device 3 of this embodiment includes: a memory 310, a processor 320, and a system bus 330. The memory 310 includes an executable program 3101 stored thereon. As those skilled in the art will understand, Figure 3 The electronic device structure shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0056] The following is combined with Figure 3 A detailed introduction to each component of the electronic device:

[0057] The memory 310 can be used to store software programs and modules. The processor 320 executes various functional applications and data processing of the electronic device by running the software programs and modules stored in the memory 310. The memory 310 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device (such as cached data), etc. In addition, the memory 310 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.

[0058] The memory 310 contains an executable program 3101 for network request methods. This executable program 3101 can be divided into one or more modules / units, which are stored in the memory 310 and executed by the processor 320 to implement audio data routing, etc. The one or more modules / units can be a series of computer program instruction segments capable of performing specific functions, describing the execution process of the computer program 3101 in the electronic device 3. For example, the computer program 3101 can be divided into functional modules such as a definition module, a parsing module, a creation module, a connection module, and a processing module.

[0059] The processor 320 is the control center of the electronic device. It connects various parts of the electronic device via various interfaces and lines. By running or executing software programs and / or modules stored in the memory 310, and by calling data stored in the memory 310, it performs various functions and processes data, thereby monitoring the overall status of the electronic device. Optionally, the processor 320 may include one or more processing units; preferably, the processor 320 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, application programs, etc., and the modem processor mainly handles wireless communication. It is understood that the modem processor may also not be integrated into the processor 320.

[0060] The system bus 330 is used to connect various functional components within the computer, transmitting data, address, and control information. Its type can be, for example, a PCI bus, an ISA bus, or a CAN bus. Instructions from the processor 320 are transmitted to the memory 310 via the bus, and the memory 310 sends data back to the processor 320. The system bus 330 is responsible for data and instruction exchange between the processor 320 and the memory 310. Of course, the system bus 330 can also connect to other devices, such as network interfaces and display devices.

[0061] In this embodiment of the invention, the executable program executed by the processing 320 of the electronic device includes:

[0062] Define audio data stream routing information and configuration information in the XML file. The routing information shall include at least the route start point, end point and functional modules along the route.

[0063] After the system starts, the configuration parser parses the configuration information in the XML and builds a linked list;

[0064] When the Audio application starts, it looks up the corresponding routing information in the linked list based on the audio data stream attributes, creates objects based on the application, functional module and driver device information in the routing information, and creates input and output ports.

[0065] Connect applications, functional modules, and driver devices to form an audio route;

[0066] Audio data is pre-processed based on the functional modules in the audio routing.

[0067] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and modules described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0068] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0069] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. An audio routing implementation method, characterized in that, include: Define audio data stream routing information and configuration information in the XML file. The routing information shall include at least the route start point, end point and functional modules along the route. After the system starts, the configuration parser parses the configuration information in the XML and builds a linked list; When the Audio application starts, it looks up the corresponding routing information in the linked list based on the audio data stream attributes, creates objects based on the application, functional module and driver device information in the routing information, and creates input and output ports. Connect applications, functional modules, and driver devices to form an audio route; Audio data is pre-processed based on the functional modules in the audio routing.

2. The method according to claim 1, characterized in that, The audio data stream routing information and configuration information defined in the XML file include: The configuration information is defined in the XML file, which includes at least the Audio application, functional modules, audio driver devices, and audio data routing. The route start point is configured as an audio application or an audio driver device, and the route end point is configured as an audio driver device or an audio application.

3. The method according to claim 1, characterized in that, When the audio application starts, it looks up the corresponding routing information in the linked list based on the audio data stream attributes, including: The corresponding routing information is searched in the linked list based on the audio device type passed by the Audio application.

4. The method according to claim 1, characterized in that, The predetermined processing includes one or more of the following: audio device parameter configuration, audio data reading and writing, and audio device control.

5. The method according to claim 1, characterized in that, The pre-processing of audio data based on the functional modules in audio routing also includes: After the audio application is closed or exited, the audio data stream is shut down in the HAL layer, the audio route is disconnected, the node objects in the route are destroyed, and related resources are reclaimed.

6. An audio routing implementation device, characterized in that, include: A definition module is used to define audio data stream routing information and configuration information in an XML file. The routing information includes at least the route start point, end point, and functional modules along the route. The parsing module is used after the system starts up to parse the configuration information in the XML and build a linked list. Create a module that, when the Audio application starts, looks up the corresponding routing information in the linked list based on the audio data stream attributes, creates objects based on the application, functional modules, and driver device information in the routing information, and creates input and output ports; The connection module is used to connect applications, functional modules, and driver devices to form an audio route; The processing module is used to perform pre-defined processing on audio data based on the functional modules in the audio routing.

7. The apparatus according to claim 6, characterized in that, The audio data stream routing information and configuration information defined in the XML file include: The configuration information is defined in the XML file, which includes at least the Audio application, functional modules, audio driver devices, and audio data routing. The route start point is configured as an audio application or an audio driver device, and the route end point is configured as an audio driver device or an audio application.

8. The apparatus according to claim 6, characterized in that, The processing module further includes: The recycling module is used to close the audio data stream at the HAL layer, disconnect the audio route, destroy the node objects in the route, and reclaim related resources after the audio application is closed or exited.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of an audio routing implementation method as described in any one of claims 1 to 5.

10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed, it implements the steps of an audio routing implementation method as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Audio testing method, mobile terminal and computer readable storage medium

    CN108366160A

  • Top HDL file generation method and device and computer readable storage medium

    CN110209387A