★ TouchArcade needs your help. Click here to support us on Patreon.

Response time for a UIButton for an iPad application

06-21-2010, 12:15 PM
#1
Joined: Jun 2010
Posts: 2
Response time for a UIButton for an iPad application

hi guys,

i have a simple UIButton that, once clicked, plays a 1 second sound. i want to be able to click that button really fast and produce that sound as many times as i humanly can.

i currently have this up and running by including the <AVFoundation/AVAudioPlayer.h> and maybe that is where the culprit is... also, i am digging into apple's references and cannot find the info for how quick is a UIButton to respond to each event and how, if at all, i can control and manipulate this value.

hi guys,

i have a simple UIButton that, once clicked, plays a 1 second sound. i want to be able to click that button really fast and produce that sound as many times as i humanly can.

i currently have this up and running by including the <AVFoundation/AVAudioPlayer.h> and maybe that is where the culprit is... also, i am digging into apple's references and cannot find the info for how quick is a UIButton to respond to each event and how, if at all, i can control and manipulate this value.

should i switch to a different audio framework like the "audio toolbox" or is there a way for me to speed things up, or perhaps instruct a button to accept a 2nd and 3rd press while the action of the first press is still underway.

cheers!

~nir.

cheers!

~nir.

Last edited by pengas; 06-21-2010 at 01:36 PM.
06-21-2010, 12:33 PM
#2
Joined: Mar 2009
Location: Oslo, Norway
Posts: 731
Shouldn't be a speed problem as long as the button registers on "Touch Down" rather than "Touch up inside" or similar.

The audio could delay things if it is not preloaded when you hit the button.
06-21-2010, 01:39 PM
#3
Joined: Jun 2010
Posts: 2
Quote:
Originally Posted by NickFalk View Post
Shouldn't be a speed problem as long as the button registers on "Touch Down" rather than "Touch up inside" or similar.

The audio could delay things if it is not preloaded when you hit the button.
thanx nick for your reply.

i am using "Touch Down" and i am pre-loading the audio file.



is there a way for me to speed things up by instructing the button to accept a 2nd and 3rd press while the action of the first press is still underway?

cheers!

~nir.
06-22-2010, 12:40 AM
#4
Joined: Mar 2009
Location: Oslo, Norway
Posts: 731
Haven't really tried anything like the scenario you describe, but a good start for you would be to find out whether the audioplayer is the culprit (as you suggest). Why not replace the call with a less expensive one for testing purposes? Like increasing an int and outputting it to a label for instance.

This way you'll find out if it's the UIButton or the Audioplayer that's delaying things...