EasyManua.ls Logo

Creative AWE32 - Page 109

Creative AWE32
110 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
SB AWE32 Developer's Information Pack PART V 3D Positional Audio API 108
Copyright Creative Technology Ltd., 1994-1996 Version 3.00
/* | a[3] a[4] a[5] | */
/* | a[6] a[7] a[8] | */
c3daReceiver rx; /* handle to c3da core receiver */
/* need to be "created" using */
/* c3daCreateReceiver */
} Receiver;
/*
* as an example, allocate some global emitters and one receiver
*/
Receiver thisRx;
Emitter Em[NUMBER_OF_EMITTERS];
/*
* sample "world" setEmitterPosition routine
*/
void
setEmitterPosition( Emitter* pEm, int x, int y, int z )
{
int new_x, new_y, new_z;
/*
* save the world coordinates
*/
pEm->x = x;
pEm->y = y;
pEm->z = z;
/*
* rotate this emitter so that it is relative to the fixed
* receiver in the c3da core
*/
new_x = thisRx.a[0]*x + thisRx.a[1]*y + thisRx.a[2]*z;
new_y = thisRx.a[3]*x + thisRx.a[4]*y + thisRx.a[5]*z;
new_z = thisRx.a[6]*x + thisRx.a[7]*y + thisRx.a[8]*z;
/*
* now tell the c3da core about the new position
*/
c3daSetEmitterPosition ( &(pEm->em), new_x, new_y, new_z );
}
/*
* sample "world" setReceiverOrientation routine
*
* Arguments:
* yaw - rotation around the z-axis (-180 to 180 degrees)
* pitch - rotation around the y-axis (-180 to 180 degrees)
* roll - rotation around the x-axis (-180 to 180 degrees)
*
* Notes:
* o order of rotations - roll, pitch, yaw
* o Instead of actually changing the orientation of the receiver,
* we equivalently move all the emitters around the fixed receiver
* in the c3da core. The rotation matrix used to move the emitters
* is simply the transpose of the "composite" rotation matrix defined
* by yaw, pitch, roll and the order of rotations.
*/
void
setReceiverOrientation( int yaw, int pitch, int roll )
{
float yaw_f;
float pitch_f;
float roll_f;
/*
* convert yaw, pitch, and roll to radians

Table of Contents