Thread: Sound/multi thread....

  1. #1
    Registered User
    Join Date
    Jan 2003
    Posts
    38

    Sound/multi thread....

    What header is used for sound and how do you make a multi threaded program?

  2. #2
    I lurk
    Join Date
    Aug 2002
    Posts
    1,361
    You need an API to do this, as it's highly platform dependant.

    You can use the Win32 API for threading and playing sounds if you're using a windows machine... #include <windows.h>

    Look up the functions "PlaySound()" and "CreateThread()" on msdn.microsoft.com

  3. #3
    Registered User
    Join Date
    Jan 2003
    Posts
    38
    Ok thanks for the info.... Ill hafta go check thos functions out....

  4. #4
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    In C++ you are better off using beginthread (or beginthreadex) instead of CreateThread......these functions are pretty dependant on the compiler to support...but most do...

    See here for a recent discussion

  5. #5
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    >>> instead of CreateThread

    Yeah, avoid CreateThread(), it can, in some cases, cause small memory leaks if you use the standard library functions.

    Also, beginthreadex() may be called beginthreadNT() if you are using some versions of Borland compilers.

    If you are using Linux or any *NIX, the threading model is a little different, search google for "pThreads".
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  6. #6
    Registered User
    Join Date
    Jan 2003
    Posts
    38
    Im running 2000 pro with microsoft vis C++ 6 if that help yea decide which to use ill probably go from one to another till one works tho thanks... .

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Thread Synchronization in Win32
    By passionate_guy in forum C Programming
    Replies: 0
    Last Post: 02-06-2006, 05:34 AM
  2. [code] Win32 Thread Object
    By Codeplug in forum Windows Programming
    Replies: 0
    Last Post: 06-03-2005, 03:55 PM
  3. Win32 Thread Object Model Revisted
    By Codeplug in forum Windows Programming
    Replies: 5
    Last Post: 12-15-2004, 08:50 AM
  4. Simple thread object model (my first post)
    By Codeplug in forum Windows Programming
    Replies: 4
    Last Post: 12-12-2004, 11:34 PM
  5. Problem : Threads WILL NOT DIE!!
    By hanhao in forum C++ Programming
    Replies: 2
    Last Post: 04-16-2004, 01:37 PM