commit 9443bb8b56b7a76dbece9db4b92a83325c0152d7
parent ddd10537c5e8cc32d1e239ad8861b0f75e9653ad
Author: Johannes Lorenz <[email protected]>
Date: Fri, 5 Jun 2015 17:18:07 +0200
Probably deglobalized 8. Needs testing.
Diffstat:
11 files changed, 55 insertions(+), 25 deletions(-)
diff --git a/TODO.txt b/TODO.txt
@@ -0,0 +1,11 @@
+(1) src/Params/LFOParams.h: static int time; //is used by Pcontinous
+parameter
+(2) src/DSP/FFTwrapper.cpp:static pthread_mutex_t *mutex = NULL;
+(3) src/Misc/MiddleWare.cpp:extern rtosc::ThreadLink *the_bToU;//XXX
+(4) src/Misc/Allocator.h:extern Allocator DummyAlloc;
+(5) src/Misc/Util.h:extern float *denormalkillbuf; /**<the buffer to add noise
+in order to avoid denormalisation*/
+(6) src/Misc/Util.h:extern class Config config;
+(7) src/Misc/Util.h:extern prng_t prng_state;
+(8) src/Params/PresetsStore.h:extern PresetsStore presetsstore;
+
diff --git a/src/Misc/Allocator.cpp b/src/Misc/Allocator.cpp
@@ -124,7 +124,7 @@ typedef struct block_header_t
static const size_t block_header_free_bit = 1 << 0;
#endif
-bool Allocator::memFree(void *pool)
+bool Allocator::memFree(void *pool) const
{
size_t bh_shift = sizeof(next_t)+sizeof(size_t);
//Assume that memory is free to start with
@@ -145,7 +145,7 @@ bool Allocator::memFree(void *pool)
return isFree;
}
-int Allocator::memPools()
+int Allocator::memPools() const
{
int i = 1;
next_t *n = impl->pools;
@@ -156,7 +156,7 @@ int Allocator::memPools()
return i;
}
-int Allocator::freePools()
+int Allocator::freePools() const
{
int i = 0;
next_t *n = impl->pools->next;
@@ -169,7 +169,7 @@ int Allocator::freePools()
}
-unsigned long long Allocator::totalAlloced()
+unsigned long long Allocator::totalAlloced() const
{
return impl->totalAlloced;
}
diff --git a/src/Misc/Allocator.h b/src/Misc/Allocator.h
@@ -68,14 +68,14 @@ class Allocator
//Return true if the current pool cannot allocate n chunks of chunk_size
bool lowMemory(unsigned n, size_t chunk_size);
- bool memFree(void *pool);
+ bool memFree(void *pool) const;
//returns number of pools
- int memPools();
+ int memPools() const;
- int freePools();
+ int freePools() const;
- unsigned long long totalAlloced();
+ unsigned long long totalAlloced() const;
struct AllocatorImpl *impl;
};
diff --git a/src/Misc/Config.cpp b/src/Misc/Config.cpp
@@ -46,7 +46,7 @@
#if 1
#define rObject Config
-static rtosc::Ports ports = {
+static const rtosc::Ports ports = {
//rString(cfg.LinuxOSSWaveOutDev),
//rString(cfg.LinuxOSSSeqInDev),
rParamI(cfg.SampleRate, "samples of audio per second"),
@@ -145,7 +145,7 @@ static rtosc::Ports ports = {
d.broadcast(d.loc, "i", (int)(log(c.cfg.OscilSize*1.0)/log(2.0)));
}},
};
-rtosc::Ports &Config::ports = ::ports;
+const rtosc::Ports &Config::ports = ::ports;
#endif
Config::Config()
diff --git a/src/Misc/Config.h b/src/Misc/Config.h
@@ -64,7 +64,7 @@ class Config
void init();
void save();
- static rtosc::Ports &ports;
+ static const rtosc::Ports &ports;
private:
void readConfig(const char *filename);
void saveConfig(const char *filename);
diff --git a/src/Misc/MiddleWare.cpp b/src/Misc/MiddleWare.cpp
@@ -849,6 +849,8 @@ public:
//Synthesis Rate Parameters
const SYNTH_T synth;
+
+ PresetsStore presetsstore;
};
MiddleWareImpl::MiddleWareImpl(MiddleWare *mw, SYNTH_T synth_, int prefered_port)
@@ -1377,3 +1379,13 @@ const char* MiddleWare::getServerAddress(void) const
{
return lo_server_get_url(impl->server);
}
+
+const PresetsStore& MiddleWare::getPresetsStore() const
+{
+ return impl->presetsstore;
+}
+
+PresetsStore& MiddleWare::getPresetsStore()
+{
+ return impl->presetsstore;
+}
diff --git a/src/Misc/MiddleWare.h b/src/Misc/MiddleWare.h
@@ -5,6 +5,8 @@
struct SYNTH_T;
class Master;
+class PresetsStore;
+
//Link between realtime and non-realtime layers
class MiddleWare
{
@@ -39,6 +41,9 @@ class MiddleWare
const SYNTH_T &getSynth(void) const;
//liblo stuff
const char* getServerAddress(void) const;
+
+ const PresetsStore& getPresetsStore() const;
+ PresetsStore& getPresetsStore();
private:
class MiddleWareImpl *impl;
};
diff --git a/src/Misc/PresetExtractor.cpp b/src/Misc/PresetExtractor.cpp
@@ -17,7 +17,6 @@
#include "../Params/PADnoteParameters.h"
#include "../Params/Presets.h"
#include "../Params/PresetsArray.h"
-#include "../Params/PresetsStore.h"
#include "../Params/SUBnoteParameters.h"
#include "../Misc/MiddleWare.h"
#include "PresetExtractor.h"
@@ -32,8 +31,9 @@ const rtosc::Ports real_preset_ports =
{
{"scan-for-presets:", 0, 0,
[](const char *msg, rtosc::RtData &d) {
- presetsstore.scanforpresets();
- auto &pre = presetsstore.presets;
+ MiddleWare &mw = *(MiddleWare*)d.obj;
+ mw.getPresetsStore().scanforpresets();
+ auto &pre = mw.getPresetsStore().presets;
d.reply(d.loc, "i", pre.size());
for(unsigned i=0; i<pre.size();++i)
d.reply(d.loc, "isss", i,
@@ -84,11 +84,13 @@ const rtosc::Ports real_preset_ports =
}},
{"clipboard-type:", 0, 0,
[](const char *msg, rtosc::RtData &d) {
- d.reply(d.loc, "s", presetsstore.clipboard.type.c_str());
+ const MiddleWare &mw = *(MiddleWare*)d.obj;
+ d.reply(d.loc, "s", mw.getPresetsStore().clipboard.type.c_str());
}},
{"delete:s", 0, 0,
[](const char *msg, rtosc::RtData &d) {
- presetsstore.deletepreset(rtosc_argument(msg,0).s);
+ MiddleWare &mw = *(MiddleWare*)d.obj;
+ mw.getPresetsStore().deletepreset(rtosc_argument(msg,0).s);
}},
};
@@ -202,7 +204,7 @@ std::string doCopy(MiddleWare &mw, string url, string name)
T *t = (T*)capture<void*>(m, url+"self");
//Extract Via mxml
//t->add2XML(&xml);
- t->copy(presetsstore, name.empty()? NULL:name.c_str());
+ t->copy(mw.getPresetsStore(), name.empty()? NULL:name.c_str());
});
return "";//xml.getXMLdata();
@@ -241,7 +243,7 @@ std::string doArrayCopy(MiddleWare &mw, int field, string url, string name)
//Get the pointer
T *t = (T*)capture<void*>(m, url+"self");
//Extract Via mxml
- t->copy(presetsstore, field, name.empty()?NULL:name.c_str());
+ t->copy(mw.getPresetsStore(), field, name.empty()?NULL:name.c_str());
});
return "";//xml.getXMLdata();
@@ -415,7 +417,7 @@ void presetPaste(MiddleWare &mw, std::string url, std::string name)
string data = "";
XMLwrapper xml;
if(name.empty()) {
- data = presetsstore.clipboard.data;
+ data = mw.getPresetsStore().clipboard.data;
if(data.length() < 20)
return;
if(!xml.putXMLdata(data.c_str()))
@@ -440,7 +442,7 @@ void presetPasteArray(MiddleWare &mw, std::string url, int field, std::string na
string data = "";
XMLwrapper xml;
if(name.empty()) {
- data = presetsstore.clipboard.data;
+ data = mw.getPresetsStore().clipboard.data;
if(data.length() < 20)
return;
if(!xml.putXMLdata(data.c_str()))
diff --git a/src/Params/PresetsStore.cpp b/src/Params/PresetsStore.cpp
@@ -34,7 +34,7 @@
using namespace std;
//XXX to remove
-PresetsStore presetsstore;
+//PresetsStore presetsstore;
PresetsStore::PresetsStore()
{
diff --git a/src/Params/PresetsStore.h b/src/Params/PresetsStore.h
@@ -62,5 +62,5 @@ class PresetsStore
void clearpresets();
};
-extern PresetsStore presetsstore;
+//extern PresetsStore presetsstore;
#endif
diff --git a/src/globals.h b/src/globals.h
@@ -265,9 +265,9 @@ struct SYNTH_T {
/**
* The size of a sound buffer (or the granularity)
- * All internal transfer of sound data use buffer of this size
- * All parameters are constant during this period of time, exception
- * some parameters(like amplitudes) which are linear interpolated.
+ * All internal transfer of sound data use buffer of this size.
+ * All parameters are constant during this period of time, except
+ * some parameters(like amplitudes) which are linearly interpolated.
* If you increase this you'll ecounter big latencies, but if you
* decrease this the CPU requirements gets high.
*/