Re: How does one update a view position during a core audio render callback?
Re: How does one update a view position during a core audio render callback?
- Subject: Re: How does one update a view position during a core audio render callback?
- From: Ian Kemmish <email@hidden>
- Date: Sat, 07 Mar 2015 21:16:27 +0000
On 7 Mar 2015, at 09:17, "Patrick J. Collins" <email@hidden> wrote:
> my playheadView's position setter just does this:
>
> -(void)setPosition:(NSUInteger)position {
> if (position == self.position) return;
> [self setFrameOrigin:NSMakePoint(position, 0)];
> }
...
> self.timer = [NSTimer scheduledTimerWithTimeInterval:(1.0f / 60) target:self selector:@selector(updatePlayhead) userInfo:nil repeats:YES];
Trying to animate a simple vertical line by recalculating your application's view hierarchy sixty times a second is a) pointless (Walt Disney didn't need sixty frames a second and neither do you), and b) unlikely to work well, as you have discovered. At a rough guess, you'll probably find you're being asked to redraw the entire waveform display every time.
If you want a draw a line, try just drawing a line:-) Find a way to cache or redraw only the bit of waveform that was obscured by the line each time you move it.
CoreAnimation, as suggested by anther poster, does this caching for you, but not necessarily in a way which is optimal for your particular needs.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Ian Kemmish 18 Durham Close, Biggleswade, Beds SG18 8HZ
email@hidden Tel: +44 1767 601361 Mob: +44 7952 854387
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden