sndPlaySound() and LockResource()

This is a discussion on sndPlaySound() and LockResource() within the Windows Programming forums, part of the Platform Specific Boards category; I'm using a function called PlayResource() (found in MSDN) that takes the name of a wave resource and plays it. ...

  1. #1
    Magically delicious LuckY's Avatar
    Join Date
    Oct 2001
    Posts
    856

    sndPlaySound() and LockResource()

    I'm using a function called PlayResource() (found in MSDN) that takes the name of a wave resource and plays it. The function does this:
    FindResource();
    LoadResource();
    LockResource();
    sndPlaySound();
    FreeResource();

    The sound could be potentially played very frequently and I think it would be better to just load/lock the resource once at program start then play when necessary and free on shutdown. I don't know if that's something that I should do though as I'm unfamiliar with all the ramifications of all the functions involved.

    What do you think?

  2. #2
    Registered User
    Join Date
    Feb 2003
    Posts
    76
    It is better, in this case, to save the resource to a temporary file (use SizeofResource to get the resource's size) and load it from there.

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21