// This file is generated by kconfig_compiler_kf6 from easyeffects_db_maximizer.kcfg.
// All changes you do to this file will be lost.

#include "easyeffects_db_maximizer.h"

DbMaximizer::DbMaximizer( const QString & masterGroup, const QString & instanceIndex )
  : KConfigBaseEE( QStringLiteral( "easyeffects/db/maximizerrc" ) )
  , mParammasterGroup(masterGroup)
  , mParaminstanceIndex(instanceIndex)
{
  KConfigCompilerSignallingItem::NotifyFunction notifyFunction = static_cast<KConfigCompilerSignallingItem::NotifyFunction>(&DbMaximizer::itemChanged);

  KConfigGroup cgmasterGroup(this->config(), QStringLiteral( "%1" ).arg( mParammasterGroup ));
  KConfigGroup cgMaximizerinstanceIndex = cgmasterGroup.group(QStringLiteral( "Maximizer#%1" ).arg( mParaminstanceIndex ));
  KConfigCompilerSignallingItem  *itemBypass;
  KConfigBaseEE::ItemBool  *innerItemBypass;
  innerItemBypass = new KConfigBaseEE::ItemBool( currentGroup(), QStringLiteral( "bypass" ), mBypass, false );
  itemBypass = new KConfigCompilerSignallingItem(innerItemBypass, this, notifyFunction, signalBypassChanged);
  itemBypass->setWriteFlags(KConfigBase::Notify);
  itemBypass->setGroup(cgMaximizerinstanceIndex);
  addItem( itemBypass, QStringLiteral( "bypass" ) );
  KConfigCompilerSignallingItem  *itemInputGain;
  KConfigBaseEE::ItemDouble  *innerItemInputGain;
  innerItemInputGain = new KConfigBaseEE::ItemDouble( currentGroup(), QStringLiteral( "inputGain" ), mInputGain, 0 );
  itemInputGain = new KConfigCompilerSignallingItem(innerItemInputGain, this, notifyFunction, signalInputGainChanged);
  innerItemInputGain->setMinValue(-36);
  innerItemInputGain->setMaxValue(36);
  itemInputGain->setWriteFlags(KConfigBase::Notify);
  itemInputGain->setGroup(cgMaximizerinstanceIndex);
  addItem( itemInputGain, QStringLiteral( "inputGain" ) );
  KConfigCompilerSignallingItem  *itemOutputGain;
  KConfigBaseEE::ItemDouble  *innerItemOutputGain;
  innerItemOutputGain = new KConfigBaseEE::ItemDouble( currentGroup(), QStringLiteral( "outputGain" ), mOutputGain, 0 );
  itemOutputGain = new KConfigCompilerSignallingItem(innerItemOutputGain, this, notifyFunction, signalOutputGainChanged);
  innerItemOutputGain->setMinValue(-36);
  innerItemOutputGain->setMaxValue(36);
  itemOutputGain->setWriteFlags(KConfigBase::Notify);
  itemOutputGain->setGroup(cgMaximizerinstanceIndex);
  addItem( itemOutputGain, QStringLiteral( "outputGain" ) );
  KConfigCompilerSignallingItem  *itemRelease;
  KConfigBaseEE::ItemDouble  *innerItemRelease;
  innerItemRelease = new KConfigBaseEE::ItemDouble( currentGroup(), QStringLiteral( "release" ), mRelease, 25 );
  itemRelease = new KConfigCompilerSignallingItem(innerItemRelease, this, notifyFunction, signalReleaseChanged);
  innerItemRelease->setMinValue(1);
  innerItemRelease->setMaxValue(100);
  itemRelease->setWriteFlags(KConfigBase::Notify);
  itemRelease->setGroup(cgMaximizerinstanceIndex);
  addItem( itemRelease, QStringLiteral( "release" ) );
  KConfigCompilerSignallingItem  *itemThreshold;
  KConfigBaseEE::ItemDouble  *innerItemThreshold;
  innerItemThreshold = new KConfigBaseEE::ItemDouble( currentGroup(), QStringLiteral( "threshold" ), mThreshold, 0 );
  itemThreshold = new KConfigCompilerSignallingItem(innerItemThreshold, this, notifyFunction, signalThresholdChanged);
  innerItemThreshold->setMinValue(-30);
  innerItemThreshold->setMaxValue(0);
  itemThreshold->setWriteFlags(KConfigBase::Notify);
  itemThreshold->setGroup(cgMaximizerinstanceIndex);
  addItem( itemThreshold, QStringLiteral( "threshold" ) );
}

bool DbMaximizer::defaultBypassValue_helper() const
{

  return false;
}

double DbMaximizer::defaultInputGainValue_helper() const
{

  return 0;
}

double DbMaximizer::defaultOutputGainValue_helper() const
{

  return 0;
}

double DbMaximizer::defaultReleaseValue_helper() const
{

  return 25;
}

double DbMaximizer::defaultThresholdValue_helper() const
{

  return 0;
}

DbMaximizer::~DbMaximizer()
{
}


void DbMaximizer::itemChanged(quint64 signalFlag) {

  switch (signalFlag) {
  case signalBypassChanged:
    Q_EMIT bypassChanged();
    break;
  case signalInputGainChanged:
    Q_EMIT inputGainChanged();
    break;
  case signalOutputGainChanged:
    Q_EMIT outputGainChanged();
    break;
  case signalReleaseChanged:
    Q_EMIT releaseChanged();
    break;
  case signalThresholdChanged:
    Q_EMIT thresholdChanged();
    break;
  }
}
