测试游戏时音效出现问题的原因

来源:互联网 发布:混凝土抗风柱计算软件 编辑:程序博客网 时间:2024/06/05 19:52

测试游戏的时候,由于听背景音乐实在听地烦了,便将背景音乐的效果给关闭了

没想到接下来就出现了问题!

值得注意的是,这个问题在我关闭背景音效之前一直就没有出现过~

我做的也是一个类似于cut the rope 的切割类物理游戏,因此在每次执行切割操作的时候都会播放一段“唰”的音效

自从关掉了背景音效,播放“唰”切割音效、程序逻辑判断切割的时候就会停顿一下,说的不好听就是卡一下

虽然只是很短暂的卡一下,但这种情况明显会让玩家感到很不爽,因此,我也感到很不爽!

总之,现在的问题就是如何将这个bug给去除掉了。。

控制台上面的所有输出如下:

GNU gdb 6.3.50-20050815 (Apple version gdb-1705) (Fri Jul  1 10:50:06 UTC 2011)Copyright 2004 Free Software Foundation, Inc.GDB is free software, covered by the GNU General Public License, and you arewelcome to change it and/or distribute copies of it under certain conditions.Type "show copying" to see the conditions.There is absolutely no warranty for GDB.  Type "show warranty" for details.This GDB was configured as "x86_64-apple-darwin".Attaching to process 7212.2011-09-27 16:33:38.826 GoldMine0.4[7212:c503] cocos2d: cocos2d v1.0.0-rc32011-09-27 16:33:38.827 GoldMine0.4[7212:c503] cocos2d: Using Director Type:CCDirectorDisplayLink2011-09-27 16:33:38.845 GoldMine0.4[7212:c503] cocos2d: OS version: 4.3.2 (0x04030200)2011-09-27 16:33:38.846 GoldMine0.4[7212:c503] cocos2d: GL_VENDOR:   Apple Computer, Inc.2011-09-27 16:33:38.846 GoldMine0.4[7212:c503] cocos2d: GL_RENDERER: Apple Software Renderer2011-09-27 16:33:38.847 GoldMine0.4[7212:c503] cocos2d: GL_VERSION:  OpenGL ES-CM 1.1 APPLE2011-09-27 16:33:38.848 GoldMine0.4[7212:c503] cocos2d: GL_MAX_TEXTURE_SIZE: 20482011-09-27 16:33:38.849 GoldMine0.4[7212:c503] cocos2d: GL_MAX_MODELVIEW_STACK_DEPTH: 162011-09-27 16:33:38.894 GoldMine0.4[7212:c503] cocos2d: GL_MAX_SAMPLES: 42011-09-27 16:33:38.908 GoldMine0.4[7212:c503] cocos2d: GL supports PVRTC: YES2011-09-27 16:33:38.910 GoldMine0.4[7212:c503] cocos2d: GL supports BGRA8888 textures: YES2011-09-27 16:33:38.911 GoldMine0.4[7212:c503] cocos2d: GL supports NPOT textures: YES2011-09-27 16:33:38.911 GoldMine0.4[7212:c503] cocos2d: GL supports discard_framebuffer: YES2011-09-27 16:33:38.912 GoldMine0.4[7212:c503] cocos2d: compiled with NPOT support: NO2011-09-27 16:33:38.913 GoldMine0.4[7212:c503] cocos2d: compiled with VBO support in TextureAtlas : YES[Switching to process 7212 thread 0x10f0b]2011-09-27 16:33:38.914 GoldMine0.4[7212:c503] cocos2d: compiled with Affine Matrix transformation in CCNode : YES2011-09-27 16:33:38.920 GoldMine0.4[7212:c503] cocos2d: compiled with Profiling Support: NO[Switching to process 7212 thread 0xc503]2011-09-27 16:33:38.928 GoldMine0.4[7212:c503] Retina Display Not supported2011-09-27 16:33:38.932 GoldMine0.4[7212:c503] cocos2d: surface size: 480x3202011-09-27 16:33:38.960 GoldMine0.4[7212:c503] Screen width 480.00 screen height 320.002011-09-27 16:33:38.961 GoldMine0.4[7212:c503] 地图的大小为:480.000000, 320.0000002011-09-27 16:33:38.964 GoldMine0.4[7212:c503] GameScene init2011-09-27 16:33:38.965 GoldMine0.4[7212:c503] cocos2d: Frame interval: 12011-09-27 16:33:44.378 GoldMine0.4[7212:c503] Denshion::CDAudioManager - Audio session set category AVAudioSessionCategorySoloAmbient failed with error Error Domain=NSOSStatusErrorDomain Code=-50 "The operation couldn’t be completed. (OSStatus error -50.)"AudioStreamBasicDescription:  2 ch,  44100 Hz, 'lpcm' (0x00000C2C) 8.24-bit little-endian signed integer, deinterleaved

我将背景音效关闭,发现只有在第一次播放“唰”切割音效的时候才会报出以下错误,此时程序表现出卡一下的效果:

2011-09-27 16:33:44.378 GoldMine0.4[7212:c503] Denshion::CDAudioManager - Audio session set category AVAudioSessionCategorySoloAmbient failed with error Error Domain=NSOSStatusErrorDomain Code=-50 "The operation couldn’t be completed. (OSStatus error -50.)"AudioStreamBasicDescription:  2 ch,  44100 Hz, 'lpcm' (0x00000C2C) 8.24-bit little-endian signed integer, deinterleaved
大意可能是说没有找到所指定的播放类,但是作为补偿,有其他的方式可以播放出该音效(胡乱猜测,不知正确与否)~

在网上查了一下资料,给出一个有用的连接:http://www.cocos2d-iphone.org/forum/topic/8499

问题和我遇到的问题不一样,但是上面给出连接的那个问题包含了我所遇到的问题

对于该问题,某某大侠的回复如下:

Audio doesn't work correctly in the simulator. I only look at issues that are confirmed on devices, please test on a device.

As for your compiler warning, you need to import SimpleAudioEngine.h or CDAudioManager.h in your HelloWorld header file.

意思差不多就是:模拟器里面对声音效果的表现不正确,但是如果是在真机上的话,则能够正确表现~

至此,问题差不多结束了,不过很遗憾的是,我没有证书,虽然有itouch4代,但是无法进行真机测试,汗~

原创粉丝点击