【发布时间】:2013-05-07 04:44:35
【问题描述】:
我试图让AVAudioPlayer 的音量随时间波动。
例如:每 10 秒,将音量调到 0.5,然后调到 1.0,等等。
我尝试过使用NSTimer,但它只能在第一次使用并且不会循环。
oscillateTimer = [NSTimer scheduledTimerWithTimeInterval:3.0 target:self selector:@selector(oscillateRun) userInfo:nil repeats:YES];
oscillateRun function
- (void)oscillateRun {
BOOL oscillation;
oscillation = NO;
if(oscillation = YES) {
oscillation = NO;
audioPlayer.volume = 0.50;
}
else {
oscillation = YES;
audioPlayer.volume = 1;
}
}
不知道该怎么做,在此先感谢!
【问题讨论】:
-
当你这样尝试时发生了什么?
标签: ios xcode avaudioplayer nstimer nstimeinterval