我正在使用iOS中的Finch openAL包装器,并希望淡出我的FISound。
假设我有一个30秒的声音,我希望能够在15秒后的5秒内淡出声音。
如果可能的话,我想避免使用openAL。
发布于 2012-10-11 15:20:36
设置一个NSTimer,反复将声音增益减小到零。或者你可以这样做:
static const float FadeStep = 0.1;
static const NSTimeInterval FadeDelay = 0.1;
@implementation FISound
- (void) fadeOut
{
self.gain = MAX(0, self.gain - FadeStep);
if (self.gain > 0) {
[self performSelector:_cmd afterDelay:FadeDelay withObject:nil];
}
}
@end这是一个快速而肮脏的解决方案,但它在许多情况下都应该可以很好地工作。
https://stackoverflow.com/questions/12834048
复制相似问题