Sound question - DJGPP

This is a public forum, where you can find out everything you wanted to know about making games. Please don't use this forum as a place to recruit new members.

Moderators: adeyke, VampD3, eriqchang, Angelus3K

Post Reply
Message
Author
turbomcphazer
Peasant Status
Posts: 4
Joined: Tue Nov 28, 2006 4:09 pm

Sound question - DJGPP

#1 Post by turbomcphazer » Tue Nov 28, 2006 4:27 pm

Hey, everyone. I don't know if anyone here programs with DJGPP, but I'm hoping someone can help me. I have only a little C programming experience (I've been programming in other languages for most of my life, though never very seriously), and I'm trying to program an AGI style adventure game with DJGPP. I'd like to include sound, but on a very basic level, probably around what the original Nintendo can do--three sine waves and one noise wave, or something like that. What I'd like to do is make a very basic sound library that would run in Windows-based DOS, would detect most standard sound cards, and would play a few simultaneous waves. It wouldn't need to play digital samples or anything; no .WAV files. I'd just like to write my own data files storing frequencies and durations, and write code to load them. Basically I want it to sound like an AGI game running with AGISB (or, more to the point, like Space Quest did on my PCjr. back in '86).

I realize I could probably use Allegro or a similar library, but that seems like overkill, for one thing, and also seems sort of like buying a LEGO set and opening the box to find the whole thing already put together--a lot of the pleasure is building the thing up myself (this is also the reason I'm not just using AGI Studio).

BUT, given the troubled state of Windows/DOS sound relations, and what I think is the idiosyncratic nature of sound cards in general, I realize that this might be very difficult or just more trouble than it's worth. Still, I'm holding out hope. Does anyone have any advice on how to access sound cards, on the most basic level, using DJGPP? Again, all I want to do is initialize the sound card, and then have enough access to start/stop simple looped waveforms. Someone on another board suggested using MPU-401 emulation, but I couldn't seem to find any info about that...

Thanks,
Pete

pass
Royal Servant Status
Posts: 129
Joined: Wed Mar 22, 2006 8:38 pm
Location: Israel

#2 Post by pass » Tue Nov 28, 2006 4:42 pm

I don't know much about audio, and I never heard of DJGPP, but you might wanna try using .mid audio files - they usually have the simplest tunes (like old mobile phones). Try maybe finding a program on the internet that lets you create them...

turbomcphazer
Peasant Status
Posts: 4
Joined: Tue Nov 28, 2006 4:09 pm

#3 Post by turbomcphazer » Thu Nov 30, 2006 7:30 pm

Yeah, midi is probably the format I'll use... I'm just trying to figure out a way to access the sound card in DOS-based C (DJGPP is a freeware C compiler)... thanks, though!

moonlit
Royal Servant Status
Posts: 98
Joined: Fri Oct 29, 2004 10:26 am
Location: The Netherlands
Contact:

#4 Post by moonlit » Sun Dec 03, 2006 1:24 am

Hi,

You might want to use VC2005/OpenAL to generate sound. It allows you to create PCM samples (for instance by filling buffers with a sinewave).

This way you don't have to worry about sound cards, interrupts etc. and it will play on more cards then just SB. For the moment VC2005 can be downloaded for free from the microsoft site. OpenAL can be downloaded for free too.

It will take some time to set it up correctly, but likely less time than trying to do the same thing from DOS.

Regards, Ron AF Greve

Post Reply