Game Development Community

Volume

by rennie moffat · in iTorque 2D · 09/24/2010 (7:24 pm) · 5 replies

Hi there,
I have noticed one thing, that my volume, tho set to 1.0 is not very loud. My actual audio files level out at zero, which is premium for any audio person, are probably 30-40% quieter than I would like. Is having volume = 1.0 as best as I can get?



About the author

My thanks to Garage Games and the Garage Games Community combined with owned determination I got one game up, Temple Racer and I am looking to build more interesting, fun games for the mass market of the iOS app store.


#1
09/24/2010 (8:14 pm)
PS. I actually have another audio related question.

My audio had worked fine for sometime, however now, it does not run at all on the device when it did before. I am unsure of how to trouble shoot this. Any tips would be appreciated.

Just some background:
-It occasionally plays in the editor and occasionally does not.
-I had originally worked in 1.3 but moved over to 1.4. Should it matter?
- I am using the audio description and audio profile behaviors from TDN.
- my audio files are the correct format and in location.


I have posted all my scripts below just in case.
Thanks if you are able to help.



audio.cs file
$DefaultAudioType = 0;
$GuiAudioType = 1;
$SimAudioType = 2;
$MusicAudioType = 3;

new AudioDescription(AudioNonLooping)
{
   volume = 1.0;
   isLooping = false;
};


new AudioDescription(AudioLooping)
{
	$volume = 1.0;
   $volume1Looping = 1.0;
   isLooping = true;
   isStreaming = true;
   is3D = false; 
   type = $GuiAudioType;  
};


new AudioProfile(mainFeature)
{
   filename = "~/data/audio/mainFeature.wav";
   description = "AudioLooping";
   preload = true;
};

audio profile, taken from TDN
if (!isObject(AudioDescriptionBehavior))
{
    %template = new BehaviorTemplate( AudioDescriptionBehavior );
   
    %template.friendlyName = "Audio Description";
    %template.behaviorType = "Audio";
    %template.description  = "Creates a new AudioDescription when this object is loaded.";
  
    %template.addBehaviorField( name, "Name for this Audio Description", string , "AudioLooping"   );
    %template.addBehaviorField( volume,      "Volume", float ,  1.0  );  
    %template.addBehaviorField( isLooping,   "Looping", bool ,   1  );
    %template.addBehaviorField( is3D,        "3D", bool ,   0  );
    %template.addBehaviorField( isStreaming, "Streaming", bool ,   0  );
    %template.addBehaviorField( preload,     "Preload", bool ,   0  );
    %template.addBehaviorField( type,        "Channel ( 1 - 8 )", int ,   1  );
   
} 
 

function AudioDescriptionBehavior::onBehaviorAdd(%this){ 
      
  if (!isobject( %this.name ) )
    new AudioDescription(  %this.name  ) { 
   };
   
   
  %this.name.volume       =  %this.volume ;
  %this.name.isLooping    =  %this.isLooping;
  %this.name.is3D         =  %this.is3D;
  %this.name.isStreaming  =  %this.isStreaming ; 
  %this.name.preload      =  %this.preload ;
  %this.name.type         =  %this.type;   
  
  
}
 
function AudioDescriptionBehavior::onRemoveFromScene(%this){ 
    
}
audio profile again taken directly from TDN
if (!isObject(AudioMainFeatureBehavior))
{
   %template = new BehaviorTemplate( AudioMainFeatureBehavior );
   
   %template.friendlyName = "Audio mainFeature";
   %template.behaviorType = "Audio";
   %template.description  = "Creates a new AudioProfile when this object is loaded.";
  
   %template.addBehaviorField( name, "Name for this audio profile", string , "mainFeature22050"   );
   %template.addBehaviorField( filename, "File name for the audio file in your data/audio directory.", string , "mainFeature22050.wav"   );
   %template.addBehaviorField( volume, "The default volume", float ,  1.0  );
   %template.addBehaviorField( description, "The Audio Description to use", string , "AudioLooping"  );
   
} 
 

function AudioMainFeatureBehavior::onBehaviorAdd(%this){  
  if (!isObject( %this.name ) ){ 
    new AudioProfile(  %this.name  ){
      volume   =  %this.volume ;
      filename = "~/data/audio/" @ %this.filename  ;  
      description =  %this.description;       
    }; 
  }  
  %this.playSound();
}
 

function AudioMainFeatureBehavior::playSound(%this)
{
	echo("inPlaySound!!!!!!!!!!");
	alxPlay(%this.name);
}

function AudioMainFeatureBehavior::onRemoveFromScene(%this)
{ 
    alxStop(%this.name);

}

#3
09/24/2010 (9:27 pm)
Thank you Scott.


I remember seeing volume set to 0.8 somewhere but forgot where.


Thanks.



#4
09/25/2010 (10:30 pm)
I hate to bump this but I am at a loss as to how to troubleshoot/fix this.


This set up WAS working, I am not sure what could have changed. One object with an audioProfile behavior and audioDescription behavior attached.


-my files exist as wav's in the game/data/audio folder. The behavior calls for the file from that position "~/data/audio".
-echos show that the command alxPlay is being called.
-echos show the filename is being called
- I have tried setting all preload, streaming and 3d as true. but none have worked.



If you have any ideas at all as to how I might go about remedying this please mention.

Cheers.
#5
09/26/2010 (10:29 pm)
I found
<UsesAudio></UsesAudio>
in the commonConfig, I set it to
<UsesAudio>1</UsesAudio>

but still no audio.

Any clues, greatly appreciated.

Cheers.