Settings.getCurrentSampeRate() seems to be crashing the DAW...on load
-
So I'm trying to get the current sample rate for my plugin , so:
const var SampleRateLabel = Content.getComponent("SampleRateLabel"); inline function onSampleRateBtnControl(component, value) { SampleRateLabel.set("text","Sample rate: " + Settings.getCurrentSampleRate()); }; Content.getComponent("SampleRateBtn").setControlCallback(onSampleRateBtnControl);
Adding this code crashes the DAW on start up....
Perhaps this is because "Settings" isnt initialised yet??
How is everyone else getting the Sample rate?
-
@Lindon What about
Engine.getSampleRate()
?If it's in a plugin then you should get -1 as the audio is handled by the host:
-
@d-healey so its an FX plugin with IRs used extensively to model the hardware - and the level output is very dependent upon the current sample rate being used by the DAW, so I need to know the currentSample rate - as used by the DAW - So I will try Engine.getSampleRate() and see if that works...
-
-- thanks Dave, that works fine...