Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Cannot load music/sound file in another thread

Author
Message
Carlos
20
Years of Service
User Offline
Joined: 26th Mar 2004
Location:
Posted: 14th Feb 2010 06:09 Edited at: 14th Feb 2010 06:10
Hi all,
I try to load data such as models and bg music from a seperate thread and keep playing a now loading sprite animation while data is loading.
The code is like this:



It can load models and display it normally but it cannot load mp3 and wav and play it inside the thread.

Anyone know why loading music from another thread would fail?

Thx.
dark coder
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 14th Feb 2010 07:49
Even if it works you shouldn't do it, GDK isn't thread safe so those operations(especially loading objects) can result in a crash.

Carlos
20
Years of Service
User Offline
Joined: 26th Mar 2004
Location:
Posted: 14th Feb 2010 09:00
huh...

When loading large size files such as huge scene or music file, the whole game halts for some time until data is finished reading.

I wonder what is the way to load data but not halting the screen display?
dark coder
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 14th Feb 2010 09:02
By using a well-written library that is designed to be asynchronously loaded, or is capable of streaming audio from disk, such as OpenAL.

Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 14th Feb 2010 21:08
Load the media before the level or program begins. Then invoke it when it's needed. That's why you see other games with "Wait while loading" screens.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office

Login to post a reply

Server time is: 2024-10-02 01:26:17
Your offset time is: 2024-10-02 01:26:17