When to call AudioEngine.Update()
by Raymond Ku · in Torque X 2D · 07/06/2010 (10:57 am) · 2 replies
hey everyone, I've been having some sound distortion problems that happen randomly as I play through my level. I've fixed this by calling the update() method for the audio engines every tick in my player component.
However as to why this fixed this I have no idea. And I'm not sure when I should be updating my audio engine. Should I update when I play a new sound? or should I make a component to just update my engines every tick( As sound still plays when the player is paused, I don't want the random distortions to come back if the updates are tied to my player component).
Does anyone else have experience with this?
Thanks
Ray
However as to why this fixed this I have no idea. And I'm not sure when I should be updating my audio engine. Should I update when I play a new sound? or should I make a component to just update my engines every tick( As sound still plays when the player is paused, I don't want the random distortions to come back if the updates are tied to my player component).
Does anyone else have experience with this?
Thanks
Ray
About the author
http://cip-game.blogspot.com
Torque Owner Scott Cameron
if your using regular XNA to do your sounds then yes you should be calling AudioEngine.Update() whenever Update gets called.
if you add the following to your game.cs file
protected override void Update(GameTime gameTime) { base.Update(gameTime); AudioEngine.Update(); }that will call it every time Update gets called.. which is called by the XNA framework upto 60 times a second maybe more maybe less. but thats where you would put it.