Hey thurr...first post and I'm in need of some help. I've basically rewritten Nitrex88's code in his tut for playing a short sound...but I'm getting errors and I can't determine where they are located...any help would be greatly appreciated.
Most errors are in the SoundEffect.m file...mostly syntax errors...and a warning: control reaches end of non-void function in the SoundEffect.m
Also in the MainView.m I get a syntax error, but only after I did #import "SoundEffect.h", which idk if that is necessary or not, but that leads me to believe something is wrong in the SoundEffect.h file. Any help is greatly appreciated. Thanks!
EDIT: I forgot to add...I'm getting an odd error: 'path' undeclared (first use in this function) error goin on...
-PolishDemon
Last edited by PolishDemon; 03-30-2009 at 09:25 PM.
The errors given by XCode are the following:
error: syntax error before '(' token
error: syntax error before '(' token
error: 'path' undeclared (first use in this function)
warning: control reaches end of non-void function
Those are in SoundEffect.m
In MainView.m, I also get an error: syntax error before '(' token
Most errors are in the SoundEffect.m file...mostly syntax errors...and a warning: control reaches end of non-void function in the SoundEffect.m
Also in the MainView.m I get a syntax error, but only after I did #import "SoundEffect.h", which idk if that is necessary or not, but that leads me to believe something is wrong in the SoundEffect.h file. Any help is greatly appreciated. Thanks!
EDIT: I forgot to add...I'm getting an odd error: 'path' undeclared (first use in this function) error goin on...
-PolishDemon
Quote:
Originally Posted by PolishDemon
BUMP
Anyone got any help for me? I really wanna know why this isn't working, I'm not giving up till I get an answer, and I can't figure it out by myself =[
Make the fixes I've highlighted in RED above. Note that the compiler isn't very specific, but it IS telling you exactly what the problem is here. Let us know how that goes.
I get failed to build, I always have followed that tutorial and I have used the same codes in the corrections. I get the following errors:
"_AudioServicesPlaySystemSound", referenced from:
-[SoundEffect play] in SoundEffect.o
and then
"_AudioServicesCreateSystemSoundID", referenced from:
-[SoundEffect initWithContentsOfFile:] in SoundEffect.o
symbol(s) not found
collect2: ld returned 1 exit status
I get failed to build, I always have followed that tutorial and I have used the same codes in the corrections. I get the following errors:
"_AudioServicesPlaySystemSound", referenced from:
-[SoundEffect play] in SoundEffect.o
and then
"_AudioServicesCreateSystemSoundID", referenced from:
-[SoundEffect initWithContentsOfFile:] in SoundEffect.o
symbol(s) not found
collect2: ld returned 1 exit status
Looks like you're missing a required framework in your project. I haven't seen the tutorial, so I don't know what it says about adding frameworks.
I get failed to build, I always have followed that tutorial and I have used the same codes in the corrections. I get the following errors:
"_AudioServicesPlaySystemSound", referenced from:
-[SoundEffect play] in SoundEffect.o
and then
"_AudioServicesCreateSystemSoundID", referenced from:
-[SoundEffect initWithContentsOfFile:] in SoundEffect.o
symbol(s) not found
collect2: ld returned 1 exit status
Yeah make sure u add the following framework: AudioToolbox.framework
And then to implement them do the following:
#import <AudioToolbox/AudioServices.h> which goes in the SoundEffect.h file...
My "aif" sound file plays fine in my app but if I try to change and program the app to play a different sound file or even overwrite the current sound file with a newer version, it no longer plays? Lucky I keep a back-up because when I put the one that was working back, it still no longer plays so I go back to the back-up.
I hope someone can help, it's driving me crazy
Thanks,
Carl
/*
File: SysSoundViewController.m
*/
#import "SysSoundViewController.h"
@implementation SysSoundViewController
- (void) viewDidLoad {
[super viewDidLoad];
// Get the main bundle for the app
NSString *path = [[NSBundle mainBundle] pathForResource:@"tap" ofType:@"aif"];
AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPathath], &soundID);
}
// Respond to a tap on the System Sound button
- (IBAction) playSystemSound {
i ve checked the code about 1000 times... didnt see it!
thank you very much!
after deleting the bracket, my errors were solved. but now i am receiving the following message:
but, now i ve got a new error
Quote:
Building target “test” of project “test” with configuration “Debug” — (2 errors)
"_AudioServicesPlaySystemSound", referenced from:
-[SoundEffect play] in SoundEffect.o
"_AudioServicesCreateSystemSoundID", referenced from:
-[SoundEffect initWithContentsOfFile:] in SoundEffect.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
Build failed (2 errors)
Last edited by gorgonzola2000; 05-14-2009 at 01:11 PM.
I get failed to build, I always have followed that tutorial and I have used the same codes in the corrections. I get the following errors:
"_AudioServicesPlaySystemSound", referenced from:
-[SoundEffect play] in SoundEffect.o
and then
"_AudioServicesCreateSystemSoundID", referenced from:
-[SoundEffect initWithContentsOfFile:] in SoundEffect.o
symbol(s) not found
collect2: ld returned 1 exit status
I get something very very similar when compiling successfully on the simulator but not on the ipod touch:
Code:
"_AudioServicesCreateSystemSoundID", referenced from:
-[SoundEffect initWithContentsOfFile:] in SoundEffect.o
"_AudioServicesDisposeSystemSoundID", referenced from:
-[SoundEffect dealloc:] in SoundEffect.o
"_AudioServicesPlaySystemSound", referenced from:
-[SoundEffect play] in SoundEffect.o
symbol(s) not found
collect2: ld returned 1 exit status
I selected and dragged the SoundEffect.h and m file from the GLPaint application to my own. Do i need to setup any special linkage when i do this?
After copying i added my code and "#import SoundEffect.h" to my .m file.
at the beginning of the SoundEffect.h file but nowhere else.
i also have "AudioToolbox.framework" installed however i don't know if it is PROPERLY installed. I just opened and dragged it into my linked frameworks folder.
Any help would be appreciated.
Now i have removed everything but the SoundEffect.h and SoundEffect.m files and STILL it does the same thing even though i am not even calling these routines?? I continue to endeavor!
and NOW i removed both of those 2 files and it finally compiles both on the simulator and the ipod touch so... what am i missing about copying those 2 files into my application folders?
Very very weird ok i removed everything and then added this to my file:
"_AudioServicesCreateSystemSoundID", referenced from:
"_AudioServicesPlaySystemSound", referenced from:
ld: symbol(s) not found
collect2: ld returned 1 exit status
for the files i call them in....and yet it still compiles just fine in the simulator... Any ideas??
i ve solved my problem.
as kalimba said, i had a problem with my framework. it wasn't imported correctly.
while importing, you re able to copy it to the projects folder (1st checkbox). dont do this. i had to delete it from my projects folder and import it again...
and it was fixed. works fine now.
so thanks to everyone
/edit
arghs... now i am looking for a tutorial which shows me, how to play different sounds at different images. are there any around?
Last edited by gorgonzola2000; 05-18-2009 at 03:48 PM.
i ve solved my problem.
as kalimba said, i had a problem with my framework. it wasn't imported correctly.
while importing, you re able to copy it to the projects folder (1st checkbox). dont do this. i had to delete it from my projects folder and import it again...
and it was fixed. works fine now.
so thanks to everyone
/edit
arghs... now i am looking for a tutorial which shows me, how to play different sounds at different images. are there any around?
Ty i had same issue. Key is to use the Add Existing Frameworks and dont drag them into the folder because then it wont LET you copy.
I am getting problems when trying to run the application. No compile errors but when the app launches it crashes out instantly. In console im getting the following error
Code:
2009-06-10 17:57:17.790[88937:20b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSURL initFileURLWithPath:isDirectory:]: nil string parameter'
2009-06-10 17:57:17.792[88937:20b] Stack:
If i comment out the NSRUL initFileURLWithPath line of code from SoundEffect.m the app launches but i get no sound at all.
I have tried to remove the Audiotoolbox framework and re add it several times but getting the same issue
Worst thing is i have another app with exactly the same code in it and that works fine
The path you're passing into initFileURLWithPath: is nil; that is, it is nothing. This happens when you ask the system for a path to a file, and the system can't find that file.
How are you building that path? If you're looking for a resource that's included in your project (not downloaded at runtime) It should be something like this:
The path you're passing into initFileURLWithPath: is nil; that it, it is nothing. This happens when you ask the system for a path to a file, and the system can't find that file.
How are you building that path? If you're looking for a resource that's included int your project (not downloaded at runtime) It should be something like this: