summaryrefslogtreecommitdiff
path: root/Userland/Applications/Piano/ProcessorParameterWidget/Slider.h
blob: 9546af76bf374f4b29ae903d834242f734ca1950 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
 * 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, LibDSP::ProcessorRangeParameter&, RefPtr<GUI::Label>);
    constexpr bool is_logarithmic() const { return m_parameter.is_logarithmic() == LibDSP::Logarithmic::Yes; }

protected:
    LibDSP::ProcessorRangeParameter& m_parameter;

private:
    // Converts based on processor parameter boundaries.
    int linear_to_logarithmic(int linear_value);
};