slowly making projectM class not depend on static crap

git-svn-id: https://projectm.svn.sourceforge.net/svnroot/projectm/trunk@437 6778bc44-b910-0410-a7a0-be141de4315d
This commit is contained in:
w1z7ard
2007-09-17 01:25:09 +00:00
parent fb2076a1a4
commit ddb0b1069b
3 changed files with 52 additions and 33 deletions

View File

@ -73,6 +73,14 @@ DLLEXPORT BeatDetect::BeatDetect() {
this->pcm = new PCM();
}
DLLEXPORT BeatDetect::~BeatDetect() {
// Free the pcm buffer
if (pcm)
delete(pcm);
}
void BeatDetect::reset() {
this->treb = 0;
this->mid = 0;

View File

@ -34,39 +34,41 @@
#include "projectM.hpp"
#include "PCM.hpp"
class BeatDetect {
public:
/** Vars */
float beat_buffer[32][80],
beat_instant[32],
beat_history[32];
float beat_val[32],
beat_att[32],
beat_variance[32];
int beat_buffer_pos;
float vol_buffer[80],
vol_instant,
vol_history;
class BeatDetect
{
public:
/** Vars */
float beat_buffer[32][80],
beat_instant[32],
beat_history[32];
float beat_val[32],
beat_att[32],
beat_variance[32];
int beat_buffer_pos;
float vol_buffer[80],
vol_instant,
vol_history;
float treb ;
float mid ;
float bass ;
float bass_old ;
float beat_sensitivity;
float treb_att ;
float mid_att ;
float bass_att ;
float vol;
float treb ;
float mid ;
float bass ;
float bass_old ;
float beat_sensitivity;
float treb_att ;
float mid_att ;
float bass_att ;
float vol;
PCM *pcm;
PCM *pcm;
/** Methods */
DLLEXPORT BeatDetect();
void initBeatDetect();
void reset();
void detectFromSamples();
void getBeatVals( float *vdataL, float *vdataR);
void freeBeatDetect();
};
/** Methods */
DLLEXPORT BeatDetect();
DLLEXPORT ~BeatDetect();
void initBeatDetect();
void reset();
void detectFromSamples();
void getBeatVals ( float *vdataL, float *vdataR );
};
#endif /** !_BEAT_DETECT_H */

View File

@ -79,7 +79,9 @@ DLLEXPORT projectM::projectM(int gx, int gy, int fps, int texsize, int width, in
DLLEXPORT projectM::~projectM() {
std::cerr << "[projectM] DESTROY PRESET TOOLS BEGIN" << std::endl;
destroyPresetTools();
std::cerr << "[projectM] DESTROY PRESET TOOLS BEGIN" << std::endl;
if (beatDetect)
delete(beatDetect);
std::cerr << "[projectM] DESTROY PRESET TOOLS END" << std::endl;
}
DLLEXPORT projectM::projectM(std::string config_file) :smoothFrame(0), beatDetect ( 0 )
@ -854,12 +856,19 @@ int projectM::initPresetTools()
projectM_resetengine();
std::cerr << "[projectM] engine has been reset." << std::endl;
return PROJECTM_SUCCESS;
}
void projectM::destroyPresetTools()
{
if (m_presetPos)
delete(m_presetPos);
/// @slow might not be necessary
m_presetPos = 0;
if ( m_presetChooser )
delete ( m_presetChooser );
@ -868,7 +877,7 @@ void projectM::destroyPresetTools()
if ( m_presetLoader )
delete ( m_presetLoader );
/// @slow might not be necessary
m_presetLoader = 0;