Paip. Solution to audio latency

Source: Internet
Author: User

 

Paip. Solution to sound latency


Author Attilax, EMAIL: 1466519819@qq.com

 


A Selection box for opening a file has a button sound... but the button sound delay is very high. It will only sound when the box comes out, more than a second ..


The method of releasing the code to throw the thread does not solve the problem.


Sleep between playing and opening OpenFileDialog. Thread. SLEEP (200); basically OK, but it will slow down the speed of opening the file box. It will be ineffective to reduce Sleep ..


It seems that we have to call WIN32 API to solve the problem.
... Read the file into the memory... When FORM_LOAD... the principle is to call winmm. dll, and then play it when the button is clicked... the effect is OK ..

 

 

 

 


---------- Code


Reference MOLEI. dll


SoundClickC417 scC4h = new SoundClickC417 ("");
ScC4h. playByte ();

 

 


------ The original code in the framework is as follows:


[DllImport ("winmm. dll")]
Private static extern int sndPlaySoundA (byte [] lpszSoundName, int uFlags );


// Play Cache
SndPlaySoundA (ba, SND_MEMORY );

 

 


 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.