📄 post27539005.asp.html
字号:
<html><head> <title>win32 programmer mmedia Unhandled exception with wavein functions</title> <link href="post27539005.asp_archivos/googleapi.css" rel="Stylesheet"> <link rel="alternate" type="application/rss+xml" title="Eggheadcafe.com Main Feed" href="http://www.pheedo.com/f/eggheadcafecom_articles"> <script src="post27539005.asp_archivos/googleapi.js" type="text/javascript"></script><script src="post27539005.asp_archivos/defaulten.js" type="text/javascript"></script> <script src="post27539005.asp_archivos/googleeggheadapi.js" type="text/javascript"></script> <script src="post27539005.asp_archivos/common.js" type="text/javascript"></script> <script type="text/javascript" src="post27539005.asp_archivos/commonads.js"></script> <script language="JavaScript"> var baseURL = 'http://www.eggheadcafe.com'; try { if (self.parent.frames.length != 0) self.parent.location=document.location; } catch (Exception) {} function PrintThisPage() { var sOption="toolbar=yes,location=no,directories=yes,menubar=yes,"; sOption+="scrollbars=yes,width=750,height=650,left=100,top=25"; var winprint=window.open("/print.asp","Print",sOption); winprint.focus(); } </script> <meta content="7" name="revisit-after"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta content="MSHTML 5.50.4134.600" name="GENERATOR"> <link href="post27539005.asp_archivos/stylesheet.css" rel="Stylesheet"> <link href="post27539005.asp_archivos/StylesForAds.css" rel="Stylesheet"> </head><body style="margin: 0px;"> <form id="form1" runat="server"> <div id="header"> <div id="logo"> <h1><a href="http://www.eggheadcafe.com/default.aspx">ASP.NET, SQL Server, WPF, C#, VB.NET</a></h1> </div> <div id="menu"> <ul> <li><a href="http://www.eggheadcafe.com/articlelist.aspx">Articles</a></li> <li><a href="http://www.eggheadcafe.com/aboutus.aspx">About Us</a></li> </ul> </div></div><!-- end #header --><div id="submenu"> <ul> <li><a href="http://www.eggheadcafe.com/tutorials/aspnet/9b325a7f-07e3-44fa-a7bf-e83e0589ac9e/jetbrains-resharper-41.aspx" title="Purchase Rsharper"><img src="post27539005.asp_archivos/promoicon.png" alt="promotion" border="0"></a></li> <li><a href="http://talentmap.eggheadcafe.com/" target="_blank" title="Find people, companies, and jobs using Microsoft .NET"><img src="post27539005.asp_archivos/promoicon-talentmap.png" alt="Find people, companies, and jobs using Microsoft .NET" border="0"></a></li> </ul></div><table width="100%" align="center" border="0" cellpadding="0" cellspacing="0"><tbody><tr> <td valign="top" width="100%" align="center"> <table border="0" cellpadding="0" cellspacing="4"> <tbody><tr><td width="850" align="center"><div id="Card_Search" style="border: 0px outset rgb(255, 255, 255); overflow: auto; visibility: hidden; background-color: rgb(255, 255, 255); position: relative; height: 5px;"> </div><div id="contentstart" name="contentstart" align="center"> <table width="675" align="center" border="0" cellpadding="2" cellspacing="2"><tbody><tr><td align="left"><br></td></tr><tr><td class="homepagetext" align="left"><a href="http://www.eggheadcafe.com/aspnet_answers/win32programmermmedia/Jul2006/post27539002.asp" class="forumroll" target="_self">Previous Thread</a></td></tr><tr><td class="homepagetext9" align="left"><br></td></tr><tr><td class="homepagetext9" align="left" nowrap="nowrap"><b><u>8/2/2006 5:40:02 AM Unhandled exception with wavein functions</u></b></td></tr><tr><td class="homepagetext" align="left"><pre class="homepagetext">Hello, I use wavein functions and I get "Unhandled exception at 0x7c901230 (ntdll.dll) in WaveIn.exe: User breakpoint" (WaveIn.exe is my program name) sometimes without any reason with the following callstack: ntdll.dll!_RtlpBreakPointHeap@4() + 0x28 ntdll.dll!_RtlpValidateHeapEntry@12() + 0x113 ntdll.dll!_RtlDebugGetUserInfoHeap@20() + 0x96 ntdll.dll!_RtlGetUserInfoHeap@20() + 0x32743 kernel32.dll!_GlobalHandle@4() + 0x3a wdmaud.drv!_waveCompleteHeader@4() + 0x40 wdmaud.drv!_waveThread@4() + 0x9c kernel32.dll!_BaseThreadStart@8() + 0x37 The interval beetween these exceptions is not constant (it could be many days, or some seconds). It doesn't seem to be linked with the CPU charge, but maybe with the windows management (when I open a window, or open a menu, etc.) I wrote a minimum code (see below) to get audio samples from my default soundcard and I get these exceptions. I tried other way than the CALLBACK_EVENT (such pooling the dwFlags, CALLBACK_FUNCTION) to check when the system finish to fill in my buffer. Same exceptions. I also tried multi-buffering. Same exceptions. Different soundcards gives same result. Does anyone has the same trouble???? Did you find a solution???? Is something wrong in my code???? Can anyone try to compile and use my code for one night with the debugger???? Thanks Blaise My config is: - Windows XP SP2 - 4 sound cards - Visual C++ 2003 This is my code: HWAVEIN WaveInHandle; WAVEHDR WaveHeader; int main(int argc , char ** argv) { MMRESULT err; WAVEFORMATEX waveFormat; HANDLE event; // Create thread to get the samples event = CreateEvent(0, TRUE, FALSE, 0); // Init the struct with the settings for recording ZeroMemory(&WaveHeader, sizeof(WAVEHDR) ); waveFormat.wFormatTag = WAVE_FORMAT_PCM; waveFormat.nChannels = 2; waveFormat.nSamplesPerSec = 44100; waveFormat.wBitsPerSample = 16; waveFormat.nBlockAlign = waveFormat.nChannels * (waveFormat.wBitsPerSample/8); waveFormat.nAvgBytesPerSec = waveFormat.nSamplesPerSec * waveFormat.nBlockAlign; waveFormat.cbSize = 0; // Open and start the default device waveInOpen(&WaveInHandle, WAVE_MAPPER, &waveFormat, (DWORD)event, 0, CALLBACK_EVENT); waveInStart(WaveInHandle); // Allocate memory for the data, prepare, and addbuffer the audio wavein WaveHeader.dwBufferLength = 1152; WaveHeader.lpData = (char *)malloc(WaveHeader.dwBufferLength); WaveHeader.dwFlags = 0; ResetEvent(event); waveInPrepareHeader(WaveInHandle, &WaveHeader, sizeof(WAVEHDR)); waveInAddBuffer(WaveInHandle, &WaveHeader, sizeof(WAVEHDR)); while (TRUE) { WaitForSingleObject(event, INFINITE); waveInUnprepareHeader(WaveInHandle, &WaveHeader, sizeof(WAVEHDR)); printf("Received %i audio samples... Do whatever you want....\n", WaveHeader.dwBytesRecorded); // Init and give the next buffer to wavein WaveHeader.dwBufferLength = 1152; WaveHeader.dwBytesRecorded = 0; WaveHeader.dwFlags = 0; ResetEvent(event); waveInPrepareHeader(WaveInHandle, &WaveHeader, sizeof(WAVEHDR)); waveInAddBuffer(WaveInHandle, &WaveHeader, sizeof(WAVEHDR)); } return(0); }</pre></td></tr><tr><td align="left"><br></td></tr><tr><td class="homepagetext" align="center"> <table width="850" align="center" border="0" cellpadding="0" cellspacing="0"> <tbody><tr><td valign="top" align="left"> <div id="AdPage" name="AdPage"><table valign="top" align="left" border="0" cellpadding="4" cellspacing="0"> <tbody><tr> <td valign="top" align="left"><div style="visibility: visible;" id="DivAdNewsGroup1"><div style="border: 0px solid rgb(207, 218, 221); padding: 1px;"> <table class="AdTable" border="0" cellpadding="0" cellspacing="0"> <tbody><tr><td colspan="2" align="left"><a href="http://services.google.com/feedback/abg?url=http://www.eggheadcafe.com/aspnet_answers/win32programmermmedia/Aug2006/post27539005.asp&hl=en&client=ca-pub-8682474657542641&adU=www.Sabreargentina.com.ar&adT=Ingeniero+En+Sistemas+%3F&adU=www.ddj.com/Go-Parallel&adT=Microsoft+Visual+C%2B%2B&adU=www.parasoft.com&adT=C%2B%2B+Debugging&adU=www.transparentcorp.com&adT=Neuro-Programmer+2.0&adU=qomo.com&adT=QOMO+Presenters&adU=www.MindGenius.com&adT=MindGenius+2.5&adU=www.bizagi.com&adT=Free+BPMN+Process+Modeler&adU=www.softwaremining.com&adT=Cobol+To+OO+Java/C%23&done=1" class="AdLogoUrl">Ads by Google</a></td></tr> <tr><td colspan="2" style="font-size: 14px;"><a class="AdTopUrl" href="http://googleads.g.doubleclick.net/aclk?sa=l&ai=BpCUrAZwISu6TLpzaxQWZ4dXuCM-Dz3_7urXRDMCNtwHAixEQARgBIPnI-gEoCDgAUNT8oNECYKHwhoBYsgETd3d3LmVnZ2hlYWRjYWZlLmNvbcgBAdoBWGh0dHA6Ly93d3cuZWdnaGVhZGNhZmUuY29tL2FzcG5ldF9hbnN3ZXJzL3dpbjMycHJvZ3JhbW1lcm1tZWRpYS9BdWcyMDA2L3Bvc3QyNzUzOTAwNS5hc3CAAgGpAifYdRlbDJI-yALx170FqAMB6APcAegDH-gDBegD8QP1AwAAAAQ&num=1&sig=AGiWqtw2ouHwim19jx4oZUwUG68KIFqrew&client=ca-pub-8682474657542641&adurl=http://www.Sabreargentina.com.ar" onmouseout="window.status=''" onmouseover="window.status='go to www.Sabreargentina.com.ar';return true">Ingeniero En Sistemas ?</a></td></tr> <tr><td colspan="2" style="font-size: 12px;" class="AdText" valign="middle">Buscamos Ingeniero En Sistemas Para Empresa L铆der En Desarrollos!</td></tr> <tr><td colspan="2" style="font-size: 11px;" valign="middle" align="left"><a class="AdBottomUrl" href="http://googleads.g.doubleclick.net/aclk?sa=l&ai=BpCUrAZwISu6TLpzaxQWZ4dXuCM-Dz3_7urXRDMCNtwHAixEQARgBIPnI-gEoCDgAUNT8oNECYKHwhoBYsgETd3d3LmVnZ2hlYWRjYWZlLmNvbcgBAdoBWGh0dHA6Ly93d3cuZWdnaGVhZGNhZmUuY29tL2FzcG5ldF9hbnN3ZXJzL3dpbjMycHJvZ3JhbW1lcm1tZWRpYS9BdWcyMDA2L3Bvc3QyNzUzOTAwNS5hc3CAAgGpAifYdRlbDJI-yALx170FqAMB6APcAegDH-gDBegD8QP1AwAAAAQ&num=1&sig=AGiWqtw2ouHwim19jx4oZUwUG68KIFqrew&client=ca-pub-8682474657542641&adurl=http://www.Sabreargentina.com.ar" onmouseout="window.status=''" onmouseover="window.status='go to www.Sabreargentina.com.ar';return true">www.Sabreargentina.com.ar</a></td></tr> <tr><td colspan="2"><br></td></tr> <tr><td colspan="2" style="font-size: 14px;"><a class="AdTopUrl" href="http://googleads.g.doubleclick.net/aclk?sa=l&ai=Bc1YUAZwISu6TLpzaxQWZ4dXuCNWlxn-Rmqv_CcCNtwHAqQcQAhgCIPnI-gEoCDgAUOOCgrkGYKHwhoBYsgETd3d3LmVnZ2hlYWRjYWZlLmNvbcgBAdoBWGh0dHA6Ly93d3cuZWdnaGVhZGNhZmUuY29tL2FzcG5ldF9hbnN3ZXJzL3dpbjMycHJvZ3JhbW1lcm1tZWRpYS9BdWcyMDA2L3Bvc3QyNzUzOTAwNS5hc3CAAgHIAoHNtwmoAwHoA9wB6AMf6AMF6APxA_UDAAAABA&num=2&sig=AGiWqtwdLVtg7kh4hJX-t39GyICaNE4qjQ&client=ca-pub-8682474657542641&adurl=http://www.ddj.com/go-parallel/%3Fkw%3Dsem_ms_entsoft_google_ParComp_ParComp_Adver1_microsoft%2520visual%2520c%252B%252B" onmouseout="window.status=''" onmouseover="window.status='go to www.ddj.com/Go-Parallel';return true">Microsoft Visual C++</a></td></tr> <tr><td colspan="2" style="font-size: 12px;" class="AdText" valign="middle">The latest news & breakthroughs in parallel computing. Visit today!</td></tr> <tr><td colspan="2" style="font-size: 11px;" valign="middle" align="left"><a class="AdBottomUrl" href="http://googleads.g.doubleclick.net/aclk?sa=l&ai=Bc1YUAZwISu6TLpzaxQWZ4dXuCNWlxn-Rmqv_CcCNtwHAqQcQAhgCIPnI-gEoCDgAUOOCgrkGYKHwhoBYsgETd3d3LmVnZ2hlYWRjYWZlLmNvbcgBAdoBWGh0dHA6Ly93d3cuZWdnaGVhZGNhZmUuY29tL2FzcG5ldF9hbnN3ZXJzL3dpbjMycHJvZ3JhbW1lcm1tZWRpYS9BdWcyMDA2L3Bvc3QyNzUzOTAwNS5hc3CAAgHIAoHNtwmoAwHoA9wB6AMf6AMF6APxA_UDAAAABA&num=2&sig=AGiWqtwdLVtg7kh4hJX-t39GyICaNE4qjQ&client=ca-pub-8682474657542641&adurl=http://www.ddj.com/go-parallel/%3Fkw%3Dsem_ms_entsoft_google_ParComp_ParComp_Adver1_microsoft%2520visual%2520c%252B%252B" onmouseout="window.status=''" onmouseover="window.status='go to www.ddj.com/Go-Parallel';return true">www.ddj.com/Go-Parallel</a></td></tr> <tr><td colspan="2"><br></td></tr> <tr><td colspan="2" style="font-size: 14px;"><a class="AdTopUrl" href="http://googleads.g.doubleclick.net/aclk?sa=l&ai=BhIIaAZwISu6TLpzaxQWZ4dXuCK2thIwBu6XOzALAjbcBwPwVEAMYAyD5yPoBKAg4AFDkh7mb______8BYKHwhoBYoAHN6Ir_A7IBE3d3dy5lZ2doZWFkY2FmZS5jb23IAQHaAVhodHRwOi8vd3d3LmVnZ2hlYWRjYWZlLmNvbS9hc3BuZXRfYW5zd2Vycy93aW4zMnByb2dyYW1tZXJtbWVkaWEvQXVnMjAwNi9wb3N0Mjc1MzkwMDUuYXNwqAMB6APcAegDH-gDBegD8QP1AwAAAAQ&num=3&sig=AGiWqtwdULh3UilAwKebQ08WWLExFzgCpQ&client=ca-pub-8682474657542641&adurl=http://www.parasoft.com/googleins1" onmouseout="window.status=''" onmouseover="window.status='go to www.parasoft.com';return true">C++ Debugging</a></td></tr> <tr><td colspan="2" style="font-size: 12px;" class="AdText" valign="middle">Detect memory leaks and runtime errors. Debug C/C++ code w/Insure++</td></tr> <tr><td colspan="2" style="font-size: 11px;" valign="middle" align="left"><a class="AdBottomUrl" href="http://googleads.g.doubleclick.net/aclk?sa=l&ai=BhIIaAZwISu6TLpzaxQWZ4dXuCK2thIwBu6XOzALAjbcBwPwVEAMYAyD5yPoBKAg4AFDkh7mb______8BYKHwhoBYoAHN6Ir_A7IBE3d3dy5lZ2doZWFkY2FmZS5jb23IAQHaAVhodHRwOi8vd3d3LmVnZ2hlYWRjYWZlLmNvbS9hc3BuZXRfYW5zd2Vycy93aW4zMnByb2dyYW1tZXJtbWVkaWEvQXVnMjAwNi9wb3N0Mjc1MzkwMDUuYXNwqAMB6APcAegDH-gDBegD8QP1AwAAAAQ&num=3&sig=AGiWqtwdULh3UilAwKebQ08WWLExFzgCpQ&client=ca-pub-8682474657542641&adurl=http://www.parasoft.com/googleins1" onmouseout="window.status=''" onmouseover="window.status='go to www.parasoft.com';return true">www.parasoft.com</a></td></tr> <tr><td colspan="2"><br></td></tr> <tr><td colspan="2" style="font-size: 14px;"><a class="AdTopUrl" href="http://googleads.g.doubleclick.net/aclk?sa=l&ai=BU7CuAZwISu6TLpzaxQWZ4dXuCMKzvpMBnuuN9QnAjbcBoP4KEAQYBCD5yPoBKAg4AFD_1cjQBmCh8IaAWKABiOXr_gOyARN3d3cuZWdnaGVhZGNhZmUuY29tyAEB2gFYaHR0cDovL3d3dy5lZ2doZWFkY2FmZS5jb20vYXNwbmV0X2Fuc3dlcnMvd2luMzJwcm9ncmFtbWVybW1lZGlhL0F1ZzIwMDYvcG9zdDI3NTM5MDA1LmFzcIACAagDAegD3AHoAx_oAwXoA_ED9QMAAAAE&num=4&sig=AGiWqtzJ0VHYVCEPhCKxBbn_2dvTLOVZhw&client=ca-pub-8682474657542641&adurl=http://www.transparentcorp.com/products/np/%3Fservice%3Dgoogle%26keyword%3Dcont_hdphnlss" onmouseout="window.status=''" onmouseover="window.status='go to www.transparentcorp.com';return true">Neuro-Programmer 2.0</a></td></tr> <tr><td colspan="2" style="font-size: 12px;" class="AdText" valign="middle">Audio/Visual brainwave entrainment Software to optimize brain function</td></tr> <tr><td colspan="2" style="font-size: 11px;" valign="middle" align="left"><a class="AdBottomUrl" href="http://googleads.g.doubleclick.net/aclk?sa=l&ai=BU7CuAZwISu6TLpzaxQWZ4dXuCMKzvpMBnuuN9QnAjbcBoP4KEAQYBCD5yPoBKAg4AFD_1cjQBmCh8IaAWKABiOXr_gOyARN3d3cuZWdnaGVhZGNhZmUuY29tyAEB2gFYaHR0cDovL3d3dy5lZ2doZWFkY2FmZS5jb20vYXNwbmV0X2Fuc3dlcnMvd2luMzJwcm9ncmFtbWVybW1lZGlhL0F1ZzIwMDYvcG9zdDI3NTM5MDA1LmFzcIACAagDAegD3AHoAx_oAwXoA_ED9QMAAAAE&num=4&sig=AGiWqtzJ0VHYVCEPhCKxBbn_2dvTLOVZhw&client=ca-pub-8682474657542641&adurl=http://www.transparentcorp.com/products/np/%3Fservice%3Dgoogle%26keyword%3Dcont_hdphnlss" onmouseout="window.status=''" onmouseover="window.status='go to www.transparentcorp.com';return true">www.transparentcorp.com</a></td></tr> <tr><td colspan="2"><br></td></tr> </tbody></table> </div></div></td> <td valign="top" width="350" align="center"><script type="text/javascript"> lqm_channel=1; lqm_publisher=135; lqm_zone=1; lqm_format="6"; </script> <script type="text/javascript" src="post27539005.asp_archivos/s.js"></script><script type="text/javascript" src="post27539005.asp_archivos/i.ashx"></script><a href="http://a.lakequincy.com/c.ashx?channel=1&format=6&pageid=A348CC58-38D0-49C0-563F-29AAE800E34C&publisher=135&url=%2fi.ashx&ypos=3548&zone=1&country=AR&userguid=3e63c848-379d-48c1-b34f-d94651dcf2e1&placement=3405&creative=2547&" target="_top"><img src="post27539005.asp_archivos/633752289711277447.gif" alt="Click here" width="300" border="0" height="250"></a> </td> </tr> </tbody></table></div> </td></tr> <tr><td><br> </td></tr> <tr><td><br> </td></tr></tbody></table> </td></tr><tr><td class="homepagetext9" align="left" nowrap="nowrap"><b><u>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -