hmm… You seem to declare the same variables twice, within the same scope…?
I would have thought that code would give you some warning or error, and I dont know why that should give you those problems… But maybe try and change the variable names the for the second part to volume_2 pitch_2 pan_2 and see if that helps…
So, I’m thinking you might have double or more instances playing simultaneously?
I have had stuff like that going on… So for certain sounds/situations, I will use a simple frame-counter to make sure the sound is only played at certain minimum intervals…
something like :
int counter = 0;
Update()
{
counter++;
if (counter >10)
{
counter = 0;
playSound();
}
}
-the same sound played twice right after each other will sound like one louder sound.
@Xentios you could test this by still using the if statement but have it evaluate to true every frame, should sound the same as if it was outside the if.