outputJack odd behaviour
Posted: Mon May 03, 2021 11:02 pm
Hi,
I'm new to VMD and Java however I do have a programing background from years back so if my code looks backwards then please excuse me.
Now I just came across this thread and the main part being "You should always write a new value to every output jack on every call to ProcessSample()."
viewtopic.php?f=9&t=592
So prior to seeing that thread I was testing to see if I had to write out the same value every time to the outputJack and this is where things got odd.
Using the above code.
1st pass, the loop is executed (as expected) tempout=0
2nd pass, the loop is bypassed (as expected) tempout=2.5
3rd pass, the loop is executed (hmm) tempout=0
4th pass, the loop is bypassed (oh) tempout=2.5
and so on and on. I did not expect this.
If I change the "count" from count<1 to count<2
1st pass, the loop is executed (as expected) tempout=0
2nd pass, the loop is executed (as expected) tempout=2.5
3rd pass, the loop is bypassed (as expected) tempout=2.5
and from here on out it's always bypassed. Interesting..
Is there a technical reason to why when setting the out value twice in a row it's taken?
I'm new to VMD and Java however I do have a programing background from years back so if my code looks backwards then please excuse me.
Now I just came across this thread and the main part being "You should always write a new value to every output jack on every call to ProcessSample()."
viewtopic.php?f=9&t=592
So prior to seeing that thread I was testing to see if I had to write out the same value every time to the outputJack and this is where things got odd.
Code: Select all
public void ProcessSample()
{
// add your own code here
double tempout = outputJack1.GetValue();
if (tempout!=2.5 || count<1)
{
outputJack1.SetValue(2.5);
textLabel1.SetText(count+"");
count=count+1;
}
}
1st pass, the loop is executed (as expected) tempout=0
2nd pass, the loop is bypassed (as expected) tempout=2.5
3rd pass, the loop is executed (hmm) tempout=0
4th pass, the loop is bypassed (oh) tempout=2.5
and so on and on. I did not expect this.
If I change the "count" from count<1 to count<2
1st pass, the loop is executed (as expected) tempout=0
2nd pass, the loop is executed (as expected) tempout=2.5
3rd pass, the loop is bypassed (as expected) tempout=2.5
and from here on out it's always bypassed. Interesting..
Is there a technical reason to why when setting the out value twice in a row it's taken?