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

#include "easyeffects_db_autogain.h"

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

  KConfigGroup cgmasterGroup(this->config(), QStringLiteral( "%1" ).arg( mParammasterGroup ));
  KConfigGroup cgAutogaininstanceIndex = cgmasterGroup.group(QStringLiteral( "Autogain#%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(cgAutogaininstanceIndex);
  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(cgAutogaininstanceIndex);
  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(cgAutogaininstanceIndex);
  addItem( itemOutputGain, QStringLiteral( "outputGain" ) );
  KConfigCompilerSignallingItem  *itemTarget;
  KConfigBaseEE::ItemDouble  *innerItemTarget;
  innerItemTarget = new KConfigBaseEE::ItemDouble( currentGroup(), QStringLiteral( "target" ), mTarget, -23 );
  itemTarget = new KConfigCompilerSignallingItem(innerItemTarget, this, notifyFunction, signalTargetChanged);
  innerItemTarget->setMinValue(-100);
  innerItemTarget->setMaxValue(0);
  itemTarget->setWriteFlags(KConfigBase::Notify);
  itemTarget->setGroup(cgAutogaininstanceIndex);
  addItem( itemTarget, QStringLiteral( "target" ) );
  QStringList defaultreferenceLabels;
  defaultreferenceLabels.append( QString::fromUtf8( "Momentary" ) );
  defaultreferenceLabels.append( QString::fromUtf8( "Shortterm" ) );
  defaultreferenceLabels.append( QString::fromUtf8( "Integrated" ) );
  defaultreferenceLabels.append( QString::fromUtf8( "Geometric Mean (MSI)" ) );
  defaultreferenceLabels.append( QString::fromUtf8( "Geometric Mean (MS)" ) );
  defaultreferenceLabels.append( QString::fromUtf8( "Geometric Mean (MI)" ) );
  defaultreferenceLabels.append( QString::fromUtf8( "Geometric Mean (SI)" ) );

  KConfigCompilerSignallingItem  *itemReferenceLabels;
  KConfigBaseEE::ItemStringList  *innerItemReferenceLabels;
  innerItemReferenceLabels = new KConfigBaseEE::ItemStringList( currentGroup(), QStringLiteral( "referenceLabels" ), mReferenceLabels, defaultreferenceLabels );
  itemReferenceLabels = new KConfigCompilerSignallingItem(innerItemReferenceLabels, this, notifyFunction, signalReferenceLabelsChanged);
  itemReferenceLabels->setWriteFlags(KConfigBase::Notify);
  itemReferenceLabels->setGroup(cgAutogaininstanceIndex);
  addItem( itemReferenceLabels, QStringLiteral( "referenceLabels" ) );
  KConfigCompilerSignallingItem  *itemReference;
  KConfigBaseEE::ItemInt  *innerItemReference;
  innerItemReference = new KConfigBaseEE::ItemInt( currentGroup(), QStringLiteral( "reference" ), mReference, 3 );
  itemReference = new KConfigCompilerSignallingItem(innerItemReference, this, notifyFunction, signalReferenceChanged);
  itemReference->setWriteFlags(KConfigBase::Notify);
  itemReference->setGroup(cgAutogaininstanceIndex);
  addItem( itemReference, QStringLiteral( "reference" ) );
  KConfigCompilerSignallingItem  *itemMaximumHistory;
  KConfigBaseEE::ItemInt  *innerItemMaximumHistory;
  innerItemMaximumHistory = new KConfigBaseEE::ItemInt( currentGroup(), QStringLiteral( "maximumHistory" ), mMaximumHistory, 15 );
  itemMaximumHistory = new KConfigCompilerSignallingItem(innerItemMaximumHistory, this, notifyFunction, signalMaximumHistoryChanged);
  innerItemMaximumHistory->setMinValue(6);
  innerItemMaximumHistory->setMaxValue(3600);
  itemMaximumHistory->setWriteFlags(KConfigBase::Notify);
  itemMaximumHistory->setGroup(cgAutogaininstanceIndex);
  addItem( itemMaximumHistory, QStringLiteral( "maximumHistory" ) );
  KConfigCompilerSignallingItem  *itemSilenceThreshold;
  KConfigBaseEE::ItemDouble  *innerItemSilenceThreshold;
  innerItemSilenceThreshold = new KConfigBaseEE::ItemDouble( currentGroup(), QStringLiteral( "silenceThreshold" ), mSilenceThreshold, -70 );
  itemSilenceThreshold = new KConfigCompilerSignallingItem(innerItemSilenceThreshold, this, notifyFunction, signalSilenceThresholdChanged);
  innerItemSilenceThreshold->setMinValue(-100);
  innerItemSilenceThreshold->setMaxValue(0);
  itemSilenceThreshold->setWriteFlags(KConfigBase::Notify);
  itemSilenceThreshold->setGroup(cgAutogaininstanceIndex);
  addItem( itemSilenceThreshold, QStringLiteral( "silenceThreshold" ) );
  KConfigCompilerSignallingItem  *itemForceSilence;
  KConfigBaseEE::ItemBool  *innerItemForceSilence;
  innerItemForceSilence = new KConfigBaseEE::ItemBool( currentGroup(), QStringLiteral( "forceSilence" ), mForceSilence, false );
  itemForceSilence = new KConfigCompilerSignallingItem(innerItemForceSilence, this, notifyFunction, signalForceSilenceChanged);
  itemForceSilence->setWriteFlags(KConfigBase::Notify);
  itemForceSilence->setGroup(cgAutogaininstanceIndex);
  addItem( itemForceSilence, QStringLiteral( "forceSilence" ) );
}

bool DbAutogain::defaultBypassValue_helper() const
{

  return false;
}

double DbAutogain::defaultInputGainValue_helper() const
{

  return 0;
}

double DbAutogain::defaultOutputGainValue_helper() const
{

  return 0;
}

double DbAutogain::defaultTargetValue_helper() const
{

  return -23;
}

QStringList DbAutogain::defaultReferenceLabelsValue_helper() const
{
  QStringList defaultreferenceLabels;
  defaultreferenceLabels.append( QString::fromUtf8( "Momentary" ) );
  defaultreferenceLabels.append( QString::fromUtf8( "Shortterm" ) );
  defaultreferenceLabels.append( QString::fromUtf8( "Integrated" ) );
  defaultreferenceLabels.append( QString::fromUtf8( "Geometric Mean (MSI)" ) );
  defaultreferenceLabels.append( QString::fromUtf8( "Geometric Mean (MS)" ) );
  defaultreferenceLabels.append( QString::fromUtf8( "Geometric Mean (MI)" ) );
  defaultreferenceLabels.append( QString::fromUtf8( "Geometric Mean (SI)" ) );

  return defaultreferenceLabels;
}

int DbAutogain::defaultReferenceValue_helper() const
{

  return 3;
}

int DbAutogain::defaultMaximumHistoryValue_helper() const
{

  return 15;
}

double DbAutogain::defaultSilenceThresholdValue_helper() const
{

  return -70;
}

bool DbAutogain::defaultForceSilenceValue_helper() const
{

  return false;
}

DbAutogain::~DbAutogain()
{
}


void DbAutogain::itemChanged(quint64 signalFlag) {

  switch (signalFlag) {
  case signalBypassChanged:
    Q_EMIT bypassChanged();
    break;
  case signalInputGainChanged:
    Q_EMIT inputGainChanged();
    break;
  case signalOutputGainChanged:
    Q_EMIT outputGainChanged();
    break;
  case signalTargetChanged:
    Q_EMIT targetChanged();
    break;
  case signalReferenceLabelsChanged:
    Q_EMIT referenceLabelsChanged();
    break;
  case signalReferenceChanged:
    Q_EMIT referenceChanged();
    break;
  case signalMaximumHistoryChanged:
    Q_EMIT maximumHistoryChanged();
    break;
  case signalSilenceThresholdChanged:
    Q_EMIT silenceThresholdChanged();
    break;
  case signalForceSilenceChanged:
    Q_EMIT forceSilenceChanged();
    break;
  }
}
