Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Rounding issue when setting SampleTune #10
Samples with a sampling rate of 48000 are incorrectly imported with a SampleTune value of 1.46 (while the ESX imports them with the value 1.47).
This is due to a rounding issue. When importing new samples into the program, the SampleTune value needs to be set. The formula currently being used is:
SampleTune = 12 * ( log(sampleRate/44100) / log(2) );
When importing a sample with a sampleRate of 48000, this yields: 1.4670696
Instead of rounding down, this should use: RoundingMode.HALF_EVEN