Merge pull request #734 from diizy/bandlimit

Move the initialization of BandLimitedWaves into engine.cpp
This commit is contained in:
Tobias Doerffel
2014-05-18 15:11:51 +02:00
4 changed files with 51 additions and 42 deletions

View File

@@ -30,6 +30,34 @@ WaveMipMap BandLimitedWave::s_waveforms[4] = { };
bool BandLimitedWave::s_wavesGenerated = false;
QString BandLimitedWave::s_wavetableDir = "";
QDataStream& operator<< ( QDataStream &out, WaveMipMap &waveMipMap )
{
for( int tbl = 0; tbl <= MAXTBL; tbl++ )
{
for( int i = 0; i < TLENS[tbl]; i++ )
{
out << waveMipMap.sampleAt( tbl, i );
}
}
return out;
}
QDataStream& operator>> ( QDataStream &in, WaveMipMap &waveMipMap )
{
sample_t sample;
for( int tbl = 0; tbl <= MAXTBL; tbl++ )
{
for( int i = 0; i < TLENS[tbl]; i++ )
{
in >> sample;
waveMipMap.setSampleAt( tbl, i, sample );
}
}
return in;
}
void BandLimitedWave::generateWaves()
{
// don't generate if they already exist

View File

@@ -43,6 +43,7 @@
#include "Plugin.h"
#include "SongEditor.h"
#include "song.h"
#include "BandLimitedWave.h"
bool engine::s_hasGUI = true;
@@ -72,6 +73,9 @@ void engine::init( const bool _has_gui )
{
s_hasGUI = _has_gui;
// generate (load from file) bandlimited wavetables
BandLimitedWave::generateWaves();
initPluginFileHandling();
s_projectJournal = new ProjectJournal;