≡
Products
▼
Support
▼
Company
▼
Forum
Ambiera Forum
Discussions, Help and Support.
Create a new account
,
Search
, or Login:
Create reply in
[Util] load sounds from Irrlicht filesystem
Posted by:
(you are not logged in)
Enter the missing letter in: "Internation?l"
(you are not logged in)
Text:
[quote][b]stefbuet[/b] wrote: Hi,
So, as irrKlang is multithreading, while we ask the irrlicht filesystem to load a file, for exemple a 3D Mesh from an archive witch contain also a sound file now playing in streaming, the irrklang engine could try to read a little bit of the sound file, and then it would occur a memory / file access conflit...
As i'm not experimented in C++ threading, I would try create a bool value, and turn it to true before loading a file from irrlicht, set it to false after the loading, something like that :
[code]
bool isLoading=true;
IReadFile *test=filesys->createAndOpenFile("testFile.3ds");
isLoading=false;
[/code]
And then give a ref of this boolean to irrklang. Then in the IrrlichtSoundFileReader at the read() method, test this boolean value and don't load anything while the other loading isn't finished :
[code]
ik_s32 IrrlichtSoundFileReader::read(void* buffer, const ik_u32 sizeToRead) {
while(isLoading) { // wait... }
return(file->read(buffer, sizeToRead));
}
[/code]
As the irrklang is multithreading, this while block wouldn't block the main program...
However this method is really weight as you have to change isLoading value each time you're doing a file loading in Irrlicht.
Personally, as I'll use only not streamed sounds, I will stay with the first part of my code. But I would be intrusted in seeing if this idea could works...
Thank,
Stef.[/quote]
Possible Codes
Feature
Code
Link
[url] www.example.com [/url]
Bold
[b]bold text[/b]
Image
[img]http://www.example.com/image.jpg[/img]
Quote
[quote]quoted text[/quote]
Code
[code]source code[/code]
Emoticons
Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact