How to change MP3 Volume in iTorque 1.5?
by Watermark · in iTorque 2D · 10/08/2012 (12:17 am) · 6 replies
I know this question's been asked before, but so far I haven't been able to find an answer. The closest seems to be the suggestion by Mark regarding a 'SoundEngine_SetBackgroundMusicVolume', here:
http://www.garagegames.com/community/forums/viewthread/117343
but it wasn't explained how it was done. And I couldn't find the SoundEngine mentioned.
The problem I am facing now is that my background music plays too loud, and it covers up the sound effects. How do I change the MP3 volume? Here's the issues I faced:
1. I am using startiPhoneAudioStream($musicStreamFile,%loop); to play my BGM. So I can't be using any of the audio profile techniques mentioned.
2. I've tried changing the pref and defaultpref values:
$pref::Audio::musicVolume = 0.8;
to something else, but it always gets changed back to 0.8 during compile. I am not even sure if this has to do with MP3.
3. Also, due to size, converting all my mp3 to wav is not a practical solution.
So how can I change the volume? Thanks.
http://www.garagegames.com/community/forums/viewthread/117343
but it wasn't explained how it was done. And I couldn't find the SoundEngine mentioned.
The problem I am facing now is that my background music plays too loud, and it covers up the sound effects. How do I change the MP3 volume? Here's the issues I faced:
1. I am using startiPhoneAudioStream($musicStreamFile,%loop); to play my BGM. So I can't be using any of the audio profile techniques mentioned.
2. I've tried changing the pref and defaultpref values:
$pref::Audio::musicVolume = 0.8;
to something else, but it always gets changed back to 0.8 during compile. I am not even sure if this has to do with MP3.
3. Also, due to size, converting all my mp3 to wav is not a practical solution.
So how can I change the volume? Thanks.
About the author
Three iTorque 1.5 games published: Sorceria 1: The Mad Doctor RPG Sorceria 2: Sunken City Sagas: RPG Boardgame and Name Generator For more info see our site: http://wmrpg.weebly.com
#2
I also tweaked some of the quality settings to that the MP3s weren't so big.
10/08/2012 (1:13 pm)
I wound up using audacity to re-generate the mp3's at lower volume, (80% I think).. I also tweaked some of the quality settings to that the MP3s weren't so big.
#3
Like Ray, I manually adjusted the volume of the mp3 in my previous game, but it's really quite time consuming and I can't adjust the volume manually.
10/09/2012 (8:33 pm)
Thanks Paul! I will go try the code out.Like Ray, I manually adjusted the volume of the mp3 in my previous game, but it's really quite time consuming and I can't adjust the volume manually.
#4
stream->setVolume(volume);
How can I fix this? Thanks.
10/09/2012 (8:59 pm)
Hi Paul. When I compiled the code XCode threw the error "No member named setVolume in iPhoneStreamSource" when it came to the line:stream->setVolume(volume);
How can I fix this? Thanks.
#5
10/10/2012 (11:39 am)
Whoops. Been a while since I wrote this. You'll have to add to platformiPhone/iPhoneStreamSource.ccbool iPhoneStreamSource::setVolume( F32 volume) {
SoundEngine::SoundEngine_SetBackgroundMusicVolume(volume);
return true;
}
Torque Owner Paul Jan
ConsoleFunction(setiPhoneAudioVolume, void, 3, 3, "setiPhoneAudioVolume( Stream ID, float volume )" ) { int objID = dAtoi( argv[1] ); SimObject *sObj = Sim::findObject( objID ); iPhoneStreamSource *stream = (iPhoneStreamSource*)(sObj); F32 volume = dAtof( argv[2] ); if( stream ) { if( stream->isPlaying() ) { stream->setVolume(volume); } } }