0

(続行する前に、私は VMWare の下で Mac OSX で開発していると言いたいので、VM の問題である可能性があるかどうかを誰かが知っている場合は、それに関してとにかく答えてください)

cocos2d の簡単なチュートリアルに従っていると、サウンドにたどり着きました

これは私がオーディオに使用するコードです

輸入品:

// Import the interfaces
#import "HelloWorldLayer.h"
#import "SimpleAudioEngine.h"

// Needed to obtain the Navigation Controller
#import "AppDelegate.h"

初期化方法:

-(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) 

どうすればそれを機能させることができますか?

4

1 に答える 1

0

少し掘り下げた後、同じ問題を抱えている他の人を見ました。彼らの問題は、システムにオーディオ ドライバーがインストールされていなかったため、サウンドがまったく再生されず、同じエラーが発生したことでした。

http://www.cocos2d-iphone.org/forum/topic/13970

ただし、これが実際のデバイスでも発生する場合は奇妙になります。PC以外にどのデバイスでテストしていますか?

于 2013-03-01T23:15:31.533 に答える