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

    PlaySound() problem

    Hey,

    I'm currently writing a sound program that will work with several wav files and at the same time play the mix of them all (say a studio mix).

    This file I want to play is a wav file and I can play it using PlaySound() in windows.h. And this works for the first about 1 minute 23 for a mono file and 37 seconds for a stereo file (with double the memory for each sample) at which point the audio playing just stops.

    I believe the problem is, some research has told me, that because of the way PlaySound() uses buffers, it can only play so much of a file (dictated by size).

    Could anyone tell me a function or some way to basically just play this song the whole way through? It's quite a large file - around 40-50mb.

    Thanks,
    Conor.

  2. #2
    Join Date
    Dec 2006
    Posts
    17

    Re: PlaySound() problem

    Check out the sample codes of DirectSound about Stream Data.

  3. #3
    Join Date
    May 2005
    Location
    Oregon
    Posts
    3,725

    Re: PlaySound() problem

    have a look in MSDN for MCIWnd Functions. Everything is there.
    Thanx

  4. #4
    Join Date
    Jan 2007
    Posts
    28

    Re: PlaySound() problem

    using the mciSendString will work
    mciSendString("open filename.wav type waveaudio as alias mywav");
    mciSendString("play mywav wait");

  5. #5
    Join Date
    May 2006
    Location
    Argentina
    Posts
    37

    Re: PlaySound() problem

    hi Conor!.

    You can try to use the FMOD Sound System librarys. There are free for use as you use you program for non comercial issues. It is audio engine that we can use using a interface defines in the includes files .h. You can program using classes (like c++) or folowing the procedural paradigm (like c).
    It's no very dificul to play just a sound, and you can do all the cool stuff you want...try it..
    the web site of FMOD is:

    http://www.fmod.org/

    I hope that's help!...and you can't forget of the nice (but simple) playSound function...

  6. #6
    Join Date
    Aug 2005
    Posts
    478

    Re: PlaySound() problem

    Just thought I'd make a useless comment, and mention that FMOD::Sound::getOpenState only completely works on streaming sounds. This wasn't clear from the documentation and I recently ran into that problem.
    Windows XP, Visual Studio 2008, SVN

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