From 8a1d8868c95345e2e1a4db7126391890a752e11a Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Tue, 9 Jan 2024 05:44:37 -0600 Subject: [PATCH] All sound effects now accept positions as well for surround sound effects during combat. --- .../AdventuresInLestoria.cpp | 8 ++--- Adventures in Lestoria/Audio.cpp | 29 +++++++++++++++++-- Adventures in Lestoria/Audio.h | 4 +++ Adventures in Lestoria/BuyItemWindow.cpp | 2 +- .../CharacterMenuWindow.cpp | 2 +- Adventures in Lestoria/Item.cpp | 4 +-- Adventures in Lestoria/ItemDrop.cpp | 2 +- Adventures in Lestoria/Monster.cpp | 6 ++-- Adventures in Lestoria/Ranger.cpp | 10 +++---- Adventures in Lestoria/SellItemWindow.cpp | 2 +- Adventures in Lestoria/SlimeKing.cpp | 10 +++---- Adventures in Lestoria/SoundEffect.cpp | 21 ++++++++++++-- Adventures in Lestoria/SoundEffect.h | 3 +- Adventures in Lestoria/Unlock.cpp | 8 +++++ Adventures in Lestoria/Version.h | 2 +- .../assets/config/audio/audio.txt | 2 +- .../assets/config/audio/bgm.txt | 4 +-- .../assets/config/audio/events.txt | 2 +- Adventures in Lestoria/olcPGEX_MiniAudio.h | 5 ++-- 19 files changed, 91 insertions(+), 35 deletions(-) diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp index 5a5973e0..1bac9a7a 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.cpp +++ b/Adventures in Lestoria/AdventuresInLestoria.cpp @@ -504,9 +504,9 @@ void AiL::HandleUserInput(float fElapsedTime){ } if(inWater){ - SoundEffect::PlaySFX("Footstep - Wet"); + SoundEffect::PlaySFX("Footstep - Wet",SoundEffect::CENTERED); }else{ - SoundEffect::PlaySFX("Footstep"); + SoundEffect::PlaySFX("Footstep",SoundEffect::CENTERED); } } } @@ -2251,7 +2251,7 @@ void AiL::DisplayBossEncounterInfo(){ alpha=uint8_t((bossDisplayTimer)*255); } vf2d textScale={3,5}; - DrawShadowStringPropDecal(vf2d{float(ScreenWidth()/2),float(ScreenHeight()/2)}-vf2d{GetTextSizeProp(displayText)}*textScale/2,displayText,{252, 186, 3, alpha},{128,0,0,alpha},textScale,2); + DrawShadowStringPropDecal(vf2d{float(ScreenWidth()/2),float(ScreenHeight()/2)}-vf2d{GetTextSizeProp(displayText)}*textScale/2,displayText,{252, 186, 3, alpha},{128,0,0,alpha},textScale,std::numeric_limits::max(),2); } if(InBossEncounter()){ Pixel displayCol=totalBossEncounterMobs==0?Pixel{224, 133, 29}:WHITE; @@ -2489,7 +2489,7 @@ bool AiL::UseLoadoutItem(int slot){ Inventory::UseItem(GetLoadoutItem(slot).lock()->ActualName()); GetLoadoutItem(slot).lock()->amt--; if(GetLoadoutItem(slot).lock()->UseSound().length()>0){ - SoundEffect::PlaySFX(GetLoadoutItem(slot).lock()->UseSound()); + SoundEffect::PlaySFX(GetLoadoutItem(slot).lock()->UseSound(),SoundEffect::CENTERED); } return true; } diff --git a/Adventures in Lestoria/Audio.cpp b/Adventures in Lestoria/Audio.cpp index ab7a2cb4..0bbfd135 100644 --- a/Adventures in Lestoria/Audio.cpp +++ b/Adventures in Lestoria/Audio.cpp @@ -38,6 +38,7 @@ All rights reserved. #include "Audio.h" #include "AdventuresInLestoria.h" #include "DEFINES.h" +#include "util.h" INCLUDE_game INCLUDE_DATA @@ -231,8 +232,13 @@ void Audio::SetAudioEvent(const Event&eventName){ if(Audio::BGMIsPlaying()){ BGM¤tBgm=Self().bgm[Self().currentBGM]; + + Self().targetVolumes.clear(); + + Self().fadeToTargetVolumeTime=currentBgm.GetFadeTime(); for(int currentTrackIndex=0;int trackID:currentBgm.GetChannelIDs()){ - Engine().SetVolume(trackID,currentBgm.GetVolume(eventName,currentTrackIndex)); + //Engine().SetVolume(trackID,currentBgm.GetVolume(eventName,currentTrackIndex)); + Self().targetVolumes.push_back(currentBgm.GetVolume(eventName,currentTrackIndex)); //Set the target volumes so that the engine can gradually move the volumes over to the new settings. currentTrackIndex++; } } @@ -252,16 +258,35 @@ void Audio::Update(){ if(Self().playBGMWaitTime==0.f){ BGM&track=Self().bgm[Self().playParams.sound]; track.Load(); + Self().prevVolumes.clear(); + Self().targetVolumes.clear(); + Self().fadeToTargetVolumeTime=0.f; for(int channelListIndex=0;int trackID:track.GetChannelIDs()){ - Engine().SetVolume(trackID,track.GetVolume(Self().currentAudioEvent,channelListIndex)); + float channelVol=track.GetVolume(Self().currentAudioEvent,channelListIndex); + Self().prevVolumes.push_back(channelVol); + Self().targetVolumes.push_back(channelVol); + Engine().SetVolume(trackID,channelVol); Engine().Play(trackID,Self().playParams.loop); channelListIndex++; } Self().fullyLoaded=true; } } + + if(Self().fadeToTargetVolumeTime>0.f){ + Self().fadeToTargetVolumeTime=std::max(0.f,Self().fadeToTargetVolumeTime-game->GetElapsedTime()); + for(int counter=0;float&vol:Self().prevVolumes){ + const BGM¤tBgm=Self().bgm[Self().currentBGM]; + Engine().SetVolume(currentBgm.GetChannelIDs()[counter],util::lerp(vol,Self().targetVolumes[counter],1-(Self().fadeToTargetVolumeTime/currentBgm.GetFadeTime()))); + counter++; + } + } } const bool Audio::BGMFullyLoaded(){ return Self().fullyLoaded; +} + +const float&Audio::BGM::GetFadeTime()const{ + return fadeTime; } \ No newline at end of file diff --git a/Adventures in Lestoria/Audio.h b/Adventures in Lestoria/Audio.h index b2438abc..4a80dcf9 100644 --- a/Adventures in Lestoria/Audio.h +++ b/Adventures in Lestoria/Audio.h @@ -93,6 +93,7 @@ private: void SetFadeTime(const float fadeTime); const ChannelID&GetChannelID(const int index); const ChannelIDList&GetChannelIDs()const; + const float&GetFadeTime()const; private: std::string songName; //Name of the track. std::string songFileName; //Name of the key in bgm. @@ -109,6 +110,9 @@ private: std::setevents; static float defaultFadeTime; Event currentAudioEvent="Default Volume"; + std::vectorprevVolumes; + std::vectortargetVolumes; + float fadeToTargetVolumeTime=0.f; bool fullyLoaded=true; float playBGMWaitTime=0.0f; BGMPlayParams playParams; diff --git a/Adventures in Lestoria/BuyItemWindow.cpp b/Adventures in Lestoria/BuyItemWindow.cpp index 6812dec5..a640fad0 100644 --- a/Adventures in Lestoria/BuyItemWindow.cpp +++ b/Adventures in Lestoria/BuyItemWindow.cpp @@ -86,7 +86,7 @@ void Menu::InitializeBuyItemWindow(){ Merchant&merchant=Merchant::GetCurrentTravelingMerchant(); const std::string&item=Component(BUY_ITEM,"Item Purchase Header")->GetString(A::ITEM_NAME); merchant.PurchaseItem(item,GetQuantity()); - SoundEffect::PlaySFX("Buy Item"); + SoundEffect::PlaySFX("Buy Item",SoundEffect::CENTERED); Menu::CloseMenu(); return true; })END; diff --git a/Adventures in Lestoria/CharacterMenuWindow.cpp b/Adventures in Lestoria/CharacterMenuWindow.cpp index 28415df9..b160a4c4 100644 --- a/Adventures in Lestoria/CharacterMenuWindow.cpp +++ b/Adventures in Lestoria/CharacterMenuWindow.cpp @@ -149,7 +149,7 @@ void Menu::InitializeCharacterMenuWindow(){ if(comp!=nullptr){ if(OppositeRingSlotDoesNotMatchCurrentEquip(comp)){ //If we find that the opposite ring slot is equipped to us, this would be an item swap or the exact same ring, therefore no stat calculations apply. Inventory::EquipItem(comp->GetItem(),EquipSlot(comp->I(Attribute::EQUIP_TYPE))); - SoundEffect::PlaySFX(comp->GetItem().lock()->UseSound()); + SoundEffect::PlaySFX(comp->GetItem().lock()->UseSound(),SoundEffect::CENTERED); for(MenuComponent*button:((ScrollableWindowComponent*)data.parentComponent)->GetComponents()){ RowItemDisplay*comp=DYNAMIC_CAST(button); if(comp!=nullptr){ diff --git a/Adventures in Lestoria/Item.cpp b/Adventures in Lestoria/Item.cpp index 2b6d6446..fdee5f3c 100644 --- a/Adventures in Lestoria/Item.cpp +++ b/Adventures in Lestoria/Item.cpp @@ -855,7 +855,7 @@ void Item::EnhanceItem(uint8_t qty){ } game->GetPlayer()->SetMoney(game->GetPlayer()->GetMoney()-consumedResources.GetCost()); - SoundEffect::PlaySFX("Enhance Item"); + SoundEffect::PlaySFX("Enhance Item",SoundEffect::CENTERED); }else{ //This is a craftable, so we have to give the player the item they crafted. Inventory::AddItem(ActualName()); @@ -866,7 +866,7 @@ void Item::EnhanceItem(uint8_t qty){ } game->GetPlayer()->SetMoney(game->GetPlayer()->GetMoney()-consumedResources.GetCost()); - SoundEffect::PlaySFX("Craft Item"); + SoundEffect::PlaySFX("Craft Item",SoundEffect::CENTERED); } } }; diff --git a/Adventures in Lestoria/ItemDrop.cpp b/Adventures in Lestoria/ItemDrop.cpp index 4218bfc8..e8b8394f 100644 --- a/Adventures in Lestoria/ItemDrop.cpp +++ b/Adventures in Lestoria/ItemDrop.cpp @@ -137,7 +137,7 @@ void ItemDrop::UpdateDrops(float fElapsedTime){ if(drop.collected){ Inventory::AddItem(drop.GetItem()->Name(),1,true); ItemOverlay::AddToItemOverlay(*drop.GetItem()); - SoundEffect::PlaySFX("Collect Item"); + SoundEffect::PlaySFX("Collect Item",SoundEffect::CENTERED); return true; } return false; diff --git a/Adventures in Lestoria/Monster.cpp b/Adventures in Lestoria/Monster.cpp index 338d5d57..d98ef8bf 100644 --- a/Adventures in Lestoria/Monster.cpp +++ b/Adventures in Lestoria/Monster.cpp @@ -282,7 +282,7 @@ void Monster::Moved(){ monsterWalkSoundTimer+=game->GetElapsedTime(); if(monsterWalkSoundTimer>1.f){ monsterWalkSoundTimer-=1.f; - SoundEffect::PlaySFX(GetWalkSound()); + SoundEffect::PlaySFX(GetWalkSound(),GetPos()); } } std::string Monster::GetDeathAnimationName(){ @@ -326,13 +326,13 @@ bool Monster::Hurt(int damage,bool onUpperLevel,float z){ if(!IsAlive()){ OnDeath(); - SoundEffect::PlaySFX(GetDeathSound()); + SoundEffect::PlaySFX(GetDeathSound(),GetPos()); }else{ hp=std::max(1,hp); //Make sure it stays alive if it's supposed to be alive... if(monsterHurtSoundCooldown==0.f){ monsterHurtSoundCooldown=util::random(0.5f)+0.5f; - SoundEffect::PlaySFX(GetHurtSound()); + SoundEffect::PlaySFX(GetHurtSound(),GetPos()); } } if(game->InBossEncounter()){ diff --git a/Adventures in Lestoria/Ranger.cpp b/Adventures in Lestoria/Ranger.cpp index cd8c8931..1ac0e61a 100644 --- a/Adventures in Lestoria/Ranger.cpp +++ b/Adventures in Lestoria/Ranger.cpp @@ -75,7 +75,7 @@ bool Ranger::AutoAttack(){ BULLET_LIST.push_back(std::make_unique(Arrow(GetPos(),extendedLine,vf2d{cos(angleToCursor)*"Ranger.Auto Attack.ArrowSpd"_F,float(sin(angleToCursor)*"Ranger.Auto Attack.ArrowSpd"_F-PI/8*"Ranger.Auto Attack.ArrowSpd"_F)}+movementVelocity,"Ranger.Auto Attack.Radius"_F/100*12,int(GetAttack()*"Ranger.Auto Attack.DamageMult"_F),OnUpperLevel(),true))); SetState(State::SHOOT_ARROW); SetAnimationBasedOnTargetingDirection(angleToCursor); - SoundEffect::PlaySFX("Ranger.Auto Attack.Sound"_S); + SoundEffect::PlaySFX("Ranger.Auto Attack.Sound"_S,SoundEffect::CENTERED); return true; } @@ -94,7 +94,7 @@ void Ranger::InitializeClassAbilities(){ float angleToCursor=atan2(game->GetWorldMousePos().y-p->GetPos().y,game->GetWorldMousePos().x-p->GetPos().x); p->SetAnimationBasedOnTargetingDirection(angleToCursor); p->SetState(State::RETREAT); - SoundEffect::PlaySFX("Ranger.Right Click Ability.Sound"_S); + SoundEffect::PlaySFX("Ranger.Right Click Ability.Sound"_S,SoundEffect::CENTERED); return true; }; #pragma endregion @@ -106,7 +106,7 @@ void Ranger::InitializeClassAbilities(){ if("Ranger.Ability 1.IsAnimationLocked"_I){ p->SetState(State::ANIMATION_LOCK); } - SoundEffect::PlaySFX("Ranger.Ability 1.Sound"_S); + SoundEffect::PlaySFX("Ranger.Ability 1.Sound"_S,SoundEffect::CENTERED); return true; }; #pragma endregion @@ -118,7 +118,7 @@ void Ranger::InitializeClassAbilities(){ p->SetAnimationBasedOnTargetingDirection(atan2(arrowVelocity.y,arrowVelocity.x)); game->SetupWorldShake("Ranger.Ability 2.WorldShakeTime"_F); p->Knockback(-1.f*arrowVelocity.norm()*"Ranger.Ability 2.Knockback"_F); - SoundEffect::PlaySFX("Ranger.Ability 2.Sound"_S); + SoundEffect::PlaySFX("Ranger.Ability 2.Sound"_S,SoundEffect::CENTERED); return true; }; #pragma endregion @@ -141,7 +141,7 @@ void Ranger::InitializeClassAbilities(){ BULLET_LIST.push_back(std::make_unique(Arrow(p->GetPos(),extendedLine,vf2d{cos(newAngle)*"Ranger.Ability 3.ArrowSpd"_F,float(sin(newAngle)*"Ranger.Ability 3.ArrowSpd"_F-PI/8*"Ranger.Ability 3.ArrowSpd"_F)}+p->movementVelocity,12*"Ranger.Ability 3.ArrowRadius"_F/100,int(p->GetAttack()*"Ranger.Ability 3.DamageMult"_F),p->OnUpperLevel(),true))); } p->SetAnimationBasedOnTargetingDirection(shootingAngle); - SoundEffect::PlaySFX("Ranger.Ability 3.Sound"_S); + SoundEffect::PlaySFX("Ranger.Ability 3.Sound"_S,SoundEffect::CENTERED); return true; }; #pragma endregion diff --git a/Adventures in Lestoria/SellItemWindow.cpp b/Adventures in Lestoria/SellItemWindow.cpp index cc32978b..1e768cdc 100644 --- a/Adventures in Lestoria/SellItemWindow.cpp +++ b/Adventures in Lestoria/SellItemWindow.cpp @@ -85,7 +85,7 @@ void Menu::InitializeSellItemWindow(){ sellItemWindow->ADD("Sell Button",MenuComponent)({{sellItemWindow->size.x/2+18,70},{64,12}},"Sell",[&](MenuFuncData data){ Merchant&merchant=Merchant::GetCurrentTravelingMerchant(); merchant.SellItem(Component(SELL_ITEM,"Item Sell Header")->GetItem(),GetQuantity()); - SoundEffect::PlaySFX("Sell Item"); + SoundEffect::PlaySFX("Sell Item",SoundEffect::CENTERED); Menu::CloseMenu(); return true; })END; diff --git a/Adventures in Lestoria/SlimeKing.cpp b/Adventures in Lestoria/SlimeKing.cpp index ac5f89d4..77bcd3b9 100644 --- a/Adventures in Lestoria/SlimeKing.cpp +++ b/Adventures in Lestoria/SlimeKing.cpp @@ -69,14 +69,14 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,std::string strat float angle=((2*PI)/bulletCount)*i+angleOffset; BULLET_LIST.emplace_back(std::make_unique(m.GetPos(),vf2d{cos(angle),sin(angle)}*bulletSpd,6,ConfigInt("ProjectileDamage"),m.OnUpperLevel(),false,YELLOW,vf2d{6,6})); } - SoundEffect::PlaySFX("Slime King Shoot"); + SoundEffect::PlaySFX("Slime King Shoot",m.GetPos()); }; const auto Landed=[&ShootBulletRing,&m](int currentPhase){ if(currentPhase==1){ ShootBulletRing(m.F(A::SHOOT_RING_OFFSET)); } - SoundEffect::PlaySFX("Slime King Land"); + SoundEffect::PlaySFX("Slime King Land",m.GetPos()); }; const auto TransitionPhase=[&](int newPhase){ @@ -291,7 +291,7 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,std::string strat float angle=(i-(bulletCount/2))*util::degToRad(ConfigFloat("Phase2.ShootAngleSpread"))+initialAngle; BULLET_LIST.emplace_back(std::make_unique(m.GetPos(),vf2d{cos(angle),sin(angle)}*bulletSpd,6,ConfigInt("ProjectileDamage"),m.OnUpperLevel(),false,YELLOW,vf2d{6,6})); } - SoundEffect::PlaySFX("Slime King Shoot"); + SoundEffect::PlaySFX("Slime King Shoot",m.GetPos()); } if(m.I(A::PATTERN_REPEAT_COUNT)>ConfigInt("Phase2.ShootCount")){ m.I(A::PATTERN_REPEAT_COUNT)=0; @@ -321,7 +321,7 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,std::string strat float angle=(i-(bulletCount/2))*util::degToRad(ConfigFloat("Phase3.ShootAngleSpread"))+initialAngle; BULLET_LIST.emplace_back(std::make_unique(m.GetPos(),vf2d{cos(angle),sin(angle)}*bulletSpd,6,ConfigInt("ProjectileDamage"),m.OnUpperLevel(),false,YELLOW,vf2d{6,6})); } - SoundEffect::PlaySFX("Slime King Shoot"); + SoundEffect::PlaySFX("Slime King Shoot",m.GetPos()); }else if(m.I(A::PATTERN_REPEAT_COUNT)>=4){ m.F(A::RECOVERY_TIME)=ConfigFloat("Phase3.PhaseRecoveryTime"); @@ -351,7 +351,7 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,std::string strat float spreadAngle=util::degToRad(ConfigFloat("Phase4.RandomOffsetAngle")); bulletAngle+=util::random(spreadAngle*2)-spreadAngle; BULLET_LIST.emplace_back(std::make_unique(m.GetPos(),vf2d{cos(bulletAngle),sin(bulletAngle)}*bulletSpd,6,ConfigInt("ProjectileDamage"),m.OnUpperLevel(),false,YELLOW,vf2d{6,6})); - SoundEffect::PlaySFX("Slime King Shoot"); + SoundEffect::PlaySFX("Slime King Shoot",m.GetPos()); }else if(m.I(A::PATTERN_REPEAT_COUNT)==5){ m.I(A::PATTERN_REPEAT_COUNT)++; diff --git a/Adventures in Lestoria/SoundEffect.cpp b/Adventures in Lestoria/SoundEffect.cpp index 75fc561e..484442c0 100644 --- a/Adventures in Lestoria/SoundEffect.cpp +++ b/Adventures in Lestoria/SoundEffect.cpp @@ -41,10 +41,13 @@ All rights reserved. #include "Audio.h" #include "util.h" #include "DEFINES.h" +#include "AdventuresInLestoria.h" INCLUDE_DATA +INCLUDE_game std::multimapSoundEffect::SOUND_EFFECTS; +const vf2d SoundEffect::CENTERED={-8419.f,-3289.f}; SoundEffect::SoundEffect(const std::string_view filename,const float&vol) :filename(filename),vol(vol){ @@ -62,7 +65,7 @@ void SoundEffect::Initialize(){ } } -void SoundEffect::PlaySFX(const std::string_view eventName){ +void SoundEffect::PlaySFX(const std::string_view eventName,const vf2d&pos){ if(eventName.length()==0)return; auto itr=SOUND_EFFECTS.equal_range(std::string(eventName)); size_t soundCount=std::distance(itr.first,itr.second); @@ -74,5 +77,19 @@ void SoundEffect::PlaySFX(const std::string_view eventName){ ++it; } const SoundEffect&sfx=(*it).second; - Audio::Engine().Play(operator""_SFX(sfx.filename.c_str(),sfx.filename.length()),sfx.vol); + if(pos==CENTERED){ + Audio::Engine().Play(operator""_SFX(sfx.filename.c_str(),sfx.filename.length()),sfx.vol); + }else{ + const float soundActivationRange="Audio.Environmental Audio Activation Range"_F; + + float distanceFromPlayer=geom2d::line(game->GetPlayer()->GetPos(),pos).length(); + if(distanceFromPlayerGetPlayer()->GetX())/soundActivationRange; //0-1 where 1 is full volume. + + float vol=distRatio*sfx.vol; + float pan=xDistRatio; + Audio::Engine().Play(operator""_SFX(sfx.filename.c_str(),sfx.filename.length()),vol,pan); + } + } } \ No newline at end of file diff --git a/Adventures in Lestoria/SoundEffect.h b/Adventures in Lestoria/SoundEffect.h index d3e06fab..48f6547e 100644 --- a/Adventures in Lestoria/SoundEffect.h +++ b/Adventures in Lestoria/SoundEffect.h @@ -46,8 +46,9 @@ using EventName=std::string; class SoundEffect{ public: SoundEffect(const std::string_view filename,const float&vol); - static void PlaySFX(const std::string_view eventName); + static void PlaySFX(const std::string_view eventName,const vf2d&pos); static void Initialize(); + static const vf2d CENTERED; private: static std::multimapSOUND_EFFECTS; std::string filename; diff --git a/Adventures in Lestoria/Unlock.cpp b/Adventures in Lestoria/Unlock.cpp index 0310e414..c78129ef 100644 --- a/Adventures in Lestoria/Unlock.cpp +++ b/Adventures in Lestoria/Unlock.cpp @@ -43,6 +43,14 @@ std::setUnlock::unlocks; void Unlock::Initialize(){ UnlockArea("WORLD_MAP"); UnlockArea("CAMPAIGN_1_1"); + UnlockArea("BOSS_1"); + UnlockArea("CAMPAIGN_1_2"); + UnlockArea("CAMPAIGN_1_3"); + UnlockArea("CAMPAIGN_1_4"); + UnlockArea("CAMPAIGN_1_5"); + UnlockArea("CAMPAIGN_1_6"); + UnlockArea("CAMPAIGN_1_7"); + UnlockArea("CAMPAIGN_1_8"); } void Unlock::UnlockArea(std::string mapName){ diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index 2427549f..919f56c9 100644 --- a/Adventures in Lestoria/Version.h +++ b/Adventures in Lestoria/Version.h @@ -39,7 +39,7 @@ All rights reserved. #define VERSION_MAJOR 0 #define VERSION_MINOR 2 #define VERSION_PATCH 1 -#define VERSION_BUILD 5517 +#define VERSION_BUILD 5528 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/assets/config/audio/audio.txt b/Adventures in Lestoria/assets/config/audio/audio.txt index b52b51b2..316d4ff4 100644 --- a/Adventures in Lestoria/assets/config/audio/audio.txt +++ b/Adventures in Lestoria/assets/config/audio/audio.txt @@ -1,4 +1,4 @@ Audio { - Environmental Audio Activation Range = 300 + Environmental Audio Activation Range = 400 } \ No newline at end of file diff --git a/Adventures in Lestoria/assets/config/audio/bgm.txt b/Adventures in Lestoria/assets/config/audio/bgm.txt index 25b048a8..0912f0d0 100644 --- a/Adventures in Lestoria/assets/config/audio/bgm.txt +++ b/Adventures in Lestoria/assets/config/audio/bgm.txt @@ -85,8 +85,8 @@ BGM Events { - Default Volume = 0%,0%,0%,0%,0%,70% - TitleScreenLoaded = 70%,0%,0%,0%,70%,70% + Default Volume = 0%,0%,0%,0%,50%,0% + TitleScreenLoaded = 30%,0%,0%,0%,50%,30% } } } \ No newline at end of file diff --git a/Adventures in Lestoria/assets/config/audio/events.txt b/Adventures in Lestoria/assets/config/audio/events.txt index a1a296ae..08750a27 100644 --- a/Adventures in Lestoria/assets/config/audio/events.txt +++ b/Adventures in Lestoria/assets/config/audio/events.txt @@ -113,7 +113,7 @@ Events Slime King Shoot { # Specify file names, followed by volume % - File[0] = slime_king_shoot.ogg, 100% + File[0] = slime_king_shoot.ogg, 60% } Slime Shoot { diff --git a/Adventures in Lestoria/olcPGEX_MiniAudio.h b/Adventures in Lestoria/olcPGEX_MiniAudio.h index e0d3c292..f8e1a51e 100644 --- a/Adventures in Lestoria/olcPGEX_MiniAudio.h +++ b/Adventures in Lestoria/olcPGEX_MiniAudio.h @@ -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,const float&vol=1.0f); + void Play(const std::string& path,const float&vol=1.0f,const float&pan=0.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,const float&vol) + void MiniAudio::Play(const std::string& path,const float&vol,const float&pan) { // create the sound ma_sound* sound = new ma_sound(); @@ -345,6 +345,7 @@ namespace olc throw MiniAudioSoundException(); ma_sound_set_volume(sound,vol); + ma_sound_set_pan(sound,pan); ma_sound_start(sound); vecOneOffSounds.push_back(sound); }