Sound loop stops playing...

Hi, a simple one (I guess).

After setting an audio sound in loop mode: it starts, then after a while (circa 15 seconds) stops… apparently just as the first screen display of the scene pops up…

PT(AudioManager) AM = AudioManager::create_AudioManager();
PT(AudioSound) mySound = AM->get_sound("song.mp3");
mySound->set_loop(true);
mySound->play();

Any idea why ?

Thks
[/code]

Hi

I think you need a task running that does:
AM->update()

make AM global or pass into data of the GenericAsyncTask.

PT(AsyncTaskManager) taskMgr = AsyncTaskManager::get_global_ptr();

PT(GenericAsyncTask) task;
task = new GenericAsyncTask(“AudioUpdate”, &audio_task, (void*) AM);

taskMgr->add(task);

.
.
.
AsyncTask::DoneStatus audio_task(GenericAsyncTask* task, void* data){

AudioManager AM = (AudioManager)data;
AM->update();

return AsyncTask::DS_cont;
}

Thanks Tah,
Followed your advice, worked 1st time !

PS. I’m however experiencing some sound stuttering while moving camera over the scene…

Is the stutter within the begin and end of the sound or at the vary end before it starts playing again ? I hear that sometimes mp3 files have some dead space at the end.

If not that…
Have you changed the priority of any tasks that change the camera position ? (that is if you are using your own mouse and or keyboard control of the camera and not the Panda control)

Are you loading a geo mip terrain and setting bruteforce false, maybe it’s the terrain update task
slowing things down ?

I noticed some Config.prc settings that are for audio that might cause or fix stutter.
http://www.panda3d.org/manual/index.php/List_of_All_Config_Variables

see:
audio-buffering-seconds
audio-preload-threshold

I had a problem before with sound stuttering or popping, but that was due to my using 1.7.1 and not uninstallng 1.7.0 version. Went back to 1.7.0 and it fixed that problem.

I’m no Panda expert, only been working with it since last August so all I can do is just guess
:wink:

Hi Tah,

Tried your suggestion with

load_prc_file_data("", "audio-buffering-seconds 5");
load_prc_file_data("", "audio-preload-threshold 2000000");

Sounds much better, but still stuttering a little bit while moving into the scene, this comes certainly from cpu load or disk access don’t figured it out yet.

EDIT The stuttering is getting worse when pressing on the mouse’s left button while in the main window…