Skip to content

Commit

Permalink
add smoothing factor to config
Browse files Browse the repository at this point in the history
  • Loading branch information
Gargaj committed Mar 7, 2015
1 parent b0ba577 commit 7982762
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ Create a ```config.json``` with e.g. the following contents: (all fields are opt
"file":"Input-Regular_(InputMono-Medium).ttf",
"size":16,
},
"rendering":{
"fftSmoothFactor": 0.9, // 0.0 means there's no smoothing at all, 1.0 means the FFT is completely smoothed flat
},
"textures":{ /* the keys below will become the shader variable names */
"texChecker":"textures/checker.png",
"texNoise":"textures/noise.png",
Expand Down
8 changes: 7 additions & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ int main()

int nDebugOutputHeight = 200;
int nTexPreviewWidth = 64;
float fFFTSmoothingFactor = 0.9f;
float fFFTSmoothingFactor = 0.9f; // higher value, smoother FFT

char szConfig[65535];
FILE * fConf = fopen("config.json","rb");
Expand All @@ -94,6 +94,12 @@ int main()
jsonxx::Object o;
o.parse( szConfig );

if (o.has<jsonxx::Object>("rendering"))
{
if (o.get<jsonxx::Object>("rendering").has<jsonxx::Number>("fftSmoothFactor"))
fFFTSmoothingFactor = o.get<jsonxx::Object>("rendering").get<jsonxx::Number>("fftSmoothFactor");
}

if (o.has<jsonxx::Object>("textures"))
{
printf("Loading textures...\n");
Expand Down

0 comments on commit 7982762

Please sign in to comment.