Thread: Opening WAVE files

  1. #1
    Registered User
    Join Date
    Feb 2005
    Posts
    3

    Opening WAVE files

    Hello Fellow Programmers!
    I am working on a project which requires me to play WAVE files in C++. I have thoroughly studied wave file format as well as know about the function sound() and nosound() which use system speakers. But what I want is to be able to have direct access to the system speaker or normal speakers of my computer using C++ to play a mono or stereo WAVE sound.
    Please help.

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    This is OS/compiler specific. If you're on Windows, may I suggest msdn or something similar.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  3. #3
    Registered User
    Join Date
    Feb 2005
    Posts
    3

    Re: Opening ...

    I am using Turbo C++ compiler, so MSDN will not help. Please suggest some tutorial or resourse.

  4. #4
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    I am using Turbo C++ compiler
    Which version? For the Win32 versions, MSDN will help.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  5. #5
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    New York
    Posts
    1,905
    Not sure if this is what you want, but....FMOD!

  6. #6
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > I am using Turbo C++ compiler,
    Well you could get a better compiler, one more in touch with reality/your operating system.

    If your OS is at least windows 95, then you're wasting your time with that compiler.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  7. #7
    Registered User
    Join Date
    Feb 2005
    Posts
    3
    Sorry for the confusion I am using Turbo C++ 3.0 by Borland it works in DOS. And I am using it because I don't have a choice. So if you can please suggest some method to access( using REGS or some I/o method) system speakey or the speakers of my computer, then please help me!

  8. #8
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Why don't you have a choice?

    Hmm ... Ralf Brown's interrupt list comes to mind.
    http://www.ctyme.com/rbrown.htm
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  9. #9
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398

    Question What do you mean "direct access?"

    If your compiler doesn't have PlaySound() or the other WinAPI (or DirectX) functions, you probably need an up to date compiler! In any case, your hardware, drivers, operating system, and compiler must be compatable.

    Normally, the Windows programmer accesses the sound card via the Windows API:
    User Program -> WinAPI -> Manufacturer's Driver -> Hardware.

    Your soundcard may be "Soundblaster compatable." If so, I think you can use a generic DOS driver.

    The hardware (and firmware) for each sound card is different, and the manufacturers don't seem to publish any information on how they work internally. The sound card manufacturer supplies a driver which communicates between the proprietary hardware and the published Windows (or other OS) interface.

    The PC's internal system speaker is connected to a couple of multivibrators which allow you to set frequency & duration of a tone. (There is no D/A converter). You cannot send a wave file to it, and you can't control the volume.
    Last edited by DougDbug; 02-07-2005 at 04:15 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Opening ASCII files in C?
    By Mavix in forum C Programming
    Replies: 6
    Last Post: 04-25-2007, 02:23 PM
  2. Need help opening a series of files
    By ramparts in forum C Programming
    Replies: 9
    Last Post: 11-14-2006, 05:49 PM
  3. Opening files with UNICODE file names
    By decohk in forum Linux Programming
    Replies: 2
    Last Post: 11-09-2006, 05:25 AM
  4. opening files
    By angelic79 in forum C Programming
    Replies: 3
    Last Post: 10-19-2004, 06:52 AM
  5. Opening files - Giving options?
    By wwwGazUKcom in forum C++ Programming
    Replies: 3
    Last Post: 09-18-2001, 07:06 AM