×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Jun 2010
    Posts
    4

    QMovie and QSound question

    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?

  2. #2
    Super Contributor
    Join Date
    Oct 2008
    Location
    INDIA
    Posts
    2,326

    Re: QMovie and QSound question

    For QSound:

    The QSound does not support the resources..Check this below two sites.

    http://discussion.forum.nokia.com/fo...-How-to-QSound

    http://wiki.forum.nokia.com/index.php/How_To_use_QSound

    For QMovie:

    At a time only one object can use the .gif file which is available in the memory.

    http://wiki.forum.nokia.com/index.php/How_to_use_QMovie

    Best regards,

  3. #3
    Registered User
    Join Date
    Jun 2010
    Posts
    4

    Re: QMovie and QSound question

    Thank you for your time.

    Unfortunately, I don't understand how the fact you mention about QSound is relevant to my problem. I've never used resources for it, I use wav files installed in the application folder. And it works fine, the sounds are played perfectly in my application. As I've written, my problem is that after I exit my application, device (i.e. mobile phone) sounds on my E52 does not seem to play, at least when navigating in the menus (such as Control Panel, or anywhere else).

    Regarding QMovie, based on what you've written, it seems that there is no way to share it (without making an own class to replace QMovie). Consequently, my current solution probably loads the same gif file multiple times when I instantiate QMovie more times with the same gif for different client objects (in other words, the QFile uses shared read access in it). (My current solution works fine, so the gif is obviously shared, just on file level, not on memory level then.) In order to save memory, I suppose it's a good idea to make a custom class, which acts as QMovie in most respects, but allows sharing the resource, if possible. The gif in the memory is stateless after all, just the playback activity (e.g. the current frame i.e. the position of the movie) is stateful.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×