mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 14:37:45 +00:00
Piano: Move to LibDSP's Classic synthesizer
Almost all synthesizer code in Piano is removed in favor of the LibDSP reimplementation. This causes some issues that mainly have to do with the way Piano currently handles talking to LibDSP. Additionally, the sampler is gone for now and will be reintroduced with future work.
This commit is contained in:
parent
3ca059da2d
commit
b14a64b3c8
14 changed files with 128 additions and 464 deletions
|
@ -17,18 +17,30 @@ namespace LibDSP {
|
|||
|
||||
using ParameterFixedPoint = FixedPoint<8, i64>;
|
||||
|
||||
// Identifies the different kinds of parameters.
|
||||
// Note that achieving parameter type identification is NOT possible with typeid().
|
||||
enum class ParameterType : u8 {
|
||||
Invalid = 0,
|
||||
Range,
|
||||
Enum,
|
||||
Boolean,
|
||||
};
|
||||
|
||||
// Processors have modifiable parameters that should be presented to the UI in a uniform way without requiring the processor itself to implement custom interfaces.
|
||||
class ProcessorParameter {
|
||||
public:
|
||||
ProcessorParameter(String name)
|
||||
ProcessorParameter(String name, ParameterType type)
|
||||
: m_name(move(name))
|
||||
, m_type(type)
|
||||
{
|
||||
}
|
||||
|
||||
String const& name() const { return m_name; }
|
||||
ParameterType type() const { return m_type; }
|
||||
|
||||
private:
|
||||
String const m_name;
|
||||
ParameterType const m_type;
|
||||
};
|
||||
|
||||
namespace Detail {
|
||||
|
@ -41,8 +53,8 @@ template<typename ParameterT>
|
|||
class ProcessorParameterSingleValue : public ProcessorParameter {
|
||||
|
||||
public:
|
||||
ProcessorParameterSingleValue(String name, ParameterT initial_value)
|
||||
: ProcessorParameter(move(name))
|
||||
ProcessorParameterSingleValue(String name, ParameterType type, ParameterT initial_value)
|
||||
: ProcessorParameter(move(name), type)
|
||||
, m_value(move(initial_value))
|
||||
{
|
||||
}
|
||||
|
@ -82,7 +94,7 @@ protected:
|
|||
class ProcessorBooleanParameter final : public Detail::ProcessorParameterSingleValue<bool> {
|
||||
public:
|
||||
ProcessorBooleanParameter(String name, bool initial_value)
|
||||
: Detail::ProcessorParameterSingleValue<bool>(move(name), move(initial_value))
|
||||
: Detail::ProcessorParameterSingleValue<bool>(move(name), ParameterType::Boolean, move(initial_value))
|
||||
{
|
||||
}
|
||||
};
|
||||
|
@ -90,7 +102,7 @@ public:
|
|||
class ProcessorRangeParameter final : public Detail::ProcessorParameterSingleValue<ParameterFixedPoint> {
|
||||
public:
|
||||
ProcessorRangeParameter(String name, ParameterFixedPoint min_value, ParameterFixedPoint max_value, ParameterFixedPoint initial_value)
|
||||
: Detail::ProcessorParameterSingleValue<ParameterFixedPoint>(move(name), move(initial_value))
|
||||
: Detail::ProcessorParameterSingleValue<ParameterFixedPoint>(move(name), ParameterType::Range, move(initial_value))
|
||||
, m_min_value(move(min_value))
|
||||
, m_max_value(move(max_value))
|
||||
, m_default_value(move(initial_value))
|
||||
|
@ -122,7 +134,7 @@ template<typename EnumT>
|
|||
requires(IsEnum<EnumT>) class ProcessorEnumParameter final : public Detail::ProcessorParameterSingleValue<EnumT> {
|
||||
public:
|
||||
ProcessorEnumParameter(String name, EnumT initial_value)
|
||||
: Detail::ProcessorParameterSingleValue<EnumT>(move(name), initial_value, ParameterType::Enum)
|
||||
: Detail::ProcessorParameterSingleValue<EnumT>(move(name), ParameterType::Enum, initial_value)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue