Sound update

This commit is contained in:
yvt 2013-10-07 20:19:11 +09:00
parent fa8297f813
commit b9226ec964
6 changed files with 49 additions and 43 deletions

View File

@ -1,6 +1,6 @@
All paks for development vesion:
http://yvt.jp/files/programs/osppaks/DevPaks6.zip
http://yvt.jp/files/programs/osppaks/DevPaks7.zip

View File

@ -111,7 +111,7 @@
param.volume = 8.f;
audioDevice.Play(fireSound, origin, param);
param.volume = 1.f;
param.volume = 3.f;
audioDevice.Play(fireFarSound, origin, param);
audioDevice.Play(fireStereoSound, origin, param);
}

View File

@ -81,7 +81,8 @@
private AudioDevice@ audioDevice;
private Model@ model;
private AudioChunk@ fireSound;
private AudioChunk@[] fireSounds(4);
private AudioChunk@[] fireMediumSounds(4);
private AudioChunk@ fireFarSound;
private AudioChunk@ fireStereoSound;
private AudioChunk@[] fireMechSounds(4);
@ -94,8 +95,22 @@
("Models/Weapons/SMG/Weapon.kv6");
@fireSound = dev.RegisterSound
("Sounds/Weapons/SMG/Fire.wav");
@fireSounds[0] = dev.RegisterSound
("Sounds/Weapons/SMG/Fire1.wav");
@fireSounds[1] = dev.RegisterSound
("Sounds/Weapons/SMG/Fire2.wav");
@fireSounds[2] = dev.RegisterSound
("Sounds/Weapons/SMG/Fire3.wav");
@fireSounds[3] = dev.RegisterSound
("Sounds/Weapons/SMG/Fire4.wav");
@fireMediumSounds[0] = dev.RegisterSound
("Sounds/Weapons/SMG/FireMedium1.wav");
@fireMediumSounds[1] = dev.RegisterSound
("Sounds/Weapons/SMG/FireMedium2.wav");
@fireMediumSounds[2] = dev.RegisterSound
("Sounds/Weapons/SMG/FireMedium3.wav");
@fireMediumSounds[3] = dev.RegisterSound
("Sounds/Weapons/SMG/FireMedium4.wav");
@fireFarSound = dev.RegisterSound
("Sounds/Weapons/SMG/FireFar.wav");
@fireStereoSound = dev.RegisterSound
@ -103,14 +118,6 @@
@reloadSound = dev.RegisterSound
("Sounds/Weapons/SMG/Reload.wav");
@fireMechSounds[0] = dev.RegisterSound
("Sounds/Weapons/SMG/Mech1.wav");
@fireMechSounds[1] = dev.RegisterSound
("Sounds/Weapons/SMG/Mech2.wav");
@fireMechSounds[2] = dev.RegisterSound
("Sounds/Weapons/SMG/Mech3.wav");
@fireMechSounds[3] = dev.RegisterSound
("Sounds/Weapons/SMG/Mech4.wav");
}
void Update(float dt) {
@ -120,17 +127,14 @@
if(!muted){
Vector3 origin = originMatrix * Vector3(0.f, 0.f, 0.f);
AudioParam param;
param.volume = 8.f;
audioDevice.Play(fireSound, origin, param);
param.volume = 4.f;
audioDevice.Play(fireMediumSounds[GetRandom(fireMediumSounds.length)], origin, param);
param.volume = 1.f;
param.volume = .8f;
param.referenceDistance = 5.f;
audioDevice.Play(fireFarSound, origin, param);
audioDevice.Play(fireStereoSound, origin, param);
AudioChunk@ mechSound;
@mechSound = fireMechSounds[GetRandom(fireMechSounds.length)];
param.volume = 1.4;
audioDevice.Play(mechSound, origin, param);
}
}
void ReloadingWeapon() {

View File

@ -28,10 +28,9 @@
private Model@ gunModel;
private Model@ magazineModel;
private AudioChunk@ fireSound;
private AudioChunk@[] fireSounds(4);
private AudioChunk@ fireFarSound;
private AudioChunk@ fireStereoSound;
private AudioChunk@[] fireMechSounds(4);
private AudioChunk@ reloadSound;
ViewSMGSkin(Renderer@ r, AudioDevice@ dev) {
@ -42,8 +41,14 @@
@magazineModel = renderer.RegisterModel
("Models/Weapons/SMG/Magazine.kv6");
@fireSound = dev.RegisterSound
("Sounds/Weapons/SMG/FireLocal.wav");
@fireSounds[0] = dev.RegisterSound
("Sounds/Weapons/SMG/FireLocal1.wav");
@fireSounds[1] = dev.RegisterSound
("Sounds/Weapons/SMG/FireLocal2.wav");
@fireSounds[2] = dev.RegisterSound
("Sounds/Weapons/SMG/FireLocal3.wav");
@fireSounds[3] = dev.RegisterSound
("Sounds/Weapons/SMG/FireLocal4.wav");
@fireFarSound = dev.RegisterSound
("Sounds/Weapons/SMG/FireFar.wav");
@fireStereoSound = dev.RegisterSound
@ -51,14 +56,6 @@
@reloadSound = dev.RegisterSound
("Sounds/Weapons/SMG/ReloadLocal.wav");
@fireMechSounds[0] = dev.RegisterSound
("Sounds/Weapons/SMG/Mech1.wav");
@fireMechSounds[1] = dev.RegisterSound
("Sounds/Weapons/SMG/Mech2.wav");
@fireMechSounds[2] = dev.RegisterSound
("Sounds/Weapons/SMG/Mech3.wav");
@fireMechSounds[3] = dev.RegisterSound
("Sounds/Weapons/SMG/Mech4.wav");
}
void Update(float dt) {
@ -72,16 +69,12 @@
Vector3 origin = Vector3(0.4f, -0.3f, 0.5f);
AudioParam param;
param.volume = 8.f;
audioDevice.PlayLocal(fireSound, origin, param);
audioDevice.PlayLocal(fireSounds[GetRandom(fireSounds.length)], origin, param);
param.volume = 1.f;
param.volume = 1.5f;
audioDevice.PlayLocal(fireFarSound, origin, param);
audioDevice.PlayLocal(fireStereoSound, origin, param);
AudioChunk@ mechSound;
@mechSound = fireMechSounds[GetRandom(fireMechSounds.length)];
param.volume = 1.4;
audioDevice.PlayLocal(mechSound, origin, param);
}
}

View File

@ -79,7 +79,7 @@
Vector3 origin = Vector3(0.4f, -0.3f, 0.5f);
AudioParam param;
param.volume = 0.2f;
audioDevice.PlayLocal(fireSound, origin, param);
audioDevice.PlayLocal(reloadSound, origin, param);
}
}

View File

@ -3883,26 +3883,35 @@ namespace spades {
GrenadeExplosion(g->GetPosition());
if(!IsMuted()){
Handle<IAudioChunk> c = audioDevice->RegisterSound("Sounds/Weapons/Grenade/Explode.wav");
Handle<IAudioChunk> c = audioDevice->RegisterSound((rand()&32)?"Sounds/Weapons/Grenade/Explode1.wav":
"Sounds/Weapons/Grenade/Explode2.wav");
AudioParam param;
param.volume = 10.f;
param.referenceDistance = 5.f;
audioDevice->Play(c, g->GetPosition(),
param);
c = audioDevice->RegisterSound("Sounds/Weapons/Grenade/ExplodeStereo.wav");
audioDevice->Play(c, g->GetPosition(),
param);
c = audioDevice->RegisterSound("Sounds/Weapons/Grenade/ExplodeFar.wav");
param.volume = 40.f;
param.volume = .3f;
param.referenceDistance = 50.f;
audioDevice->Play(c, g->GetPosition(),
param);
c = audioDevice->RegisterSound("Sounds/Weapons/Grenade/ExplodeStereo.wav");
param.volume = 40.f;
c = audioDevice->RegisterSound("Sounds/Weapons/Grenade/ExplodeFarStereo.wav");
param.volume = .3f;
param.referenceDistance = 50.f;
audioDevice->Play(c, g->GetPosition(),
param);
// debri sound
c = audioDevice->RegisterSound("Sounds/Weapons/Grenade/Debris.wav");
param.volume = 5.f;
param.referenceDistance = 1.f;
IntVector3 outPos;
Vector3 soundPos = g->GetPosition();
if(world->GetMap()->CastRay(soundPos,