Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Bug Reports

Reply
 
Thread Tools
Old 11-09-2013, 01:40 PM   #1
jack461
Human being with feelings
 
jack461's Avatar
 
Join Date: Nov 2013
Location: France
Posts: 185
Default Bug in "num_ch" handling in JS script

Hi !

I'm just starting to work with JS scripts, but I think this is a bug.

When a JS script is activated after an "init", the value of the system variable
num_ch is equal to 0 during the processing of the first audio buffer.
After that, it takes the correct value.

Try the following script : insert it as an FX, then open the "edit" window to
monitor the values of variables "bcnt" and "zz".


desc:Trying to show a bug in JS
//
@init
bcnt=0;
zz=99;
@sample
(num_ch == 0) ? (bcnt+=1;zz=num_ch; ) ;
// end




After the script is loaded, "bcnt" is set to 0, and "zz" to 99.

As soon as the track is activated, samples are sent to the script. Then, these
values become 512 (bcnt) and 0 (zz), which shows that during the first 512 samples
(the size of the internal buffer), num_ch is not equal to 2 (or the number of channels
of the track), but to 0.


I am working with Mac OS X (10.5.8) and REAPER v4.54


Best Regards.

Jack.
jack461 is offline   Reply With Quote
Old 10-24-2024, 05:03 AM   #2
danieleghisi
Human being with feelings
 
Join Date: Jul 2019
Posts: 11
Default

I have the very same issue with an elementary plugin supposed to zero-out a single channel of a multichannel track. My problem is that num_ch seems to be updated *after* the processing of the first vector, so that the first vector still plays the unwanted channel.

To reproduce, below is the stripped version of the plugin showing the issue: place it on a track with a multitrack audio channel which has some non-zero samples on the seventh channel at the very beginning of the playback.

Does anyone know a workaround to update num_ch before the processing?

=================


desc:KillChannel

@init

@sample
c = 0;
loop(num_ch, (spl(c) = (c==6 ? 0 : spl(c))); c+=1; );

Last edited by danieleghisi; 10-24-2024 at 05:04 AM. Reason: removed emoticon created within line of code
danieleghisi is offline   Reply With Quote
Old 10-24-2024, 05:42 AM   #3
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 17,784
Default

Fixing, thanks for the report.
schwa is offline   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 03:35 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.