1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-10-16 03:32:07 +00:00
serenity/Userland/Applications/Piano/ProcessorParameterWidget/Slider.h
kleines Filmröllchen 4941cffdd0 Piano+LibDSP: Move Track to LibDSP
This is a tangly commit and it fixes all the bugs that a plain move
would have caused (i.e. we need to touch other logic which had wrong
assumptions).
2022-07-22 19:35:41 +01:00

34 lines
896 B
C++

/*
* Copyright (c) 2021, kleines Filmröllchen <filmroellchen@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include "WidgetWithLabel.h"
#include <LibDSP/ProcessorParameter.h>
#include <LibGUI/Label.h>
#include <LibGUI/Slider.h>
#include <LibGfx/Orientation.h>
constexpr int slider_steps = 256;
class ProcessorParameterSlider
: public GUI::Slider
, public WidgetWithLabel {
C_OBJECT(ProcessorParameterSlider);
public:
ProcessorParameterSlider(Orientation, DSP::ProcessorRangeParameter&, RefPtr<GUI::Label>);
constexpr bool is_logarithmic() const { return m_parameter.is_logarithmic() == DSP::Logarithmic::Yes; }
protected:
DSP::ProcessorRangeParameter& m_parameter;
private:
// Converts based on processor parameter boundaries.
int linear_to_logarithmic(int linear_value);
bool m_currently_setting_from_ui { false };
};