Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 01-11-2010, 05:24 AM   #1 (permalink)
Registered Member
 
Join Date: Jun 2009
Location: vienna
Posts: 41
blacksheep is on a distinguished road
Default delay on touches

i get two strange effects using button to play and stop sounds:
1st: when i start the app the sound has a short delay on the FIRST touch, not on the following.
2nd: i want to stop the sound when lifting the finger. it works touching and releasing not to fast. when tapping fast, no sound is playing.
it seems that the "stop" IBAction is reacting faster that the "play" action.
i tried not using buttons but Touches Events - same result.

where could be the failure?


//Touch Down

- (void)play {

AVAudioPlayer *player =
[[AVAudioPlayer alloc] initWithContentsOfURL:(NSURL *)[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"%"ofType:@"caf"]] error:nil];

if (nil != player) {
[player setDelegate:self];
[player play];
} else {
NSLog(@"Failed to allocate AVAudioPlayer object!");
}
}

- (void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)flag {
if (flag == NO) NSLog(@"Playback finished unsuccessfully!");

[player setDelegate:nil];
[player release];
}

- (IBAction)D2:(id)sender {
D2 = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"D2" ofType:@"caf"]] error:nil];
D2.delegate = self;
[D2 play];
}

//Touch Up Inside

- (IBAction)D2stop:(id)sender {
D2.delegate = self;
[D2 release];
[D2 stop];
}
blacksheep is offline   Reply With Quote
Reply

Bookmarks

Tags
delay, delay in touch, touches

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 322
12 members and 310 guests
2Apps1Day, akacaj, Domele, Duncan C, GraffitiCircus, michelle, NetGuru, NSString, Paul Slocum, Sloshmonster, soohyun, v1n2e7t
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,650
Threads: 94,114
Posts: 402,885
Top Poster: BrianSlick (7,990)
Welcome to our newest member, soohyun
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 09:56 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0