Hello, I just fired up XCode 7 and iOS9. Launched my app Thailes (id889292455) in the simulator, which plays a tune when loaded. I get jagged audio and a neverending stream of messages in the log that look like this:
2015-07-02 13:01:25.164 Thailes[1791:423977] 13:01:25.164 ERROR:>aqme> 299: Audio device 0x46: error '!obj' fetching sample rate, or sample rate is 0. Defaulting to 44100.
2015-07-02 13:01:25.165 Thailes[1791:423977] 13:01:25.165 ERROR:210: EXCEPTION thrown ('!dev'): error != 0
2015-07-02 13:01:25.165 Thailes[1791:423977] 13:01:25.165 ERROR:752: Can't make UISound Renderer
2015-07-02 13:01:25.203 Thailes[1791:423998] 13:01:25.203 ERROR:>aqme> 299: Audio device 0x4f: error '!obj' fetching sample rate, or sample rate is 0. Defaulting to 44100.
2015-07-02 13:01:25.203 Thailes[1791:423998] 13:01:25.203 ERROR:210: EXCEPTION thrown ('!dev'): error != 0
2015-07-02 13:01:25.206 Thailes[1791:423998] 13:01:25.206 ERROR:>aqme> 299: Audio device 0x55: error 'who?' fetching sample rate, or sample rate is 0. Defaulting to 44100.I'm using this code (this is consolidated) where the sound is created, faded in and set to loop
_sound = [[AVAudioPlayer alloc] initWithContentsOfURL:URL error:NULL];
- (void)fadeTo:(float)volume duration:(NSTimeInterval)duration
{
_startVolume = [_sound volume];
_targetVolume = volume * _baseVolume;
_fadeTime = duration;
_fadeStart = [[NSDate date] timeIntervalSinceReferenceDate];
if (_timer == nil)
{
self.timer = [NSTimer scheduledTimerWithTimeInterval:1.0/60.0
target:self
selector:@selector(tick)
userInfo:nil
repeats:YES];
}
}
- (void)tick
{
NSTimeInterval now = [[NSDate date] timeIntervalSinceReferenceDate];
float delta = (float)((now - _fadeStart)/_fadeTime * (_targetVolume - _startVolume));
[_sound setVolume:(_startVolume + delta) * _baseVolume];
if ((delta > 0.0f && [_sound volume] >= _targetVolume) ||
(delta < 0.0f && [_sound volume] <= _targetVolume))
{
[_sound setVolume:_targetVolume * _baseVolume];
[_timer invalidate];
self.timer = nil;
if ([_sound volume] == 0.0f)
{
[self stop];
}
}
}
[_sound setNumberOfLoops:looping? -1: 0];Finally this is derived from a Sound Class I installed in my app called SoundManager, nick lockwood here it is on github:
github+com/nicklockwood/SoundManager - trouble getting posts to show with real links. replace the + with a .