Getting the actual sample rate from Lua Scripts

Don’t you just not specify it?

-- sample_rate, -- number, one of 22050, 44100, 48000, 88200, 96000. \  
-- -- by default the players current rate.  

Or do I misunderstand that? Or is it only applicable to Rendering Song (as doesn’t seem to be mentioned in Sample/Buffer section.)

This is only a table you can pass to the rendering function but doesn’t allow you to actually read out the default value. For example i have a tool to set the track output delay in samples. For this to work i need to know the current sample rate, which a user has to select manually in the GUI. If i would know that value i could delete the manual selection completely since it’s unneccessary then. If i remember right It-Alien had a tool to generate waveforms. Knowing the sample rate would allow generation of those in the current playback samplerate without setting it explicit.

Ahh I understand.

Can you read a value from a DSP? If so I can give you a workaround. Hint = Formula Device ;)

Recently downloaded CamStudio but hadn’t tried it before so thought I’d make my first video showing my hint ;)

Well, this would be a nice hackery trick for a personal project but not for a public tool IMO. What you have to consider is first the optical part: A user may wonder if suddenly a fake device appears and disappears for no proper reason. The second thing is: Your tool is not alone in Renoise and inserting a device on a track, loading some preset, assigning to a parameter etc. are actions, which can trigger all sorts of notifiers from other tools creating unneccessary overhead for something simple like getting the sample rate. ;)

Never said it was neat and then the even bigger worry is that you may leave it in place, rather than update it, when the API does get updated with the required Observable. Though thought I’d point out that a nasty hack is possible ;)