Thread: Sound compile error with Dev C++

  1. #1
    Linux Forever
    Join Date
    Oct 2002
    Posts
    373

    Sound compile error with Dev C++

    I was wanting to knw if there was a playsound() like function that works with Dev C++ and gnu compiler. I have Borland, but its not hooked up yet. Playsound gives me 31 errors right off of gametutorials. so don't give me the gametutorials junk.
    This war, like the next war, is a war to end war.

  2. #2
    Linux Forever
    Join Date
    Oct 2002
    Posts
    373
    let me show you:
    Code:
    playsound code here, which i got from gametutorials for the dev c++ files
    and i get 31 errors on something about cc1plus not found, ofstream undeclared, and a bunch of other stuff that does not belong to the program in any way. and things like #inlcude not declared??? what the ****???? And how about this one:
    line 999999: GGDHYHUUUHYDGYEGTDGYYGDJY not declared (first use this function

    What the heck is GGDHYHUUUHYDGYEGTDGYYGDJY?!?!?!

    And i was using it for a dos wave player.
    This war, like the next war, is a war to end war.

  3. #3
    Registered User
    Join Date
    Nov 2001
    Posts
    70
    The compilers that work with Dev C++ do not compile DOS exe's so this is not a DOS question.
    "...since anyone who is anyone knows C..." -Peter Cellik

  4. #4
    |<o>| <--cyclopse LouDu's Avatar
    Join Date
    Mar 2003
    Posts
    137
    DONT USE DEV C++ FOR THE 15th timke jsut downlaod borland off of borland.com
    Languages <> C++, HTML

    /*The Ledgend of Ludlow Coming to a PC Near
    You intro Cinenmatic Needed email me of
    Reply to one of my threads if you can make
    one, thats decent. */

  5. #5
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    ...and if you are wanting to write a DOS sound engine look up the following topics.

    • DMA transfer modes
    • How to program the DMA
    • Writing interrupt service routines
    • SoundBlaster DSP programming - available on Creative's website - Legacy programming - you can download the entire SDK from the old days
    • Sound mixing algorithms - for mixing mutiple sounds into one main mix - easiest way is add byte/word from each sound sample and divide by number of samples - called additive mixing - some drawbacks (too many sounds= very distorted final mix)
    • Assembly language programming - go to Randall Hyde's art of assembly language site - enough to get you started.


    The basic idea is that the DMA will scan a portion of memory continually (auto initialized DMA mode). This portion of memory contains the sound data which is then sent to the sound card's DSP via the DMA so the CPU does not have to worry about it. From the DSP it is then converted from digital to analog, amplified, and then sent to the speakers. This is a very simple description as there is much more taking place. In order to produce clickless sound you must always load the portion of the DMA buffer that you just played. This way the DMA offset will never be in the section of sound data that is being loaded which is what causes that annoying clicking.

    Split the DMA buffer in half.
    Code:
    ............................................   256 bytes
    
    ......................|.....................
           128                 128
        Loading          Playing
    • Play the second half - load the first as you play the second.
    • Play the first half - load the second.
    • Repeat for length of sound


    If you want more information then go to www.creative.com - There is a lot of information still available and the best part is that it is free. I programmed a sound system that theoretically could mix an unlimited number of sounds using a 256 byte buffer and it did not click. You really need to be in protected mode to do this correctly because you cannot, repeat cannot, load sound data from disk in the middle of a real-mode interrupt. Try it and watch the whole system crash. Salem helped me out on this issue some time ago - the solution is to move to protected mode and pre-load all the sound data into buffers before they are played - not to mention that loading from the disk during the playback degrades the quality of the sound.

    You don't have to load every sound - just when it is about to be played - hence the slowdown in games on some systems when sounds must be loaded from the CD or the hard drive.

    I'm probably above your head and if I am I'm sorry, but I spent considerable time last year figuring all this stuff out and it's really not that hard, just tedious which is why DirectSound is a life saver and a good one at that. If you are truly committed to programming this then do some research and don't let the stuff scare you - it's really pretty simple once you get your code up and running and producing sound.

  6. #6
    |<o>| <--cyclopse LouDu's Avatar
    Join Date
    Mar 2003
    Posts
    137
    dev c++ sucks
    Languages <> C++, HTML

    /*The Ledgend of Ludlow Coming to a PC Near
    You intro Cinenmatic Needed email me of
    Reply to one of my threads if you can make
    one, thats decent. */

  7. #7
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Originally posted by LouDu
    dev c++ sucks
    Obviously your some sort of genious........

    DevC++ comes with a free port of GCC - which is widely regarded to be one of the best compilers out there....but if you say they suck, then obviously you must be right

  8. #8
    |<o>| <--cyclopse LouDu's Avatar
    Join Date
    Mar 2003
    Posts
    137
    you msut be to your real rude i hate dev c++ because you need to do all these different thigns form what i leanr at school therefoe to me it sucks
    Languages <> C++, HTML

    /*The Ledgend of Ludlow Coming to a PC Near
    You intro Cinenmatic Needed email me of
    Reply to one of my threads if you can make
    one, thats decent. */

  9. #9
    Registered User
    Join Date
    Mar 2003
    Posts
    73
    I jumped from using borlands free C++ 1.01 to using Dev 5.0 (beta) and personally I found it very easy to switch too. And as windows environment it was even more welcome.

    I tryed using IDE's I d/l'd off the i'net for that free BCC5.5 (borlands) and I got nothing but headache and a half. Almost every IDE i downloaded stunk... And if you just use it from the comand line, forget about it... It's so hard to debug!

    I haven't noticed any changes really, C++ is C++. The only difference I noticed so far was that the old fstream.h, was changed to just fstream. No big deal.

    What are you currently using LouDu?

  10. #10
    Linux Forever
    Join Date
    Oct 2002
    Posts
    373
    Yea, Nuke.

    I like Dev C++, But every graphics tutorial and Fmod tutorial i get for it won't compile.

    Some tutorial, huh?

    Anyway, what i like alot about it, is the fact that one can make a default source code
    NO MORE TYPING:
    Code:
    #include <iostream>
    #include <string>
    #include <fstream>
    
    using namespace std;
    
    int main()
    {
    
    }
    Now its that way whenever i boot it up!
    This war, like the next war, is a war to end war.

  11. #11
    Registered User
    Join Date
    Mar 2003
    Posts
    73
    Yeah, I know.. I love that default setup, it saves time when you start new programs. Also, I just realized last time I was using it, was that if I REALLY wanted to I could use borlands compiler in Dev C++.. so anyone saying that Dev C++ "sucks" because it doesn't use the borland compiler is greatly misinformed.

  12. #12
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    Is it just me, or is Borland way less popular now than it was 3 years ago?

  13. #13
    Registered User
    Join Date
    Mar 2003
    Posts
    73
    I still only use Borland's JBuilder for my Java programming!

    It's just C++ I don't stick by them. I think they've become less popular because you can now get the same thing you can (almost) when you buy the software for free from other sources... Have you used they're new C++ Builder? I just didn't feel that comfortable programming in it, it's intimidating to say the least.

  14. #14
    Linux Forever
    Join Date
    Oct 2002
    Posts
    373
    no, i have used it, i have, i think.

    Edit:
    Oh right, i can't even find the right exe. I ran them all, they dont stay up!
    This war, like the next war, is a war to end war.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Sound lags in multi-thread version
    By VirtualAce in forum Game Programming
    Replies: 23
    Last Post: 08-27-2008, 11:54 AM
  2. Compile as you type
    By Rocketmagnet in forum A Brief History of Cprogramming.com
    Replies: 33
    Last Post: 12-07-2006, 01:36 PM
  3. Dev C++ Won't Compile
    By mburt in forum Windows Programming
    Replies: 8
    Last Post: 08-21-2006, 11:14 PM
  4. Compile crashes certain windows
    By Loduwijk in forum C++ Programming
    Replies: 5
    Last Post: 03-26-2006, 09:05 PM
  5. DirectX Question
    By bladerunner627 in forum Game Programming
    Replies: 2
    Last Post: 04-04-2005, 11:55 AM