COCKOS
CONFEDERATED FORUMS
Cockos : REAPER : NINJAM : Forums
Forum Home : Register : FAQ : Members List : Search :
Old 06-04-2009, 05:22 AM   #1
Stu Kennedy
Human being with feelings
 
Join Date: Mar 2009
Location: Glasgow UK
Posts: 83
Default getSampleRate()

Any idea why IPlug's getSampleRate() returns 44100 when my host is set at 48000?

It took me a while to figure out why things were out of tune

Stu
Stu Kennedy is offline   Reply With Quote
Old 06-04-2009, 06:03 AM   #2
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 15,747
Default

Make sure you check the sample rate on every Reset call. Some hosts (including Reaper) may initialize plugins at first with a generic sample rate (like 44.1) and later, when playback starts, re-initialize with the project sample rate.
schwa is offline   Reply With Quote
Old 06-04-2009, 07:38 AM   #3
Stu Kennedy
Human being with feelings
 
Join Date: Mar 2009
Location: Glasgow UK
Posts: 83
Default

Cheers again ... fixed!!
Stu Kennedy is offline   Reply With Quote
Old 06-04-2009, 11:06 AM   #4
cc_
Human being with feelings
 
Join Date: Mar 2009
Posts: 256
Default

Quote:
Originally Posted by schwa View Post
Make sure you check the sample rate on every Reset call. Some hosts (including Reaper) may initialize plugins at first with a generic sample rate (like 44.1) and later, when playback starts, re-initialize with the project sample rate.
I call pPlug->GetSampleRate() every time I need it - does that mean I don't have to worry about doing anything on reset?
cc_ is offline   Reply With Quote
Old 06-05-2009, 02:17 AM   #5
bvesco
Human being with feelings
 
bvesco's Avatar
 
Join Date: Jun 2007
Posts: 125
Default

It means you don't have to worry about doing anything with the sample rate in reset. If you have a reverb or delay you might need to clear out some tails to keep garbage from showing up next time you get some audio buffers. There might be any number of things you want to do on reset if you are not handling them elsewhere. You might also have something like some buffers or coefficients that are dependent on the sample rate that are not calculated every time you process audio (because it might be inefficient to do so) and in those circumstances you would want to trigger a recalculation in reset if the sample rate changed. Basically, there is no one right or wrong answer. Evaluate your circumstances and go from there.
__________________
Audio tutorials and articles: http://www.benvesco.com/tonemonster/
My VST plugins: http://www.vescofx.com/
bvesco is offline   Reply With Quote
Reply

Thread Tools
Display Modes

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 04:25 AM.


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