CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2003
    Posts
    50

    Using DirectSound to play segment of .wav file

    Hi there,

    I need to be be able to take a .wav file and play only part of it eg from 200 to 800 ms through the file. I have code that will do it using DirectShow, but I'd like to do it in directSound. Also, I can play the whole file using DirectSound, based on the examples in the SDK, but I don't know how to just play part of it. Is it possible?

    I'm using Visual C++ .NET 2003 IDE to write native C++ code, if it makes a difference.

    Thank you.

  2. #2
    Join Date
    Oct 2002
    Location
    Italy
    Posts
    324

    Re: Using DirectSound to play segment of .wav file

    You can load the full wav file into a static buffer (usually, a small one) or use streaming and callback functions to load parts of the file as they are needed.
    You can start from here:
    http://www.gamedev.net/reference/art...article710.asp

    To play part of it, load the approriate section of the file into a buffer or simply pass an offset to Play.
    Regards,
    Marco Era
    www.marcoera.com

    Latest post on my blog: Back to the Amiga's times

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured