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

Mockup & CodeGen, iPhone & iPad
($9.99)

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

Manu
($0.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 08-26-2009, 10:22 AM   #1 (permalink)
Registered Member
 
Join Date: Mar 2009
Posts: 140
Default REALLY weird problem.

So basically I am defining "Sound" like this:
Code:
AVAudioPlayer *ASound;
However I am getting AVAudioPlayer undeclared, despite the fact I have added and re-added AVFoundation to the frameworks folder several times and I can see the AVAudioPlayer header inside it. The AVAudioPlayer text is also blue so Xcode obviously recognizes it. Has anyone else had a similar problem and does anyone have a solution?

On a side note I'm running 2.2.1.

Last edited by ozzie; 08-26-2009 at 10:25 AM.
ozzie is offline   Reply With Quote
Old 08-26-2009, 11:38 AM   #2 (permalink)
Humbled Student
 
Dutch's Avatar
 
Join Date: Apr 2009
Location: Long Island, NY
Age: 32
Posts: 883
Send a message via AIM to Dutch
Default

Try Adding into your appDelegate.h

Code:
#import <AudioToolbox/AudioToolbox.h>
The corresponding playSound method

Code:
-(void)playSound: (NSString *)sound withExt:(NSString *)extension{
	NSString *soundPath = [[NSBundle mainBundle] pathForResource:sound ofType:extension];
	SystemSoundID soundID;
	AudioServicesCreateSystemSoundID((CFURLRef) [NSURL fileURLWithPath:soundPath], &soundID);
	AudioServicesPlaySystemSound(soundID);	
	AudioServicesPlaySystemSound(kSystemSoundID_Vibrate); 
}
Dutch is offline   Reply With Quote
Old 08-26-2009, 01:59 PM   #3 (permalink)
Registered Member
 
Join Date: Mar 2009
Posts: 140
Default

Quote:
Originally Posted by Dutch View Post
Try Adding into your appDelegate.h

Code:
#import <AudioToolbox/AudioToolbox.h>
The corresponding playSound method

Code:
-(void)playSound: (NSString *)sound withExt:(NSString *)extension{
	NSString *soundPath = [[NSBundle mainBundle] pathForResource:sound ofType:extension];
	SystemSoundID soundID;
	AudioServicesCreateSystemSoundID((CFURLRef) [NSURL fileURLWithPath:soundPath], &soundID);
	AudioServicesPlaySystemSound(soundID);	
	AudioServicesPlaySystemSound(kSystemSoundID_Vibrate); 
}
Thanks, however I'm really wanting to use AVAudioPlayer because I know how to loop it whereas I'm not sure with AudioToolbox.
ozzie is offline   Reply With Quote
Old 08-26-2009, 02:28 PM   #4 (permalink)
Registered Member
 
Join Date: Apr 2009
Posts: 536
Default

Did you actually import AVAudioPlayer.h in this source file?
eddietr is offline   Reply With Quote
Old 08-26-2009, 02:50 PM   #5 (permalink)
Registered Member
 
Join Date: Mar 2009
Posts: 140
Default

Quote:
Originally Posted by eddietr View Post
Did you actually import AVAudioPlayer.h in this source file?
Yep. Strangely enough since I've restarted my Mac its suddenly started working. Rather wierd.
ozzie is offline   Reply With Quote
Old 12-28-2009, 11:05 AM   #6 (permalink)
Registered Member
 
Join Date: Dec 2009
Posts: 54
Default

Quote:
Originally Posted by ozzie View Post
Yep. Strangely enough since I've restarted my Mac its suddenly started working. Rather wierd.
my problem is, it works on simulator but cell phone... anyone knows how to fix it??? I've tried to reboot Mac several times, cleaned All Targets before rebuild program, deleted the app from cell phone, did change another wav file which works on another app, but it just doesn't work!!
Georg is offline   Reply With Quote
Old 12-28-2009, 11:10 AM   #7 (permalink)
Humbled Student
 
Dutch's Avatar
 
Join Date: Apr 2009
Location: Long Island, NY
Age: 32
Posts: 883
Send a message via AIM to Dutch
Default

Quote:
Originally Posted by Georg View Post
my problem is, it works on simulator but cell phone... anyone knows how to fix it??? I've tried to reboot Mac several times, cleaned All Targets before rebuild program, deleted the app from cell phone, did change another wav file which works on another app, but it just doesn't work!!
Check to make sure your file names/paths for your WAV files are correct. The iPhone's file system is case-sensitive, while the simulator is not. That would be my first guess.
Dutch is offline   Reply With Quote
Old 12-28-2009, 11:04 PM   #8 (permalink)
Registered Member
 
Join Date: Dec 2009
Posts: 54
Default

Quote:
Originally Posted by Dutch View Post
Check to make sure your file names/paths for your WAV files are correct. The iPhone's file system is case-sensitive, while the simulator is not. That would be my first guess.
I have just discovered the root cause, I remarked the microphone code:

if (recorder) {
[recorder prepareToRecord];
recorder.meteringEnabled = YES;
[recorder record];
levelTimer = [NSTimer scheduledTimerWithTimeInterval: 0.03 target: self selector: @selector(levelTimerCallback userInfo: nil repeats: YES];
}

Then the WAV file workes!! looks like it's conflict problem between <AudioToolbox/AudioServices.h> and <AVFoundation/AVFoundation.h>
Any method to overcome ??
Georg 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: 249
18 members and 231 guests
ADY, Alsahir, beleg_1998, Dani77, e2applets, iph_s, JamesCahall, JasonR, mer10, Monstertaco, prchn4christ, Promo Dispenser, Robiwan, Rudy, smithdale87, timle8n1, Touchmint
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,880
Threads: 89,228
Posts: 380,756
Top Poster: BrianSlick (7,129)
Welcome to our newest member, @sandris
Powered by vBadvanced CMPS v3.1.0

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