SetInstanceVolume Bug?

Post » Wed Jun 20, 2012 8:57 pm

I have the following effect which places a heartbeat sound ... supposedly from the source of an actor

Import DebugSound Property UIHealthHeartbeatALP Autoint instanceActor targetActor PlayerEvent OnEffectStart(Actor akTarget, Actor akCaster)   target = akTarget   Player = akCaster   instance = UIHealthHeartbeatALP.Play(target)   Sound.SetInstanceVolume(instance,GetDistanceVolume())   RegisterForSingleUpdate(0.5)EndEventFloat Function GetDistanceVolume()  float distance = Player.GetDistance(target)   distance = 1000 / distance / 100   Trace("Distance Volume = " + distance)   return distanceEndfunctionEvent OnUpdate()   Sound.SetInstanceVolume(instance,GetDistanceVolume())   RegisterForSingleUpdate(0.5)EndEventEvent OnEffectFinish(Actor akTarget, Actor akCaster)   Sound.StopInstance(instance)EndEvent

As you can see I start the sound playing from an actor reference, it plays just fine, what I can't do is control the instance volume of the sound. It plays at full volume no matter what value (between 0.0 and 1.0) that it gets set to. Again, as you see the script updates itself every 1/2 second and I see the following logged into the trace logs:

 [04/12/2012 - 04:23:05PM] Distance Volume = 0.004792[04/12/2012 - 04:23:06PM] Distance Volume = 0.005035[04/12/2012 - 04:23:07PM] Distance Volume = 0.005324[04/12/2012 - 04:23:07PM] Distance Volume = 0.005610[04/12/2012 - 04:23:08PM] Distance Volume = 0.005948[04/12/2012 - 04:23:08PM] Distance Volume = 0.006327[04/12/2012 - 04:23:09PM] Distance Volume = 0.006744[04/12/2012 - 04:23:09PM] Distance Volume = 0.007216[04/12/2012 - 04:23:10PM] Distance Volume = 0.007791[04/12/2012 - 04:23:10PM] Distance Volume = 0.008503[04/12/2012 - 04:23:11PM] Distance Volume = 0.009345[04/12/2012 - 04:23:12PM] Distance Volume = 0.010311[04/12/2012 - 04:23:12PM] Distance Volume = 0.011520[04/12/2012 - 04:23:13PM] Distance Volume = 0.013115[04/12/2012 - 04:23:13PM] Distance Volume = 0.015021[04/12/2012 - 04:23:14PM] Distance Volume = 0.017530[04/12/2012 - 04:23:14PM] Distance Volume = 0.021081[04/12/2012 - 04:23:15PM] Distance Volume = 0.027117[04/12/2012 - 04:23:16PM] Distance Volume = 0.037668[04/12/2012 - 04:23:17PM] Distance Volume = 0.076560[04/12/2012 - 04:23:17PM] Distance Volume = 0.091222[04/12/2012 - 04:23:18PM] Distance Volume = 0.122450[04/12/2012 - 04:23:18PM] Distance Volume = 0.127966

These numbers are purposefully low because I was trying to see if modifying the instance volume worked at all and the previous numbers (muliply what you see here by 10) didn't seem to do anything useful.

So is there a bug in SetInstanceVolume? Can it only be called once? It doesn't seem to change the volume regardless of what I do, but obviously it's playing the sound, and additional tracing (not shown above) shows that an instance ID is being returned.

Any suggestions or help would be much appreciated.
User avatar
Anne marie
 
Posts: 3454
Joined: Tue Jul 11, 2006 1:05 pm

Return to V - Skyrim