The network sound mixing method
Technical field
The present invention relates to a kind of network multimedia amusing method, be specifically related to a kind of network sound mixing method.
Background technology
Along with networks development, the user is more and more stronger to the demand of network multimedia amusement.Traditional entertainment way is like Karaoke, and expense is higher, and the number of participating in simultaneously is limited, is difficult to satisfy popular demand.Though most network entertainment software provides the network karaoke function, because at the WINDOWS platform, Microsoft does not formulate unified sound card and drives standard, the interface that some specific sound card is opened Kara OK function is very obscure; And partly integrated HD sound card is not supported Kara OK function, and therefore existing multi-person speech software is supported very imperfection of Kara OK function.Need the user manually to select the hardware audio mixing to play Karaoka and play Karaoka with the software audio mixing, under the unsupported situation of hardware, can't accomplish Kara OK function.For part voice entertainment software, the player software of soft audio mixing is that voice software is built-in, does not support the main flow player such as player software such as KuGoo, QQ music, can not satisfy user's demand.
Summary of the invention
Technical matters to be solved by this invention provides a kind of network sound mixing method, and it can use various types of sound cards to realize the network karaoke function.
For solving the problems of the technologies described above, the technical solution of network sound mixing method of the present invention does, may further comprise the steps:
Step 1, the calling system api function, whether the characteristic of analysis sound card has stereo-mixing or identity function option in the input option of inspection sound card;
Step 2 will be accompanied and voice carries out audio mixing, for the sound card that the stereo-mixing option is arranged, adopt the hardware sound mixing method; For the sound card of no stereo-mixing option, adopt the software sound mixing method.
The hardware sound mixing method that adopts is:
The first step is provided with sound card, gets into hardware audio mixing pattern;
Second step, the audio mixing operation; The start-up system media-player software; Sound card is gathered the voice data that comes from microphone simultaneously, and the voice data that comes from system's media player; Sound card will come from the voice data of microphone and the voice data of system's media player carries out the audio mixing processing, send Talk Client voice software to, realize the network karaoke function.
The software sound mixing method that adopts is:
The first step, the registration table of analysis user system is found out user's default player software;
Second step started default player software, loaded HOOK DLL at the default player software process simultaneously; HOOK DLL follows the tracks of system's api function of default player software transfer, obtains the pcm audio data that player software is play, and sends Talk Client voice software to through Inter-Process Communication; Simultaneously, the sound card collection comes from the voice data of microphone, and sends Talk Client voice software to; The voice data that the TalkClient voice software the obtains player software line data of going forward side by side is handled; Talk Client voice software carries out the audio mixing processing with the voice data of treated player software with the voice data that comes from microphone, realizes the network karaoke function.
Talk Client voice software to the method that the voice data of player software carries out data processing is: for the pcm audio data of player and user's sampling rate condition of different, resample; Perhaps adjust channel number.
The technique effect that the present invention can reach is:
The present invention is directed to different sound cards and adopt different sound mixing methods,, realize the network karaoke function, to satisfy the demand of any harshness of user applicable to various types of sound cards.
Description of drawings
Below in conjunction with accompanying drawing and embodiment the present invention is done further detailed explanation:
Fig. 1 supports the sound card of Kara OK function to regulate the synoptic diagram of tab;
Fig. 2 does not support the sound card of Kara OK function to regulate the synoptic diagram of tab;
Fig. 3 is the process flow diagram that adopts the hardware sound mixing method to play Karaoka;
Fig. 4 is the process flow diagram that adopts the software sound mixing method to play Karaoka.
Embodiment
Network sound mixing method of the present invention may further comprise the steps:
Step 1, calling system API (Application Programming Interface, API) function, whether the characteristic of analysis sound card has stereo-mixing or identity function option in the input option of inspection sound card;
Be about to sound card and be divided into two kinds, a kind of such sound card is supported Kara OK function in order the sound card of stereo-mixing option to be arranged, and another kind ofly be that the sound card of no stereo-mixing option, such sound card do not support Kara OK function perhaps to support the Kara OK function defectiveness;
The input end of sound card has various input patterns, and according to the condition code analysis, the sound card that condition code is arranged is with regard to the support hardware audio mixing;
Step 2 will be accompanied and voice carries out audio mixing, for the sound card that the stereo-mixing option is arranged, adopt the hardware sound mixing method; For the sound card of no stereo-mixing option, adopt the software sound mixing method.
(1) for the sound card that the stereo-mixing option is arranged, this sound card possesses the function of resampling, adjustment sample bits, sound channel conversion, stereo-mixing, and sound card is set, and gets into hardware audio mixing pattern;
The method that sound card is set is as shown in Figure 1, selects microphone volume control, and the mute microphone (MIC) mute function promptly uses the stereo-mixing function of sound card, gets into karaoke mode;
The audio mixing operation:
As shown in Figure 3, the start-up system media-player software; Sound card is gathered the voice data (voice) that comes from microphone simultaneously, and the voice data (accompaniment) that comes from system's media player; Sound card will come from the voice data of microphone and the voice data of system's media player carries out the audio mixing processing, send the TalkClient voice software to, realize the network karaoke function.
(2) for the sound card of no stereo-mixing option, the adjusting tab of this sound card is as shown in Figure 2, no hardware audio mixing pattern, and the registration table of analysis user system is found out user's default player software; Start default player software, load HOOK DLL (hook dynamic base) at the default player software process simultaneously; HOOKDLL follows the tracks of system's api function of default player software transfer; Obtain PCM (the Pulse Code Modulation that player software is play; Pulse-code modulation recording) voice data, and send Talk Client voice software to through Inter-Process Communication; Talk Client voice software possesses the function of resampling, adjustment sample bits, sound channel conversion, stereo-mixing, and Talk Client voice software is a prior art, does not do at this and gives unnecessary details;
Meanwhile, the sound card collection comes from the voice data of microphone, and sends Talk Client voice software to;
Talk Client voice software obtains the data line data of going forward side by side and handles, if the pcm audio data of player and user's sampling rate is different then resample, also can adjust channel number; Talk Client voice software carries out audio mixing with treated voice data and the voice data that comes from microphone to be handled, and encoding at last sends, and realizes the network karaoke function, as shown in Figure 4.
Adopt the present invention to realize that the embodiment of network karaoke function is following:
The sound card of user A has the stereo-mixing option, and the support hardware audio mixing is as shown in Figure 1, regulates the output of tab at sound card, and stereo-mixing option (, the sound that can with other noun such as you hear or the like different according to sound card) is arranged; User A clicks the Karaoke button, and program is chosen stereo-mixing through the calling system api function, starts player software; After the sound of the sound of player software and user's microphone was all gathered by Talk Client voice software, encoding sent to the take over party, plays Karaoka.
The sound card of user B does not have the stereo-mixing option, and the support hardware audio mixing is not as shown in Figure 2, regulates the output of tab at sound card, no stereo-mixing option (according to the sound card difference, the sound that can hear such as you with other noun or the like); User B clicks the Karaoke button, and Talk Client voice software starts player, when starting player, loads the pcm audio data that Hook DLL obtains player; The TalkClient voice software gets access to and carries out audio mixing with the data of microphone after the pcm audio data of player and handle, and realizes Kara OK function.