mirror of
https://github.com/projectM-visualizer/projectm.git
synced 2026-03-10 09:25:18 +00:00
successful win32 build, unran. untested. handing off to sperl
- hand wrote defines for a few standard math functions for non C99 compliant platforms - added #ifdefs to handle glew includes - put some preprocessor macros and includes to project file git-svn-id: https://projectm.svn.sourceforge.net/svnroot/projectm/trunk@467 6778bc44-b910-0410-a7a0-be141de4315d
This commit is contained in:
@ -35,6 +35,7 @@
|
||||
#include "projectM.hpp"
|
||||
#include "BeatDetect.hpp"
|
||||
#include "PCM.hpp"
|
||||
#include <cmath>
|
||||
|
||||
DLLEXPORT BeatDetect::BeatDetect() {
|
||||
int x,y;
|
||||
@ -156,13 +157,14 @@ void BeatDetect::getBeatVals( float *vdataL,float *vdataR ) {
|
||||
|
||||
bass=(beat_instant[0])/(1.5*beat_history[0]);
|
||||
|
||||
if ( isnan( treb ) ) {
|
||||
|
||||
if ( projectM_isnan( treb ) ) {
|
||||
treb = 0.0;
|
||||
}
|
||||
if ( isnan( mid ) ) {
|
||||
if ( projectM_isnan( mid ) ) {
|
||||
mid = 0.0;
|
||||
}
|
||||
if ( isnan( bass ) ) {
|
||||
if ( projectM_isnan( bass ) ) {
|
||||
bass = 0.0;
|
||||
}
|
||||
treb_att=.6 * treb_att + .4 * treb;
|
||||
|
||||
@ -6,6 +6,8 @@
|
||||
#include "Algorithms.hpp"
|
||||
#include "InitCondUtils.hpp"
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
using namespace Algorithms;
|
||||
|
||||
|
||||
@ -51,6 +51,10 @@ extern FILE *fmemopen(void *buf, size_t len, const char *pMode);
|
||||
#define STRING_BUFFER_SIZE 1024*150
|
||||
#define STRING_LINE_SIZE 1024
|
||||
|
||||
#define projectM_isnan(x) ((x) != (x))
|
||||
#define projectM_fmax(x,y) ((x) >= (y) ? (x): (y))
|
||||
#define projectM_fmin(x,y) ((x) <= (y) ? (x): (y))
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
|
||||
@ -59,7 +59,7 @@ float PrefunExpr::eval_prefun_expr ( int mesh_i, int mesh_j )
|
||||
/* This is slightly less than safe, since
|
||||
who knows if the passed argument is valid. For
|
||||
speed purposes we'll go with this */
|
||||
float arg_list[this->num_args];
|
||||
float * arg_list = new float[this->num_args];
|
||||
|
||||
#ifdef EVAL_DEBUG_DOUBLE
|
||||
DWRITE ( "fn[" );
|
||||
@ -79,6 +79,7 @@ float PrefunExpr::eval_prefun_expr ( int mesh_i, int mesh_j )
|
||||
|
||||
|
||||
}
|
||||
delete(arg_list);
|
||||
|
||||
#ifdef EVAL_DEBUG_DOUBLE
|
||||
DWRITE ( "]" );
|
||||
|
||||
@ -15,6 +15,8 @@
|
||||
//
|
||||
|
||||
#include "MoodBar.hpp"
|
||||
#include "Common.hpp"
|
||||
|
||||
#include <cmath>
|
||||
extern "C" {
|
||||
#include <malloc.h>
|
||||
@ -272,8 +274,8 @@ void MoodBar::stretchNormalize (float * rgb)
|
||||
avgbb /= (float) tb;
|
||||
|
||||
// lost from here- what is theory behind this?
|
||||
mini = fmaxf (avg + (avgb - avg) * 2.f, avgbb);
|
||||
maxi = fminf (avg + (avgu - avg) * 2.f, avguu);
|
||||
mini = projectM_fmax (avg + (avgb - avg) * 2.f, avgbb);
|
||||
maxi = projectM_fmin (avg + (avgu - avg) * 2.f, avguu);
|
||||
delta = maxi - mini;
|
||||
|
||||
if (delta == 0.f)
|
||||
@ -282,7 +284,10 @@ void MoodBar::stretchNormalize (float * rgb)
|
||||
// Assign colos to normalized m_ringBufferue of last item in buffer
|
||||
// i = numvals-1;
|
||||
// m_ringBuffers[c].
|
||||
rgb[c] = finite (rgb[c]) ? fminf(1.f, fmaxf(0.f, (rgb[c] - mini) / delta))
|
||||
#ifdef LINUX
|
||||
rgb[c] = finite (rgb[c]) ? projectM_fmin(1.f, projectM_fmax(0.f, (rgb[c] - mini) / delta))
|
||||
: 0.f;
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,7 +38,7 @@
|
||||
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
#include <GL/gl.h>
|
||||
#include <glew.h>
|
||||
#endif /** WIN32 */
|
||||
|
||||
#ifdef LINUX
|
||||
|
||||
@ -159,7 +159,7 @@ Param * Param::new_param_int(char * name, short int flags, void * engine_val,
|
||||
|
||||
/* Creates a new parameter of type bool */
|
||||
Param * Param::new_param_bool(char * name, short int flags, void * engine_val,
|
||||
int upper_bound, int lower_bound, bool init_val) {
|
||||
bool upper_bound, bool lower_bound, bool init_val) {
|
||||
|
||||
Param * param;
|
||||
CValue iv, ub, lb;
|
||||
|
||||
@ -97,7 +97,7 @@ public:
|
||||
static Param * new_param_int( char * name, short int flags, void * engine_val,
|
||||
int upper_bound, int lower_bound, int init_val );
|
||||
static Param * new_param_bool( char * name, short int flags, void * engine_val,
|
||||
int upper_bound, int lower_bound, bool init_val );
|
||||
bool upper_bound, bool lower_bound, bool init_val );
|
||||
static Param * new_param_string(char * name, short int flags, void * engine_val);
|
||||
|
||||
};
|
||||
|
||||
@ -14,7 +14,6 @@
|
||||
#include <cassert>
|
||||
#include <memory>
|
||||
#include <iostream>
|
||||
|
||||
class PresetChooser;
|
||||
|
||||
/// A simple iterator class to traverse back and forth a preset directory
|
||||
@ -218,8 +217,16 @@ inline std::auto_ptr<Preset> PresetChooser::directoryIndex(std::size_t index, co
|
||||
template <class WeightFunctor>
|
||||
inline std::auto_ptr<Preset> PresetChooser::doWeightedSample(WeightFunctor & weightFunctor, const PresetInputs & presetInputs, PresetOutputs & presetOutputs) {
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
// Choose a random bounded mass between 0 and 1
|
||||
float cutoff = ((float)(rand())) / RAND_MAX;
|
||||
#endif
|
||||
|
||||
#ifdef LINUX
|
||||
// Choose a random bounded mass between 0 and 1
|
||||
float cutoff = ((float)(random())) / RAND_MAX;
|
||||
#endif
|
||||
|
||||
// Sum up mass, stopping when cutoff is reached. This is the typical
|
||||
// weighted sampling algorithm.
|
||||
|
||||
@ -15,11 +15,14 @@
|
||||
#include <sstream>
|
||||
#include <set>
|
||||
|
||||
#ifdef LINUX
|
||||
extern "C"
|
||||
{
|
||||
#include <errno.h>
|
||||
#include <dirent.h>
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#include <cassert>
|
||||
#include "projectM.hpp"
|
||||
|
||||
@ -114,6 +117,10 @@ std::auto_ptr<Preset> PresetLoader::loadPreset(unsigned int index, const PresetI
|
||||
|
||||
void PresetLoader::handleDirectoryError()
|
||||
{
|
||||
#ifdef WIN32
|
||||
std::cerr << "[PresetLoader] warning: errno unsupported on win32 platforms. fix me" << std::endl;
|
||||
#else
|
||||
|
||||
switch (errno)
|
||||
{
|
||||
case ENOENT:
|
||||
@ -137,4 +144,5 @@ void PresetLoader::handleDirectoryError()
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -5,7 +5,18 @@
|
||||
|
||||
#include <memory> // for auto pointers
|
||||
#include <sys/types.h>
|
||||
#ifdef WIN32
|
||||
#include "win32-dirent.h"
|
||||
#endif
|
||||
|
||||
#ifdef LINUX
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
|
||||
#ifdef MACOS
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
|
||||
#include <vector>
|
||||
|
||||
class Preset;
|
||||
|
||||
@ -5,8 +5,16 @@
|
||||
#include "PresetFrameIO.hpp"
|
||||
#include "BeatDetect.hpp"
|
||||
#include <string>
|
||||
|
||||
#ifdef LINUX
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#include <glew.h>
|
||||
#endif
|
||||
|
||||
#ifdef USE_FTGL
|
||||
#include <FTGL/FTGL.h>
|
||||
#include <FTGL/FTGLPixmapFont.h>
|
||||
|
||||
@ -2,7 +2,12 @@
|
||||
#define TextureManager_HPP
|
||||
|
||||
#include "PresetFrameIO.hpp"
|
||||
#ifdef LINUX
|
||||
#include <GL/gl.h>
|
||||
#endif
|
||||
#ifdef WIN32
|
||||
#include <glew.h>
|
||||
#endif
|
||||
#include "texture.h"
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
61
src/projectM-engine/libprojectM.rc
Normal file
61
src/projectM-engine/libprojectM.rc
Normal file
@ -0,0 +1,61 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "afxres.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
LANGUAGE 9, 1
|
||||
#pragma code_page(1252)
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#include ""afxres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
@ -117,7 +117,8 @@
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="1"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
|
||||
AdditionalIncludeDirectories=""C:\Program Files\Microsoft Visual Studio 8\VC\include\GL""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;GLEW_BUILD;USE_FBO"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="true"
|
||||
@ -127,6 +128,8 @@
|
||||
ProgramDataBaseFileName=".\Release/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
ShowIncludes="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
@ -226,6 +229,10 @@
|
||||
RelativePath=".\InitCond.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\libprojectM.rc"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\MoodBar.cpp"
|
||||
>
|
||||
@ -479,6 +486,10 @@
|
||||
RelativePath=".\Renderer.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\resource.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\texture.h"
|
||||
>
|
||||
|
||||
@ -33,6 +33,10 @@
|
||||
#include "time.h"
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
//#include <xmms/plugin.h>
|
||||
#include <iostream>
|
||||
#include "projectM.hpp"
|
||||
@ -72,7 +76,7 @@ DLLEXPORT projectM::projectM(int gx, int gy, int fps, int texsize, int width, in
|
||||
projectM_resetGL( wvw, wvh );
|
||||
}
|
||||
|
||||
DLLEXPORT projectM::~projectM() {
|
||||
projectM::~projectM() {
|
||||
std::cerr << "[projectM] DESTROY PRESET TOOLS BEGIN" << std::endl;
|
||||
destroyPresetTools();
|
||||
std::cerr << "[projectM] DESTROY PRESET TOOLS END" << std::endl;
|
||||
@ -308,7 +312,7 @@ DLLEXPORT void projectM::renderFrame()
|
||||
DWRITE ( "exiting renderFrame()\n" );
|
||||
}
|
||||
|
||||
DLLEXPORT void projectM::projectM_reset()
|
||||
void projectM::projectM_reset()
|
||||
{
|
||||
|
||||
// DWRITE( "projectM_reset(): in\n" );
|
||||
|
||||
14
src/projectM-engine/resource.h
Normal file
14
src/projectM-engine/resource.h
Normal file
@ -0,0 +1,14 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by libprojectM.rc
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 101
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1001
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
@ -7,8 +7,14 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <GL/gl.h>
|
||||
|
||||
#ifdef LINUX
|
||||
#include <GL/gl.h>
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#include <glew.h>
|
||||
#endif
|
||||
|
||||
// openGL extensions if not present, define them
|
||||
#ifndef GL_COMPRESSED_RGB_S3TC_DXT1_EXT
|
||||
|
||||
Reference in New Issue
Block a user