void projectM::readSettings (const Settings & settings ) { _settings.meshX = settings.meshX; _settings.meshY = settings.meshY; _settings.textureSize = settings.textureSize; _settings.fps = settings.fps; _settings.windowWidth = settings.windowWidth; _settings.windowHeight = settings.windowHeight; _settings.smoothPresetDuration = settings.smoothPresetDuration; _settings.presetDuration = settings.presetDuration; _settings.softCutRatingsEnabled = settings.softCutRatingsEnabled; _settings.presetURL = settings.presetURL; _settings.titleFontURL = settings.titleFontURL; _settings.menuFontURL = settings.menuFontURL; _settings.shuffleEnabled = settings.shuffleEnabled; _settings.easterEgg = settings.easterEgg; projectM_init ( _settings.meshX, _settings.meshY, _settings.fps, _settings.textureSize, _settings.windowWidth,_settings.windowHeight); _settings.beatSensitivity = settings.beatSensitivity; _settings.aspectCorrection = settings.aspectCorrection; }
void projectM::readConfig (const std::string & configFile ) { ConfigFile config ( configFile ); _settings.meshX = config.read<int> ( "Mesh X", 32 ); _settings.meshY = config.read<int> ( "Mesh Y", 24 ); _settings.textureSize = config.read<int> ( "Texsize", 512 ); _settings.fps = config.read<int> ( "FPS", 35 ); _settings.windowWidth = config.read<int> ( "Window Width", 512 ); _settings.windowHeight = config.read<int> ( "Window Height", 512 ); _settings.smoothPresetDuration = config.read<int> ( "Smooth Preset Duration", config.read<int>("Smooth Transition Duration", 10)); _settings.presetDuration = config.read<int> ( "Preset Duration", 15 ); _settings.presetURL = config.read<string> ( "Preset Path", CMAKE_INSTALL_PREFIX "/share/projectM/presets" ); _settings.titleFontURL = config.read<string> ( "Title Font", CMAKE_INSTALL_PREFIX "/share/projectM/fonts/Vera.ttf" ); _settings.menuFontURL = config.read<string> ( "Menu Font", CMAKE_INSTALL_PREFIX "/share/projectM/fonts/VeraMono.ttf" ); _settings.shuffleEnabled = config.read<bool> ( "Shuffle Enabled", true); _settings.easterEgg = config.read<float> ( "Easter Egg Parameter", 0.0); projectM_init ( _settings.meshX, _settings.meshY, _settings.fps, _settings.textureSize, _settings.windowWidth,_settings.windowHeight); _settings.beatSensitivity = beatDetect->beat_sensitivity = config.read<float> ( "Hard Cut Sensitivity", 10.0 ); if ( config.read ( "Aspect Correction", true ) ) _settings.aspectCorrection = renderer->correction = true; else _settings.aspectCorrection = renderer->correction = false; }
int main( int argc, char **argv ) { /** Variables */ int fullscreen = 0; int width = 512, height = 512; SDL_Surface *screen; #ifdef DEBUG int value; int rgb_size[3]; #endif const SDL_VideoInfo* info = NULL; int bpp = 0; /* Flags we will pass into SDL_SetVideoMode. */ int flags = 0; #ifdef DEBUG #ifdef WIN32 /** Init debug */ debugFile = fopen( "c:\\projectMvis.txt", "wb" ); #else debugFile = fopen( "/tmp/projectMvis.txt", "wb" ); #endif /** WIN32 */ #endif /** DEBUG */ /** Allocate the SDL windows */ /* Information about the current video settings. */ /* First, initialize SDL's video subsystem. */ if( SDL_Init( SDL_INIT_VIDEO ) < 0 ) { /* Failed, exit. */ #ifdef DEBUG fprintf( debugFile, "Video initialization failed: %s\n", SDL_GetError( ) ); #endif //projectM_vtable.disable_plugin (&projectM_vtable); return PROJECTM_ERROR; } /* Let's get some video information. */ info = SDL_GetVideoInfo( ); if( !info ) { /* This should probably never happen. */ #ifdef DEBUG fprintf( debugFile, "Video query failed: %s\n", SDL_GetError( ) ); #endif // projectM_vtable.disable_plugin (&projectM_vtable); return PROJECTM_ERROR; } bpp = info->vfmt->BitsPerPixel; // SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 5 ); // SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 5 ); // SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 5 ); SDL_GL_SetAttribute( SDL_GL_ACCUM_RED_SIZE, 8 ); SDL_GL_SetAttribute( SDL_GL_ACCUM_GREEN_SIZE, 8 ); SDL_GL_SetAttribute( SDL_GL_ACCUM_BLUE_SIZE, 8 ); SDL_GL_SetAttribute( SDL_GL_ALPHA_SIZE, 8 ); SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 ); SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); if (fullscreen==0) flags = SDL_OPENGL | SDL_HWSURFACE; else flags = SDL_OPENGL | SDL_HWSURFACE |SDL_FULLSCREEN; // w = 512; h = 512; bpp = 16; #ifdef DEBUG fprintf( debugFile, "pre SDL_SetVideoMode()\n" ); #endif screen = SDL_SetVideoMode( width, height, bpp, flags ) ; #ifdef DEBUG fprintf( debugFile, "post SDL_SetVideoMode()\n" ); #endif if(screen == NULL ) { /* * This could happen for a variety of reasons, * including DISPLAY not being set, the specified * resolution not being available, etc. */ #ifdef DEBUG fprintf( debugFile, "Video mode set failed: %s\n", SDL_GetError( ) ); #endif // projectM_vtable.disable_plugin (&projectM_vtable); return PROJECTM_ERROR; } #ifdef DEBUG fprintf(debugFile, "Screen BPP: %d\n", SDL_GetVideoSurface()->format->BitsPerPixel); fprintf(debugFile, "\n"); fprintf( debugFile, "Vendor : %s\n", glGetString( GL_VENDOR ) ); fprintf( debugFile, "Renderer : %s\n", glGetString( GL_RENDERER ) ); fprintf( debugFile, "Version : %s\n", glGetString( GL_VERSION ) ); fprintf( debugFile, "Extensions : %s\n", glGetString( GL_EXTENSIONS ) ); fprintf(debugFile, "\n"); rgb_size[0] = 8; rgb_size[1] = 8; rgb_size[2] = 8; SDL_GL_GetAttribute( SDL_GL_RED_SIZE, &value ); fprintf( debugFile, "SDL_GL_RED_SIZE: requested %d, got %d\n", rgb_size[0],value); SDL_GL_GetAttribute( SDL_GL_GREEN_SIZE, &value ); fprintf( debugFile, "SDL_GL_GREEN_SIZE: requested %d, got %d\n", rgb_size[1],value); SDL_GL_GetAttribute( SDL_GL_BLUE_SIZE, &value ); fprintf( debugFile, "SDL_GL_BLUE_SIZE: requested %d, got %d\n", rgb_size[2],value); SDL_GL_GetAttribute( SDL_GL_DEPTH_SIZE, &value ); fprintf( debugFile, "SDL_GL_DEPTH_SIZE: requested %d, got %d\n", bpp, value ); SDL_GL_GetAttribute( SDL_GL_DOUBLEBUFFER, &value ); fprintf( debugFile, "SDL_GL_DOUBLEBUFFER: requested 1, got %d\n", value ); #ifdef PANTS if ( fsaa ) { SDL_GL_GetAttribute( SDL_GL_MULTISAMPLEBUFFERS, &value ); printf( "SDL_GL_MULTISAMPLEBUFFERS: requested 1, got %d\n", value ); SDL_GL_GetAttribute( SDL_GL_MULTISAMPLESAMPLES, &value ); printf( "SDL_GL_MULTISAMPLESAMPLES: requested %d, got %d\n", fsaa, value ); } #endif #endif /** Setup some window stuff */ SDL_WM_SetCaption( PROJECTM_TITLE, NULL ); /** Initialise projectM */ globalPM = (projectM_t *)malloc( sizeof( projectM_t ) ); projectM_reset( globalPM ); globalPM->fullscreen = 0; globalPM->renderTarget->texsize = 1024; // globalPM->renderTarget->origCcontext = (void *)aglGetCurrentContext(); #ifdef DEBUG if ( debugFile != NULL ) { fprintf( debugFile, "current context: %X\n", globalPM->renderTarget->origContext ); fflush( debugFile ); } #endif #ifdef MACOS globalPM->fontURL = (char *)malloc( sizeof( char ) * 512 ); strcpy( globalPM->fontURL, "../../fonts" ); globalPM->presetURL = (char *)malloc( sizeof( char ) * 512 ); strcpy( globalPM->presetURL, "../../presets" ); #else globalPM->fontURL = (char *)malloc( sizeof( char ) * 512 ); strcpy( globalPM->fontURL, "c:\\tmp\\projectM\\fonts" ); globalPM->presetURL = (char *)malloc( sizeof( char ) * 512 ); strcpy( globalPM->presetURL, "c:\\tmp\\projectM\\presets_test" ); #endif /** MACOS */ projectM_init( globalPM ); projectM_resetGL( globalPM, width, height ); /** Allocate the buffer for frame dumping, if applicable */ if ( dumpFrame ) { fbuffer = (GLubyte *)malloc( sizeof( GLubyte ) * globalPM->wvw * globalPM->wvh * 3 ); } /** Initialise the thread */ // renderLoop( globalPM ); main123( argc, argv ); return PROJECTM_SUCCESS; }
void projectM::readConfig (const std::string & configFile ) { std::cout << "[projectM] config file: " << configFile << std::endl; ConfigFile config ( configFile ); _settings.meshX = config.read<int> ( "Mesh X", 32 ); _settings.meshY = config.read<int> ( "Mesh Y", 24 ); _settings.textureSize = config.read<int> ( "Texture Size", 512 ); _settings.fps = config.read<int> ( "FPS", 35 ); _settings.windowWidth = config.read<int> ( "Window Width", 512 ); _settings.windowHeight = config.read<int> ( "Window Height", 512 ); _settings.smoothPresetDuration = config.read<int> ( "Smooth Preset Duration", config.read<int>("Smooth Transition Duration", 10)); _settings.presetDuration = config.read<int> ( "Preset Duration", 15 ); #ifdef LINUX _settings.presetURL = config.read<string> ( "Preset Path", CMAKE_INSTALL_PREFIX "/share/projectM/presets" ); #endif #ifdef __APPLE__ /// @bug awful hardcoded hack- need to add intelligence to cmake wrt bundling - carm _settings.presetURL = config.read<string> ( "Preset Path", "../Resources/presets" ); #endif #ifdef WIN32 _settings.presetURL = config.read<string> ( "Preset Path", CMAKE_INSTALL_PREFIX "/share/projectM/presets" ); #endif #ifdef __APPLE__ _settings.titleFontURL = config.read<string> ( "Title Font", "../Resources/fonts/Vera.tff"); _settings.menuFontURL = config.read<string> ( "Menu Font", "../Resources/fonts/VeraMono.ttf"); #endif #ifdef LINUX _settings.titleFontURL = config.read<string> ( "Title Font", projectM_FONT_TITLE ); _settings.menuFontURL = config.read<string> ( "Menu Font", projectM_FONT_MENU ); #endif #ifdef WIN32 _settings.titleFontURL = config.read<string> ( "Title Font", projectM_FONT_TITLE ); _settings.menuFontURL = config.read<string> ( "Menu Font", projectM_FONT_MENU ); #endif _settings.shuffleEnabled = config.read<bool> ( "Shuffle Enabled", true); _settings.easterEgg = config.read<float> ( "Easter Egg Parameter", 0.0); _settings.softCutRatingsEnabled = config.read<float> ( "Soft Cut Ratings Enabled", false); projectM_init ( _settings.meshX, _settings.meshY, _settings.fps, _settings.textureSize, _settings.windowWidth,_settings.windowHeight); _settings.beatSensitivity = beatDetect->beat_sensitivity = config.read<float> ( "Hard Cut Sensitivity", 10.0 ); if ( config.read ( "Aspect Correction", true ) ) { _settings.aspectCorrection = true; renderer->correction = true; } else { _settings.aspectCorrection = false; renderer->correction = false; } }