From 829c7f8da9aa285029b9d636edda191b5c2b507b Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Wed, 4 Apr 2012 20:17:50 +0200 Subject: reset filter-envelopes instead of reattacking --- synth/Makefile | 3 ++- synth/defines.h | 2 +- synth/envelope.cpp | 8 ++++++++ synth/envelope.h | 1 + synth/note.cpp | 2 +- synth/readwave.cpp | 1 + 6 files changed, 14 insertions(+), 3 deletions(-) (limited to 'synth') diff --git a/synth/Makefile b/synth/Makefile index 80cf705..01e27ee 100644 --- a/synth/Makefile +++ b/synth/Makefile @@ -1,5 +1,6 @@ CXX=g++ -CFLAGS=-Wall -O2 +#CFLAGS=-Wall -O2 +CFLAGS=-Wall -O -g CXXFLAGS=$(CFLAGS) LDFLAGS=-lm `pkg-config --cflags --libs jack` diff --git a/synth/defines.h b/synth/defines.h index 354e683..56d2ec5 100644 --- a/synth/defines.h +++ b/synth/defines.h @@ -80,7 +80,7 @@ extern float LFO_FREQ_HZ[]; #if ( (WAVE_SAW_START < N_NORMAL_WAVEFORMS) || \ (WAVE_PULSE_START < WAVE_SAW_START+WAVE_SAW_N) ) - #error NORMAL WAVEFORMS, SAW- AND PULSE-WAVES MAY NOT OVERLAP! + #error NORMAL WAVEFORMS, SAW- AND PULSE-WAVES MAY NOT OVERLAP! #endif #define N_WAVEFORMS (WAVE_PULSE_START+WAVE_PULSE_N) diff --git a/synth/envelope.cpp b/synth/envelope.cpp index 13b1044..837b4a7 100644 --- a/synth/envelope.cpp +++ b/synth/envelope.cpp @@ -85,6 +85,14 @@ void Envelope::reattack() sustain=sustain_orig; } +void Envelope::reset() +{ + state=ATTACK; + sustain=sustain_orig; + level=0; + t=0; +} + void Envelope::release_key() { if (has_release_phase) diff --git a/synth/envelope.h b/synth/envelope.h index a9bb15b..3c93a03 100644 --- a/synth/envelope.h +++ b/synth/envelope.h @@ -17,6 +17,7 @@ class Envelope Envelope(env_settings_t s, int frames=1); void release_key(); void reattack(); + void reset(); fixed_t get_level(); bool still_active(); void set_hold(bool h); diff --git a/synth/note.cpp b/synth/note.cpp index d208ae8..54267a8 100644 --- a/synth/note.cpp +++ b/synth/note.cpp @@ -289,7 +289,7 @@ void Note::reattack() for (int i=0;ireattack(); - factor_env[i]->reattack(); + factor_env[i]->reset(); } if (filter_params.enabled) diff --git a/synth/readwave.cpp b/synth/readwave.cpp index 0b2c0a0..aa4ef92 100644 --- a/synth/readwave.cpp +++ b/synth/readwave.cpp @@ -1,5 +1,6 @@ #include #include +#include #include "readwave.h" #include "util.h" -- cgit v1.2.3