[[SimpleAudioEngine sharedEngine] backgroundMusicVolume :0.5f];
Gives me a warning on "backgroundMusicVolume". That method is in the SimpleAudioManager.h. Is there a bug?
A fast, easy to use, free, and community supported 2D game engine
[[SimpleAudioEngine sharedEngine] backgroundMusicVolume :0.5f];
Gives me a warning on "backgroundMusicVolume". That method is in the SimpleAudioManager.h. Is there a bug?
Whats the difference between playBackroundMusic and playSound?
and "[[SimpleAudioEngine sharedEngine] playEffect:@"death.wav" gain:0.5f];" gives me a warning too.
Whats the warning?
@Joao - warning: 'SimpleAudioEngine' may not respond to '-playEffect:gain:'
If you're using the SimpleAudioEngine from CocosDenshion, there's no such method in the class. Either call:
-(ALuint) playEffect:(NSString*) filePath;
or:
-(ALuint) playEffect:(NSString*) filePath pitch:(Float32) pitch pan:(Float32) pan gain:(Float32) gain;
For the backgroundMusicVolume warning, it's not a method, it's a property. Try something like
[[SimpleAudioEngine sharedEngine] setBackgroundMusicVolume :0.5f];I was looking at:
/** plays an audio effect with a file path, pitch, pan and gain */
-(ALuint) playEffect:(NSString*) filePath pitch:(Float32) pitch pan:(Float32) pan gain:(Float32) gain;
from SimpleAudioEngine.h
im trying to lower the volume on some of the sound effects im using in my game. I think they fit the game very well, but they are too loud.
OK. But the warning :
warning: 'SimpleAudioEngine' may not respond to '-playEffect:gain:'
makes it look like you're doing something like:
[[SimpleAudioEngine sharedEngine] playEffect:@"myEffect.wav" gain:0.5];
The way to use it would be:
[[SimpleAudioEngine sharedEngine] playEffect:@"myEffect.wav" pitch:0.5 pan:0.5 gain:0.5];
Sorry if I'm way off and not making any sense but I'm already half asleep :)
First question, backgroundMusicVolume is a property so you don't set its value like that.
For your second question - I assume you mean playEffect as there is no playSound method. The main difference is that playBackgroundMusic uses an AVAudioPlayer to play the sound and playEffect uses OpenAL. playBackgroundMusic therefore allows you to play mp3 files with hardware decoding and playEffect lets you play multiple sound effects and control their pitch, pan and gain.
As for your third question - the warning says it all. There is no method with the signature you are calling. Either don't specify gain or additionally specify pitch and pan.
I suggest you get more familiar with Objective C before raising the bug alarm.
I'm TRYING to get more familiar with Objective C. I've been reading, poking, asking and banging out lines of code for a month now. I'm nowhere near where I want to be, but I really do only ask questions in here after I have looked in many other places first...
I'm sorry that I dont know the difference between
[[SimpleAudioEngine sharedEngine] playEffect:@"myEffect.wav" pitch:0.5 pan:0.5 gain:0.5];
and simply
[[SimpleAudioEngine sharedEngine] playEffect:@"myEffect.wav" gain:0.5];
in my world of simple understanding, it should have worked.
Yes, I know I need to learn more.
It's like any C function, if function has for example 3 parameters, you can't call it with only one.
Example:
function giveMeMonster(noOfHeads, noOfLegs, noOfHands)
if you call it with giveMeMonster(3) what you'll get? Funny monster with 3 heads or 3 legs?
Uh, sorry it's 4 a.m. here :)
heh, another late night coder. I wonder how many others here code into the wee hours of the night...
I have looked in many places... I'm sorry im so new.
But I have no idea how to find this myself.
'
First question, backgroundMusicVolume is a property so you don't set its value like that.
'
I don't know the difference I guess between what is a property and what isnt and I have no idea where to look to find the answer.
I figured it out.
In case there is anyone as dense as me, here is how I solved it:
[[SimpleAudioEngine sharedEngine] playBackgroundMusic:@"intro2.mp3" loop:TRUE];
[[SimpleAudioEngine sharedEngine] setBackgroundMusicVolume:0.2f];Yeah.. really helpful was the original writer, Osiris... com on, people... if you know how should it be done, just post few rows of code... :)
You must log in to post.