-/*
-Here's what's happening now:
-
-Stuck in right DAC spinlock!
-Aborting!
-
-Tail=681, Head=681, BUFFER_SIZE-1=FFFF
-From while: Tail=683, Head=681
-
-????? What the FUCK ?????
-
-& when I uncomment the lines below spin++; it *doesn't* lock here... WTF?????
-
-I think it was missing parentheses causing the fuckup... Seems to work now...
-
-Except for Super Burnout now...! Aarrrgggghhhhh!
-
-Tail=AC, Head=AE
-Stuck in left DAC spinlock! Aborting!
-Tail=AC, Head=AE, BUFFER_SIZE-1=FFFF
-From while: Tail=AE, Head=AE
-
-So it's *really* stuck here in the left FIFO. Figure out why!!!
-
-Prolly 'cause it doesn't set the sample rate right away--betcha it works with the BIOS...
-It gets farther, but then locks here (weird!):
-
-Tail=2564, Head=2566
-Stuck in left DAC spinlock! Aborting!
-Tail=2564, Head=2566, BUFFER_SIZE-1=FFFF
-From while: Tail=2566, Head=2566
-
-Weird--recompile with more WriteLog() entries and it *doesn't* lock...
-Yeah, because there was no DSP running. Duh!
-
-Tail=AC, Head=AE
-Stuck in left DAC spinlock! Aborting!
-LTail=AC, LHead=AE, BUFFER_SIZE-1=FFFF
-RTail=AF, RHead=AF, BUFFER_SIZE-1=FFFF
-From while: Tail=AE, Head=AE
-
-Odd: The right FIFO is empty, but the left FIFO is full!
-And this is what is causing the lockup--the DAC callback waits for the side with
-less samples ready and in this case it's the right channel (that never fills up)
-that it's waiting for...!
-
-Okay, with the kludge in place for the right channel not being filled, we select
-a track and then it locks here:
-
-Tail=60D8, Head=60DA
-Stuck in left DAC spinlock! Aborting!
-LTail=60D8, LHead=60D8, BUFFER_SIZE-1=FFFF
-RTail=DB, RHead=60D9, BUFFER_SIZE-1=FFFF
-From while: Tail=60DA, Head=60D8
-*/
-#warning Spinlock problem--!!! FIX !!!
-#warning Odd: The right FIFO is empty, but the left FIFO is full!
- // Spin until buffer has been drained (for too fast processors!)...
-uint32 spin = 0;
- while (((RightFIFOTailPtr + 2) & (BUFFER_SIZE - 1)) == RightFIFOHeadPtr)//;
- {
-spin++;
-//if ((spin & 0x0FFFFFFF) == 0)
-// WriteLog("Tail=%X, Head=%X, BUFFER_SIZE-1=%X\n", RightFIFOTailPtr, RightFIFOHeadPtr, BUFFER_SIZE - 1);
-
-if (spin == 0xFFFF0000)
-{
-uint32 rtail = RightFIFOTailPtr, rhead = RightFIFOHeadPtr;
-WriteLog("Tail=%X, Head=%X", rtail, rhead);
-
- WriteLog("\nStuck in right DAC spinlock! Aborting!\n");
- WriteLog("LTail=%X, LHead=%X, BUFFER_SIZE-1=%X\n", LeftFIFOTailPtr, LeftFIFOHeadPtr, BUFFER_SIZE - 1);
- WriteLog("RTail=%X, RHead=%X, BUFFER_SIZE-1=%X\n", RightFIFOTailPtr, RightFIFOHeadPtr, BUFFER_SIZE - 1);
- WriteLog("From while: Tail=%X, Head=%X", (RightFIFOTailPtr + 2) & (BUFFER_SIZE - 1), RightFIFOHeadPtr);
-// LogDone();
-// exit(0);
- GUICrashGracefully("Stuck in right DAC spinlock!");
- return;
-}
- }//*/
-
- SDL_LockAudio();
- RightFIFOTailPtr = (RightFIFOTailPtr + 2) % BUFFER_SIZE;
- DACBuffer[RightFIFOTailPtr] = data;
- SDL_UnlockAudio();
-/*#ifdef DEBUG_DAC
- else
- WriteLog("DAC: Ran into FIFO's right tail pointer!\n");
-#endif*/