Sound Effects.

This commit is contained in:
2024-01-08 04:13:27 -06:00
parent ac8bca2396
commit 6539bbdb50
45 changed files with 163 additions and 3 deletions
@@ -94,6 +94,6 @@ void EnvironmentalAudio::Update(){
float distRatio=1-distanceFromPlayer/ACTIVATION_RANGE; //0-1 where 1 is full volume.
float xDistRatio=(pos.x-game->GetPlayer()->GetX())/ACTIVATION_RANGE; //0-1 where 1 is full volume.
Audio::Engine().SetVolume(soundInstance,distRatio);
Audio::Engine().SetVolume(soundInstance,distRatio*SOUND_DATA[audioName].volume);
Audio::Engine().SetPan(soundInstance,xDistRatio);
}
@@ -3,4 +3,163 @@ Events
LowHealth = "Occurs when the player is low in health."
InCombat = "Occurs when the player is in combat."
Underwater = "Occurs when the player is in water."
SFX
{
Consume Potion
{
File[0] = consume_potion.ogg
}
Consume Item
{
File[0] = consume_item.ogg
}
Equip Armor
{
File[0] = equip.ogg
File[1] = equip2.ogg
}
Equip Accessory
{
File[0] = equip_ring.ogg
}
Footstep
{
File[0] = footsteps.ogg
}
Footstep - Wet
{
File[0] = footsteps_wet.ogg
}
Buy Item
{
File[0] = item_buy.ogg
}
Sell Item
{
File[0] = item_sell.ogg
}
Craft Item
{
File[0] = item_craft.ogg
}
Enhance Item
{
File[0] = item_enhance.ogg
}
Monster Hurt
{
File[0] = monster_hurt.ogg
}
Ranger Auto Attack
{
File[0] = ranger_auto1.ogg
File[1] = ranger_auto2.ogg
}
Ranger Backstep
{
File[0] = ranger_backstep.ogg
}
Ranger Multishot
{
File[0] = ranger_multishot.ogg
}
Ranger Rapid Fire
{
File[0] = ranger_rapid_fire.ogg
}
Ranger Charged Shot
{
File[0] = ranger_charged_shot.ogg
}
Ranger Multishot
{
File[0] = ranger_multishot.ogg
}
Slime Dead
{
File[0] = slime_dead.ogg
}
Monster Dead
{
File[0] = slime_dead2.ogg
}
Slime King Land
{
File[0] = slime_king_landing.ogg
}
Slime King Shoot
{
File[0] = slime_king_shoot.ogg
}
Slime Shoot
{
File[0] = slime_shoot.ogg
File[1] = slime_shoot2.ogg
}
Slime Walk
{
File[0] = slime_walk.ogg
File[1] = slime_walk2.ogg
File[2] = slime_walk3.ogg
}
Spell Cast
{
File[0] = spell_cast.ogg
}
Warrior Auto Attack
{
File[0] = warrior_auto1.ogg
}
Warrior Battlecry
{
File[0] = warrior_battlecry.ogg
}
Warrior Block Hit
{
File[0] = warrior_blockhit1.ogg
File[1] = warrior_blockhit2.ogg
}
Warrior Ground Slam
{
File[0] = warrior_groundslam.ogg
}
Warrior Sonic Slash
{
File[0] = warrior_sonicslash.ogg
}
Wizard Auto Attack
{
File[0] = wizard_auto1.ogg
File[1] = wizard_auto2.ogg
}
Wizard Fire Bolt
{
File[0] = wizard_firebolt.ogg
}
Wizard Fire Bolt Hit
{
File[0] = wizard_firebolt_hit.ogg
}
Wizard Lightning Bolt
{
File[0] = wizard_lightningbolt.ogg
}
Wizard Lightning Bolt Hit
{
File[0] = wizard_firebolt_hit.ogg
}
Wizard Meteor
{
File[0] = wizard_meteor.ogg
}
Wizard Meteor Flames
{
File[0] = wizard_meteor_lingering.ogg
}
Wizard Teleport
{
File[0] = wizard_teleport.ogg
}
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+3 -2
View File
@@ -89,7 +89,7 @@ namespace olc
// plays a sample, can be set to loop
void Play(const int id, const bool loop = false);
// plays a sound file, as a one off, and automatically unloads it
void Play(const std::string& path);
void Play(const std::string& path,const float&vol=1.0f);
// stops a sample, rewinds to beginning
void Stop(const int id);
// pauses a sample, does not change position
@@ -335,7 +335,7 @@ namespace olc
ma_sound_start(vecSounds.at(id));
}
void MiniAudio::Play(const std::string& path)
void MiniAudio::Play(const std::string& path,const float&vol)
{
// create the sound
ma_sound* sound = new ma_sound();
@@ -344,6 +344,7 @@ namespace olc
if(ma_sound_init_from_file(&engine, path.c_str(), MA_SOUND_FLAG_DECODE | MA_SOUND_FLAG_ASYNC, NULL, NULL, sound) != MA_SUCCESS)
throw MiniAudioSoundException();
ma_sound_set_volume(sound,vol);
ma_sound_start(sound);
vecOneOffSounds.push_back(sound);
}