Two distinct problems/questions, but since they're in the same application, I decided to put them to the same topic for the sake of simplicity.
My sound problem: in my application(a free 2D game), I use QSound to play short (2-5 seconds) sounds. Since I need real-time instant playing (e.g. weapon shot) without any delay, I instantiate QSound in advance, stored in member variables. Later, when it's needed, I just call play() so it plays it immediately. This is how sound playback works in my application. Problem: it happens sometimes (actually quite often) that when I've regularly exited the application on my Nokia E52, menu navigation sounds are muted. So when I navigate or press the soft keys anywhere, everything is silent (note that the device is not put to Silent mode or anything similar). Other system sounds, however, seem to play fine (e.g. when a sis installation is finished, or when an error is noticed for invalid sisx signature). Only device reboot solves this problem. Note that I don't call QSound::stop() anywhere.
My QMovie question:
There is a specified list of gif animations, e.g. a1.gif, a2.gif, a3.gif, ... an.gif. I use QMovie to play them, and I have multiple objects that need these animations independently. For example, at a particular moment, object1 needs a2.gif, object2 needs a6.gif and object3 needs a1.gif to be played. Generally, each object might need any of a1.gif, a2.gif, ... to be played, at any time, and possibly with different timing. Consequently, I can't instantiate a single QMovie for each gif animation, because QMovie is stateful (e.g. the current frame is stored) and its current playback state might be different for each client object. For instance, both obj1 and obj2 might be playing a2.gif, but in a different phase, so I can't make just one QMovie for a2.gif that will be shared by all objects. On the other hand, e.g. if I instantiate 25 QMovie objects for a1.gif (because 25 objects need it), it looks like a waste of resources. How big overhead does this mean? I know QMovie internally opens and reads an IO device i.e. QFile. What happens if 25 QMovie objects read from the same file e.g. a1.gif? If I disable frame caching, is it efficient enough, or should I make an own class to use instead of QMovie? In other words, is QMovie playback memory intensive, and even if not, is QMovie a lightweight class with little overhead?