home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Dream 59
/
CDDream59.ISO
/
BeOs
/
Sound
/
Intel
/
PPBeDevKit.ZIP
/
PLAYERPR.TAR
/
PlayerPRO
/
Source
/
OutPut8.c
< prev
next >
Wrap
C/C++ Source or Header
|
1998-12-26
|
4KB
|
150 lines
/******************** ***********************/
//
// 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 Sampler8in8AddPolyStereo( Channel *curVoice, register Ptr ASCBuffer, short chanNo, MADDriverRec *intDriver)
{
char *SndBuffer;
long i = intDriver->ASCBUFFER, volChn;
short temp;
Boolean killSample = false;
///
long aDD, aCC = curVoice->lAC, off;
aDD = (AMIGA_CLOCKFREQ2 << BYTEDIV) / ( curVoice->period * (intDriver->DriverSettings.outPutRate>>16));
///
if( curVoice->curPtr >= curVoice->maxPtr && curVoice->loopSize == 0) return;
SndBuffer = (char*) curVoice->curPtr;
volChn = DoVolPanning256( 3, curVoice, intDriver);
while( i-- > 0)
{
off = 2*(aCC>>BYTEDIV);
if( (Ptr) SndBuffer + off >= curVoice->maxPtr)
{
if( curVoice->loopSize > 0)
{
SndBuffer -= curVoice->loopSize;
if( SndBuffer + off < curVoice->begPtr) SndBuffer = curVoice->begPtr - off;
}
else
{
killSample = true;
break;
}
}
temp = (volChn * *(SndBuffer + off)) >> 8;
off++;
temp += (volChn * *(SndBuffer + off)) >> 8;
temp /= 2;
*ASCBuffer += temp; aCC += aDD;
ASCBuffer += chanNo;
}
if( !killSample) curVoice->curPtr = (Ptr) (SndBuffer + (long) (aCC>>BYTEDIV));
else
{
curVoice->samplePtr = 0L; curVoice->curPtr = curVoice->maxPtr;
}
curVoice->lAC = aCC & ((1 << BYTEDIV) - 1);
}
void Sampler8in8AddPoly( Channel *curVoice, register Ptr ASCBuffer, short chanNo, MADDriverRec *intDriver)
{
char *SndBuffer;
long i = intDriver->ASCBUFFER, volChn;
Boolean killSample = false;
///
long aDD, aCC = curVoice->lAC, off;
aDD = (AMIGA_CLOCKFREQ2 << BYTEDIV) / ( curVoice->period * (intDriver->DriverSettings.outPutRate>>16));
///
if( curVoice->curPtr >= curVoice->maxPtr && curVoice->loopSize == 0) return;
SndBuffer = (char*) curVoice->curPtr;
volChn = DoVolPanning256( 3, curVoice, intDriver);
while( i-- > 0)
{
off = (aCC>>BYTEDIV);
if( (Ptr) SndBuffer + off >= curVoice->maxPtr)
{
if( curVoice->loopSize > 0)
{
SndBuffer -= curVoice->loopSize;
if( SndBuffer + off < curVoice->begPtr) SndBuffer = curVoice->begPtr - off;
}
else
{
killSample = true;
break;
}
}
*ASCBuffer += (volChn * *(SndBuffer + off)) >> 8; aCC += aDD;
ASCBuffer += chanNo;
}
if( !killSample) curVoice->curPtr = (Ptr) (SndBuffer + (long) (aCC>>BYTEDIV));
else
{
curVoice->samplePtr = 0L; curVoice->curPtr = curVoice->maxPtr;
}
curVoice->lAC = aCC & ((1 << BYTEDIV) - 1);
}
void Sample8BufferAddPoly( Channel *curVoice, register Ptr ASCBuffer, short chanNo, MADDriverRec *intDriver)
{
if( curVoice->stereo)
{
if( curVoice->amp == 8) Sampler8in8AddPolyStereo( curVoice, ASCBuffer, chanNo, intDriver);
}
else
{
if( curVoice->amp == 8) Sampler8in8AddPoly( curVoice, ASCBuffer, chanNo, intDriver);
}
}
void Play8PolyPhonic( MADDriverRec *intDriver)
{
long i, x;
Byte *alpha = (Byte*) intDriver->IntDataPtr;
x = intDriver->ASCBUFFER * intDriver->DriverSettings.numChn;
while( x-- > 0) *alpha++ = 0x80;
for( i = 0 ; i < intDriver->DriverSettings.numChn; i++)
{
Sample8BufferAddPoly( &intDriver->chan[ i], intDriver->IntDataPtr + i, intDriver->DriverSettings.numChn, intDriver);
}
}