home *** CD-ROM | disk | FTP | other *** search
- /******************** ***********************/
- //
- // Player PRO 5.0 - DRIVER SOURCE CODE -
- //
- // Library Version 5.0
- //
- // To use with MAD Library for Mac: Symantec, CodeWarrior and MPW
- //
- // Antoine ROSSET
- // 16 Tranchees
- // 1206 GENEVA
- // SWITZERLAND
- //
- // COPYRIGHT ANTOINE ROSSET 1996, 1997, 1998
- //
- // Thank you for your interest in PlayerPRO !
- //
- // FAX: (+41 22) 346 11 97
- // PHONE: (+41 79) 203 74 62
- // Internet: RossetAntoine@bluewin.ch
- //
- /******************** ***********************/
-
- #include "RDriver.h"
- #include "RDriverInt.h"
-
- void MADTickLoopFill8( Channel *curVoice, long *ASCBuffer1, long *ASCBuffer2, long size, short left, short right)
- {
- size++;
- while( size-- > 0)
- {
- *ASCBuffer1 += left; ASCBuffer1 += 2;
- *ASCBuffer2 += right; ASCBuffer2 += 2;
- }
- curVoice->prevPtr = 0L;
- }
-
- void MADTickLoop8( long size, Channel *curVoice, long *ASCBuffer1, long *ASCBuffer2, MADDriverRec *intDriver)
- {
- long tLongL, tLongR;
- long curLevelL = curVoice->curLevelL, curLevelR = curVoice->curLevelR, curLastWordL = curVoice->curLastWordL, curLastWordR = curVoice->curLastWordR, TICKREMOVESIZE = curVoice->TICKREMOVESIZE;
- Boolean LevelDirectionL = curVoice->LevelDirectionL, LevelDirectionR = curVoice->LevelDirectionR, RemoverWorking = curVoice->RemoverWorking;
-
- if( TICKREMOVESIZE == 0) return;
-
- while( size-- > 0)
- {
- if( LevelDirectionL)
- {
- if( curLevelL > 0) curLevelL--; else RemoverWorking = false;
- tLongL = (curLastWordL * curLevelL) / TICKREMOVESIZE;
- }
- else
- {
- if( curLevelL < TICKREMOVESIZE) curLevelL++; else RemoverWorking = false;
- tLongL = (curLastWordL * curLevelL) / TICKREMOVESIZE;
- tLongL -= curLastWordL;
- }
-
- if( curVoice->LevelDirectionR)
- {
- if( curLevelR > 0) curLevelR--; else RemoverWorking = false;
- tLongR = (curLastWordR * curLevelR) / TICKREMOVESIZE;
- }
- else
- {
- if( curLevelR < TICKREMOVESIZE) curLevelR++; else RemoverWorking = false;
- tLongR = (curLastWordR * curLevelR) / TICKREMOVESIZE;
- tLongR -= curLastWordR;
- }
-
- // Double ASCBUFFER
- *ASCBuffer1 += tLongL; ASCBuffer1 += 2;
- *ASCBuffer2 += tLongR; ASCBuffer2 += 2;
- }
-
- curVoice->curLevelL = curLevelL;
- curVoice->curLevelR = curLevelR;
- curVoice->curLastWordL = curLastWordL;
- curVoice->curLastWordR = curLastWordR;
- curVoice->TICKREMOVESIZE = TICKREMOVESIZE;
- curVoice->LevelDirectionL = LevelDirectionL;
- curVoice->LevelDirectionR = LevelDirectionR;
- curVoice->RemoverWorking = RemoverWorking;
- }
-
- void MADTickRemoverStart8( Channel *curVoice, long *ASCBuffer1, long *ASCBuffer2, MADDriverRec *intDriver)
- {
- long i = intDriver->ASCBUFFER;
- long curDoVol0 = DoVolPanning256( 0, curVoice, intDriver), curDoVol1 = DoVolPanning256( 1, curVoice, intDriver);
-
- if( curVoice->prevPtr != curVoice->begPtr ||
- (curVoice->curPtr >= curVoice->maxPtr && curVoice->loopSize == 0) ||
- curVoice->prevVol0 != curDoVol0 ||
- curVoice->prevVol1 != curDoVol1)
- {
- Boolean DoIT = false;
-
- curVoice->LevelDirectionL = true;
- curVoice->LevelDirectionR = true;
-
- // Right Channel
- if( curVoice->prevVol0 != curDoVol0 && curVoice->prevPtr == curVoice->begPtr)
- {
- long diff = curVoice->prevVol0 - curDoVol0;
-
- if( diff > 0)
- {
- if( curVoice->prevVol0 != 0) curVoice->lastWordR -= (curVoice->lastWordR * curDoVol0) / curVoice->prevVol0;
- curVoice->prevVol0 = curDoVol0;
- DoIT = true;
- }
- else if( diff < 0)
- {
- if( curVoice->prevVol0 != 0) curVoice->lastWordR -= (curVoice->lastWordR * curDoVol0) / curVoice->prevVol0;
- curVoice->lastWordR = -curVoice->lastWordR;
- curVoice->prevVol0 = curDoVol0;
- curVoice->LevelDirectionR = false;
- DoIT = true;
- }
- }
- else if( curVoice->prevPtr == curVoice->begPtr) curVoice->lastWordR = 0;
-
- // Left Channel
- if( curVoice->prevVol1 != curDoVol1 && curVoice->prevPtr == curVoice->begPtr)
- {
- long diff = curVoice->prevVol1 - curDoVol1;
-
- if( diff > 0)
- {
- if( curVoice->prevVol1 != 0) curVoice->lastWordL -= (curVoice->lastWordL * curDoVol1) / curVoice->prevVol1;
- curVoice->prevVol1 = curDoVol1;
- DoIT = true;
- }
- else if( diff < 0)
- {
- if( curVoice->prevVol1 != 0) curVoice->lastWordL -= (curVoice->lastWordL * curDoVol1) / curVoice->prevVol1;
- curVoice->lastWordL = -curVoice->lastWordL;
- curVoice->prevVol1 = curDoVol1;
- curVoice->LevelDirectionL = false;
- DoIT = true;
- }
- }
- else if( curVoice->prevPtr == curVoice->begPtr) curVoice->lastWordL = 0;
-
- if( curVoice->lastWordL != 0 || curVoice->lastWordR != 0 || DoIT == true)
- {
- curVoice->TICKREMOVESIZE = intDriver->VSYNC;
- curVoice->TICKREMOVESIZE /= intDriver->finespeed;
- curVoice->TICKREMOVESIZE *= 80L;
- curVoice->TICKREMOVESIZE /= intDriver->VExt;
-
- if( curVoice->LevelDirectionR) curVoice->curLevelR = curVoice->TICKREMOVESIZE;
- else curVoice->curLevelR = 0;
-
- if( curVoice->LevelDirectionL) curVoice->curLevelL = curVoice->TICKREMOVESIZE;
- else curVoice->curLevelL = 0;
-
- curVoice->curLastWordR = curVoice->lastWordR;
- curVoice->curLastWordL = curVoice->lastWordL;
- curVoice->lastWordR = 0;
- curVoice->lastWordL = 0;
-
- curVoice->RemoverWorking = true;
- }
-
- curVoice->prevPtr = curVoice->begPtr;
- curVoice->prevVol0 = curDoVol0;
- curVoice->prevVol1 = curDoVol1;
- }
-
- if( curVoice->RemoverWorking) MADTickLoop8( i, curVoice, ASCBuffer1, ASCBuffer2, intDriver);
- }