|
|
|
09-18-2018, 08:25 PM
|
#1
|
Human being with feelings
Join Date: Aug 2013
Location: Bowral, Australia
Posts: 1,638
|
Another JS Trap for Young Players? (Solved)
I discovered today that if you add an integer to a sample value, thus: spl0+1 the result is the value of spl1, not the value of spl0 with 1 added to it!
To get the desired value, use (spl0)+1 or spl(0)+1. This is not documented and I mention it because I wasted a good half hour trying to track it down. I didn't experiment with subtraction or non integers, but I know that spl0*some_number works as expected. Go figure.
Last edited by Time Waster; 09-19-2018 at 06:10 PM.
|
|
|
09-18-2018, 09:31 PM
|
#2
|
Human being with feelings
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,686
|
you mean doing
Code:
a = spl0;
a +=1;
b = spl0+1;
would result in a being different from b ?
This would be a nasty bug and hard to believe to happen.
-Michael
|
|
|
09-18-2018, 10:32 PM
|
#3
|
Human being with feelings
Join Date: Aug 2013
Location: Bowral, Australia
Posts: 1,638
|
Yes, that is what I mean. There is some strange logic to it, but It seems like a bug to me. spl0+1 gives the same result as spl(0+1).
Last edited by Time Waster; 09-18-2018 at 10:48 PM.
|
|
|
09-19-2018, 12:20 AM
|
#4
|
Human being with feelings
Join Date: Nov 2010
Location: Mullet
Posts: 829
|
i can't confirm this...
"spl0+1" works as expected.
__________________
I like turtles
|
|
|
09-19-2018, 01:22 AM
|
#5
|
Human being with feelings
Join Date: Jan 2007
Location: mcr:uk
Posts: 3,889
|
Me neither. Working correctly here.
|
|
|
09-19-2018, 03:17 AM
|
#6
|
Human being with feelings
Join Date: Aug 2013
Location: Bowral, Australia
Posts: 1,638
|
Hmm, weird. I definitely fixed the problem by simply bracketing the I spl0. I'll have to investigate further.
|
|
|
09-19-2018, 08:31 AM
|
#7
|
Human being with feelings
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,686
|
I can't confirm, either.
see this code:
Code:
desc:spl0test
@sample
c += 1;
c >= 100000 ? (
c = 0;
x0 = spl0;
x1 = spl0+1;
x11 = x0+1;
xd = x1 - x11;
);
Placed after a noise generator and watching the debug window.
-Michael
|
|
|
09-19-2018, 06:08 PM
|
#8
|
Human being with feelings
Join Date: Aug 2013
Location: Bowral, Australia
Posts: 1,638
|
Today I removed the brackets that I put in yesterday and it all worked fine. I suspect the problem was that I had not done a full recompile/reset, so maybe that is the lesson to be learned, if things aren't working as expected, do a recompile/reset first.
|
|
|
09-19-2018, 09:30 PM
|
#9
|
Human being with feelings
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,686
|
I'm not really sure what "recompile/reset" does besides loading the default values to the sliders.
It seems that simply storing recompiles and sets some variables to Zero, but seemingly not all. Maybe the @init section is executed.
Yet another weird kind of initialization is performed when Reaper looses and gets back the GUI focus (in Windows). (See the other thread I posted here.)
-Michael
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 05:34 AM.
|