State saving.

pull/1/head
Holger Wirtz 8 years ago
parent 87e158540c
commit 96470269a0
  1. 12
      dexed-test.sh
  2. 44
      dexed.txt
  3. 10
      src/Dexed.h
  4. 13
      src/Makefile
  5. 39
      src/dexed.cpp
  6. 10
      src/dexed.h
  7. 2
      src/manifest.ttl
  8. BIN
      src/msfa/aligned_buf.h.gch
  9. 5
      src/msfa/controllers.h
  10. BIN
      src/msfa/controllers.h.gch
  11. BIN
      src/msfa/dx7note.h.gch
  12. BIN
      src/msfa/env.h.gch
  13. BIN
      src/msfa/exp2.h.gch
  14. 1
      src/msfa/fm_core.cc
  15. BIN
      src/msfa/fm_core.h.gch
  16. BIN
      src/msfa/fm_op_kernel.h.gch
  17. BIN
      src/msfa/freqlut.h.gch
  18. BIN
      src/msfa/lfo.h.gch
  19. BIN
      src/msfa/module.h.gch
  20. BIN
      src/msfa/pitchenv.h.gch
  21. BIN
      src/msfa/sin.h.gch
  22. 12
      src/msfa/synth.h
  23. BIN
      src/msfa/synth.h.gch
  24. 12
      src/trace.c
  25. 11
      src/trace.h

@ -0,0 +1,12 @@
#!/bin/sh
export LV2_PATH="/usr/local/lib/lv2"
jackd --silent -r -d dummy &
mod-host -i <<ENDOFDATA
add https://github.com/dcoredump/dexed.lv2 0
add http://gareus.org/oss/lv2/stepseq#s8n8 1
connect effect_1:midiout effect_0:midi_in
connect effect_0:lv2_audio_out_1 system:playback_1
connect effect_0:lv2_audio_out_1 system:playback_2
param_set 1 grid_1_1 1
param_set 1 grid_2_3 1
ENDOFDADA

@ -1,44 +0,0 @@
PluginParam.cpp: 340 DexedAudioProcessor::initCtrl() {
CtrlDX(String name, int steps, int offset = -1, int displayValue = 0);
fxCutoff = new CtrlFloat("Cutoff", &fx.uiCutoff);
fxReso = new CtrlFloat("Resonance", &fx.uiReso);
output = new CtrlFloat("Output", &fx.uiGain);
tune = new CtrlTune("MASTER TUNE ADJ", this);
algo = new CtrlDX("ALGORITHM", 31, 134, 1);
feedback = new CtrlDX("FEEDBACK", 7, 135);
oscSync = new CtrlDX("OSC KEY SYNC", 1, 136);
lfoRate = new CtrlDX("LFO SPEED", 99, 137);
lfoDelay = new CtrlDX("LFO DELAY", 99, 138);
lfoPitchDepth = new CtrlDX("LFO PM DEPTH", 99, 139);
lfoAmpDepth = new CtrlDX("LFO AM DEPTH", 99, 140);
lfoSync = new CtrlDX("LFO KEY SYNC", 1, 141);
lfoWaveform = new CtrlDXLabel("LFO WAVE", 5, 142, lbl);
transpose = new CtrlDXTranspose("MIDDLE C", 48, 144);
pitchModSens = new CtrlDX("P MODE SENS.", 7, 143);
0..5
pitchEgRate[i] = new CtrlDX(rate, 99, 126+i);
pitchEgLevel[i] = new CtrlDX(level, 99, 130+i);
opCtrl[opVal].egRate[j] = new CtrlDX(opRate, 99, opTarget + j);
opCtrl[opVal].egLevel[j] = new CtrlDX(opLevel, 99, opTarget + j + 4);
opCtrl[opVal].level = new CtrlDX(opVol, 99, opTarget + 16);
opCtrl[opVal].opMode = new CtrlDX(opMode, 1, opTarget + 17);
opCtrl[opVal].coarse = new CtrlDX(coarse, 31, opTarget + 18);
opCtrl[opVal].fine = new CtrlDX(fine, 99, opTarget + 19);
opCtrl[opVal].detune = new CtrlDX(detune, 14, opTarget + 20, -7);
opCtrl[opVal].sclBrkPt = new CtrlDX(sclBrkPt, 99, opTarget + 8);
opCtrl[opVal].sclLeftDepth = new CtrlDX(sclLeftDepth, 99, opTarget + 9);
opCtrl[opVal].sclRightDepth = new CtrlDX(sclRightDepth, 99, opTarget + 10);
opCtrl[opVal].sclLeftCurve = new CtrlDXLabel(sclLeftCurve, 3, opTarget + 11, keyScaleLabels);
opCtrl[opVal].sclRightCurve = new CtrlDXLabel(sclRightCurve, 3, opTarget + 12, keyScaleLabels);
opCtrl[opVal].sclRate = new CtrlDX(sclRate, 7, opTarget + 13);
opCtrl[opVal].ampModSens = new CtrlDX(ampModSens, 3, opTarget + 14);
opCtrl[opVal].velModSens = new CtrlDX(velModSens, 7, opTarget + 15);
opCtrl[opVal].opSwitch = new CtrlOpSwitch(opSwitchLabel, (char *)&(controllers.opSwitch)+(5-i));

@ -21,16 +21,6 @@
#ifndef DEXED_H_INCLUDED #ifndef DEXED_H_INCLUDED
#define DEXED_H_INCLUDED #define DEXED_H_INCLUDED
void dexed_trace(const char *source, const char *fmt, ...);
#define DEXED_ID "0.9.2" #define DEXED_ID "0.9.2"
#ifdef DEBUG
#define DEXED_VERSION DEXED_ID " DEBUG"
#define TRACE(fmt, ...) dexed_trace(__PRETTY_FUNCTION__,fmt,##__VA_ARGS__)
#else
#define DEXED_VERSION DEXED_ID
#define TRACE(fmt, ...)
#endif
#endif // DEXED_H_INCLUDED #endif // DEXED_H_INCLUDED

@ -1,16 +1,16 @@
#DEBUG=-DDEBUG=1 -DMSFADEBUG=1 DEBUG=-DDEBUG=1
#DEBUG=-DMSFADEBUG=1
BUNDLE=dexed.lv2 BUNDLE=dexed.lv2
INSTALL_DIR=/home/pi/zynthian/zynthian-plugins/mod-lv2 #INSTALL_DIR=/home/pi/zynthian/zynthian-plugins/mod-lv2
INSTALL_DIR=/usr/local/lib/lv2
TARGET=dexed.so 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 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
CFLAGS=-fPIC -DPIC $(DEBUG) -std=c++11 -I. -I/usr/local/include/lvtk-2 CFLAGS=-fPIC -DPIC $(DEBUG) -std=c++11 -I. -I/usr/local/include/lvtk-2
LDFLAGS=-L/usr/local/lib -llvtk_plugin2 LDFLAGS=-L/usr/local/lib -llvtk_plugin2
all: $(BUNDLE) Makefile all: $(BUNDLE) Makefile
clean: clean:
rm -f *.o *~ *.bak *.gch dexed.peg *.so rm -f *.o *~ *.bak *.gch dexed.peg *.so *.gch msfa/*.gch
rm -rf $(BUNDLE) rm -rf $(BUNDLE)
install: $(BUNDLE) install: $(BUNDLE)
@ -37,6 +37,9 @@ dexed.so: $(OBJ) dexed.o
dexed.o: dexed.cpp dexed.peg dexed.o: dexed.cpp dexed.peg
$(CXX) $(CFLAGS) -Wall -c dexed.cpp $(CXX) $(CFLAGS) -Wall -c dexed.cpp
trace.o: trace.c trace.h
$(CXX) $(CFLAGS) -Wall -c trace.c
ringbuffer.o: msfa/ringbuffer.cc ringbuffer.o: msfa/ringbuffer.cc
$(CXX) $(CFLAGS) -Wall -c msfa/ringbuffer.cc $(CXX) $(CFLAGS) -Wall -c msfa/ringbuffer.cc

@ -561,6 +561,34 @@ void Dexed::onParam(int param_num,int param_val)
data[param_num]=param_val; data[param_num]=param_val;
} }
int Dexed::getEngineType() {
return engineType;
}
void Dexed::setEngineType(int tp) {
TRACE("settings engine %d", tp);
switch (tp) {
case DEXED_ENGINE_MARKI:
controllers.core = &engineMkI;
feedback_bitdepth = 11;
break;
case DEXED_ENGINE_OPL:
controllers.core = &engineOpl;
feedback_bitdepth = 11;
break;
default:
controllers.core = &engineMsfa;
feedback_bitdepth = 8;
break;
}
engineType = tp;
}
void Dexed::setMonoMode(bool mode) {
monoMode = mode;
}
//============================================================================== //==============================================================================
DexedVoice::DexedVoice(double rate) : m_key(lvtk::INVALID_KEY), m_rate(rate) DexedVoice::DexedVoice(double rate) : m_key(lvtk::INVALID_KEY), m_rate(rate)
@ -604,15 +632,4 @@ unsigned char DexedVoice::get_key(void) const
TRACE("Bye"); TRACE("Bye");
} }
#ifdef DEBUG
void dexed_trace(const char *source, const char *fmt, ...) {
char output[4096];
va_list argptr;
va_start(argptr, fmt);
vsnprintf(output, 4095, fmt, argptr);
va_end(argptr);
printf("%s: %s\n",source,output);
}
#endif
static int _ = Dexed::register_class(p_uri); static int _ = Dexed::register_class(p_uri);

@ -31,6 +31,9 @@
#include "EngineMkI.h" #include "EngineMkI.h"
#include "EngineOpl.h" #include "EngineOpl.h"
#include "dexed.peg" #include "dexed.peg"
#ifdef DEBUG
#include "trace.h"
#endif
struct ProcessorVoice { struct ProcessorVoice {
int midi_note; int midi_note;
@ -46,12 +49,6 @@ enum DexedEngineResolution {
DEXED_ENGINE_OPL DEXED_ENGINE_OPL
}; };
#ifdef DEBUG
#define TRACE(fmt, ...) _trace(__PRETTY_FUNCTION__,fmt,##__VA_ARGS__)
#else
#define TRACE(fmt, ...)
#endif
// GLOBALS // GLOBALS
//static const float scaler = 0.00003051757813; //static const float scaler = 0.00003051757813;
static const float scaler = 0.00003; static const float scaler = 0.00003;
@ -84,6 +81,7 @@ class Dexed : public lvtk::Synth<DexedVoice, Dexed>
void run(uint32_t sample_count); void run(uint32_t sample_count);
int getEngineType(); int getEngineType();
void setEngineType(int rs); void setEngineType(int rs);
void setMonoMode(bool mode);
void set_params(void); void set_params(void);
void GetSamples(int n_samples, int16_t *buffer); void GetSamples(int n_samples, int16_t *buffer);
//bool isMonoMode(); //bool isMonoMode();

@ -6,7 +6,7 @@
@prefix pset: <http://lv2plug.in/ns/ext/presets#> . @prefix pset: <http://lv2plug.in/ns/ext/presets#> .
@prefix doap: <http://usefulinc.com/ns/doap#> . @prefix doap: <http://usefulinc.com/ns/doap#> .
<https://github.com/dcoredump/dexed> <https://github.com/dcoredump/dexed.lv2>
a lv2:Plugin ; a lv2:Plugin ;
doap:name "Dexed"; doap:name "Dexed";
rdfs:seeAlso <Dexed.ttl> . rdfs:seeAlso <Dexed.ttl> .

Binary file not shown.

@ -18,10 +18,13 @@
#define __CONTROLLERS_H #define __CONTROLLERS_H
#include "synth.h" #include "synth.h"
#include "../Dexed.h"
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#ifdef DEBUG
#include "trace.h"
#endif
#ifdef _WIN32 #ifdef _WIN32
#define snprintf _snprintf #define snprintf _snprintf
#endif #endif

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -23,7 +23,6 @@
#include "fm_op_kernel.h" #include "fm_op_kernel.h"
#include "fm_core.h" #include "fm_core.h"
//using namespace std; //using namespace std;
const FmAlgorithm FmCore::algorithms[32] = { const FmAlgorithm FmCore::algorithms[32] = {

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -17,16 +17,6 @@
#ifndef __SYNTH_H #ifndef __SYNTH_H
#define __SYNTH_H #define __SYNTH_H
#define DEXED_ID "0.9.2"
#ifdef DEBUG
#define DEXED_VERSION DEXED_ID " DEBUG"
#define TRACE(fmt, ...) dexed_trace(__PRETTY_FUNCTION__,fmt,##__VA_ARGS__)
#else
#define DEXED_VERSION DEXED_ID
#define TRACE(fmt, ...)
#endif
// This IS not be present on MSVC. // This IS not be present on MSVC.
// See http://stackoverflow.com/questions/126279/c99-stdint-h-header-and-ms-visual-studio // See http://stackoverflow.com/questions/126279/c99-stdint-h-header-and-ms-visual-studio
#include <stdint.h> #include <stdint.h>
@ -68,8 +58,6 @@ inline static T max(const T& a, const T& b) {
} }
void dexed_trace(const char *source, const char *fmt, ...);
#define QER(n,b) ( ((float)n)/(1<<b) ) #define QER(n,b) ( ((float)n)/(1<<b) )
#endif // __SYNTH_H #endif // __SYNTH_H

Binary file not shown.

@ -0,0 +1,12 @@
#ifdef DEBUG
#include <stdio.h>
#include <stdarg.h>
void _trace(const char *source, const char *fmt, ...) {
char output[4096];
va_list argptr;
va_start(argptr, fmt);
vsnprintf(output, 4095, fmt, argptr);
va_end(argptr);
printf("%s: %s\n",source,output);
}
#endif

@ -0,0 +1,11 @@
#ifndef TRACE_H_INCLUDED
#define TRACE_H_INCLUDED
#ifdef DEBUG
extern void _trace(const char *source, const char *fmt, ...);
#define TRACE(fmt, ...) _trace(__PRETTY_FUNCTION__,fmt,##__VA_ARGS__)
#else
#define TRACE(fmt, ...)
#endif
#endif
Loading…
Cancel
Save