please just work already

This commit is contained in:
Connor Olding 2015-06-10 20:48:07 -07:00
parent 3cc5467f5b
commit 44d303cf95
10 changed files with 42 additions and 51 deletions

View File

@ -42,7 +42,7 @@ LADSPA_FLAGS =
VST_FLAGS = -Wno-write-strings -Wno-narrowing VST_FLAGS = -Wno-write-strings -Wno-narrowing
VST_FLAGS += -I $(VST_SDK_DIR) -DBUILDING_DLL=1 VST_FLAGS += -I $(VST_SDK_DIR) -DBUILDING_DLL=1
OPT_FLAGS = -Ofast -march=native -mfpmath=sse OPT_FLAGS = -Ofast -march=core2 -mfpmath=sse
# any possibly produced files besides intermediates # any possibly produced files besides intermediates
ALL = $(SHOBJ) $(PROGRAM) $(BIN)/vstsdk.o $(EXE) $(DLL) ALL = $(SHOBJ) $(PROGRAM) $(BIN)/vstsdk.o $(EXE) $(DLL)

View File

@ -53,3 +53,4 @@ other targets:
* scrap overly-complex makefile for a shell script * scrap overly-complex makefile for a shell script
* support for CPUs without SSE/NEON * support for CPUs without SSE/NEON
* don't mix CamelCase with underscores (only done for legacy reasons) * don't mix CamelCase with underscores (only done for legacy reasons)
* compressor plugin

View File

@ -130,3 +130,8 @@ struct Crap_delay_test
c_R = c_L; c_R = c_L;
} }
}; };
constexpr char Crap_delay_test::label[];
constexpr char Crap_delay_test::name[];
constexpr char Crap_delay_test::author[];
constexpr char Crap_delay_test::copyright[];

View File

@ -1,5 +1,5 @@
template<class Mixin> template<class Mixin>
struct Buffer2 : public virtual Mixin { struct Buffer2 : public Mixin {
virtual void virtual void
process2(v2df *buf, ulong rem) = 0; process2(v2df *buf, ulong rem) = 0;
@ -16,15 +16,15 @@ struct Buffer2 : public virtual Mixin {
rem = count - pos; rem = count - pos;
for (ulong i = 0; i < rem; i++) { for (ulong i = 0; i < rem; i++) {
buf[i][0] = in_L[i]; buf[i].v[0] = in_L[i];
buf[i][1] = in_R[i]; buf[i].v[1] = in_R[i];
} }
process2(buf, rem); process2(buf, rem);
for (ulong i = 0; i < rem; i++) { for (ulong i = 0; i < rem; i++) {
out_L[i] = buf[i][0]; out_L[i] = buf[i].v[0];
out_R[i] = buf[i][1]; out_R[i] = buf[i].v[1];
} }
in_L += BLOCK_SIZE; in_L += BLOCK_SIZE;

View File

@ -1,5 +1,5 @@
template<class Mixin> template<class Mixin>
struct Buffer2OS2 : public virtual Mixin { struct Buffer2OS2 : public Mixin {
virtual void virtual void
process2(v2df *buf, ulong rem) = 0; process2(v2df *buf, ulong rem) = 0;

View File

@ -1,5 +1,5 @@
template<class Mixin> template<class Mixin>
struct Buffer4 : public virtual Mixin { struct Buffer4 : public Mixin {
virtual void virtual void
process2(v4sf *buf_L, v4sf *buf_R, ulong rem) = 0; process2(v4sf *buf_L, v4sf *buf_R, ulong rem) = 0;
@ -19,19 +19,19 @@ struct Buffer4 : public virtual Mixin {
rem = count - pos; rem = count - pos;
for (ulong i = 0, j = 0; i < rem; i += 2, j++) { for (ulong i = 0, j = 0; i < rem; i += 2, j++) {
buf_L[j][0] = in_L[i+0]; buf_L[j].v[0] = in_L[i+0];
buf_L[j][1] = in_L[i+1]; buf_L[j].v[1] = in_L[i+1];
buf_R[j][0] = in_R[i+0]; buf_R[j].v[0] = in_R[i+0];
buf_R[j][1] = in_R[i+1]; buf_R[j].v[1] = in_R[i+1];
} }
process2(buf_L, buf_R, rem); process2(buf_L, buf_R, rem);
for (ulong i = 0, j = 0; i < rem; i += 2, j++) { for (ulong i = 0, j = 0; i < rem; i += 2, j++) {
out_L[i+0] = buf_L[j][0]; out_L[i+0] = buf_L[j].v[0];
out_L[i+1] = buf_L[j][1]; out_L[i+1] = buf_L[j].v[1];
out_R[i+0] = buf_R[j][0]; out_R[i+0] = buf_R[j].v[0];
out_R[i+1] = buf_R[j][1]; out_R[i+1] = buf_R[j].v[1];
} }
in_L += BLOCK_SIZE; in_L += BLOCK_SIZE;

View File

@ -2,14 +2,6 @@ struct Crap {
virtual inline virtual inline
~Crap() {} ~Crap() {}
ulong id;
char *label;
char *name;
char *author;
char *copyright;
ulong bands;
ulong parameters;
virtual void virtual void
pause() = 0; pause() = 0;
@ -39,7 +31,7 @@ struct Crap {
}; };
template<class Mixin> template<class Mixin>
struct AdjustAll : public virtual Mixin { struct AdjustAll : public Mixin {
ulong fs; ulong fs;
virtual void virtual void
@ -60,7 +52,7 @@ struct AdjustAll : public virtual Mixin {
}; };
template<class Mixin> template<class Mixin>
struct NoParams : public virtual Mixin { struct NoParams : public Mixin {
// etc // etc
//void //void

View File

@ -123,18 +123,18 @@ svf_run_block_mat(svf_matrix<T> *RESTRICT mat, T *RESTRICT buf, ulong count)
T t1, t2, t3, t4; T t1, t2, t3, t4;
T memory = mat->memory; T memory = mat->memory;
for (ulong i = 0; i < count/2; i++) { for (ulong i = 0; i < count/2; i++) {
memory[0] = buf[i][0]; memory.v[0] = buf[i].v[0];
memory[1] = buf[i][1]; memory.v[1] = buf[i].v[1];
t1 = mat->a*memory; t1 = mat->a*memory;
t2 = mat->b*memory; t2 = mat->b*memory;
t3 = mat->c*memory; t3 = mat->c*memory;
t4 = mat->d*memory; t4 = mat->d*memory;
memory[0] = t1[0] + t1[1] + t1[2] + t1[3]; memory.v[0] = t1.v[0] + t1.v[1] + t1.v[2] + t1.v[3];
memory[1] = t2[0] + t2[1] + t2[2] + t2[3]; memory.v[1] = t2.v[0] + t2.v[1] + t2.v[2] + t2.v[3];
memory[2] = t3[0] + t3[1] + t3[2] + t3[3]; memory.v[2] = t3.v[0] + t3.v[1] + t3.v[2] + t3.v[3];
memory[3] = t4[0] + t4[1] + t4[2] + t4[3]; memory.v[3] = t4.v[0] + t4.v[1] + t4.v[2] + t4.v[3];
buf[i][0] = memory[0]; buf[i].v[0] = memory.v[0];
buf[i][1] = memory[1]; buf[i].v[1] = memory.v[1];
} }
mat->memory = memory; mat->memory = memory;
} }

View File

@ -73,16 +73,6 @@ struct Dumber<_v4sf> : public DumberBase<_v4sf> {
TEMPLATE inline TEMPLATE inline
Dumber(T x) Dumber(T x)
{ v = (_v4sf){float(x), float(x), float(x), float(x)}; } { v = (_v4sf){float(x), float(x), float(x), float(x)}; }
inline float &
operator[](int index) {
return ((float *)&v)[index];
}
inline const float &
operator[](int index) const {
return ((float *)&v)[index];
}
}; };
typedef Dumber<_v2df> v2df; typedef Dumber<_v2df> v2df;

View File

@ -39,18 +39,20 @@ struct plugin : public AudioEffectX
Param params[CrapPlug::parameters]; Param params[CrapPlug::parameters];
CrapPlug crap; Crap *crap;
}; };
AudioEffect * AudioEffect *
createEffectInstance(audioMasterCallback audioMaster) createEffectInstance(audioMasterCallback audioMaster)
{ {
// TODO: return new plugin<CrapPlug>(audioMaster);
return new plugin(audioMaster); return new plugin(audioMaster);
} }
plugin::plugin(audioMasterCallback audioMaster) plugin::plugin(audioMasterCallback audioMaster)
: AudioEffectX(audioMaster, 1, CrapPlug::parameters) : AudioEffectX(audioMaster, 1, CrapPlug::parameters)
{ {
crap = new CrapPlug();
setNumInputs(2); setNumInputs(2);
setNumOutputs(2); setNumOutputs(2);
setUniqueID(CrapPlug::id); setUniqueID(CrapPlug::id);
@ -62,12 +64,13 @@ plugin::plugin(audioMasterCallback audioMaster)
plugin::~plugin() plugin::~plugin()
{ {
delete crap;
} }
void void
plugin::resume() plugin::resume()
{ {
crap.resume(); crap->resume();
AudioEffectX::resume(); AudioEffectX::resume();
} }
@ -75,14 +78,14 @@ void
plugin::suspend() plugin::suspend()
{ {
AudioEffectX::suspend(); AudioEffectX::suspend();
crap.pause(); crap->pause();
} }
void void
plugin::processReplacing( plugin::processReplacing(
float **inputs, float **outputs, VstInt32 count) float **inputs, float **outputs, VstInt32 count)
{ {
crap.process( crap->process(
inputs[0], inputs[1], inputs[0], inputs[1],
outputs[0], outputs[1], outputs[0], outputs[1],
count); count);
@ -92,7 +95,7 @@ void
plugin::processDoubleReplacing( plugin::processDoubleReplacing(
double **inputs, double **outputs, VstInt32 count) double **inputs, double **outputs, VstInt32 count)
{ {
crap.process( crap->process(
inputs[0], inputs[1], inputs[0], inputs[1],
outputs[0], outputs[1], outputs[0], outputs[1],
count); count);
@ -108,7 +111,7 @@ void
plugin::setSampleRate(float fs) plugin::setSampleRate(float fs)
{ {
AudioEffectX::setSampleRate(fs); AudioEffectX::setSampleRate(fs);
crap.adjust(params, (unsigned long) fs); crap->adjust(params, (unsigned long) fs);
#ifdef DELAY #ifdef DELAY
setInitialDelay(global_delay); setInitialDelay(global_delay);
#endif #endif
@ -160,7 +163,7 @@ plugin::setParameter(VstInt32 index, float value)
{ {
if (index >= CrapPlug::parameters) return; if (index >= CrapPlug::parameters) return;
params[index].set(value); params[index].set(value);
crap.adjust_one(params, index); crap->adjust_one(params, index);
} }
float float