CN116560612A - Audio routing implementation method and device - Google Patents

Audio routing implementation method and device Download PDF

Info

Publication number
CN116560612A
CN116560612A CN202310315765.3A CN202310315765A CN116560612A CN 116560612 A CN116560612 A CN 116560612A CN 202310315765 A CN202310315765 A CN 202310315765A CN 116560612 A CN116560612 A CN 116560612A
Authority
CN
China
Prior art keywords
audio
route
information
application
audio data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310315765.3A
Other languages
Chinese (zh)
Inventor
李森林
谢宏江
李燕青
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan Kotei Informatics Co Ltd
Original Assignee
Wuhan Kotei Informatics Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Wuhan Kotei Informatics Co Ltd filed Critical Wuhan Kotei Informatics Co Ltd
Priority to CN202310315765.3A priority Critical patent/CN116560612A/en
Publication of CN116560612A publication Critical patent/CN116560612A/en
Pending legal-status Critical Current

Links

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
    • G06F3/165Management of the audio stream, e.g. setting of volume, audio stream path

Abstract

The invention provides a method and a device for realizing audio routing, wherein the method comprises the following steps: defining audio data flow route information and configuration information in an xml file, wherein the route information at least comprises a route starting point, a route ending point and a function module passing by; after the system is started, the configuration analyzer analyzes the configuration information in the xml and constructs a linked list; when the Audio application is started, searching corresponding route information in the linked list according to the Audio data stream attribute, creating an object based on the application, the function module and the driving equipment information in the route information, and creating an input/output port; connecting an application, a functional module and a driving device to form an audio route; the audio data is subjected to predetermined processing based on the functional module in the audio routing. According to the scheme, the process of adding the function processing module can be simplified on the basis of not modifying the overall framework of the Android HAL layer, and specific processing of audio data is facilitated.

Description

Audio routing implementation method and device
Technical Field
The invention belongs to the field of Android application development, and particularly relates to an audio route implementation method and device.
Background
In the Android HAL native code, the audio input/output stream does nothing to the audio data, and the HAL layer (Hardware Abstraction Layer, i.e., the hardware abstraction layer) simply handles the audio data. Thus, in adding audio processing, enriching audio functions, it is often necessary to modify the foundation of the native framework, thereby resulting in a very complex process of adding audio processing functions.
Disclosure of Invention
In view of this, the embodiment of the invention provides a method and a device for implementing audio routing, which are used for solving the problem that the existing implementation process for adding audio processing functions is complex.
In a first aspect of an embodiment of the present invention, there is provided an audio routing implementation method, including:
defining audio data flow route information and configuration information in an xml file, wherein the route information at least comprises a route starting point, a route ending point and a function module passing by;
after the system is started, the configuration analyzer analyzes the configuration information in the xml and constructs a linked list;
when the Audio application is started, searching corresponding route information in the linked list according to the Audio data stream attribute, creating an object based on the application, the function module and the driving equipment information in the route information, and creating an input/output port;
connecting an application, a functional module and a driving device to form an audio route;
the audio data is subjected to predetermined processing based on the functional module in the audio routing.
In a second aspect of the embodiment of the present invention, there is provided an audio route implementation apparatus, including:
the definition module is used for defining audio data stream routing information and configuration information in an xml file, wherein the routing information at least comprises a routing starting point, a routing ending point and a functional module passing by;
the analysis module is used for analyzing the configuration information in the xml by the configuration analyzer after the system is started, and constructing a linked list;
the creating module is used for searching the corresponding route information in the linked list according to the Audio data stream attribute when the Audio application is started, creating an object based on the application, the function module and the driving equipment information in the route information, and creating an input/output port;
the connection module is used for connecting the application, the functional module and the driving equipment to form an audio route;
and the processing module is used for carrying out preset processing on the audio data based on the functional module in the audio route.
In a third aspect of the embodiments of the present invention, there is provided an electronic device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, the processor implementing the steps of the method according to the first aspect of the embodiments of the present invention when the computer program is executed by the processor.
In a fourth aspect of the embodiments of the present invention, there is provided a computer readable storage medium storing a computer program which, when executed by a processor, implements the steps of the method provided by the first aspect of the embodiments of the present invention.
According to the embodiment of the invention, the audio data flow route is added in the Android HAL layer, so that the audio data flow route dynamic processing can be realized on the basis of keeping the audio data transmission function of the native framework HAL layer, and the process of adding the functional processing module can be simplified on the basis of not modifying the whole framework, thereby facilitating the specific processing of the audio data.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following description will briefly explain the drawings used in the embodiments or the description of the prior art, and it is obvious that the drawings described below are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort to a person skilled in the art.
Fig. 1 is a schematic flow chart of an implementation method of audio routing according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of an audio routing implementation device according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, features and advantages of the present invention more comprehensible, the technical solutions in the embodiments of the present invention are described in detail below with reference to the accompanying drawings, and it is apparent that the embodiments described below are only some embodiments of the present invention, but not all embodiments of the present invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
It should be understood that the term "comprising" and other similar meaning in the description of the invention or the claims and the above-mentioned figures is intended to cover a non-exclusive inclusion, such as a process, method or system, apparatus comprising a series of steps or elements, without limitation to the listed steps or elements. Furthermore, "first" and "second" are used to distinguish between different objects and are not used to describe a particular order.
Referring to fig. 1, a flow chart of an implementation method of audio routing according to an embodiment of the present invention includes:
s101, defining audio data stream routing information and configuration information in an xml file, wherein the routing information at least comprises a routing starting point, a routing ending point and a functional module passing by;
in an xml file, one or more pieces of routing information, which is a completed link consisting of a start point (from), an end point (to) and a functional module (module) of a path, can be defined.
Defining configuration information in an xml file, wherein the configuration information at least comprises an Audio application, a functional module, audio driving equipment and an Audio data route; the route starting point is configured as Audio application or Audio driving equipment, and the route end point is configured as Audio driving equipment or Audio application.
Configuration information of from, to, module is also required in the xml file definition, and four configurations are defined including audio application, function module, audio driving device and audio data routing. In this embodiment, from may be configured as an audio application or an audio driving device, to may be configured as an audio driving device or an audio application, and module may be configured as a functional module.
S102, after the system is started, the configuration analyzer analyzes the configuration information in the xml and constructs a linked list;
after the system is started, the configuration analyzer analyzes the configuration information in the xml file, and the configuration information is respectively added into the corresponding linked list after being analyzed. Illustratively, each of the linked lists is named as appList (linked list of audio applications), moduleList (linked list of function modules), deviceList (linked list of audio driving devices), and routeList (linked list of routes), respectively.
S103, when the Audio application is started, searching corresponding route information in the linked list according to the Audio data stream attribute, creating an object based on the application, the function module and the driving equipment information in the route information, and creating an input/output port;
when an Audio upper layer application is started, an Audio input or output stream is opened at the HAL layer, the type of Audio equipment is transferred according to the application, matching detection is carried out by traversing a linked list of the Audio application, if matching is successful, a corresponding Audio route name of the Audio application is obtained, matching detection is carried out by traversing a linked list of routes, corresponding route information is found, corresponding application, function module and driving equipment information is found by traversing a corresponding linked list (appList, moduleList, deviceList) according to from, to, module type in the route information, corresponding objects are created, and input or output ports are created for the application, the function module and the driving equipment.
S104, connecting the application, the functional module and the driving equipment to form an audio route;
and the application, the functional module and the driving equipment are connected through respective ports to form a complete audio route.
S105, performing preset processing on the audio data based on the functional module in the audio route.
After the frequency link is established, operations such as audio equipment configuration parameters, audio data reading and writing, audio equipment control and the like can be performed through the route.
The predetermined processing includes one or more of audio device parameter configuration, audio data reading and writing and audio device control.
Preferably, after the audio application is finished, closing the audio stream at the HAL layer, and simultaneously disconnecting the audio route, destroying node objects in the route, and recovering related resources.
In the embodiment, an audio data routing frame is built on the Android HAL layer, operations such as data reading and writing are realized on the basis of realizing the native frame codes are kept, and special processing can be performed on audio data. The process of adding the audio processing function in the HAL layer is simplified, and the need of modifying the original stabilized HAL layer audio code frame when realizing the specific function is avoided. For example, after audio is collected from a microphone in ktv and the audio effect of CarPlay in the vehicle-mounted system, the audio needs to be output to a power amplifier, which can be completely implemented in SmartRoute (audio data flow routing).
It should be understood that the sequence number of each step in the above embodiment does not mean the sequence of execution, and the execution sequence of each process should be determined by its function and internal logic, and should not be construed as limiting the implementation process of the embodiment of the present invention.
Fig. 2 is a schematic structural diagram of an audio route implementation device according to an embodiment of the present invention, where the device includes:
a definition module 210, configured to define audio data stream routing information and configuration information in an xml file, where the routing information includes at least a routing start point, a destination point, and a functional module for routing;
defining configuration information in an xml file, wherein the configuration information at least comprises an Audio application, a functional module, audio driving equipment and an Audio data route;
the route starting point is configured as an Audio application or an Audio driving device, and the route ending point is configured as an Audio driving device or an Audio application.
The parsing module 220 is configured to parse the configuration information in the xml by the configuration parser after the system is started, and construct a linked list;
specifically, corresponding route information is searched in the linked list according to the type of the Audio equipment transmitted by the Audio application.
The creating module 230 is configured to, when the Audio application is started, search corresponding routing information in the linked list according to the Audio data stream attribute, create an object based on application, function module and driving device information in the routing information, and create an input/output port;
a connection module 240 for connecting the application, the function module and the driving device to form an audio route;
the processing module 250 is configured to perform predetermined processing on the audio data based on the functional module in the audio routing.
The predetermined processing includes one or more of audio device parameter configuration, audio data reading and writing and audio device control.
Preferably, the processing module 250 further includes:
and the recovery module is used for closing the audio data stream at the HAL layer after the audio application is closed or exited, disconnecting the audio route, destroying the node object in the route and recovering related resources.
It will be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working process of the above-described system and module may refer to the corresponding process in the foregoing method embodiment, which is not repeated herein.
Fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present invention. The electronic device is used for realizing audio data routing in the Android HAL. As shown in fig. 3, the electronic apparatus 3 of this embodiment includes: memory 310, processor 320, and system bus 330, the memory 310 including an executable program 3101 stored thereon, it will be understood by those skilled in the art that the electronic device structure shown in fig. 3 is not limiting of the electronic device and may include more or fewer components than illustrated, or may combine certain components, or a different arrangement of components.
The following describes the respective constituent elements of the electronic device in detail with reference to fig. 3:
the memory 310 may be used to store software programs and modules, and the processor 320 may execute various functional applications and data processing of the electronic device by executing the software programs and modules stored in the memory 310. The memory 310 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program (such as a sound playing function, an image playing function, etc.) required for at least one function, and the like; the storage data area may store data created according to the use of the electronic device (such as cache data), and the like. In addition, memory 310 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage device.
An executable program 3101 containing network request methods on the memory 310, the executable program 3101 may be partitioned into one or more modules/units stored in the memory 310 and executed by the processor 320 to implement audio data routing, etc., the one or more modules/units may be a series of computer program instruction segments capable of performing specific functions describing the execution of the computer program 3101 in the electronic device 3. For example, the computer program 3101 may be divided into functional modules such as a definition module, an analysis module, a creation module, a connection module, and a processing module.
Processor 320 is a control center of the electronic device that utilizes various interfaces and lines to connect various portions of the overall electronic device, perform various functions of the electronic device and process data by running or executing software programs and/or modules stored in memory 310, and invoking data stored in memory 310, thereby performing overall condition monitoring of the electronic device. Optionally, processor 320 may include one or more processing units; preferably, the processor 320 may integrate an application processor that primarily handles operating systems, applications, etc., with a modem processor that primarily handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 320.
The system bus 330 is used to connect various functional components inside the computer, and CAN transfer data information, address information, and control information, and the types of which may be PCI bus, ISA bus, and CAN bus, for example. Instructions from the processor 320 are transferred to the memory 310 through the bus, the memory 310 feeds back data to the processor 320, and the system bus 330 is responsible for data and instruction interaction between the processor 320 and the memory 310. Of course, the system bus 330 may also access other devices, such as a network interface, a display device, etc.
In an embodiment of the present invention, the executable program executed by the process 320 included in the electronic device includes:
defining audio data flow route information and configuration information in an xml file, wherein the route information at least comprises a route starting point, a route ending point and a function module passing by;
after the system is started, the configuration analyzer analyzes the configuration information in the xml and constructs a linked list;
when the Audio application is started, searching corresponding route information in the linked list according to the Audio data stream attribute, creating an object based on the application, the function module and the driving equipment information in the route information, and creating an input/output port;
connecting an application, a functional module and a driving device to form an audio route;
the audio data is subjected to predetermined processing based on the functional module in the audio routing.
It will be clearly understood by those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described system, apparatus and module may refer to corresponding procedures in the foregoing method embodiments, which are not repeated herein.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and in part, not described or illustrated in any particular embodiment, reference is made to the related descriptions of other embodiments.
The above embodiments are only for illustrating the technical solution of the present invention, and not for limiting the same; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (10)

1. An audio routing implementation method, comprising:
defining audio data flow route information and configuration information in an xml file, wherein the route information at least comprises a route starting point, a route ending point and a function module passing by;
after the system is started, the configuration analyzer analyzes the configuration information in the xml and constructs a linked list;
when the Audio application is started, searching corresponding route information in the linked list according to the Audio data stream attribute, creating an object based on the application, the function module and the driving equipment information in the route information, and creating an input/output port;
connecting an application, a functional module and a driving device to form an audio route;
the audio data is subjected to predetermined processing based on the functional module in the audio routing.
2. The method of claim 1, wherein defining audio data stream routing information and configuration information in an xml file comprises:
defining configuration information in an xml file, wherein the configuration information at least comprises an Audio application, a functional module, audio driving equipment and an Audio data route;
the route starting point is configured as Audio application or Audio driving equipment, and the route end point is configured as Audio driving equipment or Audio application.
3. The method of claim 1, wherein when the Audio application is started, searching the corresponding routing information in the linked list according to the Audio data stream attribute comprises:
and searching corresponding route information in the linked list according to the Audio equipment type transmitted by the Audio application.
4. The method of claim 1, wherein the predetermined processing comprises one or more of audio device parameter configuration, reading and writing of audio data, and audio device control.
5. The method of claim 1, wherein the predetermined processing of the audio data based on the functional module in the audio routing further comprises:
after the audio application is closed or exits, closing the audio data stream at the HAL layer, disconnecting the audio route, destroying node objects in the route, and recovering related resources.
6. An audio route implementation device, comprising:
the definition module is used for defining audio data stream routing information and configuration information in an xml file, wherein the routing information at least comprises a routing starting point, a routing ending point and a functional module passing by;
the analysis module is used for analyzing the configuration information in the xml by the configuration analyzer after the system is started, and constructing a linked list;
the creating module is used for searching the corresponding route information in the linked list according to the Audio data stream attribute when the Audio application is started, creating an object based on the application, the function module and the driving equipment information in the route information, and creating an input/output port;
the connection module is used for connecting the application, the functional module and the driving equipment to form an audio route;
and the processing module is used for carrying out preset processing on the audio data based on the functional module in the audio route.
7. The apparatus of claim 6, wherein defining audio data stream routing information and configuration information in an xml file comprises:
defining configuration information in an xml file, wherein the configuration information at least comprises an Audio application, a functional module, audio driving equipment and an Audio data route;
the route starting point is configured as Audio application or Audio driving equipment, and the route end point is configured as Audio driving equipment or Audio application.
8. The apparatus of claim 6, wherein the processing module further comprises:
and the recovery module is used for closing the audio data stream at the HAL layer after the audio application is closed or exited, disconnecting the audio route, destroying the node object in the route and recovering related resources.
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 the processor, when executing the computer program, implements the steps of an audio routing implementation method according to any of claims 1 to 5.
10. A computer readable storage medium storing a computer program, characterized in that the computer program when executed implements the steps of an audio routing implementation method according to any one of claims 1 to 5.
CN202310315765.3A 2023-03-28 2023-03-28 Audio routing implementation method and device Pending CN116560612A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310315765.3A CN116560612A (en) 2023-03-28 2023-03-28 Audio routing implementation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310315765.3A CN116560612A (en) 2023-03-28 2023-03-28 Audio routing implementation method and device

Publications (1)

Publication Number Publication Date
CN116560612A true CN116560612A (en) 2023-08-08

Family

ID=87493608

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310315765.3A Pending CN116560612A (en) 2023-03-28 2023-03-28 Audio routing implementation method and device

Country Status (1)

Country Link
CN (1) CN116560612A (en)

Similar Documents

Publication Publication Date Title
US8346697B2 (en) Direct construction of finite state machines
US9639333B2 (en) Method and system for model driven development
US20210365253A1 (en) Heterogeneity-agnostic and topology-agnostic data plane programming
JP4001286B2 (en) Program maintenance support apparatus, program maintenance support method, and program
Cooper et al. The Hamiltonian cycle and travelling salesman problems in cP systems
CN112860264B (en) Method and device for reconstructing abstract syntax tree
CN112988163B (en) Intelligent adaptation method, intelligent adaptation device, intelligent adaptation electronic equipment and intelligent adaptation medium for programming language
CN113505278A (en) Graph matching method and device, electronic equipment and storage medium
Zhang et al. Automated Extraction of Grammar Optimization Rule Configurations for Metamodel-Grammar Co-evolution
CN116560612A (en) Audio routing implementation method and device
CN114567688B (en) FPGA-based collaborative network protocol analysis method and device
ter Beek et al. States and events in KandISTI: a retrospective
BELL et al. Model-based mutation testing using pushdown automata
Guillon et al. Two-Way Automata and One-Tape Machines: Read Only Versus Linear Time
Ehlers et al. Symmetric synthesis
CN112825031B (en) Process description method and device based on JSON format
CN116939669B (en) Network element identification method, system, equipment and readable medium based on IP learning table
Haga et al. Inconsistency Checking of UML Sequence Diagrams and State Machines Using the Structure-Behavior Coalescence Method
千田忠賢 On the Repair of Denial of Service in Real-World Regular Expressions
CN117008920A (en) Engine system, request processing method and device, computer equipment and storage medium
Casey Methods and Tools for Enhancing Safety and Security of Programmable Networks
CN117724702A (en) Component configuration generation method, device, computing equipment and computer storage medium
CHEN et al. IoT Modeling and Verification: From the CaIT Calculus to UPPAAL
Acuña et al. Extracting semantics from legacy scientific workflows
CN112764718A (en) Method and device for multi-end use of codes, storage medium and electronic equipment

Legal Events

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