I am writing an application that should use large sound multi-samples, usually about 50 mb in size. One file contains about 80 separate short sound recordings that can be played in my application at any time. For this reason, all audio data is loaded into memory for quick access.
However, when loading one of these files, it may take many seconds to enter into memory, which means that my program will be temporarily frozen. What is a good way to avoid this? It must be compatible with Windows and OS X. It freezes at the same time: myMultiSampleClass->open();which should do a lot of dynamic memory allocation and reading from a file using ifstream.
I thought of two possible options:
Open the file and load it into memory in another thread so that my application process does not hang. I looked through the Boost library to do this, but I need to do quite a bit of reading before I am ready for implementation. All I have to do is call the open () function on the stream, then destroy the stream later.
, , , , . , . , , , . , , - HDD/Memory . , x , , , , .
? : -)