Adjust the preload value to account for 4-byte floats

This commit is contained in:
Paul Ferrand 2020-09-10 13:37:36 +02:00
parent 0e7ba04c8c
commit 935b07603e

View file

@ -565,14 +565,14 @@ void Editor::Impl::createFrameContents()
for (int log2value = 10; log2value <= 16; ++log2value) {
int value = 1 << log2value;
char text[256];
sprintf(text, "%d kB", value / 1024);
sprintf(text, "%d kB", value / 1024 * 4);
text[sizeof(text) - 1] = '\0';
preloadSizeSlider_->addEntry(text, value);
}
preloadSizeSlider_->setValueToStringFunction2(
[](float value, std::string& result, CParamDisplay*) -> bool
{
result = std::to_string(static_cast<int>(std::round(value * (1.0 / 1024)))) + " kB";
result = std::to_string(static_cast<int>(std::round(value * (1.0 / 1024 * 4)))) + " kB";
return true;
});