PDA

View Full Version : Sound compile error with Dev C++



Blizzarddog
03-03-2003, 12:47 PM
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.

Blizzarddog
03-03-2003, 01:32 PM
let me show you:


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.

KrAzY CrAb
03-03-2003, 04:45 PM
The compilers that work with Dev C++ do not compile DOS exe's so this is not a DOS question.

LouDu
03-03-2003, 06:43 PM
DONT USE DEV C++ FOR THE 15th timke jsut downlaod borland off of borland.com

VirtualAce
03-06-2003, 08:03 PM
...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.


............................................ 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.

LouDu
03-07-2003, 05:25 PM
dev c++ sucks

Fordy
03-07-2003, 05:36 PM
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

LouDu
03-07-2003, 05:39 PM
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

Nuke
03-30-2003, 01:08 AM
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?

Blizzarddog
03-31-2003, 10:24 AM
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:


#include <iostream>
#include <string>
#include <fstream>

using namespace std;

int main()
{

}


Now its that way whenever i boot it up!

Nuke
04-01-2003, 07:28 PM
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. :D

sean
04-03-2003, 08:18 PM
Is it just me, or is Borland way less popular now than it was 3 years ago?

Nuke
04-09-2003, 08:57 PM
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. :D

Blizzarddog
04-10-2003, 08:51 AM
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!