private void PlaySound(string fileName, bool playOnNewChannel, double leftVol = 1.0, double? rightVol = null)
{
if (this.fmodSystem == null)
return;
var sound = LoadSound(fileName);
sound.LoopCount = 0;
if (!playOnNewChannel)
{
try
{
this.currentFxChannel?.Stop();
}
catch (FmodInvalidHandleException)
{
// Ignore
}
}
var channel = this.fmodSystem.PlaySound(sound, this.fxGroup, true);
if (!rightVol.HasValue)
rightVol = leftVol;
channel.FmodChannel.setMixLevelsOutput((float)leftVol, (float)rightVol.Value, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
// Play
channel.Pause = false;
if (!playOnNewChannel)
this.currentFxChannel = channel;
}