Changed clipping code - seems to be easier to read and avoiding complex calculations.

pull/1/head
Holger Wirtz 8 years ago
parent 3d516e0811
commit 3dd5e5a224
  1. 3
      src/Makefile
  2. 5
      src/dexed.cpp
  3. 1
      src/dexed.h

@ -5,7 +5,6 @@ OBJ=fm_core.o env.o lfo.o dx7note.o sin.o pitchenv.o fm_op_kernel.o freqlut.o ex
CFLAGS=-fPIC -DPIC -std=c++11 -I. -I/usr/local/include/lvtk-2 -DLVTK_DEBUG=false
LDFLAGS=-L/usr/local/lib -llvtk_plugin2
#CFLAGS_OPTIONS+=-DNON_DEXED_CLIP # enable for non-dexed-cliping code
#CFLAGS_OPTIONS+=-DPITCHWHEEL # enable for adding pitchwheel code
ifeq ($(ARCH),)
@ -53,8 +52,6 @@ else
CXXFLAGS += $(CFLAGS) $(CFLAGS_OPTIONS) -O3 -mcpu=cortex-a7 -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -mvectorize-with-neon-quad
endif
CXXFLAGS=$(CFLAGS) $(CFLAGS_OPTIONS) -DNON_DEXED_CLIP -O3
all: $(BUNDLE) Makefile
clean: Makefile

@ -428,7 +428,7 @@ void Dexed::GetSamples(uint32_t n_samples, float* buffer)
if (voices[note].live) {
voices[note].dx7_note->compute(audiobuf.get(), lfovalue, lfodelay, &controllers);
for (uint32_t j=0; j < N; ++j) {
int32_t val = audiobuf.get()[j];
/* int32_t val = audiobuf.get()[j];
val = val >> 4;
int32_t clip_val = val < -(1 << 24) ? 0x8000 : val >= (1 << 24) ? 0x7fff : val >> 9;
float f = static_cast<float>(clip_val)/0x8000;
@ -436,7 +436,8 @@ void Dexed::GetSamples(uint32_t n_samples, float* buffer)
f=1.0;
if(f<-1.0)
f=-1.0;
sumbuf[j]+=f;
sumbuf[j]+=f; */
sumbuf[j]+=static_cast<float>(audiobuf.get()[j])*scaler;
audiobuf.get()[j]=0;
}
}

@ -51,6 +51,7 @@ enum DexedEngineResolution {
};
// GLOBALS
static const float scaler = 0.0000000025;
//==============================================================================

Loading…
Cancel
Save