Page 1 of 1

soundblaster, anyone?

Posted: Mon Mar 06, 2006 12:00 am
by robert macabre
i decided early on that i would refrain from asking for help with my code and i would research and find the answers online, but i really cannot figure out what's wrong with what should be a simple soundblaster detecting function. my problem is that i can only get the initialization and the mixer settings working, and i thought that maybe the problem with direct sound mode lay in qemu. so, i tried my code on my actual pc, and it wouldn't even find the soundblaster card. i know for a fact that there is a soundblaster compatible, because i just bought a soundblaster live! card which might be as close to soundblaster compatible as possible haha.

anyway, here is the initialization code. i'm almost certain that if i could fix this i could get going again.

Code: Select all

ushort lsBases[i]={0x0210,0x220,0x0230,0x0240,0x0250,0x0260,0x0280};
#define lsBaseCount 7

ushort LSAutoDetect() {
	uchar i;
	ushort j;
	string nBuffer[5];
	for (i=0;i<lsBaseCount;i++) {
		puts((strptr)"Attempting to detect SoundBlaster on port 0x");
		puts(StrSToH(lsBases[i],nBuffer));
		puts((strptr)"...");
		outportb(lsBases[i]+SB_DSP_RESET,1);
		TmrWait(1);
		outportb(lsBases[i]+SB_DSP_RESET,0);
		//TmrWaitS(0.1);
		if (inportb(lsBases[i]+SB_DSP_READSTAT)&0x80) {
			for (j=0;j<0xFFFF;j++) {
				if (inportb(lsBases[i]+SB_DSP_READ)==0xAA) {
					puts((strptr)"Passed!\n");
					return lsBases[i];
				}
			}
		}
		puts((strptr)"Failed.\n");
	}
	puts((strptr)"No SoundBlaster present! :[\n");
	return 0;
}
oh, and the types and functions i use are basically..

Code: Select all

typedef unsigned short ushort;
typedef unsigned char *strptr;

TmrWaitS waits a specified number of seconds, TmrWait waits a certain number of ticks, which is currently 11025 just to test out direct mode to see if it's working (which it's not) (and i made sure 1/11025 was more than 3 microseconds like i'm supposedly supposed to wait)
like i said, qemu works fine with this code. it finds it at port 0x0220 i believe.. but my real soundblaster card on my real pc doesn't do anything.

if anyone can spot what i'm doing wrong, i'd be pretty happy.

thanks[/code]

Re: soundblaster, anyone?

Posted: Mon Mar 06, 2006 12:00 am
by Da_Maestro
Check the programming documentation for the soundblaster live...you might find that this compatability with the original soundblaster is achieved through a dos program which intercepts commands to the old hardware and redirects them.

I know that a lot of soundblaster "clones" use this method :-S

Re: soundblaster, anyone?

Posted: Mon Mar 06, 2006 12:00 am
by robert macabre
hey thanks! i hadn't thought of that.