(继续我想说我开发的在VMWare下的Mac OSX,所以如果有人知道它可能是一个VM问题之前,请回答关于反正那)EXC_BAD_ACCESS有声音在cocos2d
我下面的cocos2d的一个简单的教程,我赶到的声音
这是我使用音频
进口代码:
// Import the interfaces
#import "HelloWorldLayer.h"
#import "SimpleAudioEngine.h"
// Needed to obtain the Navigation Controller
#import "AppDelegate.h"
Init方法:
-(id) init
{
// always call "super" init
// Apple recommends to re-assign "self" with the "super's" return value
if((self=[super init]))
{
[[SimpleAudioEngine sharedEngine] playBackgroundMusic:@"Field1.mp3" loop:YES];
CCMenuItemImage *uno = [CCMenuItemImage itemWithNormalImage:@"vblue.png" selectedImage:@"vblue.png" target:self selector:@selector(uno)];
uno.position = ccp(-150,0);
CCMenuItemImage *due = [CCMenuItemImage itemWithNormalImage:@"vgreen.png" selectedImage:@"vgreen.png" target:self selector:@selector(uno)];
due.position = ccp(-50,0);
CCMenuItemImage *start = [CCMenuItemImage itemWithNormalImage:@"play.png" selectedImage:@"play.png" target:self selector:@selector(uno)];
start.position = ccp(150,0);
CCMenuItemImage *stop = [CCMenuItemImage itemWithNormalImage:@"pausa.png" selectedImage:@"pausa.png" target:self selector:@selector(uno)];
stop.position = ccp(50,0);
CCMenu *menu = [CCMenu menuWithItems:uno,due,start,stop, nil];
[self addChild:menu];
}
return self;
}
问题的行是
[[SimpleAudioEngine sharedEngine] playBackgroundMusic:@"Field1.mp3" loop:YES];
由于音频错误,并没有该行的游戏作品Xcode的报告。
编译器输出:
<AudioControl> Error '!obj' trying to fetch default input device's sample rate
2013-03-01 12:29:09.101 Tutorial10[374:4803]
<AudioControl> Error getting audio input device sample rate: '!obj'2013-03-01 12:29:09.102 Tutorial10[374:4803]
<AudioControl> AQMEIOManager::FindIOUnit: error 'NoHW'
2013-03-01 12:29:09.104 Tutorial10[374:1b03]
<0xb0115000> AQMEIOManager::FindIOUnit: error 'NoHW'
(lldb)
我怎样才能使它发挥作用?
您是否在实际设备上或仅在模拟器上试过这个?你可以毫无问题地演奏其他声音吗? – dqhendricks 2013-03-01 21:07:41
在两者上我都遇到同样的问题。我不知道我错在哪里,因为在教程中,我看到这个人也是这样做的。 – user1714647 2013-03-01 21:30:52
你有没有尝试过不同的MP3(最好是一个确认可以工作,即从另一个游戏的应用程序包)? – LearnCocos2D 2013-03-01 22:23:13