PCM moved out of beatdetect. Only projectM.hpp needs to be included, and even more headers removed from installation

git-svn-id: https://projectm.svn.sourceforge.net/svnroot/projectm/trunk@530 6778bc44-b910-0410-a7a0-be141de4315d
This commit is contained in:
psperl
2007-10-05 17:13:12 +00:00
parent 3b43927cc6
commit 75f2e2a25c
10 changed files with 28 additions and 32 deletions

View File

@ -37,9 +37,11 @@
#include "PCM.hpp"
#include <cmath>
DLLEXPORT BeatDetect::BeatDetect() {
DLLEXPORT BeatDetect::BeatDetect(PCM *pcm) {
int x,y;
this->pcm=pcm;
this->vol_instant=0;
this->vol_history=0;
@ -71,14 +73,11 @@ DLLEXPORT BeatDetect::BeatDetect() {
this->bass_att = 0;
this->vol = 0;
this->pcm = new PCM();
}
DLLEXPORT BeatDetect::~BeatDetect() {
// Free the pcm buffer
if (pcm)
delete(pcm);
DLLEXPORT BeatDetect::~BeatDetect()
{
}

View File

@ -62,7 +62,7 @@ class BeatDetect
PCM *pcm;
/** Methods */
DLLEXPORT BeatDetect();
DLLEXPORT BeatDetect(PCM *pcm);
DLLEXPORT ~BeatDetect();
void initBeatDetect();
void reset();

View File

@ -34,5 +34,5 @@ FILE(GLOB fonts "fonts/*.ttf")
INSTALL(FILES ${fonts} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/projectM/fonts)
INSTALL(FILES "${CMAKE_BINARY_DIR}/libprojectM.pc" DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig)
INSTALL(FILES config.inp DESTINATION ${CMAKE_INSTALL_PREFIX}/share/projectM)
INSTALL(FILES projectM.hpp BeatDetect.hpp Preset.hpp event.h KeyHandler.hpp dlldefs.h fatal.h PresetFrameIO.hpp PCM.hpp DESTINATION include/libprojectM)
INSTALL(FILES projectM.hpp Preset.hpp event.h dlldefs.h fatal.h PresetFrameIO.hpp PCM.hpp DESTINATION include/libprojectM)
INSTALL(TARGETS projectM DESTINATION lib)

View File

@ -81,9 +81,11 @@ projectM::~projectM() {
destroyPresetTools();
if (renderer)
delete(renderer);
delete(renderer);
if (beatDetect)
delete(beatDetect);
delete(beatDetect);
if (pcm)
delete(pcm);
}
DLLEXPORT unsigned projectM::initRenderToTexture()
@ -350,7 +352,9 @@ void projectM::projectM_reset()
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();
pcm = new PCM();
beatDetect = new BeatDetect(pcm);
initPresetTools();
#if 0

View File

@ -66,10 +66,12 @@
#include "event.h"
#include "fatal.h"
#include "PresetFrameIO.hpp"
#include "PCM.hpp"
#include <memory>
class BeatDetect;
class PCM;
class Func;
class Renderer;
class Preset;
@ -107,9 +109,8 @@ typedef enum {
class projectM
{
public:
BeatDetect * beatDetect;
PCM *pcm;
DLLEXPORT projectM(std::string config_file);
DLLEXPORT 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);
@ -124,6 +125,8 @@ public:
~projectM();
private:
BeatDetect * beatDetect;
Renderer *renderer;
std::string presetURL;

View File

@ -12,10 +12,7 @@
#include <config.h>
#include <libvisual/libvisual.h>
#include <libprojectM/BeatDetect.hpp>
#include <libprojectM/PCM.hpp>
#include <libprojectM/projectM.hpp>
#include <libprojectM/KeyHandler.hpp>
#include "lvtoprojectM.h"
#include "ConfigFile.h"
@ -234,7 +231,7 @@ extern "C" int lv_projectm_render (VisPluginData *plugin, VisVideo *video, VisAu
addPCM16Data(pcms,512);
*/
priv->PM->beatDetect->pcm->addPCMfloat(*pcm,512);
priv->PM->pcm->addPCMfloat(*pcm,512);
priv->PM->renderFrame();

View File

@ -23,10 +23,7 @@
#include <stdlib.h>
#include <math.h>
#include <SDL/SDL.h>
#include <libprojectM/BeatDetect.hpp>
#include <libprojectM/PCM.hpp>
#include <libprojectM/projectM.hpp>
#include <libprojectM/KeyHandler.hpp>
#include "sdltoprojectM.h"
#include "ConfigFile.h"

View File

@ -23,10 +23,9 @@
#include <stdlib.h>
#include <math.h>
#include <SDL/SDL.h>
#include <libprojectM/BeatDetect.hpp>
#include <libprojectM/PCM.hpp>
#include <libprojectM/projectM.hpp>
#include <libprojectM/KeyHandler.hpp>
#include "sdltoprojectM.h"
#include "ConfigFile.h"

View File

@ -23,10 +23,9 @@
#include <stdlib.h>
#include <math.h>
#include <SDL/SDL.h>
#include <libprojectM/BeatDetect.hpp>
#include <libprojectM/PCM.hpp>
#include <libprojectM/projectM.hpp>
#include <libprojectM/KeyHandler.hpp>
#include "sdltoprojectM.h"
#include "ConfigFile.h"

View File

@ -41,10 +41,8 @@ www.gamedev.net/reference/programming/features/beatdetection/
#include <math.h>
#include "ConfigFile.h"
#include <libprojectM/BeatDetect.hpp>
#include <libprojectM/PCM.hpp>
#include <libprojectM/projectM.hpp>
#include <libprojectM/KeyHandler.hpp>
#include "sdltoprojectM.h"
#include "video_init.h"
@ -329,7 +327,7 @@ extern "C" void projectM_render_pcm(gint16 pcm_data[2][512])
{
//SDL_mutexP(mutex); while ( SDL_SemValue(sem)==1 )
if ( SDL_SemValue(sem)==1 )
globalPM->beatDetect->pcm->addPCM16(pcm_data);
globalPM->pcm->addPCM16(pcm_data);
//SDL_mutexV(mutex);