A kind of method and system by usb audio channel transmission data
Technical field
The invention belongs to communication technique field more particularly to a kind of method by usb audio channel transmission data and it is
System.
Background technique
With the rapid development of computer hardware, peripheral equipment is increasing, keyboard, mouse, modem, printer,
Already for well known to compuman, digital camera, MP3 walkman come one after another scanner, so more equipment, how to access a
People's computer? USB interface plug and play has become important one of data access, and existing USB transmission data method is
Transmission method is interrupted by USB flash memory data block or HID, need to be uniformly responsible for managing data transmission by operating system, when simultaneously
When plugging multiple USB while needing a large amount of transmission data, operating system execution efficiency is then relatively low, and application software can not be read in time
Data influence the execution efficiency and terminal client experience of application software.
Summary of the invention
The embodiment of the invention provides a kind of method and system by usb audio channel transmission data, it is intended to solve existing
When having technology to have multiple USB while needing a large amount of transmission data, operating system execution efficiency is then relatively low, and application software can not be timely
Read data, the low problem of execution efficiency.
On the one hand, a kind of method by usb audio channel transmission data is provided, which comprises
Non-speech data is sent to speech control interface and converts interaction data, the friendship for the non-speech data
Mutual data include data packet, VoP;
The interaction data is alternately transmitted to the voice stream interface of data receiver by usb audio channel, wherein institute
VoP is stated to transmit in a manner of ISO;
By interaction data described in the voice flow interface, report the interaction data to related application;
The VoP is parsed according to preset standard description, obtains complete non-speech data in conjunction with the data packet.
On the other hand, a kind of system by usb audio channel transmission data is provided, the system comprises:
Data transmitting terminal and data receiver, the data transmitting terminal include:
Data conversion unit, for non-speech data to be sent to speech control interface and converts the non-speech data
For interaction data, the interaction data includes data packet, VoP;
Data transmission unit, for the interaction data to be alternately transmitted to data receiver by usb audio channel
Voice stream interface, wherein the VoP is transmitted in a manner of ISO;
The data receiver includes:
Data receipt unit, for reporting the interaction data by interaction data described in the voice flow interface
To related application;
Data parsing unit is obtained for parsing the VoP according to preset standard description in conjunction with the data packet
Take whole non-speech data.
In the embodiment of the present invention, non-speech data is sent to speech control interface and converts the non-speech data to
Interaction data, the interaction data include data packet, VoP;By usb audio channel alternately by the interaction data
It is transmitted to the voice stream interface of data receiver, wherein the VoP is transmitted in a manner of ISO;It is connect by the voice flow
Mouth receives the interaction data, reports the interaction data to related application;The voice number is parsed according to preset standard description
According to packet, complete non-speech data is obtained in conjunction with the data packet, the present invention using USB Mic interface asynchronous transmission mode, will count
According to upper application software is directly reported to, application software directly obtains data from USB Mic interface, participates in association without operating system
It adjusts.
Detailed description of the invention
Fig. 1 is the implementation flow chart for the method by usb audio channel transmission data that the embodiment of the present invention one provides;
Fig. 2 is the topological structure schematic diagram for the USB microphone that the embodiment of the present invention one provides;
Fig. 3 is the concrete structure diagram of the system provided by Embodiment 2 of the present invention by usb audio channel transmission data.
Specific embodiment
In order to make the objectives, technical solutions, and advantages of the present invention clearer, with reference to the accompanying drawings and embodiments, right
The present invention is further elaborated.It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, and
It is not used in the restriction present invention.
In embodiments of the present invention, non-speech data is sent to speech control interface and converts the non-speech data
For interaction data, the interaction data includes data packet, VoP;By usb audio channel alternately by the interactive number
According to the voice stream interface for being transmitted to data receiver, wherein the VoP is transmitted in a manner of ISO;Pass through the voice flow
Interaction data described in interface reports the interaction data to related application;The voice is parsed according to preset standard description
Data packet obtains complete non-speech data in conjunction with the data packet.
Realization of the invention is described in detail below in conjunction with specific embodiment:
Embodiment one
Fig. 1 shows the implementation process of the method by usb audio channel transmission data of the offer of the embodiment of the present invention one,
Details are as follows:
It should be noted that the present invention is suitable for Android, Windows system and has USB Microphone interface
Intelligent terminal.
In step s101, non-speech data is sent to speech control interface and converts friendship for the non-speech data
Mutual data, the interaction data include data packet, VoP.
In the present embodiment, the non-speech data is the non-audio data of data transmitting terminal storage.The data packet is
USB format non-audio data, one size are 16K sampling, and 16, the VoP is to be converted into usb audio to lead to
The non-audio data of the microphone data format of road transmission, one size are that 16K is sampled, 16.
In step s 102, the interaction data is alternately transmitted to the voice of data receiver by usb audio channel
Stream interface, wherein the VoP is transmitted in a manner of ISO.
In the present embodiment, the usb audio channel, that is, USB Microphone interface, also referred to as USB Mic interface.Data
The interaction data is alternately transmitted to the voice stream interface of data receiver by usb audio channel by transmitting terminal, wherein described
VoP is transmitted in a manner of ISO, is equivalent to 32 bytes of every millisecond of biography in this way, format table specific as follows:
In step s 103, by interaction data described in the voice flow interface, report the interaction data to phase
Close application.
In the present embodiment, data receiver reports the friendship by interaction data described in the voice flow interface
Mutual data are participated in related application without system.
In step S104, the VoP is parsed according to preset standard description, has been obtained in conjunction with the data packet
Whole non-speech data.
In the present embodiment, data receiver parses the VoP according to preset standard description, in conjunction with the number
Complete non-speech data is obtained according to packet, upper application software directly reads data, and it is high-efficient, across hardware platform, it is widely used.
The present embodiment can achieve using USB Mic interface asynchronous transmission mode, data be directly reported to upper layer application
Software, application software directly obtain data from USB Mic interface, participate in coordinating without operating system.
Embodiment two
Fig. 3 shows the specific structure of the system provided by Embodiment 2 of the present invention by usb audio channel transmission data
Block diagram, for ease of description, only parts related to embodiments of the present invention are shown.In the present embodiment, this passes through usb audio
The system of channel transmission data includes: data transmitting terminal 1 and data receiver 2, and the data transmitting terminal 1 includes:
Data conversion unit 11, for non-speech data to be sent to speech control interface and turns the non-speech data
Interaction data is turned to, the interaction data includes data packet, VoP;
Data transmission unit 12, for the interaction data to be alternately transmitted to data receiver by usb audio channel
Voice stream interface, wherein the VoP is transmitted in a manner of ISO;
The data receiver 2 includes:
Data receipt unit 21, for reporting the interactive number by interaction data described in the voice flow interface
According to related application;
Data parsing unit 22, for parsing the VoP according to preset standard description, in conjunction with the data packet
Obtain complete non-speech data.
The present embodiment can achieve using USB Mic interface asynchronous transmission mode, data be directly reported to upper layer application
Software, application software directly obtain data from USB Mic interface, participate in coordinating without operating system.
Further, the interaction data is specially 32bit.
System provided in an embodiment of the present invention by usb audio channel transmission data can be applied in aforementioned corresponding side
In method embodiment one, details are referring to the description of above-described embodiment one, and details are not described herein.
It is worth noting that, included each unit is only drawn according to function logic in the above system embodiment
Point, but be not limited to the above division, as long as corresponding functions can be realized;In addition, each functional unit is specific
Title is also only for convenience of distinguishing each other, the protection scope being not intended to restrict the invention.
In addition, those of ordinary skill in the art will appreciate that realizing all or part of the steps in the various embodiments described above method
It is that relevant hardware can be instructed to complete by program, corresponding program can store to be situated between in a computer-readable storage
In matter, the storage medium, such as ROM/RAM, disk or CD.The foregoing is merely presently preferred embodiments of the present invention and
, it is not intended to limit the invention, any modifications, equivalent replacements, and improvements done within the spirit and principles of the present invention
Deng should all be included in the protection scope of the present invention.