gpt4 book ai didi

iphone - 在 iPad 上播放声音,使用 AudioToolbox

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:46:33 25 4
gpt4 key购买 nike

我发现了一个使用工具箱播放声音的功能,创建它的人获得了荣誉:

-(SystemSoundID) createSoundID: (NSString*)name {
NSString *path = [NSString stringWithFormat: @"%@/%@",
[[NSBundle mainBundle] resourcePath], name];

NSURL* filePath = [NSURL fileURLWithPath: path isDirectory: NO];
SystemSoundID soundID;
AudioServicesCreateSystemSoundID((CFURLRef)filePath, &soundID);
NSLog(@"%@, %@", path, filePath);
return soundID;
}

但是一旦我想要播放声音并使用该功能

mySound = [self createSoundID: @"canopen.wav"];

AudioServicesPlaySystemSound(mySound);

它只能在模拟器中播放,一旦我将它移到 iPad 上就不能播放。请帮忙

最佳答案

我前段时间也遇到过同样的事情。检查您的 iPad 是否已静音 :)

关于iphone - 在 iPad 上播放声音,使用 AudioToolbox,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7668595/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com