jadav.rakesh Posted March 1, 2012 Share Posted March 1, 2012 Hi guys,Looks like I am the worst user of "UNiGiNE" game engine.I stuck on one another problem.I want to restart (Replay) the sound. E.g. Sound file is 20.0 Seconds long and I call Replay function after 3 Seconds which should restart sound from the first frame again.This is my script function: void RePlay(SoundSource sound){sound.stop();sound.setTime(0.0f);sound.play();} But this function is not giving me expected result.I am damn sure that this function was working ( at-least was giving me expected result ) before last update.This is the node file parameters : sound/Samples/Units/Engineer/engineer_shot_001.oga 0 0.0 5 50 180 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 Regards,rakeshj. Link to comment
unclebob Posted March 6, 2012 Share Posted March 6, 2012 Hi, The problem is that sound parameters will be applied on the next sound frame (sound frame rate is about 30 fps) and if you'll stop and start SoundSource playback in one sound frame, it'll take no effect to source time. The fastest way to solve your problem is just to wait about 1 / 30 second and then start playing your SoundSource instance. Here is updated code: void replay(SoundSource sound) { sound.stop(); sound.setTime(0.0f); sleep(1.0f / 30.0f); sound.play(); } Also you should call this method in a thread like this: thread("replay",your_sound_source_instance); Link to comment
craig.jones Posted August 21, 2013 Share Posted August 21, 2013 Hi All, Just wondering if anyone knows if this issue has been fixed in a later version? Thanks, Craig Link to comment
frustum Posted August 21, 2013 Share Posted August 21, 2013 call engine.sound.renderWorld(1) function instead of sleep to force sound system update. Link to comment
Recommended Posts