Mail Archives: djgpp/1994/05/05/06:32:48
Dear Dave
I noticed recently in the mail that you asked if somebody did something
about your Sound Blaster code. I analyzed this code and obtained the
following results:
1."Choppy sound"
Notice, that to DMA registers and SB register you should write
the length of buffer DECREMENTED BY 1. After I decremented the values
the sound became perfectly clear.
2."Locking up the machine"
I modified a little the initializing sequence adding "while" loop.
It works better this way, I think.
/*
* Init the soundblaster card.
*/
void
sb_initcard()
{
outportb(sb_ioaddr + SB_DSP_RESET, 1);
/*
* Kill some time
*/
inportb(sb_ioaddr + SB_DSP_RESET);
inportb(sb_ioaddr + SB_DSP_RESET);
inportb(sb_ioaddr + SB_DSP_RESET);
inportb(sb_ioaddr + SB_DSP_RESET);
outportb(sb_ioaddr + SB_DSP_RESET, 0);
/* the following line added to prevent lock-up */
while(!(inportb(sb_ioaddr+SB_DSP_DATA_AVAIL)&0x80))
;
/*
* Need to add a timeout here!
*/
while (inportb(sb_ioaddr + SB_DSP_READ_DATA) != 0xAA)
;
}
This code only helps to recover after the last error, but the
sound still stops. I observed, that ISR is never called from
real mode. That may mean, that we are losing interrupt.
The system doesn't lock up, only the sound stops playing.
There has to be something wrong with the callback procedure.
I tried to change callback_iret to callback_retf, but it didn't
change anything. This callback requires a closer look
Grzegorz W. Jablonski
grzegorz AT kmm-lx DOT p DOT lodz DOT pl
- Raw text -