mirror of
https://github.com/projectM-visualizer/projectm.git
synced 2026-02-24 17:25:57 +00:00
proper init of preset loader at projectm top level
took out all milkdrop specific stuff from projectM.cpp (including headers) git-svn-id: https://projectm.svn.sourceforge.net/svnroot/projectm/personal/carm/represet@1152 6778bc44-b910-0410-a7a0-be141de4315d
This commit is contained in:
@ -23,13 +23,26 @@
|
||||
|
||||
#include "MilkdropPresetFactory.hpp"
|
||||
|
||||
#include "BuiltinFuncs.hpp"
|
||||
#include "Eval.hpp"
|
||||
|
||||
MilkdropPresetFactory::MilkdropPresetFactory(int gx, int gy) {
|
||||
/* Initializes the builtin function database */
|
||||
BuiltinFuncs::init_builtin_func_db();
|
||||
|
||||
/* Initializes all infix operators */
|
||||
Eval::init_infix_ops();
|
||||
|
||||
MilkdropPresetFactory::MilkdropPresetFactory(int gx, int gy)
|
||||
{
|
||||
_presetOutputs.Initialize(gx,gy);
|
||||
|
||||
}
|
||||
|
||||
MilkdropPresetFactory::~MilkdropPresetFactory() {}
|
||||
MilkdropPresetFactory::~MilkdropPresetFactory() {
|
||||
|
||||
Eval::destroy_infix_ops();
|
||||
BuiltinFuncs::destroy_builtin_func_db();
|
||||
|
||||
}
|
||||
|
||||
std::auto_ptr<Preset> MilkdropPresetFactory::allocate(const std::string & url, const std::string & name, const std::string & author) {
|
||||
_presetOutputs.customWaves.clear();
|
||||
|
||||
@ -35,8 +35,9 @@ extern "C"
|
||||
|
||||
#include "Common.hpp"
|
||||
|
||||
PresetLoader::PresetLoader ( std::string dirname = std::string() ) :_dirname ( dirname ), _dir ( 0 ), _ratingsSum ( 0 )
|
||||
PresetLoader::PresetLoader (int gx, int gy, std::string dirname = std::string()) :_dirname ( dirname ), _dir ( 0 ), _ratingsSum ( 0 )
|
||||
{
|
||||
_presetFactoryManager.initialize(gx,gy);
|
||||
// Do one scan
|
||||
if ( _dirname != std::string() )
|
||||
rescan();
|
||||
|
||||
@ -28,7 +28,7 @@ class PresetLoader {
|
||||
public:
|
||||
|
||||
/// Initializes the preset loader with the target directory specified
|
||||
PresetLoader(std::string dirname);
|
||||
PresetLoader(int gx, int gy, std::string dirname);
|
||||
|
||||
~PresetLoader();
|
||||
|
||||
|
||||
@ -40,24 +40,16 @@
|
||||
//#include <xmms/plugin.h>
|
||||
#include <iostream>
|
||||
#include "projectM.hpp"
|
||||
#include "BuiltinFuncs.hpp"
|
||||
#include "BeatDetect.hpp"
|
||||
#include "Eval.hpp"
|
||||
#include "Param.hpp"
|
||||
#include "Parser.hpp"
|
||||
#include "Preset.hpp"
|
||||
#include "PerPixelEqn.hpp"
|
||||
#include "PresetMerge.hpp"
|
||||
//#include "menu.h"
|
||||
#include "PCM.hpp" //Sound data handler (buffering, FFT, etc.)
|
||||
#include "CustomWave.hpp"
|
||||
#include "CustomShape.hpp"
|
||||
#include "IdlePreset.hpp"
|
||||
|
||||
#include <map>
|
||||
|
||||
#include "Renderer.hpp"
|
||||
#include "PresetFrameIO.hpp"
|
||||
#include "PresetChooser.hpp"
|
||||
#include "ConfigFile.h"
|
||||
#include "TextureManager.hpp"
|
||||
@ -65,16 +57,6 @@
|
||||
#ifdef USE_THREADS
|
||||
#include "pthread.h"
|
||||
#endif
|
||||
/*
|
||||
DLLEXPORT projectM::projectM ( int gx, int gy, int fps, int texsize, int width, int height, std::string preset_url,std::string title_fonturl, std::string title_menuurl ) :beatDetect ( 0 ), renderer ( 0 ), settings.presetURL ( preset_url ), title_fontURL ( title_fonturl ), menu_fontURL ( menu_fontURL ), smoothFrame ( 0 ), m_presetQueuePos(0)
|
||||
{
|
||||
presetURL = preset_url;
|
||||
projectM_reset();
|
||||
projectM_init ( gx, gy, fps, texsize, width, height );
|
||||
projectM_resetGL ( width, height );
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
projectM::~projectM()
|
||||
{
|
||||
@ -463,7 +445,7 @@ void projectM::projectM_init ( int gx, int gy, int fps, int texsize, int width,
|
||||
renderer->SetPipeline(presetOutputs);
|
||||
running = true;
|
||||
|
||||
initPresetTools();
|
||||
initPresetTools(gx, gy);
|
||||
|
||||
#ifdef USE_THREADS
|
||||
pthread_mutex_init(&mutex, NULL);
|
||||
@ -682,21 +664,15 @@ DLLEXPORT void projectM::projectM_setTitle ( std::string title )
|
||||
}
|
||||
|
||||
|
||||
int projectM::initPresetTools()
|
||||
int projectM::initPresetTools(int gx, int gy)
|
||||
{
|
||||
|
||||
/* Initializes the builtin function database */
|
||||
BuiltinFuncs::init_builtin_func_db();
|
||||
|
||||
/* Initializes all infix operators */
|
||||
Eval::init_infix_ops();
|
||||
|
||||
/* Set the seed to the current time in seconds */
|
||||
srand ( time ( NULL ) );
|
||||
|
||||
std::string url = (m_flags & FLAG_DISABLE_PLAYLIST_LOAD) ? std::string() : settings().presetURL;
|
||||
|
||||
if ( ( m_presetLoader = new PresetLoader ( url) ) == 0 )
|
||||
if ( ( m_presetLoader = new PresetLoader ( gx, gy, url) ) == 0 )
|
||||
{
|
||||
m_presetLoader = 0;
|
||||
std::cerr << "[projectM] error allocating preset loader" << std::endl;
|
||||
@ -766,9 +742,6 @@ void projectM::destroyPresetTools()
|
||||
/// @slow might not be necessary
|
||||
m_presetLoader = 0;
|
||||
|
||||
Eval::destroy_infix_ops();
|
||||
BuiltinFuncs::destroy_builtin_func_db();
|
||||
|
||||
}
|
||||
|
||||
/// @bug queuePreset case isn't handled
|
||||
|
||||
@ -274,7 +274,7 @@ private:
|
||||
void projectM_initengine();
|
||||
void projectM_resetengine();
|
||||
/// Initializes preset loading / management libraries
|
||||
int initPresetTools();
|
||||
int initPresetTools(int gx, int gy);
|
||||
|
||||
/// Deinitialize all preset related tools. Usually done before projectM cleanup
|
||||
void destroyPresetTools();
|
||||
|
||||
Reference in New Issue
Block a user