Results 1 to 7 of 7

Thread: [OpenAL] alDeleteSources is way too slow!

  1. #1

    [OpenAL] alDeleteSources is way too slow!

    Hey everyone

    I got this little problem. When running my application, i see hickups when sounds stop playing.

    When sound-sources have stopped playing, i delete them, when the "UpdateSound" routine is executed. I narrowed the whole problem down to the alDeleteSources routine.

    I got this code:

    [pascal]
    procedure TN2D_SoundSource.Delete;
    begin
    if alIsSource(fSource) then
    begin
    BeepEx(1000,5);
    alDeleteSources(1,@fSource);
    BeepEx(800,5);
    end;

    inherited;
    end;
    [/pascal]

    When a sound stopped playing, this delete routine is called, and the soundsource will be destroyed. As you can see, i added 2 beeps in this routine. This way, i could easily check how long it takes to execute alDeleteSources.

    Sometimes it just takes some miliseconds, and the two beeps are both played in a short period of time. But sometimes, it takes up to a second, before the game continues to execute.

    Is this normal, or is there a sollution available?? Should i save up those stopped sounds, and delete 10 of them with a single call? Should i reuse the soundsources by changing their soundbuffers?

    I know some of you guys have experience with OpenAL. Can someone give me a good hint on this?

    Thanx a bunch
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  2. #2

    [OpenAL] alDeleteSources is way too slow!

    This doesn't seem right, it should delete right away..

    Here's a useful hint: re-use sources instead of deleting them (just let them stay when not needed and when they are, queve another wave buffer.. ).
    This is my game project - Top Down City:
    http://www.pascalgamedevelopment.com...y-Topic-Reboot

    My OpenAL audio wrapper with Intelligent Source Manager to use unlimited:
    http://www.pascalgamedevelopment.com...source+manager

  3. #3

    [OpenAL] alDeleteSources is way too slow!

    Thanx! ... i'm going to try that. i will post again with any results
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  4. #4

    [OpenAL] alDeleteSources is way too slow!

    I turns out that calling alSourcei(fSource,AL_BUFFER,??); is also very slow.

    I measured the time, and sometimes it took up to 3 seconds to execute this. This is realy weird since i have a realy up to date system (AMD Dual core, 2GB ram and Geforce 8600GT). :?

    Any more tips?
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  5. #5

    [OpenAL] alDeleteSources is way too slow!

    change openal output device.. try installing creative's sdk..

    P.S. you don't happen to be on vista, are you?
    This is my game project - Top Down City:
    http://www.pascalgamedevelopment.com...y-Topic-Reboot

    My OpenAL audio wrapper with Intelligent Source Manager to use unlimited:
    http://www.pascalgamedevelopment.com...source+manager

  6. #6

    [OpenAL] alDeleteSources is way too slow!

    P.S. you don't happen to be on vista, are you?
    eeh... actualy i am Are there issues with vista then?

    I rewrote my sound module. Now, i give each soundbuffer a predefined ammount of sources, so i dont have to change the buffer for any source. The problem seems to be solved, but ATM i have many unused sources. Is that a problem?

    You have experience with OpenAL. Can you explain me how your Sound-module deals with buffers/sources?

    Thanx
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  7. #7

    [OpenAL] alDeleteSources is way too slow!

    Quote Originally Posted by chronozphere
    P.S. you don't happen to be on vista, are you?
    eeh... actualy i am Are there issues with vista then?

    I rewrote my sound module. Now, i give each soundbuffer a predefined ammount of sources, so i dont have to change the buffer for any source. The problem seems to be solved, but ATM i have many unused sources. Is that a problem?

    You have experience with OpenAL. Can you explain me how your Sound-module deals with buffers/sources?

    Thanx
    There is a part on that in my sig

    My OpenAL audio wrapper with Intelligent Source Manager:
    http://www.pascalgamedevelopment.com...?p=25428#25428

    That's the exact thing i use in my game, plus some additional stuff, you can see it has some advanced stuff such as some soucre management, and sound distance culling, etc...

    My openal lib just initializes all sources when it loads, and then uses the sources handles whenever it needs them.. it queves a wave buffer, and after it plays back it stops.

    The wrapper for openal is more than just a wrapper and sources manager, it actually supports pausing the entire system at any state, which makes it possible in the future to actually halt the program, save the audio library state to disk, and reload it back later, i haven't implemented the actual routines for saving and loading yet, but it has everything ready for that and pausing already works.
    This is my game project - Top Down City:
    http://www.pascalgamedevelopment.com...y-Topic-Reboot

    My OpenAL audio wrapper with Intelligent Source Manager to use unlimited:
    http://www.pascalgamedevelopment.com...source+manager

Bookmarks

Posting Permissions

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