XNA Creators Club Online
Page 1 of 1 (5 items)
Sort Posts: Previous Next

Fail to play infinite sound when loading the AudioEngine by ThreadPool

Last post 06-16-2008 9:05 AM by shikn. 4 replies.
  • 06-10-2008 1:52 AM

    Fail to play infinite sound when loading the AudioEngine by ThreadPool

    Vista, VS2008, C#.

    When I load audio files by following code with a Thread pool,  I found the sound with infinite setting cannot play,  but the sounds without infinite setting are played well.

    public static void Initialize()
    {
       
    ThreadPool.QueueUserWorkItem(new WaitCallback(LoadAudioFiles));
    }

    private
    static void LoadAudioFiles(Object stateInfo)
    {
        audioEngine =
    new AudioEngine(audioEngineFileName);
        waveBank = new WaveBank
    (audioEngine, waveBankFileName);
        soundBank =
    new SoundBank
    (audioEngine, soundBankFileName);
    }

    Any one have any suggestions?  Thanks.

  • 06-10-2008 2:48 AM In reply to

    Re: Fail to play infinite sound when loading the AudioEngine by ThreadPool

    shikn:

    Any one have any suggestions? 

    Don't use a separate thread. What do you think you're gaining by doing it that way?



    Jim Perry - Microsoft XNA MVP
    Here's what I'm up to.
    If people spent a minute searching the forums before posting I'd be out of a job.
  • 06-10-2008 3:09 AM In reply to

    Re: Fail to play infinite sound when loading the AudioEngine by ThreadPool

    When loading those audio files,  it looks take 3~4 seconds,  I'm going to play the sounds in UI thread, but if I load the audio files in UI thread. It will freeze UI in loading time. I mean I play it when the thread loading finished. Why the infinite sound cannot be played well?  Is it a known issue?   Thanks.
  • 06-10-2008 11:52 AM In reply to

    Re: Fail to play infinite sound when loading the AudioEngine by ThreadPool

    So you load the sounds before starting your UI. If you think this is a bug, report it on the Connect site.


    Jim Perry - Microsoft XNA MVP
    Here's what I'm up to.
    If people spent a minute searching the forums before posting I'd be out of a job.
  • 06-16-2008 9:05 AM In reply to

    Re: Fail to play infinite sound when loading the AudioEngine by ThreadPool

    Thanks, Jim.
    Finally I think I figure out the where the problem is.  I found that if I set the playlist type of cue to interactive. I will fail to play it after loading the library by another thread. It is not related with the infinite/finite setting.  I think I don't need the interactive feature, so I just change it to others(Eg. Ordered).  It works now.
Page 1 of 1 (5 items) Previous Next