Added original Dexed clipping code. Can be disabled by setting

"-DNON_DEXED_CLIP" in Makefile.
Added switch for enabling pitch-wheel code - but this code seems currently to
broken. For enabling add "-DPITCHWHEEL" in Makefile.
Renamed method for calculating which operator is a carrier.
Smaller optimizations.
pull/1/head
Holger Wirtz 8 years ago
parent d02f6f623a
commit f647d06181
  1. 9
      src/Makefile
  2. 18
      src/dexed.cpp
  3. 5
      src/manifest.ttl
  4. 7
      src/msfa/dx7note.cc
  5. 2
      src/msfa/fm_core.cc
  6. 2
      src/msfa/fm_core.h

@ -5,6 +5,9 @@ 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),)
ARCH := $(shell uname -m)
endif
@ -41,13 +44,13 @@ endif
ifeq ($(DEBUG), 1)
ifeq ($(FILETRACE), 1)
CXXFLAGS += -DDEBUG -DFILETRACE $(CFLAGS)
CXXFLAGS += -DDEBUG -DFILETRACE $(CFLAGS) $(CFLAGS_OPTIONS)
else
CXXFLAGS += -DDEBUG $(CFLAGS)
CXXFLAGS += -DDEBUG $(CFLAGS) $(CFLAGS_OPTIONS)
endif
else
#CXXFLAGS += -Ofast $(CFLAGS) $(CPU) $(FPU)
CXXFLAGS += $(CFLAGS) -O3 -mcpu=cortex-a7 -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -mvectorize-with-neon-quad
CXXFLAGS += $(CFLAGS) $(CFLAGS_OPTIONS) -O3 -mcpu=cortex-a7 -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -mvectorize-with-neon-quad
endif
all: $(BUNDLE) Makefile

@ -428,11 +428,14 @@ 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];
#ifndef NON_DEXED_CLIP
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; */
float f = static_cast<float>(clip_val)/0x8000;
#else
float f=static_cast<float>(audiobuf.get()[j]<<2)/INT_MAX;
#endif
if(f>1.0)
f=1.0;
if(f<-1.0)
@ -457,7 +460,7 @@ void Dexed::GetSamples(uint32_t n_samples, float* buffer)
if(++_param_counter%32)
{
uint8_t op_out=controllers.core->op_out(data[134]); // look for carriers
uint8_t op_carrier=controllers.core->get_carrier_operators(data[134]); // look for carriers
for(i=0;i < MAX_ACTIVE_NOTES;i++)
{
@ -470,8 +473,10 @@ void Dexed::GetSamples(uint32_t n_samples, float* buffer)
for(uint8_t op=0;op<6;op++)
{
TRACE("op=%d op_out=%d 2^op=%d %d",op,op_out,static_cast<uint8_t>(pow(2,op)),op_out&static_cast<uint8_t>(pow(2,op)));
if((op_out&static_cast<uint8_t>(pow(2,op)))>0)
uint8_t op_bit=static_cast<uint8_t>(pow(2,op));
TRACE("op=%d op_out=%d 2^op=%d %d",op,op_out,op_bit,op_out&op_bit);
if((op_carrier&op_bit)>0)
{
// this voice is a carrier!
op_carrier_num++;
@ -484,7 +489,8 @@ void Dexed::GetSamples(uint32_t n_samples, float* buffer)
}
if(op_amp==op_carrier_num)
{
voices[i].live=false; // every carrier produces no audio anymore
// all carrier-operators are silent -> disable the voice
voices[i].live=false;
TRACE("Shutting down Voice[%2d]",i);
}
}

@ -8,17 +8,18 @@
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
<https://github.com/dcoredump/dexed.lv2>
a lv2:Plugin ;
a lv2:Plugin, doap:Project, lv2:SynthPlugin ;
doap:name "Dexed" ;
doap:description "Synth" ;
doap:shortdesc "Dexed" ;
lv2:minorVersion 1; lv2:microVersion 0;
doap:homepage <https://github.com/dcoredump/dexed/tree/native-lv2> ;
doap:maintainer [
foaf:name "dcoredump" ;
foaf:homepage <https://github.com/dcoredump/dexed/tree/native-lv2> ;
foaf:mbox <mailto:dcoredump@googlemail.com> ;
] ;
rdfs:comment "Dexed.lv2 is a native LV2 port of the famous DX-7 emulator Dexed.";
lv2:microVersion 1 ;lv2:minorVersion 0 ;
doap:developer [
a foaf:Person ;
foaf:name "Pascal Gauthier" ;

@ -190,7 +190,7 @@ void Dx7Note::compute(int32_t *buf, int32_t lfo_val, int32_t lfo_delay, const Co
int32_t pitch_mod = max(pmod_1, pmod_2);
pitch_mod = pitchenv_.getsample() + (pitch_mod * (senslfo < 0 ? -1 : 1));
/*
#ifdef PITCHWHEEL
int pitchbend = ctrls->values_[kControllerPitch];
int32_t pb = (pitchbend - 0x2000);
if (pb != 0) {
@ -204,8 +204,9 @@ void Dx7Note::compute(int32_t *buf, int32_t lfo_val, int32_t lfo_delay, const Co
}
pitch_mod += pb;
pitch_mod += ctrls->masterTune;
*/
//TRACE("pitch_mod=%d pb=%d");
TRACE("pitch_mod=%d pb=%d");
#endif
// ==== AMP MOD ====
uint32_t amod_1 = ((int64_t) ampmoddepth_ * (int64_t) lfo_delay) >> 8; // Q24 :D

@ -68,7 +68,7 @@ int n_out(const FmAlgorithm &alg) {
return count;
}
uint8_t FmCore::op_out(uint8_t algorithm)
uint8_t FmCore::get_carrier_operators(uint8_t algorithm)
{
uint8_t op_out=0;
FmAlgorithm alg=algorithms[algorithm];

@ -48,7 +48,7 @@ class FmCore {
public:
virtual ~FmCore() {};
static void dump();
uint8_t op_out(uint8_t algorithm);
uint8_t get_carrier_operators(uint8_t algorithm);
virtual void render(int32_t *output, FmOpParams *params, int algorithm, int32_t *fb_buf, int32_t feedback_gain);
protected:
AlignedBuf<int32_t, N>buf_[2];

Loading…
Cancel
Save