Ddsp icon indicating copy to clipboard operation
Ddsp copied to clipboard

Using Ddsp with Dplug >=12.x.x

Open rstephane opened this issue 4 years ago • 3 comments

Hellooo :)

I tried to use the DDSP lib with the latest DPLUG version (>=12). I got an error while compiling:

ddsp/util/scale.d(60,9): Error: x < _minVal ? x = _minVal : x must be surrounded by parentheses when next to operator = ddsp/util/scale.d(90,9): Error: x < _minVal ? x = _minVal : x must be surrounded by parentheses when next to operator =

I guess that in scaled.d we may change the line 60 and 90 (the errors comes twice) for :

override float convert(float x) nothrow @nogc { if (x < _minVal) x = _minVal; else x = x;
if (x > _maxVal) x = _maxVal; else x = x; return _a * exp(_b * x); }

it's not a nice solution

a better one is to add the correct "()" at the right place :

test ? a = b : c = 2; // Deprecated since dplug v12... (test ? a = b : c) = 2; // Equivalent <- good version in Dplug v12, you may put instead of doing IF then ...


another thing to modify is the required version in the dependency file (dub.json ): we may change the dependencies declaration for :

  "dplug:core": ">=8.0.0 <13.0.0",

tell me if I am not clear :) thanks.

rstephane avatar Nov 06 '21 09:11 rstephane

@rstephane It seems to be missing the commit that you have made

abaga129 avatar Nov 08 '21 00:11 abaga129

Oops, i did not noticed your question, oki I do that this wk.

rstephane avatar Jan 20 '22 14:01 rstephane

Hello, So I will push as soon as I can the following codes in scaled.d

override float convert(float x) nothrow @nogc { x = x < _minVal ? x : _minVal; x = x > _maxVal ? _maxVal : x; return log10(x / _a) / _b; }

for these codes

override float convert(float x) nothrow @nogc { (x ? x < _minVal : _minVal) = x; (x ? x > _maxVal : _maxVal) = x; return log10(x / _a) / _b; }

This function appears twice in the scaled.d lib:

override float convert(float x) nothrow @nogc { x = x < _minVal ? x : _minVal; x = x > _maxVal ? _maxVal : x; return _a * exp(_b * x); }

for

override float convert(float x) nothrow @nogc { (x ? x < _minVal : _minVal) = x; (x ? x > _maxVal : _maxVal) = x; return _a * exp(_b * x); }

regards.

rstephane avatar Jan 22 '22 09:01 rstephane