Mail Archives: djgpp/2007/05/15/23:32:17
<pyzals AT gmail DOT com> wrote in message
news:1179233938 DOT 968657 DOT 125170 AT q75g2000hsh DOT googlegroups DOT com...
> Slash'EM to start out with. Nothing official, just for fun.
>
> What DJ said makes perfect sense to me now, (Thanks DJ). What I still
> don't understand is that there seems to be code out there that is
> supposed to work with DJGPP, but doesn't take this into account.
>
> http://www.shdon.com/dos/sound#mixing
> is an excellent example. I downloaded it and compiled it. It compiles
> perfectly, but it's wav file reproduction is faulty. The wav's start
> playing somewhere in the middle and are generally messed up.
>
dmamix-d.zip for DJGPP? I downloaded that. When I first ran it, it
crackled like crazy. But, I figured I was using the wrong IRQ and DMA. My
sound blaster string is this:
SET BLASTER=A220 I5 D1
When I tried IRQ 5 and DMA 1, all the .wav's ran nicely in a Windows
console. When I tried under DOS, it couldn't find my sound card.
I compiled with gcc -Wall -pedantic which found a few errors. Delete the
start and end lines and run through patch:
patch -p0 < dmagcc.dif
Rod Pemberton
----START--dmagcc.dif---
--- dmagcc.c 1999-02-16 01:12:42.000000000 +0000
+++ dmagcc.new 2007-05-15 23:11:20.000000000 +0000
@@ -56,7 +56,7 @@
outportb (Test + 0x6, 0);
delay(10);
//Check if (reset was succesfull
- if ((inportb(Test + 0xE) & 0x80 == 0x80) && (inportb(Test + 0xA) ==
0xAA))
+ if (((inportb(Test + 0xE) & 0x80) == 0x80) && (inportb(Test + 0xA) ==
0xAA))
{
//DSP was found
Base = Test;
@@ -134,7 +134,7 @@
{
char *Address;
//Fill an 8K block in the DMA buffer with 128's - silence
- Address = DMABuffer + (Buffer << 13);
+ Address = (char *)(DMABuffer + (Buffer << 13));
memset (Address, 128, 8192);
//Copy DMA buffer to DOS memory
dosmemput(Address, 8192, DOSBufOfs + (Buffer << 13));
@@ -197,7 +197,7 @@
Voice->SoundLength = ftell (WAVFile) - 48;
fseek(WAVFile, 0L, SEEK_SET);
- Voice->Sample = (char *)malloc(Voice->SoundLength + 2); //Assign memory
+ Voice->Sample = (unsigned char *)malloc(Voice->SoundLength + 2); //Assign
memory
fseek(WAVFile, 46L, SEEK_SET); //Skip the header
//Load the sample data
@@ -250,7 +250,7 @@
unsigned int Page1, Page2; //Words
//Assign 32K to DMA Buffer
- DMABuffer = (char *)malloc (32768);
+ DMABuffer = (unsigned char *)malloc (32768);
//Assign 32K (2048 paragraphs) of DOS memory
TempBuf.size = 2048;
@@ -298,7 +298,7 @@
_go32_dpmi_set_protected_mode_interrupt_vector (Vector, &OldIRQ);
}
-void main ()
+int main (void)
{
int Temp;
//Clear screen
@@ -317,11 +317,11 @@
if (Temp == 9) {
//or none at all
printf ("No Sound Blaster found\n");
- return;
+ return(0);
} else printf ("Sound Blaster found at %Xh\n", Base);
- printf ("Please specify DMA channel : "); scanf("%d", &DMA);
- printf ("Please specify IRQ level : "); scanf("%d", &IRQ);
+ printf ("Please specify DMA channel : "); scanf("%u", &DMA);
+ printf ("Please specify IRQ level : "); scanf("%u", &IRQ);
//Assign memory to the DMA Buffer
AssignBuffer ();
@@ -390,5 +390,5 @@
outportb (0x21, inportb (0x21) | 4);
} else outportb (0x21, inportb (0x21) | (1 << IRQ));
- return;
+ return(0);
}
----END---
- Raw text -