int32_t MV_Pan3D(int32_t handle, int32_t angle, int32_t distance) { if (distance < 0) { distance = -distance; angle += MV_NUMPANPOSITIONS / 2; } int const volume = MIX_VOLUME(distance); angle &= MV_MAXPANPOSITION; return MV_SetPan(handle, max(0, 255 - distance), MV_PanTable[ angle ][ volume ].left, MV_PanTable[ angle ][ volume ].right); }
int MV_PlayVorbis3D ( char *ptr, unsigned int ptrlength, int pitchoffset, int angle, int distance, int priority, unsigned int callbackval ) { int left; int right; int mid; int volume; int status; if ( !MV_Installed ) { MV_SetErrorCode( MV_NotInstalled ); return( MV_Error ); } if ( distance < 0 ) { distance = -distance; angle += MV_NumPanPositions / 2; } volume = MIX_VOLUME( distance ); // Ensure angle is within 0 - 31 angle &= MV_MaxPanPosition; left = MV_PanTable[ angle ][ volume ].left; right = MV_PanTable[ angle ][ volume ].right; mid = max( 0, 255 - distance ); status = MV_PlayVorbis( ptr, ptrlength, pitchoffset, mid, left, right, priority, callbackval ); return( status ); }
int32_t MV_PlayFLAC3D ( char *ptr, uint32_t ptrlength, int32_t loophow, int32_t pitchoffset, int32_t angle, int32_t distance, int32_t priority, uint32_t callbackval ) { int32_t left; int32_t right; int32_t mid; int32_t volume; int32_t status; if ( !MV_Installed ) { MV_SetErrorCode( MV_NotInstalled ); return MV_Error; } if ( distance < 0 ) { distance = -distance; angle += MV_NUMPANPOSITIONS / 2; } volume = MIX_VOLUME( distance ); // Ensure angle is within 0 - 127 angle &= MV_MAXPANPOSITION; left = MV_PanTable[ angle ][ volume ].left; right = MV_PanTable[ angle ][ volume ].right; mid = max( 0, 255 - distance ); status = MV_PlayFLAC(ptr, ptrlength, pitchoffset, loophow, -1, mid, left, right, priority, callbackval); return status; }
void MV_SetReverb(int32_t reverb) { MV_ReverbLevel = MIX_VOLUME(reverb); MV_ReverbTable = &MV_VolumeTable[MV_ReverbLevel][0]; }
static inline const int16_t *MV_GetVolumeTable(int32_t vol) { return MV_VolumeTable[MIX_VOLUME(vol)]; }