From: brianp AT ic DOT owatonna DOT mn DOT us (Brian Peterson) Newsgroups: comp.os.msdos.djgpp Subject: Sound effect problems with MikMod under DJGPP Date: 8 Feb 1997 20:48:53 GMT Organization: Internet Connections Lines: 40 Message-ID: <5diorl$rug@oak.Internet-Connections.net> NNTP-Posting-Host: s15.ic.owatonna.mn.us To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp I've been having problems with sound effects under MikMod. I'm wondering if this has something to do with the fact that MikMod was morely designed as simply a player module for demos rather than for use in games, as there really isn't any direct and easy way of using sound effects, so I could just be doing something wrong. Actually, I've had a few problems with MikMod, but this is the only one I haven't been able to work around. That is, on SoundBlaster cards, the sound effects lag by anywhere from half a second, to nearly a full two seconds, depending on the computer, the card, etc. This is definetely annoying, and ruins the atmosphere of the game. At first I thought I was just calling the sounds wrong, but on my GUS the sounds don't lag at all. So, my next thought was that the delay was caused by too large of a DMA buffer. The default, however, is 8k, which is rarely longer than 1/5 of a second. Changing the buffer size had no effect on the sound lags. I'm using DJGPP v.2.0, with MikMod v.2.09b; I realize MikMod v.2.1 is out, but the only difference seems to be drivers for other sound devices which I don't need. This is the sound playing code I'm using: MD_VoiceSetVolume(chanl,64); MD_VoiceSetPanning(chanl,128); MD_VoiceSetFrequency(chanl,sfx[efc]->loopend); MD_VoicePlay(chanl,sfx[efc]->handle,0,sfx[efc]->length,0,0,sfx[efc]->flags); I modified the WAV loader routine to place the WAVs frequency in the LOOPEND variable as you can see, since we shouldn't be using looping sound effects, and it was the easiest way to handle that situation. However, the lag was present before I made that modification as well, so I don't think that's the problem. Yes, I am calling MD_Update() correctly. :) The project this is for is an RPG engine I'm developing. You can find it's homepage at http://www.inlink.com/~vecna/crs.html, or download the beta RPG.ZIP at /~vecna/beta.html to see what I'm talking about. If anyone has any idea what could be causing this lag and how to fix it, I would REALLY appreciate it. If you wish to reply by email, please send it to vecna AT inlink DOT com.