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

View Single Post
Old 07-30-2010, 12:04 AM   #25 (permalink)
AdamSubach
Registered Member
 
Join Date: Apr 2010
Posts: 106
AdamSubach is on a distinguished road
Default

Quote:
Originally Posted by BrianSlick View Post
That looks fine.

The data formatters message could indicate a memory issue. Add log messages to the didReceiveMemoryWarning methods and find out if those are triggering.

Really there are too many possibilities to give you much help without more code.
Code:
#import "Stage_2.h"
#import "Stage_3.h"

#import "IPHONEAPP.h"

#import <AudioToolbox/AudioToolbox.h>
#import <AVFoundation/AVFoundation.h>

@implementation Stage_2

@synthesize audioPlayer, audioPlayer2;

//Stage_3 Parts- View/Alert/Auido
//
//
-(IBAction) stage_3 {
	//View Switch
	Stage_3 *screen = [[Stage_3 alloc] initWithNibName:nil bundle:nil];
	screen.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
	[self presentModalViewController:screen animated:YES];
	[screen release];
	//Audio-Make sure the audio is at the start of the stream.
	self.audioPlayer.currentTime = 0;
	
	[self.audioPlayer play];	
}

//backHome Parts- View/Alert/Vibrate/Audio
//
//

-(IBAction)backHome {
	//View Switch
	IPHONEAPPViewController *screen = [[IPHONEAPPViewController alloc] initWithNibName:nil bundle:nil];
	screen.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
	[self presentModalViewController:screen animated:YES];
	[screen release];
	//Alert
	UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"Woops..." 
												   delegate:self cancelButtonTitle:@"Try Again?" otherButtonTitles:nil];
	[alert show];
	[alert release];
	//Vibrate
	AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
	//Audio-Make sure the audio is at the start of the stream.
	self.audioPlayer2.currentTime = 0;
	
	[self.audioPlayer2 play];	
	
}

//viewDidLoad Parts
//
//
- (void) viewDidLoad {
	
//Sound "Foward"
//
//
	NSString *filePath = [[NSBundle mainBundle] pathForResource:@"fowardSound"ofType:@"mp3"];
	NSURL *fileURL = [[NSURL alloc] initFileURLWithPath:filePath];
	self.audioPlayer = [[AVAudioPlayer alloc] 
						initWithContentsOfURL:fileURL error:nil];
	
	[self.audioPlayer prepareToPlay];
	
	[filePath release];
	[fileURL release];
//Sound "Back"
//
//
	NSString *filePath2 = [[NSBundle mainBundle] pathForResource:@"backSound"ofType:@"mp3"];
	NSURL *fileURL2 = [[NSURL alloc] initFileURLWithPath:filePath2];
	self.audioPlayer2 = [[AVAudioPlayer alloc] 
						initWithContentsOfURL:fileURL2 error:nil];
	
	[self.audioPlayer2 prepareToPlay];
	
	[filePath2 release];
	[fileURL2 release];
	
	[super viewDidLoad];
	
}

- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}



- (void)dealloc {
	[audioPlayer release];
	[audioPlayer2 release];
    [super dealloc];
}


@end
AdamSubach is offline   Reply With Quote
 

» Advertisements
» Online Users: 352
10 members and 342 guests
Domele, esoteric, HemiMG, ipodphone, jakedukes3003, Newbie123, online-loans70, PavelSea, thephotographer, TomTool
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,568
Threads: 94,081
Posts: 402,751
Top Poster: BrianSlick (7,990)
Welcome to our newest member, online-loans70
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 11:29 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.