- const int64_t start = 0;
- const int64_t end = 8000;
- const int64_t quantization_length = 4;
+ const uint64_t samplerate = _data->get_samplerate();
+ const int64_t start_time = _data->get_start_time();
+ const float samples_per_pixel = samplerate * scale / 1e15f;
+ const int64_t start = samplerate * (offset - start_time) /
+ 1000000000000000ULL;
+ const int64_t end = start + samples_per_pixel * rect.width();
+ const int64_t quantization_length = 1LL << (int64_t)floorf(
+ max(logf(samples_per_pixel / Log2), 0.0f));