0
我在使用SystemSoundID
类的游戏中播放声音效果,并带有一些奇怪的结果。我的一些声音(包括下面的landed1
)会根据音量按钮更改音量,但其他乐器则会始终以全音量播放。以下是与这两个声音相关的所有代码。SystemSoundID有时会随着设备音量而改变
SystemSoundID deathsound;
SystemSoundID landed1;
...
NSURL * soundURL;
soundURL = [[NSBundle mainBundle] URLForResource:@"SMPKLanded1" withExtension:@"mp3"];
AudioServicesCreateSystemSoundID ((__bridge CFURLRef) soundURL, &landed1);
soundURL = [[NSBundle mainBundle] URLForResource:@"SMPKDeathSound" withExtension:@"mp3"];
AudioServicesCreateSystemSoundID ((__bridge CFURLRef) soundURL, &deathsound);
...
AudioServicesPlaySystemSound(landed1);
...
AudioServicesPlaySystemSound(deathsound);
为什么会这两个行为如此不同,如果代码和文件类型基本上是相同的?这个不成立!