Reinventing the wheel
There are plenty of sound librarys and code resources out there.
For our games we linked to a premade sound blaster library for DJGPP.
To add sound to your programs you need link them to 'libsb.a'
Compile your code using this example command line for the compiler:
gcc -o myprog myprog.c
and include this compiler directive at the top of your program:
The other header files in the example download must be in the same
directory as sb_lib.h. This will give your prgram access to these
functions in sblib.a :
sb_sample * //new data type
sb_load_sample(char *filename,filetype);//filetype _SB_WAV
sb_install_driver(int frequency)//should return SB_SUCCESS
sb_mix_sample(sb_sample*);//play a sound
There are probably more funstions in the library, examine the header
if you think you need more functionality.
a working example including libsb
This library was written by Joel H. Hunter (1995) If you are him
please mail us!
1> The Sound-Blaster Library for DJGPP V. 2.0 is copyrighted
You are free to do with it as you please, with the following conditions:
a) If you change/add to/make better this library, send me your changes!
I will maintain all such patches, and re-release a new, better
library that everyone can enjoy and will benefit from!
b) If you create a new library based on this library, give Eric
credit, and maintain this freeware policy.
The Sound-Blaster Library for DJGPP V. 2.0 is based in part on VAT.
can obtain VAT at mack.rt66.com/users/smeagol/vatxxx.zip, and can
contact Eric at firstname.lastname@example.org.
c) You MAY use this library in a commercial/shareware application,
however, please let me know about it, give me a little credit,
and send me a copy.
2> USE OF THIS LIBRARY IS STRICTLY AT YOUR OWN RISK! THE AUTHOR
RESPONSIBILITY FOR TIME, MONEY, AND/OR EQUIPMENT LOST DUE TO THE
USE OF THIS LIBRARY.
3> THIS LIBRARY IS NOT GUARANTEED TO WORK SAFELY ON ANY COMPUTER!
4> THIS LIBRARY IS NOT GUARANTEED TO BE SUITABLE FOR ANY SPECIFIC
5> IF THE ABOVE RESTRICTIONS DO NOT CONFORM TO THE LAWS OF YOUR
STATE, YOU MUST NOT USE THIS LIBRARY.
All product names and logos are registered trademarks
of their respective owners.
All content © www.retro-games.co.uk