Changes

Jump to navigation Jump to search
6 bytes added ,  17:58, 22 October 2021
Changed cue definition variable names
Line 242: Line 242:  
To add your own sounds to the soundbank, you can define a new <tt>CueDefinition</tt> and add a name:
 
To add your own sounds to the soundbank, you can define a new <tt>CueDefinition</tt> and add a name:
 
<syntaxhighlight lang="c#">
 
<syntaxhighlight lang="c#">
CueDefinition cue_definition = new CueDefinition();
+
CueDefinition myCueDefinition = new CueDefinition();
    
// Adding the name for the cue, which will be
 
// Adding the name for the cue, which will be
 
// the name of the sound when using sound functions.
 
// the name of the sound when using sound functions.
cue_definition.name = "myNewSound";
+
myCueDefinition.name = "myNewSound";
 
</syntaxhighlight>
 
</syntaxhighlight>
   Line 253: Line 253:  
// If this sound is played multiple times in quick succession,
 
// If this sound is played multiple times in quick succession,
 
// only one sound instance will play at a time.
 
// only one sound instance will play at a time.
cue_definition.instanceLimit = 1;
+
myCueDefinition.instanceLimit = 1;
cue_definition.limitBehavior = CueDefinition.LimitBehavior.ReplaceOldest;
+
myCueDefinition.limitBehavior = CueDefinition.LimitBehavior.ReplaceOldest;
 
</syntaxhighlight>
 
</syntaxhighlight>
   Line 272: Line 272:  
<syntaxhighlight lang="c#">
 
<syntaxhighlight lang="c#">
 
// Setting the sound effect to the new cue.
 
// Setting the sound effect to the new cue.
cue_definition.SetSound(sound_effect, Game1.audioEngine.GetCategoryIndex("Default"), false);
+
myCueDefinition.SetSound(sound_effect, Game1.audioEngine.GetCategoryIndex("Default"), false);
    
// Adding the cue to the sound bank.
 
// Adding the cue to the sound bank.
Game1.soundBank.AddCue(cue_definition);
+
Game1.soundBank.AddCue(myCueDefinition);
 
</syntaxhighlight>
 
</syntaxhighlight>
   Line 289: Line 289:  
<syntaxhighlight lang="c#">
 
<syntaxhighlight lang="c#">
 
// Get the cue to manipulate.
 
// Get the cue to manipulate.
var cue_definition = Game1.soundBank.GetCueDefinition("debuffHit");
+
var existingCueDef = Game1.soundBank.GetCueDefinition("debuffHit");
    
// Get the audio file and add it to a new SoundEffect, to replace the old one.
 
// Get the audio file and add it to a new SoundEffect, to replace the old one.
Line 299: Line 299:     
// Assign the new sound effect to this cue.
 
// Assign the new sound effect to this cue.
cue_definition.SetSound(sound_effect, audioEngine.GetCategoryIndex("Default"), false);
+
existingCueDef.SetSound(sound_effect, audioEngine.GetCategoryIndex("Default"), false);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
41

edits

Navigation menu