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

Reply
 
Thread Tools
Old 01-07-2024, 08:07 AM   #1
BirdBird
Human being with feelings
 
BirdBird's Avatar
 
Join Date: Mar 2019
Posts: 437
Default Wrong samplerate passed to JSFX plugins on @init

When using ext_noinit = 1.0, @init always seems to see srate to be 44100, regardless of the users samplerate, when the plugins are loaded. (Either inserted, or taken online)
Code:
@init
ext_noinit = 1.0;
a = srate;

@sample
b = srate;


Hitting Full recompile/reset afterwards makes the plugin get the correct samplerate inside @init.
BirdBird is offline   Reply With Quote
Old 01-07-2024, 09:00 AM   #2
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 16,223
Default

If using ext_noinit, you should probably check for samplerate changes in @block or @slider (@slider will also get called in response to srate changes)
Justin is offline   Reply With Quote
Old 01-07-2024, 09:17 AM   #3
BirdBird
Human being with feelings
 
BirdBird's Avatar
 
Join Date: Mar 2019
Posts: 437
Default

To be clear, the first @init always gets the wrong samplerate when loading the plugin in this case, whether there was a samplerate change or not.

This means that every single JSFX plugin that uses ext_noinit and has some code for DSP initialization at @init based on srate, will sound different at any samplerate that is different than 44100 upon subsequent project loads.

I think that is a bug?


Edit: Ok, moving things to @block!

Last edited by BirdBird; 01-07-2024 at 09:31 AM.
BirdBird is offline   Reply With Quote
Old 01-08-2024, 12:22 AM   #4
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,745
Default

Quote:
Originally Posted by Justin View Post
If using ext_noinit, you should probably check for samplerate changes in @block or @slider (@slider will also get called in response to srate changes)
Really? I'm trying to remember where I might have used ext_nonint, but not realized this...

I guess it might a good idea to add this to the ext_noninit documentation. The documentation for srate already have some remark about not depending too much on @init, although IMO it's a bit cryptic, so it could be improved as well.
Tale is offline   Reply With Quote
Old 01-09-2024, 07:15 PM   #5
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 16,223
Default

Tale -- good point, docs updated.

BirdBird -- definitely better to check in @block or @slider, you'll catch samplerate changes initiated by the user or project, too. (@slider is guaranteed to be called after a samplerate change, so probably as safe as @block but a slightly more efficient place)

Having said both of these things, we can make @init use the last-known samplerate rather than 44100...
Justin is offline   Reply With Quote
Old 01-10-2024, 12:29 AM   #6
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,745
Default

Quote:
Originally Posted by Justin View Post
Tale -- good point, docs updated.
Great, thanks!
Tale 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 10:57 AM.


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