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 07-07-2010, 12:22 AM   #1 (permalink)
Registered Member
 
Join Date: Feb 2010
Location: Haverstraw, NY.
Posts: 94
antonio15020 is on a distinguished road
Send a message via MSN to antonio15020
Default problem on multiple sounds

hello, i am new to iphone dev, I have a problem, I have an app with 7 different sounds in the simulator works well, but on my iphone only hear the audio number 1.
This is the code, what is my mistake? thanks.


This is the viewcontroller.h

Code:
#import <UIKit/UIKit.h>
#import <AudioToolbox/AudioToolbox.h>

@interface AudioTimeViewController : UIViewController {
	NSTimer *_timer;
	NSTimer *_timer2;
	NSTimer *_timer3;
	NSTimer *_timer4;
	NSTimer *_timer5;
	NSTimer *_timer6;
	NSTimer *_timer7;
	
}
@property (nonatomic,retain) NSTimer		*_timer;
-(IBAction)audio1:(id)sender;
-(IBAction)audio2:(id)sender;
-(IBAction)audio3:(id)sender;
-(IBAction)audio4:(id)sender;
-(IBAction)audio5:(id)sender;
-(IBAction)audio6:(id)sender;
-(IBAction)audio7:(id)sender;
-(IBAction)preview1:(id)sender;
-(IBAction)preview2:(id)sender;
-(IBAction)preview3:(id)sender;
-(IBAction)preview4:(id)sender;
-(IBAction)preview5:(id)sender;
-(IBAction)preview6:(id)sender;
-(IBAction)preview7:(id)sender;
@end
This is the viewcontroller.m
Code:
#import "AudioTimeViewController.h"

@implementation AudioTimeViewController
@synthesize _timer;


- (void)dealloc{  
	[_timer invalidate];	
	[_timer release];
	[_timer2 invalidate];	
	[_timer2 release];
	[_timer3 invalidate];	
	[_timer3 release];
	[_timer4 invalidate];	
	[_timer4 release];
	[_timer5 invalidate];	
	[_timer5 release];
	[_timer6 invalidate];	
	[_timer6 release];
    [_timer7 invalidate];	
	[_timer7 release];
	[super dealloc];
}

-(IBAction)audio1:(id)sender
{
	if( _timer )
		[_timer invalidate];
	_timer = [NSTimer scheduledTimerWithTimeInterval:1.0f target:self selector:@selector(audio1) userInfo:nil repeats:NO];
}

-(void)audio1

{
	
	CFBundleRef mainBundle = CFBundleGetMainBundle();
	CFURLRef soundFileURLRef;
	soundFileURLRef = CFBundleCopyResourceURL(mainBundle, (CFStringRef)@"audio1",CFSTR("aif"),NULL);
	if (soundFileURLRef) {
	
	}
	UInt32 soundID;
	AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID);
	AudioServicesPlaySystemSound(soundID);
	
		
}

-(IBAction)audio2:(id)sender
{
	if( _timer2 )
		[_timer2 invalidate];
	_timer2 = [NSTimer scheduledTimerWithTimeInterval:1.0f target:self selector:@selector(audio2) userInfo:nil repeats:NO];
}

-(void)audio2

{
	CFBundleRef mainBundle = CFBundleGetMainBundle();
	CFURLRef soundFileURLRef;
	soundFileURLRef = CFBundleCopyResourceURL(mainBundle, (CFStringRef)@"audio2",CFSTR("aif"),NULL);
	if (soundFileURLRef) {
		
	}
	UInt32 soundID;
	AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID);
	AudioServicesPlaySystemSound(soundID);
}

-(IBAction)audio3:(id)sender
{
	if( _timer3 )
		[_timer3 invalidate];
	_timer3 = [NSTimer scheduledTimerWithTimeInterval:1.0f target:self selector:@selector(audio3) userInfo:nil repeats:NO];
}

-(void)audio3

{
	CFBundleRef mainBundle = CFBundleGetMainBundle();
	CFURLRef soundFileURLRef;
	soundFileURLRef = CFBundleCopyResourceURL(mainBundle, (CFStringRef)@"audio3",CFSTR("aif"),NULL);
	if (soundFileURLRef) {
		
	}
	UInt32 soundID;
	AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID);
	AudioServicesPlaySystemSound(soundID);
}

-(IBAction)audio4:(id)sender
{
	if( _timer4 )
		[_timer4 invalidate];
	_timer4 = [NSTimer scheduledTimerWithTimeInterval:1.0f target:self selector:@selector(audio4) userInfo:nil repeats:NO];
}

-(void)audio4

{
	CFBundleRef mainBundle = CFBundleGetMainBundle();
	CFURLRef soundFileURLRef;
	soundFileURLRef = CFBundleCopyResourceURL(mainBundle, (CFStringRef)@"audio4",CFSTR("aif"),NULL);
	if (soundFileURLRef) {
		
	}
	UInt32 soundID;
	AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID);
	AudioServicesPlaySystemSound(soundID);
}

-(IBAction)audio5:(id)sender
{
	if( _timer5 )
		[_timer5 invalidate];
	_timer5 = [NSTimer scheduledTimerWithTimeInterval:1.0f target:self selector:@selector(audio5) userInfo:nil repeats:NO];
}

-(void)audio5

{
	CFBundleRef mainBundle = CFBundleGetMainBundle();
	CFURLRef soundFileURLRef;
	soundFileURLRef = CFBundleCopyResourceURL(mainBundle, (CFStringRef)@"audio5",CFSTR("aif"),NULL);
	if (soundFileURLRef) {
		
	}
	UInt32 soundID;
	AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID);
	AudioServicesPlaySystemSound(soundID);
}

-(IBAction)audio6:(id)sender
{
	if( _timer6 )
		[_timer6 invalidate];
	_timer6 = [NSTimer scheduledTimerWithTimeInterval:1.0f target:self selector:@selector(audio6) userInfo:nil repeats:NO];
}

-(void)audio6

{
	CFBundleRef mainBundle = CFBundleGetMainBundle();
	CFURLRef soundFileURLRef;
	soundFileURLRef = CFBundleCopyResourceURL(mainBundle, (CFStringRef)@"audio6",CFSTR("aif"),NULL);
	if (soundFileURLRef) {
		
	}
	UInt32 soundID;
	AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID);
	AudioServicesPlaySystemSound(soundID);
}

-(IBAction)audio7:(id)sender
{
	if( _timer7 )
		[_timer7 invalidate];
	_timer7 = [NSTimer scheduledTimerWithTimeInterval:1.0f target:self selector:@selector(audio7) userInfo:nil repeats:NO];
}

-(void)audio7

{
	CFBundleRef mainBundle = CFBundleGetMainBundle();
	CFURLRef soundFileURLRef;
	soundFileURLRef = CFBundleCopyResourceURL(mainBundle, (CFStringRef)@"audio7",CFSTR("aif"),NULL);
	if (soundFileURLRef) {
		
	}
	UInt32 soundID;
	AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID);
	AudioServicesPlaySystemSound(soundID);
}

//de aqui enpieza las pruebas del preview

- (IBAction)preview1:(id)sender
{
	CFBundleRef mainBundle = CFBundleGetMainBundle();
	CFURLRef soundFileURLRef;
	soundFileURLRef = CFBundleCopyResourceURL(mainBundle, (CFStringRef)@"audio1",CFSTR("aif"),NULL);
	if (soundFileURLRef) {
		
	}
	UInt32 soundID;
	AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID);
	AudioServicesPlaySystemSound(soundID);
}

- (IBAction)preview2:(id)sender
{
	CFBundleRef mainBundle = CFBundleGetMainBundle();
	CFURLRef soundFileURLRef;
	soundFileURLRef = CFBundleCopyResourceURL(mainBundle, (CFStringRef)@"audio2",CFSTR("aif"),NULL);
	if (soundFileURLRef) {
		
	}
	UInt32 soundID;
	AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID);
	AudioServicesPlaySystemSound(soundID);
}

- (IBAction)preview3:(id)sender
{
	CFBundleRef mainBundle = CFBundleGetMainBundle();
	CFURLRef soundFileURLRef;
	soundFileURLRef = CFBundleCopyResourceURL(mainBundle, (CFStringRef)@"audio3",CFSTR("aif"),NULL);
	if (soundFileURLRef) {
		
	}
	UInt32 soundID;
	AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID);
	AudioServicesPlaySystemSound(soundID);
}

- (IBAction)preview4:(id)sender
{
	CFBundleRef mainBundle = CFBundleGetMainBundle();
	CFURLRef soundFileURLRef;
	soundFileURLRef = CFBundleCopyResourceURL(mainBundle, (CFStringRef)@"audio4",CFSTR("aif"),NULL);
	if (soundFileURLRef) {
		
	}
	UInt32 soundID;
	AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID);
	AudioServicesPlaySystemSound(soundID);
}

- (IBAction)preview5:(id)sender
{
	CFBundleRef mainBundle = CFBundleGetMainBundle();
	CFURLRef soundFileURLRef;
	soundFileURLRef = CFBundleCopyResourceURL(mainBundle, (CFStringRef)@"audio5",CFSTR("aif"),NULL);
	if (soundFileURLRef) {
		
	}
	UInt32 soundID;
	AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID);
	AudioServicesPlaySystemSound(soundID);
}

- (IBAction)preview6:(id)sender
{
	CFBundleRef mainBundle = CFBundleGetMainBundle();
	CFURLRef soundFileURLRef;
	soundFileURLRef = CFBundleCopyResourceURL(mainBundle, (CFStringRef)@"audio6",CFSTR("aif"),NULL);
	if (soundFileURLRef) {
		
	}
	UInt32 soundID;
	AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID);
	AudioServicesPlaySystemSound(soundID);
}

- (IBAction)preview7:(id)sender
{
	CFBundleRef mainBundle = CFBundleGetMainBundle();
	CFURLRef soundFileURLRef;
	soundFileURLRef = CFBundleCopyResourceURL(mainBundle, (CFStringRef)@"audio7",CFSTR("aif"),NULL);
	if (soundFileURLRef) {
		
	}
	UInt32 soundID;
	AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID);
	AudioServicesPlaySystemSound(soundID);
}

// aqui terminan las pruebas del preview
- (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 {
	// Release any retained subviews of the main view.
	// e.g. self.myOutlet = nil;
}




@end
antonio15020 is offline   Reply With Quote
Old 07-07-2010, 10:20 AM   #2 (permalink)
Registered Member
 
Join Date: Feb 2010
Location: Haverstraw, NY.
Posts: 94
antonio15020 is on a distinguished road
Send a message via MSN to antonio15020
Question Problem on multiple sounds

anyone can help me? I try to wav, caf, aif. Still problem
antonio15020 is offline   Reply With Quote
Reply

Bookmarks

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: 344
9 members and 335 guests
anothermine, bignoggins, Chickenrig, firecall, givensur, iNet, michaelhansen, Objective Zero, stanny
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,657
Threads: 94,118
Posts: 402,893
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jenniead38
Powered by vBadvanced CMPS v3.1.0

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