本文整理汇总了C++中Sound函数的典型用法代码示例。如果您正苦于以下问题:C++ Sound函数的具体用法?C++ Sound怎么用?C++ Sound使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Sound函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Reset8910
void Reset8910(register AY8910 *D,int First)
{
static byte RegInit[16] =
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFD,
0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00
};
int J;
#define ClockHz 4000000
/* Reset state */
memcpy(D->R,RegInit,sizeof(D->R));
D->EPhase = 0;
D->Clock = ClockHz>>4;
D->First = First;
D->Sync = AY8910_ASYNC;
D->Changed = 0x00;
D->EPeriod = 0;
D->ECount = 0;
D->Latch = 0x00;
/* Set sound types */
SetSound(0+First,SND_MELODIC);
SetSound(1+First,SND_MELODIC);
SetSound(2+First,SND_MELODIC);
SetSound(3+First,SND_NOISE);
SetSound(4+First,SND_NOISE);
SetSound(5+First,SND_NOISE);
/* Silence all channels */
for(J=0;J<AY8910_CHANNELS;J++)
{
D->Freq[J]=D->Volume[J]=0;
Sound(J+First,0,0);
}
}
示例2: ADDTOCALLSTACK
void CChar::NPC_OnHirePayMore( CItem * pGold, bool fHire )
{
ADDTOCALLSTACK("CChar::NPC_OnHirePayMore");
// We have been handed money.
// similar to PC_STATUS
CCharBase * pCharDef = Char_GetDef();
unsigned int iWage = pCharDef->GetHireDayWage();
CItemContainer *pBank = GetBank();
if ( !iWage || !pBank )
return;
if ( pGold )
{
if ( fHire )
{
pBank->m_itEqBankBox.m_Check_Amount = 0; // zero any previous balance.
}
pBank->m_itEqBankBox.m_Check_Amount += pGold->GetAmount();
Sound( pGold->GetDropSound( NULL ));
pGold->Delete();
}
TCHAR *pszMsg = Str_GetTemp();
sprintf(pszMsg, g_Cfg.GetDefaultMsg(DEFMSG_NPC_PET_HIRE_TIME), pBank->m_itEqBankBox.m_Check_Amount / iWage);
Speak(pszMsg);
}
示例3: ADDTOCALLSTACK
int CChar::Use_PlayMusic( CItem * pInstrument, int iDifficultyToPlay )
{
ADDTOCALLSTACK("CChar::Use_PlayMusic");
// SKILL_ENTICEMENT, SKILL_MUSICIANSHIP,
// ARGS:
// iDifficultyToPlay = 0-100
// RETURN:
// >=0 = success
// -1 = too hard for u.
// -2 = can't play. no instrument.
if ( !pInstrument )
{
pInstrument = ContentFind(RESOURCE_ID(RES_TYPEDEF, IT_MUSICAL), 0, 1);
if ( !pInstrument )
{
SysMessageDefault(DEFMSG_MUSICANSHIP_NOTOOL);
return -2;
}
}
bool fSuccess = Skill_UseQuick(SKILL_MUSICIANSHIP, iDifficultyToPlay, (Skill_GetActive() != SKILL_MUSICIANSHIP));
Sound(pInstrument->Use_Music(fSuccess));
if ( fSuccess )
return iDifficultyToPlay; // success
// Skill gain for SKILL_MUSICIANSHIP failure will need to be triggered
// manually, since Skill_UseQuick isn't going to do it for us in this case
if ( Skill_GetActive() == SKILL_MUSICIANSHIP )
Skill_Experience(SKILL_MUSICIANSHIP, -iDifficultyToPlay);
SysMessageDefault(DEFMSG_MUSICANSHIP_POOR);
return -1; // fail
}
示例4: CheckForEnemies
func CheckForEnemies(Size)
{
for(var o in FindObjects(Find_Distance(Size), Find_Func("CanBeHit", this)))
{
if(o->GetOwner() == GetOwner() || GetEffect("BallHitCD", o))
continue;
o->AddBallHitEffect();
o->Fling(0, -2);
AddEffect("BallHitCD", o, 1, 15);
var trailparticles =
{
Prototype = Particles_ElectroSpark2(),
Size = PV_Linear(PV_Random(5,15),0),
BlitMode = GFX_BLIT_Additive,
Rotation = PV_Random(0,360),
R = pR,
G = pG,
B = pB,
};
CreateParticle("Lightning", o->GetX() - GetX(), o->GetY() - GetY(), 0, 0, 10, trailparticles, 5);
WeaponDamage(o, SpellDamage);
Sound("Ball::ball_hit", false, 50);
}
}
示例5: KillBall
func KillBall()
{
Sound("Ball::ball_die", false, 50);
if(rangedummy)
rangedummy->RemoveObject();
RemoveObject();
}
示例6: C4Vizatergo_Explode
void C4Vizatergo_Explode(ServerEntity_t *eVizatergo)
{
Sound(eVizatergo,CHAN_AUTO,va("fx/explosion%i.wav",rand()%6+1),255,ATTN_NORM);
Entity_RadiusDamage(eVizatergo,MONSTER_RANGE_NEAR,40,DAMAGE_TYPE_EXPLODE);
Entity_Remove(eVizatergo);
}
示例7: Point_EffectUse
void Point_EffectUse(ServerEntity_t *eEntity)
{
switch(eEntity->local.style)
{
case 1:
Entity_RadiusDamage(eEntity,MONSTER_RANGE_MEDIUM,eEntity->local.iDamage, eEntity->local.iDamageType);
break;
case 2:
Engine.WriteByte(MSG_BROADCAST,SVC_TEMPENTITY);
Engine.WriteByte(MSG_BROADCAST,CTE_GUNSHOT);
Engine.WriteCoord(MSG_BROADCAST,eEntity->v.origin[0]);
Engine.WriteCoord(MSG_BROADCAST,eEntity->v.origin[1]);
Engine.WriteCoord(MSG_BROADCAST,eEntity->v.origin[2]);
break;
case 3:
Engine.WriteByte(MSG_BROADCAST,SVC_TEMPENTITY);
Engine.WriteByte(MSG_BROADCAST,CTE_TELEPORT);
Engine.WriteCoord(MSG_BROADCAST,eEntity->v.origin[0]);
Engine.WriteCoord(MSG_BROADCAST,eEntity->v.origin[1]);
Engine.WriteCoord(MSG_BROADCAST,eEntity->v.origin[2]);
break;
default:
Engine.Con_Warning("Unknown effect style! (%i)\n",eEntity->local.style);
}
if(eEntity->v.noise)
Sound(eEntity,CHAN_ITEM,eEntity->v.noise,255,ATTN_NORM);
}
示例8: Sound
void CSounds::OnRender()
{
// check for sound initialisation
if(m_WaitForSoundJob)
{
if(m_SoundJob.Status() == CJob::STATE_DONE)
m_WaitForSoundJob = false;
else
return;
}
// set listner pos
Sound()->SetListenerPos(m_pClient->m_pCamera->m_Center.x, m_pClient->m_pCamera->m_Center.y);
// play sound from queue
if(m_QueuePos > 0)
{
int64 Now = time_get();
if(m_QueueWaitTime <= Now)
{
Play(m_aQueue[0].m_Channel, m_aQueue[0].m_SetId, 1.0f, vec2(0,0));
m_QueueWaitTime = Now+time_freq()*3/10; // wait 300ms before playing the next one
if(--m_QueuePos > 0)
mem_move(m_aQueue, m_aQueue+1, m_QueuePos*sizeof(QueueEntry));
}
}
}
示例9: Intro_PlaneHit
func Intro_PlaneHit()
{
// Plane hit ground! Continue sequence.
Sound("Objects::Plane::PlaneCrash", true);
SetR(-90);
var particles = Particles_Smoke(true);
particles.Size = PV_Linear(PV_Random(20, 60), PV_Random(50, 100));
CreateParticle("Smoke", PV_Random(-30,30), PV_Random(-30,30), PV_Random(-60, 60), PV_Random(-20,0), PV_Random(200, 500), particles, 20);
particles.Size = PV_Linear(PV_Random(50, 80), PV_Random(100, 200));
CreateParticle("Smoke", PV_Random(-30,30), PV_Random(-30,30), PV_Random(-20, 20), PV_Random(-20,0), PV_Random(100, 200), particles, 20);
for (var iplr=0,plr; iplr<GetPlayerCount(C4PT_User); ++iplr)
{
plr = GetPlayerByIndex(iplr, C4PT_User);
var icrew=0,crew;
while (crew=GetCrew(plr, icrew++))
{
crew->Exit(0,-5, 0, Random(1)+1, Random(5)-6);
crew->SetAction("Tumble");
}
}
SetMeshMaterial("CrashedAirplane");
this.MeshTransformation=Trans_Mul(Trans_Rotate(10,0,2,1), Airplane.MeshTransformation);
this.Hit = this.intro_seq.plane_Hit;
this.intro_seq.plane_crashed = true;
this.intro_seq->ScheduleNext(50);
return true;
}
示例10: FxLifeStop
func FxLifeStop(object target, proplist effect, int reason, bool temporary)
{
if(temporary)
return;
var prt = {
Size = 15,
Alpha = PV_Linear(255, 0),
Rotation = PV_Step(15, PV_Random(0, 360)),
ForceY = GetGravity()
};
CreateParticle("SawbladePrt", 0, 0, PV_Random(-35, 35), PV_Random(-35, 5), 40, prt, 6);
var prt2 = {
Size = PV_Linear(2, 0),
ForceY = GetGravity(),
Stretch = PV_Speed(1000, 500),
Rotation = PV_Direction(),
R = 255,
G = PV_Linear(128,32),
B = PV_Random(0, 128, 2),
Alpha = PV_Random(255,0,3),
BlitMode = GFX_BLIT_Additive,
};
CreateParticle("Flash", 0, 0, PV_Random(-35, 35), PV_Random(-35, 5), 70, prt2, 20);
Sound("sawblade_destroyed", false, 50);
RemoveObject();
}
示例11: AddSystem
void CEngine::CreateSystems()
{
AddSystem( Input() );
AddSystem( Sound() );
AddSystem( Physics() );
AddSystem( Script() );
}
示例12: Initialize
protected func Initialize()
{
SetVisibility(VIS_All());
SetPlrView(GetOwner(), this());
SetAction("Fly");
Sound("Morse", 0,this(),100,0, 1);
}
示例13: setSize
Gib::Gib
(
str name,
qboolean blood_trail,
str bloodtrailname,
str bloodspurtname,
str bloodsplatname,
float bloodsplatsize,
float pitch
)
{
setSize( Vector( "0 0 0" ), Vector( "0 0 0" ) );
if ( name.length() )
setModel( name.c_str() );
setMoveType( MOVETYPE_GIB );
setSolidType( SOLID_BBOX );
takedamage = DAMAGE_YES;
sprayed = false;
fadesplat = true;
scale = 2.0f;
next_bleed_time = 0;
final_pitch = pitch;
if ( blood_trail )
{
// Make a blood emitter and bind it to the head
blood = new Mover;
if ( bloodtrailname.length() )
blood->setModel( bloodtrailname.c_str() );
blood->setMoveType( MOVETYPE_BOUNCE );
blood->setSolidType( SOLID_NOT );
blood->bind( this );
// Save the blood spurt name
if ( bloodspurtname.length() )
blood_spurt_name = bloodspurtname;
// Save the blood splat name
if ( bloodsplatname.length() )
blood_splat_name = bloodsplatname;
blood_splat_size = bloodsplatsize;
}
else
{
blood = NULL;
}
Sound( "snd_decap", CHAN_BODY, 1, 300 );
}
示例14: Area_PlatformTouch
void Area_PlatformTouch(ServerEntity_t *eArea, ServerEntity_t *eOther) {
if(eArea->local.flags == STATE_UP || eArea->local.flags == STATE_TOP)
return;
if((eOther->Monster.type != MONSTER_PLAYER) && eOther->v.health <= 0)
return;
if(eArea->v.nextthink > eArea->v.ltime)
return;
eArea->local.flags = STATE_UP;
Area_Move(eArea, eArea->local.pos2, eArea->local.speed, Area_PlatformWait);
if(eArea->local.cSoundStart)
Sound(eArea,CHAN_BODY,eArea->local.cSoundStart,255,ATTN_NORM);
if(eArea->local.cSoundMoving)
Sound(eArea,CHAN_VOICE,eArea->local.cSoundMoving,255,ATTN_NORM);
}
示例15: Area_ButtonDone
void Area_ButtonDone(ServerEntity_t *eArea, ServerEntity_t *other) {
eArea->local.flags = STATE_DOWN;
eArea->local.value = 0;
if (eArea->local.sound_stop) {
Sound(eArea, CHAN_VOICE, eArea->local.sound_stop, 255, ATTN_NORM);
}
}