Fixes and tests...

Fully removed the ringbuffer - it is not needed anymore!
pull/1/head
Holger Wirtz 8 years ago
parent 3bc4c28cfe
commit 72350a5cf5
  1. 5
      src/Makefile
  2. 23
      src/dexed.cpp
  3. 2
      src/dexed.h
  4. 7
      src/msfa/dx7note.cc
  5. 0
      src/trash/ringbuffer.cc
  6. 0
      src/trash/ringbuffer.h

@ -2,7 +2,7 @@
BUNDLE=dexed.lv2
INSTALL_DIR=/home/pi/zynthian/zynthian-plugins/mod-lv2
TARGET=dexed.so
OBJ=ringbuffer.o fm_core.o env.o lfo.o dx7note.o sin.o pitchenv.o fm_op_kernel.o freqlut.o exp2.o EngineMkI.o EngineOpl.o PluginFx.o trace.o
OBJ=fm_core.o env.o lfo.o dx7note.o sin.o pitchenv.o fm_op_kernel.o freqlut.o exp2.o EngineMkI.o EngineOpl.o PluginFx.o trace.o
CFLAGS=-fPIC -DPIC $(DEBUG) -std=c++11 -I. -I/usr/local/include/lvtk-2
LDFLAGS=-L/usr/local/lib -llvtk_plugin2
@ -33,9 +33,6 @@ dexed.o: Makefile dexed.cpp dexed.peg
trace.o: Makefile trace.c trace.h
$(CXX) $(CFLAGS) -Wall -c trace.c
ringbuffer.o: Makefile msfa/ringbuffer.cc
$(CXX) $(CFLAGS) -Wall -c msfa/ringbuffer.cc
fm_core.o: Makefile msfa/fm_core.cc
$(CXX) $(CFLAGS) -Wall -c msfa/fm_core.cc

@ -9,7 +9,6 @@
#include "msfa/sin.h"
#include "msfa/freqlut.h"
#include "msfa/controllers.h"
#include "msfa/ringbuffer.h"
#include "PluginFx.h"
#include <string.h>
#include <limits.h>
@ -25,7 +24,6 @@ Dexed::Dexed(double rate) : lvtk::Synth<DexedVoice, Dexed>(p_n_ports, p_midi_in)
Tanh::init();
Sin::init();
lastStateSave = 0;
currentNote = -1;
engineType = -1;
monoMode = 0;
@ -58,6 +56,8 @@ Dexed::Dexed(double rate) : lvtk::Synth<DexedVoice, Dexed>(p_n_ports, p_midi_in)
lfo.reset(data + 137);
extra_buf_size_ = 0;
add_voices(new DexedVoice(rate));
add_audio_outputs(p_audio_out);
@ -292,7 +292,6 @@ void Dexed::run (uint32_t sample_count)
TRACE("midi msg %d: %d\n",i,((uint8_t*)LV2_ATOM_BODY(&ev->body))[i]);
}
#endif
// ring_buffer_.Write ((uint8_t*) LV2_ATOM_BODY (&ev->body), ev->body.size);
if(ProcessMidiMessage((uint8_t*) LV2_ATOM_BODY (&ev->body),ev->body.size)==false)
break;
@ -328,19 +327,6 @@ void Dexed::run (uint32_t sample_count)
void Dexed::GetSamples(int n_samples, float *buffer)
{
/* size_t input_offset;
TransferInput();
for (input_offset = 0; input_offset < input_buffer_index_; ) {
int bytes_available = input_buffer_index_ - input_offset;
int bytes_consumed = ProcessMidiMessage(input_buffer_ + input_offset, bytes_available);
if (bytes_consumed == 0) {
break;
}
input_offset += bytes_consumed;
}
ConsumeInput(input_offset); */
int i;
if ( refreshVoice ) {
for(i=0;i < MAX_ACTIVE_NOTES;i++) {
@ -351,7 +337,6 @@ void Dexed::GetSamples(int n_samples, float *buffer)
lfo.reset(data + 137);
refreshVoice = false;
}
// flush first events
for (i=0; i < n_samples && i < extra_buf_size_; i++) {
buffer[i] = extra_buf_[i];
@ -408,10 +393,6 @@ void Dexed::GetSamples(int n_samples, float *buffer)
}
extra_buf_size_ = i - n_samples;
}
//#ifdef DEBUG
//for(i=0;i<n_samples;i++)
// TRACE("samplebuffer[%d]=%f",i,buffer[i]);
//#endif
}
bool Dexed::ProcessMidiMessage(const uint8_t *buf, int buf_size) {

@ -26,7 +26,6 @@
#include "msfa/lfo.h"
#include "msfa/synth.h"
#include "msfa/fm_core.h"
#include "msfa/ringbuffer.h"
#include "PluginFx.h"
#include "EngineMkI.h"
#include "EngineOpl.h"
@ -113,7 +112,6 @@ class Dexed : public lvtk::Synth<DexedVoice, Dexed>
FmCore engineMsfa;
EngineMkI engineMkI;
EngineOpl engineOpl;
RingBuffer ring_buffer_;
float* outbuf_;
uint32_t bufsize_;
int16_t extra_buf_[N];

@ -114,9 +114,11 @@ int ScaleLevel(int midinote, int break_pt, int left_depth, int right_depth,
int left_curve, int right_curve) {
int offset = midinote - break_pt - 17;
if (offset >= 0) {
return ScaleCurve(offset / 3, right_depth, right_curve);
//return ScaleCurve(offset / 3, right_depth, right_curve);
return ScaleCurve((offset+1) / 3, right_depth, right_curve);
} else {
return ScaleCurve((-offset) / 3, left_depth, left_curve);
//return ScaleCurve((-offset) / 3, left_depth, left_curve);
return ScaleCurve(-(offset-1) / 3, left_depth, left_curve);
}
}
@ -295,3 +297,4 @@ void Dx7Note::oscSync() {
params_[i].phase = 0;
}
}

Loading…
Cancel
Save