From 5097d9a8028f534a07651f1e76e09c53fdced770 Mon Sep 17 00:00:00 2001 From: psperl Date: Fri, 5 Oct 2007 04:14:40 +0000 Subject: [PATCH] more config file options git-svn-id: https://projectm.svn.sourceforge.net/svnroot/projectm/trunk@520 6778bc44-b910-0410-a7a0-be141de4315d --- src/projectM-engine/BeatDetect.cpp | 4 ++-- src/projectM-engine/BeatDetect.hpp | 2 +- src/projectM-engine/Renderer.cpp | 29 ++++++++++---------------- src/projectM-engine/Renderer.hpp | 7 ++++--- src/projectM-engine/TextureManager.cpp | 6 +++--- src/projectM-engine/config.inp.in | 21 ++++++++++++------- src/projectM-engine/projectM.cpp | 24 ++++++++++++++------- src/projectM-engine/projectM.hpp | 4 ++-- src/projectM-libvisual/libtool | 18 ++++++++-------- src/projectM-xmms/main.cpp | 3 +-- 10 files changed, 62 insertions(+), 56 deletions(-) diff --git a/src/projectM-engine/BeatDetect.cpp b/src/projectM-engine/BeatDetect.cpp index 329549e8e..d4387df3c 100755 --- a/src/projectM-engine/BeatDetect.cpp +++ b/src/projectM-engine/BeatDetect.cpp @@ -64,7 +64,7 @@ DLLEXPORT BeatDetect::BeatDetect() { this->treb = 0; this->mid = 0; this->bass = 0; - this->bass_old = 0; + this->vol_old = 0; this->beat_sensitivity = 10.00; this->treb_att = 0; this->mid_att = 0; @@ -92,7 +92,7 @@ void BeatDetect::reset() { } void BeatDetect::detectFromSamples() { - bass_old = bass; + vol_old = vol; bass=0;mid=0;treb=0; getBeatVals(pcm->pcmdataL,pcm->pcmdataR); diff --git a/src/projectM-engine/BeatDetect.hpp b/src/projectM-engine/BeatDetect.hpp index 786f74241..96105f3af 100755 --- a/src/projectM-engine/BeatDetect.hpp +++ b/src/projectM-engine/BeatDetect.hpp @@ -52,7 +52,7 @@ class BeatDetect float treb ; float mid ; float bass ; - float bass_old ; + float vol_old ; float beat_sensitivity; float treb_att ; float mid_att ; diff --git a/src/projectM-engine/Renderer.cpp b/src/projectM-engine/Renderer.cpp index 93f122b32..5efddd023 100644 --- a/src/projectM-engine/Renderer.cpp +++ b/src/projectM-engine/Renderer.cpp @@ -13,7 +13,7 @@ class Preset; GLuint texture; -Renderer::Renderer(int width, int height, int gx, int gy, RenderTarget *renderTarget, TextureManager *textureManager, BeatDetect *beatDetect, std::string _fontURL): fontURL(_fontURL), m_presetName("None") +Renderer::Renderer(int width, int height, int gx, int gy, RenderTarget *renderTarget, TextureManager *textureManager, BeatDetect *beatDetect, std::string _titlefontURL, std::string _menufontURL): title_fontURL(_titlefontURL), menu_fontURL(_menufontURL), m_presetName("None") { int x; int y; @@ -81,12 +81,18 @@ Renderer::Renderer(int width, int height, int gx, int gy, RenderTarget *renderTa this->beatDetect = beatDetect; this->textureManager = textureManager; + + #ifdef USE_FTGL - /** Reset fonts */ - title_font = NULL; - other_font = NULL; - poly_font = NULL; + /**f Load the standard fonts */ + + title_font = new FTGLPixmapFont(title_fontURL.c_str()); + poly_font = new FTGLPolygonFont(title_fontURL.c_str()); + other_font = new FTGLPixmapFont(menu_fontURL.c_str()); + + #endif /** USE_FTGL */ + } @@ -460,19 +466,6 @@ void Renderer::reset(int w, int h) -#ifdef USE_FTGL - /**f Load the standard fonts */ - if ( title_font == NULL && other_font == NULL ) { - char path[1024]; - - sprintf( path, "%s%cVera.ttf", this->fontURL.c_str(), PATH_SEPARATOR ); - title_font = new FTGLPixmapFont(path); - poly_font = new FTGLPolygonFont(path); - sprintf( path, "%s%cVeraMono.ttf", this->fontURL.c_str(), PATH_SEPARATOR ); - other_font = new FTGLPixmapFont(path); - - } -#endif /** USE_FTGL */ if (!this->renderTarget->useFBO) { diff --git a/src/projectM-engine/Renderer.hpp b/src/projectM-engine/Renderer.hpp index 92f8b82cb..f597c9846 100644 --- a/src/projectM-engine/Renderer.hpp +++ b/src/projectM-engine/Renderer.hpp @@ -69,8 +69,9 @@ FTGLPolygonFont *poly_font; int studio; int correction; - std::string fontURL; - + std::string title_fontURL; + std::string menu_fontURL; + int noSwitch; int totalframes; @@ -78,7 +79,7 @@ float realfps; std::string title; int drawtitle; - Renderer( int width, int height, int gx, int gy, RenderTarget *renderTarget, TextureManager *textureManager, BeatDetect *beatDetect, std::string fontURL); + Renderer( int width, int height, int gx, int gy, RenderTarget *renderTarget, TextureManager *textureManager, BeatDetect *beatDetect, std::string title_fontURL, std::string menu_fontURL); ~Renderer(); void RenderFrame(PresetOutputs *presetOutputs, PresetInputs *presetInputs); void reset(int w, int h); diff --git a/src/projectM-engine/TextureManager.cpp b/src/projectM-engine/TextureManager.cpp index dc5ef68f3..991001a14 100644 --- a/src/projectM-engine/TextureManager.cpp +++ b/src/projectM-engine/TextureManager.cpp @@ -61,10 +61,10 @@ GLuint TextureManager::getTexture(const std::string imageURL) SOIL_LOAD_AUTO, SOIL_CREATE_NEW_ID, - // SOIL_FLAG_POWER_OF_TWO + SOIL_FLAG_POWER_OF_TWO // SOIL_FLAG_MIPMAPS - // SOIL_FLAG_MULTIPLY_ALPHA - SOIL_FLAG_COMPRESS_TO_DXT + | SOIL_FLAG_MULTIPLY_ALPHA + | SOIL_FLAG_COMPRESS_TO_DXT //| SOIL_FLAG_DDS_LOAD_DIRECT ); textures[imageURL]=tex; diff --git a/src/projectM-engine/config.inp.in b/src/projectM-engine/config.inp.in index e0c370581..dcc4dc4df 100644 --- a/src/projectM-engine/config.inp.in +++ b/src/projectM-engine/config.inp.in @@ -1,16 +1,21 @@ # projectM.config # Configuration File for projectM -Texsize = 512 # Size of rendering -Mesh X = 32 # blah -Mesh Y = 24 # -FPS = 35 # -Fullscreen = false # comment after sale -Window Width = 512 # comment after title -Window Height = 512 # comment after weight +Texsize = 512 # Size of internal rendering texture +Mesh X = 32 # Width of PerPixel Equation mesh +Mesh Y = 24 # Height of PerPixel Equation mesh +FPS = 35 # Frames Per Second +Fullscreen = false +Window Width = 512 # startup window width +Window Height = 512 # startup window height Smooth Transition Duration = 5 # in seconds Preset Duration = 15 # in seconds +Hard Cut Sensitivity = 10 # Lower to make hard cuts more frequent +Aspect Correction = true # Custom Shape Aspect Correction + Preset Path = @CMAKE_INSTALL_PREFIX@/share/projectM/presets #preset location -Font Path = @CMAKE_INSTALL_PREFIX@/share/projectM/fonts #font location \ No newline at end of file +Title Font = @CMAKE_INSTALL_PREFIX@/share/projectM/fonts/Vera.ttf +Menu Font = @CMAKE_INSTALL_PREFIX@/share/projectM/fonts/VeraMono.ttf + \ No newline at end of file diff --git a/src/projectM-engine/projectM.cpp b/src/projectM-engine/projectM.cpp index 736cee6b7..297eaa7a2 100755 --- a/src/projectM-engine/projectM.cpp +++ b/src/projectM-engine/projectM.cpp @@ -118,9 +118,16 @@ void projectM::readConfig(std::string config_file) else fullscreen = 0; presetURL = config.read( "Preset Path", "/usr/share/projectM/presets" ); - fontURL = config.read( "Font Path", "/usr/share/projectM/fonts" ); + + title_fontURL = config.read( "Title Font", "/usr/share/projectM/fonts/Vera.ttf" ); + menu_fontURL = config.read( "Menu Font", "/usr/share/projectM/fonts/VeraMono.ttf" ); projectM_init(gx, gy, fps, texsize, wvw, wvh); + + beatDetect->beat_sensitivity = config.read( "Hard Cut Sensitivity", 10.0 ); + if (config.read("Aspect Correction", true)) renderer->correction = 1; + else renderer->correction = 0; + projectM_resetGL( wvw, wvh ); } @@ -190,12 +197,12 @@ DLLEXPORT void projectM::renderFrame() assert(m_activePreset2.get()); renderer->setPresetName(m_activePreset2->presetName()); - nohard=(int)(presetInputs.fps*3.5); + //nohard=(int)(presetInputs.fps*3.5); smoothFrame = (int)(presetInputs.fps * smoothDuration); // printf("SOFT CUT - Smooth started\n"); } - else if ( ( beatDetect->bass-beatDetect->bass_old>beatDetect->beat_sensitivity ) && nohard<0)//@REMOVE + else if ( ( beatDetect->vol-beatDetect->vol_old>beatDetect->beat_sensitivity ) && nohard<0)//@REMOVE { // printf("%f %d %d\n", beatDetect->bass-beatDetect->bass_old,this->frame,this->avgtime); // printf("HARD CUT"); @@ -204,7 +211,7 @@ DLLEXPORT void projectM::renderFrame() m_activePreset = m_presetPos->allocate(presetInputs, presetOutputs); assert(m_activePreset.get()); - nohard=presetInputs.fps*5; + //nohard=presetInputs.fps*1; smoothFrame=0; presetInputs.progress=0.0; presetInputs.frame = 1; @@ -305,8 +312,9 @@ void projectM::projectM_reset() // m_activePreset = 0; // } - this->presetURL = ""; - this->fontURL = ""; + //this->presetURL = ""; + //this->title_fontURL = ""; + /** Default variable settings */ this->hasInit = 0; @@ -365,7 +373,7 @@ void projectM::projectM_reset() presetInputs.fps = fps; - + this->nohard=fps*5; /** We need to initialise this before the builtin param db otherwise bass/mid etc won't bind correctly */ assert(!beatDetect); beatDetect = new BeatDetect(); @@ -507,7 +515,7 @@ void projectM::projectM_reset() this->presetInputs.gx = gx; this->presetInputs.gy = gy; - this->renderer = new Renderer ( width, height, gx, gy, renderTarget, textureManager, beatDetect, fontURL); + this->renderer = new Renderer ( width, height, gx, gy, renderTarget, textureManager, beatDetect, title_fontURL, menu_fontURL); renderer->setPresetName(m_activePreset->presetName()); diff --git a/src/projectM-engine/projectM.hpp b/src/projectM-engine/projectM.hpp index 04068ec7c..f923c3380 100755 --- a/src/projectM-engine/projectM.hpp +++ b/src/projectM-engine/projectM.hpp @@ -118,8 +118,8 @@ public: std::string presetURL; - std::string fontURL; - + std::string title_fontURL; + std::string menu_fontURL; int hasInit; int pcmframes; diff --git a/src/projectM-libvisual/libtool b/src/projectM-libvisual/libtool index 447d0edfd..87c480e45 100755 --- a/src/projectM-libvisual/libtool +++ b/src/projectM-libvisual/libtool @@ -325,10 +325,10 @@ variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COM link_all_deplibs=unknown # Compile-time system search path for libraries -sys_lib_search_path_spec="/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2 /usr/lib64 /lib64 /usr/x86_64-pc-linux-gnu/lib" +sys_lib_search_path_spec="/usr/lib/gcc/x86_64-pc-linux-gnu/4.2.0 /usr/lib64 /lib64 /usr/x86_64-pc-linux-gnu/lib" # Run-time system search path for libraries -sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/local/lib //usr/lib32/opengl/nvidia/lib //usr/lib64/opengl/nvidia/lib /lib /usr/lib /lib64 /usr/lib64 /usr/local/lib64 /lib32 /usr/lib32 /usr/local/lib32 /usr/x86_64-pc-linux-gnu/lib /usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2 /usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/32 /usr/lib/gcc/x86_64-pc-linux-gnu/4.2.0 /usr/lib/gcc/x86_64-pc-linux-gnu/4.2.0/32 /usr/lib/gcc/x86_64-pc-linux-gnu/3.4.6 /usr/lib/gcc/x86_64-pc-linux-gnu/3.4.6/32 /usr/lib64/nspr /usr/lib64/nss /usr/lib64/openmotif-2.2 /usr/lib32/openmotif-2.2 /usr/lib/qt4 /usr/lib64/qt4 /usr/lib32/qt4 /usr/kde/3.5/lib /usr/kde/3.5/lib64 /usr/kde/3.5/lib32 /usr/qt/3/lib /usr/qt/3/lib64 /usr/qt/3/lib32 /opt/firefox /usr/games/lib /usr/games/lib32 /usr/lib/octave-2.1.73 " +sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/local/lib //usr/lib32/opengl/nvidia/lib //usr/lib64/opengl/nvidia/lib /lib /usr/lib /lib64 /usr/lib64 /usr/local/lib64 /lib32 /usr/lib32 /usr/local/lib32 /usr/x86_64-pc-linux-gnu/lib /usr/lib/gcc/x86_64-pc-linux-gnu/4.2.0 /usr/lib/gcc/x86_64-pc-linux-gnu/4.2.0/32 /usr/lib64/nspr /usr/lib64/nss /usr/lib32/openmotif-2.2 /usr/lib64/openmotif-2.3 /usr/lib/qt4 /usr/lib64/qt4 /usr/lib32/qt4 /usr/kde/3.5/lib /usr/kde/3.5/lib64 /usr/kde/3.5/lib32 /usr/qt/3/lib /usr/qt/3/lib64 /usr/qt/3/lib32 /opt/firefox /usr/games/lib /usr/games/lib32 /usr/lib/octave-2.1.73 " # Fix the shell variable $srcfile for the compiler. fix_srcfile_path="" @@ -7528,11 +7528,11 @@ striplib="strip --strip-unneeded" # Dependencies to place before the objects being linked to create a # shared library. -predep_objects="/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/../../../../lib64/crti.o /usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/crtbeginS.o" +predep_objects="/usr/lib/gcc/x86_64-pc-linux-gnu/4.2.0/../../../../lib64/crti.o /usr/lib/gcc/x86_64-pc-linux-gnu/4.2.0/crtbeginS.o" # Dependencies to place after the objects being linked to create a # shared library. -postdep_objects="/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/crtendS.o /usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/../../../../lib64/crtn.o" +postdep_objects="/usr/lib/gcc/x86_64-pc-linux-gnu/4.2.0/crtendS.o /usr/lib/gcc/x86_64-pc-linux-gnu/4.2.0/../../../../lib64/crtn.o" # Dependencies to place before the objects being linked to create a # shared library. @@ -7544,7 +7544,7 @@ postdeps="-lstdc++ -lm -lgcc_s -lc -lgcc_s" # The library search path used internally by the compiler when linking # a shared library. -compiler_lib_search_path="-L/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2 -L/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2 -L/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/../../../../x86_64-pc-linux-gnu/lib -L/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/../../.." +compiler_lib_search_path="-L/usr/lib/gcc/x86_64-pc-linux-gnu/4.2.0 -L/usr/lib/gcc/x86_64-pc-linux-gnu/4.2.0 -L/usr/lib/gcc/x86_64-pc-linux-gnu/4.2.0/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-pc-linux-gnu/4.2.0/../../../../x86_64-pc-linux-gnu/lib -L/usr/lib/gcc/x86_64-pc-linux-gnu/4.2.0/../../.." # Method to check whether dependent libraries are shared objects. deplibs_check_method="pass_all" @@ -7624,10 +7624,10 @@ variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COM link_all_deplibs=unknown # Compile-time system search path for libraries -sys_lib_search_path_spec="/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2 /usr/lib64 /lib64 /usr/x86_64-pc-linux-gnu/lib" +sys_lib_search_path_spec="/usr/lib/gcc/x86_64-pc-linux-gnu/4.2.0 /usr/lib64 /lib64 /usr/x86_64-pc-linux-gnu/lib" # Run-time system search path for libraries -sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/local/lib //usr/lib32/opengl/nvidia/lib //usr/lib64/opengl/nvidia/lib /lib /usr/lib /lib64 /usr/lib64 /usr/local/lib64 /lib32 /usr/lib32 /usr/local/lib32 /usr/x86_64-pc-linux-gnu/lib /usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2 /usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/32 /usr/lib/gcc/x86_64-pc-linux-gnu/4.2.0 /usr/lib/gcc/x86_64-pc-linux-gnu/4.2.0/32 /usr/lib/gcc/x86_64-pc-linux-gnu/3.4.6 /usr/lib/gcc/x86_64-pc-linux-gnu/3.4.6/32 /usr/lib64/nspr /usr/lib64/nss /usr/lib64/openmotif-2.2 /usr/lib32/openmotif-2.2 /usr/lib/qt4 /usr/lib64/qt4 /usr/lib32/qt4 /usr/kde/3.5/lib /usr/kde/3.5/lib64 /usr/kde/3.5/lib32 /usr/qt/3/lib /usr/qt/3/lib64 /usr/qt/3/lib32 /opt/firefox /usr/games/lib /usr/games/lib32 /usr/lib/octave-2.1.73 " +sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/local/lib //usr/lib32/opengl/nvidia/lib //usr/lib64/opengl/nvidia/lib /lib /usr/lib /lib64 /usr/lib64 /usr/local/lib64 /lib32 /usr/lib32 /usr/local/lib32 /usr/x86_64-pc-linux-gnu/lib /usr/lib/gcc/x86_64-pc-linux-gnu/4.2.0 /usr/lib/gcc/x86_64-pc-linux-gnu/4.2.0/32 /usr/lib64/nspr /usr/lib64/nss /usr/lib32/openmotif-2.2 /usr/lib64/openmotif-2.3 /usr/lib/qt4 /usr/lib64/qt4 /usr/lib32/qt4 /usr/kde/3.5/lib /usr/kde/3.5/lib64 /usr/kde/3.5/lib32 /usr/qt/3/lib /usr/qt/3/lib64 /usr/qt/3/lib32 /opt/firefox /usr/games/lib /usr/games/lib32 /usr/lib/octave-2.1.73 " # Fix the shell variable $srcfile for the compiler. fix_srcfile_path="" @@ -7932,10 +7932,10 @@ variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COM link_all_deplibs=unknown # Compile-time system search path for libraries -sys_lib_search_path_spec="/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2 /usr/lib64 /lib64 /usr/x86_64-pc-linux-gnu/lib" +sys_lib_search_path_spec="/usr/lib/gcc/x86_64-pc-linux-gnu/4.2.0 /usr/lib64 /lib64 /usr/x86_64-pc-linux-gnu/lib" # Run-time system search path for libraries -sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/local/lib //usr/lib32/opengl/nvidia/lib //usr/lib64/opengl/nvidia/lib /lib /usr/lib /lib64 /usr/lib64 /usr/local/lib64 /lib32 /usr/lib32 /usr/local/lib32 /usr/x86_64-pc-linux-gnu/lib /usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2 /usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/32 /usr/lib/gcc/x86_64-pc-linux-gnu/4.2.0 /usr/lib/gcc/x86_64-pc-linux-gnu/4.2.0/32 /usr/lib/gcc/x86_64-pc-linux-gnu/3.4.6 /usr/lib/gcc/x86_64-pc-linux-gnu/3.4.6/32 /usr/lib64/nspr /usr/lib64/nss /usr/lib64/openmotif-2.2 /usr/lib32/openmotif-2.2 /usr/lib/qt4 /usr/lib64/qt4 /usr/lib32/qt4 /usr/kde/3.5/lib /usr/kde/3.5/lib64 /usr/kde/3.5/lib32 /usr/qt/3/lib /usr/qt/3/lib64 /usr/qt/3/lib32 /opt/firefox /usr/games/lib /usr/games/lib32 /usr/lib/octave-2.1.73 " +sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/local/lib //usr/lib32/opengl/nvidia/lib //usr/lib64/opengl/nvidia/lib /lib /usr/lib /lib64 /usr/lib64 /usr/local/lib64 /lib32 /usr/lib32 /usr/local/lib32 /usr/x86_64-pc-linux-gnu/lib /usr/lib/gcc/x86_64-pc-linux-gnu/4.2.0 /usr/lib/gcc/x86_64-pc-linux-gnu/4.2.0/32 /usr/lib64/nspr /usr/lib64/nss /usr/lib32/openmotif-2.2 /usr/lib64/openmotif-2.3 /usr/lib/qt4 /usr/lib64/qt4 /usr/lib32/qt4 /usr/kde/3.5/lib /usr/kde/3.5/lib64 /usr/kde/3.5/lib32 /usr/qt/3/lib /usr/qt/3/lib64 /usr/qt/3/lib32 /opt/firefox /usr/games/lib /usr/games/lib32 /usr/lib/octave-2.1.73 " # Fix the shell variable $srcfile for the compiler. fix_srcfile_path="" diff --git a/src/projectM-xmms/main.cpp b/src/projectM-xmms/main.cpp index 431b61b51..f4c8445c0 100755 --- a/src/projectM-xmms/main.cpp +++ b/src/projectM-xmms/main.cpp @@ -36,8 +36,7 @@ www.gamedev.net/reference/programming/features/beatdetection/ #include #include #include -#include -#include + #include #include #include "ConfigFile.h"