Skip to content

Commit

Permalink
sound sources, setup in cfg, gui all
Browse files Browse the repository at this point in the history
  • Loading branch information
cryham committed Nov 30, 2024
1 parent 2dce01f commit f896386
Show file tree
Hide file tree
Showing 11 changed files with 172 additions and 77 deletions.
111 changes: 91 additions & 20 deletions data/gui/Game_Options.layout
Original file line number Diff line number Diff line change
Expand Up @@ -1544,39 +1544,39 @@

<Widget type="TextBox" skin="TextBox" position="32 110 144 24">
<Property key="Caption" value="#{Engine}"/>
<Property key="TextColour" value="0.8 0.85 1.0"/>
<Property key="TextColour" value="1 0.7 0.7"/>
</Widget>
<Widget type="Slider" skin="Slider" position="248 110 320 18" name="VolEngine">
<Property key="Colour" value="0.8 0.9 1"/>
<Property key="Colour" value="1 0.7 0.7"/>
</Widget>
<Widget type="TextBox" skin="TextBox" position="180 110 60 24" name="VolEngineVal">
<Property key="TextColour" value="0.8 0.85 1.0"/>
<Property key="TextColour" value="1 0.8 0.8"/>
</Widget>

<Widget type="TextBox" skin="TextBox" position="32 140 144 24">
<Property key="Caption" value="#{Tires}"/>
<Property key="TextColour" value="0.75 0.8 1.0"/>
<Property key="TextColour" value="0.8 0.8 0.8"/>
</Widget>
<Widget type="Slider" skin="Slider" position="248 140 320 18" name="VolTires">
<Property key="Colour" value="0.8 0.9 1"/>
<Property key="Colour" value="0.8 0.8 0.8"/>
</Widget>
<Widget type="TextBox" skin="TextBox" position="180 140 60 24" name="VolTiresVal">
<Property key="TextColour" value="0.75 0.8 1.0"/>
<Property key="TextColour" value="0.9 0.9 0.9"/>
</Widget>

<Widget type="TextBox" skin="TextBox" position="32 170 144 24">
<Property key="Caption" value="#{Suspension}"/>
<Property key="TextColour" value="0.75 0.8 1.0"/>
<Property key="TextColour" value="0.9 0.9 0.6"/>
</Widget>
<Widget type="Slider" skin="Slider" position="248 170 320 18" name="VolSusp">
<Property key="Colour" value="0.8 0.9 1"/>
<Property key="Colour" value="0.9 0.9 0.7"/>
</Widget>
<Widget type="TextBox" skin="TextBox" position="180 170 60 24" name="VolSuspVal">
<Property key="TextColour" value="0.75 0.8 1.0"/>
<Property key="TextColour" value="0.9 0.9 0.7"/>
</Widget>

<Widget type="TextBox" skin="TextBox" position="32 200 144 24">
<Property key="Caption" value="#{Environment}"/>
<Property key="Caption" value="#{Environment}"/> <!-- wind -->
<Property key="TextColour" value="0.6 0.75 1.0"/>
</Widget>
<Widget type="Slider" skin="Slider" position="248 200 320 18" name="VolEnv">
Expand All @@ -1586,22 +1586,27 @@
<Property key="TextColour" value="0.6 0.75 1.0"/>
</Widget>

<!-- <Widget type="TextBox" skin="TextBox" position="32 230 144 24">
<Widget type="TextBox" skin="TextBox" position="32 290 144 24">
<Property key="Caption" value="#{Ambience}"/>
<Property key="TextColour" value="0.6 1.0 0.5"/>
<Property key="TextColour" value="0.7 0.9 0.6"/>
</Widget>
<Widget type="Slider" skin="Slider" position="248 230 320 18" name="VolAmbient">
<Property key="Colour" value="0.8 1 0.7"/>
<Widget type="Slider" skin="Slider" position="248 290 320 18" name="VolAmbient">
<Property key="Colour" value="0.7 1.0 0.6"/>
</Widget>
<Widget type="TextBox" skin="TextBox" position="180 290 60 24" name="VolAmbientVal">
<Property key="TextColour" value="0.7 1.0 0.6"/>
</Widget>
<Widget type="TextBox" skin="TextBox" position="180 230 60 24" name="VolAmbientVal">
<Property key="TextColour" value="0.6 1.0 0.5"/>
</Widget> -->

<Widget type="Button" skin="CheckBox" position="32 256 408 24" name="ChkReverb">
<Property key="Caption" value="#{Reverb} **"/>
<Property key="TextColour" value="0.6 0.8 1.0"/>
</Widget>

<Widget type="TextBox" skin="TextBox" position="248 432 484 24">
<Property key="Caption" value="#{TipSliderReset}"/>
<Property key="TextColour" value="0.45 0.55 0.65"/>
</Widget>

<Widget type="ImageBox" skin="ImageBox" position="640 20 100 100">
<Property key="ImageCoord" value="128 128 128 128"/>
<Property key="Alpha" value="0.6"/>
Expand Down Expand Up @@ -1632,10 +1637,76 @@
<Property key="TextColour" value="0.65 0.8 0.9"/>
</Widget>

<Widget type="TextBox" skin="TextBox" position="248 432 484 24">
<Property key="Caption" value="#{TipSliderReset}"/>
<Property key="TextColour" value="0.45 0.55 0.65"/>
<Widget type="ImageBox" skin="ImageBox" position="640 20 100 100">
<Property key="ImageCoord" value="128 128 128 128"/>
<Property key="Alpha" value="0.6"/>
<Property key="ImageTexture" value="gui_icons.png"/>
</Widget>
</Widget>

<Widget type="TabItem" skin="" position="2 24 738 472">
<Property key="Caption" value="#A0C0E0#{Settings}"/>

<Widget type="TextBox" skin="TextBox" position="32 110 144 24">
<Property key="Caption" value="Sources"/>
<Property key="TextColour" value="1 0.7 0.7"/>
</Widget>
<Widget type="Slider" skin="Slider" position="248 110 320 18" name="SndSources">
<Property key="Colour" value="1 0.7 0.7"/>
</Widget>
<Widget type="TextBox" skin="TextBox" position="180 110 60 24" name="SndSourcesVal">
<Property key="TextColour" value="1 0.8 0.8"/>
</Widget>

<Widget type="TextBox" skin="TextBox" position="32 140 144 24">
<Property key="Caption" value="#{Tires}"/>
<Property key="TextColour" value="0.8 0.8 0.8"/>
</Widget>
<Widget type="Slider" skin="Slider" position="248 140 320 18" name="SndSrcDyn">
<Property key="Colour" value="0.8 0.8 0.8"/>
</Widget>
<Widget type="TextBox" skin="TextBox" position="180 140 60 24" name="SndSrcDynVal">
<Property key="TextColour" value="0.9 0.9 0.9"/>
</Widget>

<!-- <Widget type="TextBox" skin="TextBox" position="32 170 144 24">
<Property key="Caption" value="#{Suspension}"/>
<Property key="TextColour" value="0.9 0.9 0.6"/>
</Widget>
<Widget type="Slider" skin="Slider" position="248 170 320 18" name="VolSusp">
<Property key="Colour" value="0.9 0.9 0.7"/>
</Widget>
<Widget type="TextBox" skin="TextBox" position="180 170 60 24" name="VolSuspVal">
<Property key="TextColour" value="0.9 0.9 0.7"/>
</Widget>
<Widget type="TextBox" skin="TextBox" position="32 200 144 24">
<Property key="Caption" value="#{Environment}"/>
<Property key="TextColour" value="0.6 0.75 1.0"/>
</Widget>
<Widget type="Slider" skin="Slider" position="248 200 320 18" name="VolEnv">
<Property key="Colour" value="0.8 0.9 1"/>
</Widget>
<Widget type="TextBox" skin="TextBox" position="180 200 60 24" name="VolEnvVal">
<Property key="TextColour" value="0.6 0.75 1.0"/>
</Widget>
<Widget type="TextBox" skin="TextBox" position="32 290 144 24">
<Property key="Caption" value="#{Ambience}"/>
<Property key="TextColour" value="0.7 0.9 0.6"/>
</Widget>
<Widget type="Slider" skin="Slider" position="248 290 320 18" name="VolAmbient">
<Property key="Colour" value="0.7 1.0 0.6"/>
</Widget>
<Widget type="TextBox" skin="TextBox" position="180 290 60 24" name="VolAmbientVal">
<Property key="TextColour" value="0.7 1.0 0.6"/>
</Widget> -->

<Widget type="Button" skin="CheckBox" position="32 388 408 24" name="SndDynamic">
<Property key="Caption" value="#{Dynamic} #{Objects}"/>
<Property key="TextColour" value="0.8 0.9 0.9"/>
</Widget>

<Widget type="ImageBox" skin="ImageBox" position="640 20 100 100">
<Property key="ImageCoord" value="128 128 128 128"/>
<Property key="Alpha" value="0.6"/>
Expand Down
6 changes: 4 additions & 2 deletions docs/Roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,10 @@ specular on terrain
trails after particles/clouds
car glass, pipes, beam etc not visible in fluid if seen from above

rivers wrong way
waterfalls refract cuts off above cam y
rqg rivers after water
river alpha fade last segs
*rivers* wrong way
waterfalls refract *cuts* off above cam y

Pbs particles, fade from fog, soft

Expand Down
5 changes: 4 additions & 1 deletion src/common/GuiCom.h
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,10 @@ class CGuiCom : public BaseGui
SV svVolTires, svVolSusp, svVolEnv;
SV svVolFlSplash, svVolFlCont, svVolCarCrash, svVolCarScrap;
Ck ckSndChk, ckSndChkWr;
#endif
#endif // setup
SV svSndRefDist, svSndRolloff, svSndMaxDist;
SV svSndBuf, svSndSrc, svSndSrcDyn;


// ⚙️ Settings --------------------------
// startup common
Expand Down
13 changes: 11 additions & 2 deletions src/common/GuiCom_Options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,8 @@ void CGuiCom::GuiInitGraphics() // ? not yet: called on preset change with bGI
// ck= &ckSoftPar; ck->Init("SoftParticles",&pSet->softparticles); Cev(EffUpdShd);


// 🔉 Sound --------
// 🔉 Sound
//------------------------------------------------------------
sv= &svVolMaster; sv->Init("VolMaster", &pSet->s.vol_master, 0.f, 2.0f); sv->DefaultF(1.55f); SevC(VolMaster);
sv= &svVolAmbient; sv->Init("VolAmbient", &pSet->s.vol_ambient, 0.f, 2.0f); sv->DefaultF(1.f);

Expand All @@ -269,10 +270,18 @@ void CGuiCom::GuiInitGraphics() // ? not yet: called on preset change with bGI

ck= &ckSndChk; ck->Init("SndChk", &pSet->s.snd_chk);
ck= &ckSndChkWr; ck->Init("SndChkWr", &pSet->s.snd_chkwr);
#endif
#endif // setup
ck= &ckReverb; ck->Init("ChkReverb", &pSet->s.snd_reverb);
sv= &svVolHud; sv->Init("VolHud", &pSet->s.vol_hud, 0.f, 2.f); sv->DefaultF(0.75f); SevC(VolHud);

sv= &svSndBuf; sv->Init("SndBuf", &pSet->s.cnt_buffers, 256, 2048, 2); sv->DefaultI(1024);
sv= &svSndSrc; sv->Init("SndSrc", &pSet->s.cnt_sources, 64, 1024, 2); sv->DefaultI(244);
sv= &svSndSrcDyn; sv->Init("SndSrcDyn", &pSet->s.cnt_dynamics, 6, 256, 2); sv->DefaultI(12);

sv= &svSndRefDist; sv->Init("SndRefDist", &pSet->s.ref_dist, 0.01f, 100.f, 2.f); sv->DefaultF(1.f);
sv= &svSndMaxDist; sv->Init("SndMaxDist", &pSet->s.max_dist, 0.01f, 1500.f, 2.f); sv->DefaultF(500.f);
sv= &svSndRolloff; sv->Init("SndRolloff", &pSet->s.rolloff, 0.00f, 1.f, 2.f); sv->DefaultF(0.05f);


// ⚙️ Settings 🆕 Startup common
//------------------------------------------------------------
Expand Down
21 changes: 12 additions & 9 deletions src/common/settings_com.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,18 +101,21 @@ void SETcom::SerializeCommon(bool w, CONFIGFILE & c)


// 🔊 Sounds --------
Param(c,w, "sound.device", s.snd_device); Param(c,w, "sound.reverb", s.snd_reverb);
Param(c,w, "sound.volume", s.vol_master); Param(c,w, "sound.ambient", s.vol_ambient);
Param(c,w, "sound.volume", s.vol_master); Param(c,w, "sound.ambient", s.vol_ambient);
#ifndef SR_EDITOR // game only
Param(c,w, "sound.vol_engine", s.vol_engine); Param(c,w, "sound.vol_turbo", s.vol_turbo);
Param(c,w, "sound.vol_tires", s.vol_tires); Param(c,w, "sound.vol_env", s.vol_env);
Param(c,w, "sound.vol_engine", s.vol_engine); Param(c,w, "sound.vol_turbo", s.vol_turbo);
Param(c,w, "sound.vol_tires", s.vol_tires); Param(c,w, "sound.vol_env", s.vol_env);
Param(c,w, "sound.vol_susp", s.vol_susp);
Param(c,w, "sound.vol_fl_splash", s.vol_fl_splash); Param(c,w, "sound.vol_fl_cont", s.vol_fl_cont);
Param(c,w, "sound.vol_car_crash", s.vol_car_crash); Param(c,w, "sound.vol_car_scrap", s.vol_car_scrap);
Param(c,w, "sound.vol_fl_splash", s.vol_fl_splash); Param(c,w, "sound.vol_fl_cont", s.vol_fl_cont);
Param(c,w, "sound.vol_car_crash", s.vol_car_crash); Param(c,w, "sound.vol_car_scrap", s.vol_car_scrap);
Param(c,w, "sound.hud_vol", s.vol_hud);
Param(c,w, "sound.hud_chk", s.snd_chk); Param(c,w, "sound.hud_chk_wrong", s.snd_chkwr);
#endif

Param(c,w, "sound.hud_chk", s.snd_chk); Param(c,w, "sound.hud_chk_wrong", s.snd_chkwr);
#endif // snd setup
Param(c,w, "sound_config.device", s.snd_device); Param(c,w, "sound_config.reverb", s.snd_reverb);
Param(c,w, "sound_config.cnt_sources", s.cnt_sources); Param(c,w, "sound_config.cnt_dynamics", s.cnt_dynamics);
Param(c,w, "sound_config.cnt_buffers", s.cnt_buffers);
Param(c,w, "sound_config.ref_dist", s.ref_dist); Param(c,w, "sound_config.rolloff", s.rolloff);
Param(c,w, "sound_config.max_dist", s.max_dist);

// 🪟 font ----
Param(c,w, "font.gui", font_gui);
Expand Down
8 changes: 8 additions & 0 deletions src/common/settings_com.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,15 @@ class SETcom
vol_car_crash =1.f, vol_car_scrap =1.f;
bool snd_chk = 0, snd_chkwr = 1; // play hud
#endif
// setup
bool snd_reverb = 1; std::string snd_device;

// 8 players * (10? car + 8 wheels * 2 surfaces)
// int detail; // less/more sounds todo ..
int cnt_buffers = 1024, cnt_sources = 244, cnt_dynamics = 12; // 256
int cntAll() { return cnt_sources + cnt_dynamics; }

float max_dist = 500.f, ref_dist = 1.f, rolloff = 0.05f;
} s;

// 📰🔻 Tracks list ----
Expand Down
13 changes: 5 additions & 8 deletions src/game/Game_Update.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,21 @@
#include "par.h"
#include "Def_Str.h"
#include "CScene.h"
// #include "SceneXml.h"
// #include "CData.h"
#include "settings.h"
#include "CHud.h"
#include "CGui.h"
#include "GuiCom.h"
#include "CGame.h"
#include "game.h"
// #include "SoundMgr.h"
// #include "CarPosInfo.h"
#include "CarModel.h"
#include "FollowCamera.h"
// #include "carcontrolmap_local.h"
// #include "CInput.h"
#include "Road.h"
#include "PaceNotes.h"
#include "GraphicsSystem.h"
#include "BtOgreExtras.h"
#include "gameclient.hpp"
#include "SoundMgr.h"

#include "GraphicsSystem.h"
#include "BtOgreExtras.h"
#include <OgreVector3.h>
#include <OgreSceneManager.h>
#include <OgreRoot.h>
Expand Down Expand Up @@ -162,6 +157,8 @@ void App::update( float dt )
for (int c = 0; c < carModels.size(); ++c)
hud->Update(c, dt);
hud->Update(-1, dt);

pGame->snd->Update(dt); // 🔊


/// 📉 graphs update -._/\_-.
Expand Down
2 changes: 1 addition & 1 deletion src/game/Hud_Graphs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ void App::GraphsNewVals() // Game
graphs[0]->UpdTitle("Sounds Info\n"+snd->sReverb);
graphs[1]->UpdTitle("\nbuf: "+toStr(snd->buffers_used_max)+" /"+toStr(SoundBaseMgr::MAX_BUFFERS)+"\n"+
"src: "+toStr(snd->sources_use)+" /"+toStr(snd->hw_sources_num)+" inst: "+toStr(Sound::instances));
graphs[2]->UpdTitle("hw: "+iToStr(snd->hw_sources_use,2)+" /"+toStr(SoundBaseMgr::ALL_SRC));
graphs[2]->UpdTitle("hw: "+iToStr(snd->hw_sources_use,2)+" /"+toStr(pSet->s.cnt_sources));

bool info = pSet->sounds_info;
if (info)
Expand Down
Loading

0 comments on commit f896386

Please sign in to comment.