From c00f9bcae3baaa7782b166f6b1a95f7876991ed6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Sun, 16 Sep 2018 10:30:09 +0200 Subject: [PATCH] drumkit.xsd / adsr fix accepted values even if it is weird, the unit of the adsr values is the tick. their range defined by the gui are: [0 ; 100000] for attack and decay [0.0 ; 1.0] for sustain [256 ; 100256] for release --- data/xsd/drumkit.xsd | 4 ++-- src/core/src/basics/adsr.cpp | 15 +++++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/data/xsd/drumkit.xsd b/data/xsd/drumkit.xsd index 20b5f79a6..41cc77246 100644 --- a/data/xsd/drumkit.xsd +++ b/data/xsd/drumkit.xsd @@ -73,8 +73,8 @@ - - + + diff --git a/src/core/src/basics/adsr.cpp b/src/core/src/basics/adsr.cpp index b00749e94..f504bec12 100644 --- a/src/core/src/basics/adsr.cpp +++ b/src/core/src/basics/adsr.cpp @@ -47,18 +47,21 @@ void ADSR::normalise() if (__sustain < 0.0) { __sustain = 0.0; } - if (__release < 0.0) { - __release = 0.0; + if (__release < 256) { + __release = 256; } - if (__attack > 1.0) { - __attack = 1.0; + if (__attack > 100000) { + __attack = 100000; } - if (__decay > 1.0) { - __decay = 1.0; + if (__decay > 100000) { + __decay = 100000; } if (__sustain > 1.0) { __sustain = 1.0; } + if (__release > 100256) { + __release = 100256; + } } ADSR::ADSR( float attack, float decay, float sustain, float release ) : Object( __class_name ),