崩溃了一次SDL_Mixer;现在所有使用SDL_Mixer的程序在初始化时崩溃

时间:2012-12-19 19:26:24

标签: c++ audio crash sdl sdl-mixer

我正在使用SDL_mixer查看音频this tutorial,一切都很顺利。

之后我决定通过探索来实验,玩耍和学习,所以我制作了一个非常相似的程序,有两个声道,让我播放一些视频游戏音乐,按下按钮来播放游戏音效。

然后我开始玩得开心,按钮捣乱只是为了愚蠢并测试程序。我开始按钮mashing多个按钮非常快然后执行该操作大概5秒左右,程序意外关闭。

从2个月左右的那个日期开始,我无法在使用SDL_mixer的计算机上运行任何东西。我尝试使用SDL_mixer创建新项目,我已经重新下载了所有SDL和SDL_mixer,甚至还问了this question on the sdl forums

我正准备重新格式化我的整台计算机以使其再次运行,这是非常好的。扩展库不应该强迫某人重新格式化,特别是当这个问题可能会传递给稍后下载并使用该程序的最终用户时。

我正在使用Windows 7 64位; Microsoft Visual Studio 2012 Professional; C ++;和SDL 1.x

另外,如果有人知道什么是错的,我该如何解决这个问题,防止它再次发生,并安全地使用声音,这样我就不会在用户的电脑上造成问题?

我用来初始化混音器的行如下:

//Initialize SDL_mixer 
if( Mix_OpenAudio( 22050, MIX_DEFAULT_FORMAT, 2, 4096 ) == -1 ) 
{ 
    return false; 
}

启动程序后调试器吐出的行会立即关闭:

'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Users\Rayne\Documents\Visual Studio 11\Projects\SDL_Tutorial11\Debug\SDL_Tutorial11.exe'. Symbols loaded. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Users\Rayne\Documents\Visual Studio 11\Projects\SDL_Tutorial11\Debug\SDL.dll'. Module was built without symbols. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\advapi32.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcrt.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sechost.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rpcrt4.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sspicli.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptbase.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\gdi32.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\user32.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\lpk.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\usp10.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winmm.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Users\Rayne\Documents\Visual Studio 11\Projects\SDL_Tutorial11\Debug\SDL_image.dll'. Module was built without symbols. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Users\Rayne\Documents\Visual Studio 11\Projects\SDL_Tutorial11\Debug\SDL_ttf.dll'. Module was built without symbols. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Users\Rayne\Documents\Visual Studio 11\Projects\SDL_Tutorial11\Debug\libfreetype-6.dll'. Module was built without symbols. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Users\Rayne\Documents\Visual Studio 11\Projects\SDL_Tutorial11\Debug\zlib1.dll'. Module was built without symbols. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Users\Rayne\Documents\Visual Studio 11\Projects\SDL_Tutorial11\Debug\SDL_mixer.dll'. Module was built without symbols. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp110.dll'. Symbols loaded. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcr110.dll'. Symbols loaded. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\imm32.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msctf.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ddraw.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dciman32.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\setupapi.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cfgmgr32.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\oleaut32.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ole32.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\devobj.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dwmapi.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\ddraw.dll' 
'SDL_Tutorial11.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\dwmapi.dll' 
'SDL_Tutorial11.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\setupapi.dll' 
'SDL_Tutorial11.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\devobj.dll' 
'SDL_Tutorial11.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\oleaut32.dll' 
'SDL_Tutorial11.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\ole32.dll' 
'SDL_Tutorial11.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\cfgmgr32.dll' 
'SDL_Tutorial11.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\dciman32.dll' 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\uxtheme.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dwmapi.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KBDUS.DLL'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\KBDUS.DLL' 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KBDUS.DLL'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\KBDUS.DLL' 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dsound.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ole32.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\powrprof.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\setupapi.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cfgmgr32.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\oleaut32.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\devobj.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dinput.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\hid.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\wintrust.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\crypt32.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msasn1.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ole32.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\ole32.dll' 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ole32.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\ole32.dll' 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\clbcatq.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\MMDevAPI.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\propsys.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shlwapi.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\AudioSes.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Users\Rayne\Documents\Visual Studio 11\Projects\SDL_Tutorial11\Debug\libmikmod-2.dll'. Module was built without symbols. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\wdmaud.drv'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ksuser.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\avrt.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msacm32.drv'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msacm32.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\midimap.dll'. Cannot find or open the PDB file. 
The thread 0x5b8 has exited with code 0 (0x0). 
The thread 0x1d2c has exited with code 0 (0x0). 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Users\Rayne\Documents\Visual Studio 11\Projects\SDL_Tutorial11\Debug\libpng15-15.dll'. Module was built without symbols. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Users\Rayne\Documents\Visual Studio 11\Projects\SDL_Tutorial11\Debug\libvorbisfile-3.dll'. Module was built without symbols. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Users\Rayne\Documents\Visual Studio 11\Projects\SDL_Tutorial11\Debug\libvorbis-0.dll'. Module was built without symbols. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Users\Rayne\Documents\Visual Studio 11\Projects\SDL_Tutorial11\Debug\libogg-0.dll'. Module was built without symbols. 
The thread 0x1a1c has exited with code 0 (0x0). 
The thread 0x1fbc has exited with code 0 (0x0). 
The thread 0x3f8 has exited with code 0 (0x0). 
The thread 0x584 has exited with code 0 (0x0). 
The thread 0xa98 has exited with code 0 (0x0). 
The thread 0x182c has exited with code 1 (0x1). 
The thread 0x1d1c has exited with code 1 (0x1). 
The thread 0x1278 has exited with code 1 (0x1). 
The thread 0x1d28 has exited with code 1 (0x1). 
The thread 0x1ca0 has exited with code 1 (0x1). 
The thread 0x1844 has exited with code 1 (0x1). 
The thread 0x1340 has exited with code 1 (0x1). 
The thread 0x6e8 has exited with code 1 (0x1). 
The thread 0x2008 has exited with code 1 (0x1). 
The program '[4852] SDL_Tutorial11.exe' has exited with code 1 (0x1).

P.S。是否有更简单的方法来表示大部分代码而无需手动复制 - 超过每行前面的4个空格?这需要一段时间._。;

1 个答案:

答案 0 :(得分:1)

感谢genpfault的建议,我能够找到解决这个问题的方法。

事实证明,解决方案是,当程序从过载的声道中崩溃时,由于声音必须通过按键激活,排队的按键被强加到程序的源代码,因为Visual Studio在崩溃后会自动抓住“窗口焦点”并“抓住”多余的字符。

在程序的最开始,这些字符恰好被附加到SDL_mixer函数的第一个错误检查行之一的字符串文字中,因此它没有为编译器引发语法错误;错误检查行只是说“nope,加载的文件与此字符串不完全匹配,因此关闭程序”,这导致程序在我的断点可以注册并允许我调试之前退出。

终于解决了这个问题,这绝对是一种解脱。

谢谢genpffault和stack-overflow!〜