summaryrefslogtreecommitdiff
path: root/synth
diff options
context:
space:
mode:
authorFlorian Jung <florian.a.jung@web.de>2012-04-04 20:17:50 +0200
committerFlorian Jung <florian.a.jung@web.de>2012-04-04 20:17:50 +0200
commit829c7f8da9aa285029b9d636edda191b5c2b507b (patch)
treef82649301e827278a1e8c1a49022b86b82b03641 /synth
parent531a6e90cbf1cc2afd8eae7683bda48c5cf4506a (diff)
reset filter-envelopes instead of reattacking
Diffstat (limited to 'synth')
-rw-r--r--synth/Makefile3
-rw-r--r--synth/defines.h2
-rw-r--r--synth/envelope.cpp8
-rw-r--r--synth/envelope.h1
-rw-r--r--synth/note.cpp2
-rw-r--r--synth/readwave.cpp1
6 files changed, 14 insertions, 3 deletions
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;i<n_oscillators;++i)
{
envelope[i]->reattack();
- 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 <string>
#include <cstring>
+#include <cstdio>
#include "readwave.h"
#include "util.h"