Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User abickerton's Avatar
    Join Date
    Mar 2003
    Posts
    19
    Hi,

    I'm having a problem with the Series 40 phones, 7210 & 5100 so far.

    The following code prdouces a global root overflow, I have tried this code outside of a thread to further narrow it down.
    public void playSound(int freq, int dur, int volume){
    new Thread(){
    public void run(){
    Sound snd = new Sound(freq, dur);
    if(volume != 0)
    snd.setGain(volume);
    snd.play(1);

    }
    }.start();
    }

    Can anyone suggest a work around or a better way of doing it.

    It's in a thread to avoid the game pausing while the sound is being played

  2. #2
    Regular Contributor pbergius's Avatar
    Join Date
    Mar 2003
    Location
    Irving, Texas, USA
    Posts
    419
    Hello,

    It is hard to determine exact cause for root overflow from the code snippet you provided. My educated guess is that you create too fast too many objects (Threads). Probably garbage collector can't remove unreferenced objects before object reference space is exhausted.

    My only suggestion would be that you create a separate thread for game engine and let the sounds to be played as they are needed without creating a thread.

    Regards,

    Petteri / Forum Nokia

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved