I've a timer and at the end of it an alarm.
The alarm sits in a function like this:
The first time the alarm sounds it's off by 0.5 sec or so. Any subsequent call to this function and there is no delay.
I have tried to put the
In the initialization code and just call the PlaySound from my function but the result is the same.
In the function above though, I'm not retaining anything so I should have to create the sound every time, no?
I can accept a delay, but why is there no delay the second & 3rd time I sound the alarm?
Is there any way of making this a bit more consistent? Perhaps playing the sound in the initialization code but in mute, can I do that?
The alarm sits in a function like this:
Code:
- (void) soundAlarm {
[alarmTimer invalidate];
alarmTimer = nil;
SystemSoundID sound;
AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"ALARM" ofType:@"WAV"]], &sound);
AudioServicesPlaySystemSound (sound);
}
The first time the alarm sounds it's off by 0.5 sec or so. Any subsequent call to this function and there is no delay.
I have tried to put the
Code:
AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"ALARM" ofType:@"WAV"]], &sound);
In the function above though, I'm not retaining anything so I should have to create the sound every time, no?
I can accept a delay, but why is there no delay the second & 3rd time I sound the alarm?
Is there any way of making this a bit more consistent? Perhaps playing the sound in the initialization code but in mute, can I do that?