77 lines
2.1 KiB
C++
77 lines
2.1 KiB
C++
/////////////////////////////////////////////////////
|
|
/////////////////////////////////////////////////////
|
|
//
|
|
// SetDopplerScale
|
|
//
|
|
/////////////////////////////////////////////////////
|
|
/////////////////////////////////////////////////////
|
|
#include "CKALL.h"
|
|
|
|
CKERROR CreateSetDopplerScaleBehaviorProto(CKBehaviorPrototype **pproto);
|
|
int SetDopplerScale(const CKBehaviorContext& behcontext);
|
|
|
|
CKObjectDeclaration *FillBehaviorSetDopplerScaleDecl()
|
|
{
|
|
|
|
CKObjectDeclaration *od = CreateCKObjectDeclaration("Set Doppler Scale");
|
|
od->SetDescription("Controls the DopplerScale of a sound, either it is playing or not.");
|
|
/* rem:
|
|
<SPAN CLASS=in>In: </SPAN>triggers the process<BR>
|
|
<SPAN CLASS=out>Out: </SPAN>is activated when the process is completed.<BR>
|
|
<BR>
|
|
<SPAN CLASS=pin>DopplerScale : </SPAN>Controls the DopplerScale. <BR>
|
|
*/
|
|
od->SetCategory("Sounds/3D Properties");
|
|
od->SetType(CKDLL_BEHAVIORPROTOTYPE);
|
|
od->SetGuid(CKGUID(0x65f7342f,0x15a97a82));
|
|
od->SetAuthorGuid(VIRTOOLS_GUID);
|
|
od->SetAuthorName("Virtools");
|
|
od->SetVersion(0x00010000);
|
|
od->SetCreationFunction(CreateSetDopplerScaleBehaviorProto);
|
|
od->SetCompatibleClassId(CKCID_WAVESOUND);
|
|
od->NeedManager(SOUND_MANAGER_GUID);
|
|
|
|
return od;
|
|
}
|
|
|
|
|
|
CKERROR CreateSetDopplerScaleBehaviorProto(CKBehaviorPrototype **pproto)
|
|
{
|
|
CKBehaviorPrototype *proto = CreateCKBehaviorPrototype("Set Doppler Scale");
|
|
if(!proto) return CKERR_OUTOFMEMORY;
|
|
|
|
proto->DeclareInput("In");
|
|
proto->DeclareOutput("Out");
|
|
|
|
proto->DeclareInParameter("Doppler Scale",CKPGUID_FLOAT,"1");
|
|
|
|
proto->SetBehaviorFlags(CKBEHAVIOR_TARGETABLE);
|
|
proto->SetFlags(CK_BEHAVIORPROTOTYPE_OBSOLETE);
|
|
proto->SetFunction(SetDopplerScale);
|
|
|
|
*pproto = proto;
|
|
|
|
return CK_OK;
|
|
}
|
|
|
|
|
|
int SetDopplerScale(const CKBehaviorContext& behcontext)
|
|
{
|
|
CKBehavior* beh = behcontext.Behavior;
|
|
|
|
beh->ActivateInput(0,FALSE);
|
|
beh->ActivateOutput(0);
|
|
|
|
CKWaveSound* wave=(CKWaveSound*)beh->GetTarget();
|
|
if( !wave) return CKBR_OK;
|
|
|
|
float DopplerScale;
|
|
beh->GetInputParameterValue(0,&DopplerScale);
|
|
|
|
wave->SetDopplerFactor(DopplerScale);
|
|
|
|
return CKBR_OK;
|
|
}
|
|
|
|
|