#include "configuration.hpp"
#include "jam_manager.hpp"

Configuration::Configuration()
{
	// Internal //
	mainW_ = 930;
	mainH_= 780;
	mainMax_ = false;
	mainX_ = -1;	// Dummy
	mainY_ = -1;	// Dummy
	mainVSplit_ = -1;	// Dummy
	instFMW_ = 570;
	instFMH_ = 750;
	instSSGW_ = 500;
	instSSGH_ = 390;
	followMode_ = true;
	workDir_ = "";
	instOpenFormat_ = 0;
	bankOpenFormat_ = 0;

	// General //
	// General settings
	warpCursor_ = true;
	warpAcrossOrders_ = true;
	showRowNumHex_ = true;
	showPrevNextOrders_ = true;
	backupModules_ = true;
	dontSelectOnDoubleClick_ = false;
	reverseFMVolumeOrder_ = true;
	moveCursorToRight_ = false;
	retrieveChannelState_ = false;
	enableTranslation_ = true;
	showFMDetuneSigned_ = false;
	showWaveVisual_ = true;
	fill00ToEffectValue_ = true;
	autosetInstrument_ = true;
	moveCursorHScroll_ = true;

	// Edit settings
	pageJumpLength_ = 4;
	editableStep_ = 1;
	keyRepetision_ = true;

	// Keys
	keyOffKey_ = u8"-";
	octUpKey_ = u8"Num+*";
	octDownKey_ = u8"Num+/";
	echoKey_ = u8"^";
	noteEntryLayout_ = QWERTY;

	// Sound //
	sndAPI_ = u8"";
	sndDevice_ = u8"";
	realChip_ = RealChipInterface::NONE;
	emulator_ = 1;
	sampleRate_ = 44100;
	bufferLength_ = 40;

	// Midi //
	midiInPort_ = u8"";

	// Mixer //
	mixerVolumeMaster_ = 100;
	mixerVolumeFM_ = 0;
	mixerVolumeSSG_ = 0;

	// Input //
	fmEnvelopeTexts_ = {
		{
			"PMD",
			std::vector<FMEnvelopeTextType>({
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::AL,
				FMEnvelopeTextType::FB,
				FMEnvelopeTextType::AR1,
				FMEnvelopeTextType::DR1,
				FMEnvelopeTextType::SR1,
				FMEnvelopeTextType::RR1,
				FMEnvelopeTextType::SL1,
				FMEnvelopeTextType::TL1,
				FMEnvelopeTextType::KS1,
				FMEnvelopeTextType::ML1,
				FMEnvelopeTextType::DT1,
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::AR2,
				FMEnvelopeTextType::DR2,
				FMEnvelopeTextType::SR2,
				FMEnvelopeTextType::RR2,
				FMEnvelopeTextType::SL2,
				FMEnvelopeTextType::TL2,
				FMEnvelopeTextType::KS2,
				FMEnvelopeTextType::ML2,
				FMEnvelopeTextType::DT2,
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::AR3,
				FMEnvelopeTextType::DR3,
				FMEnvelopeTextType::SR3,
				FMEnvelopeTextType::RR3,
				FMEnvelopeTextType::SL3,
				FMEnvelopeTextType::TL3,
				FMEnvelopeTextType::KS3,
				FMEnvelopeTextType::ML3,
				FMEnvelopeTextType::DT3,
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::AR4,
				FMEnvelopeTextType::DR4,
				FMEnvelopeTextType::SR4,
				FMEnvelopeTextType::RR4,
				FMEnvelopeTextType::SL4,
				FMEnvelopeTextType::TL4,
				FMEnvelopeTextType::KS4,
				FMEnvelopeTextType::ML4,
				FMEnvelopeTextType::DT4,
				FMEnvelopeTextType::Skip
			})
		},
		{
			"FMP",
			std::vector<FMEnvelopeTextType>({
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::AR1,
				FMEnvelopeTextType::DR1,
				FMEnvelopeTextType::SR1,
				FMEnvelopeTextType::RR1,
				FMEnvelopeTextType::SL1,
				FMEnvelopeTextType::TL1,
				FMEnvelopeTextType::KS1,
				FMEnvelopeTextType::ML1,
				FMEnvelopeTextType::DT1,
				FMEnvelopeTextType::AR2,
				FMEnvelopeTextType::DR2,
				FMEnvelopeTextType::SR2,
				FMEnvelopeTextType::RR2,
				FMEnvelopeTextType::SL2,
				FMEnvelopeTextType::TL2,
				FMEnvelopeTextType::KS2,
				FMEnvelopeTextType::ML2,
				FMEnvelopeTextType::DT2,
				FMEnvelopeTextType::AR3,
				FMEnvelopeTextType::DR3,
				FMEnvelopeTextType::SR3,
				FMEnvelopeTextType::RR3,
				FMEnvelopeTextType::SL3,
				FMEnvelopeTextType::TL3,
				FMEnvelopeTextType::KS3,
				FMEnvelopeTextType::ML3,
				FMEnvelopeTextType::DT3,
				FMEnvelopeTextType::AR4,
				FMEnvelopeTextType::DR4,
				FMEnvelopeTextType::SR4,
				FMEnvelopeTextType::RR4,
				FMEnvelopeTextType::SL4,
				FMEnvelopeTextType::TL4,
				FMEnvelopeTextType::KS4,
				FMEnvelopeTextType::ML4,
				FMEnvelopeTextType::DT4,
				FMEnvelopeTextType::AL,
				FMEnvelopeTextType::FB
			})
		},
		{
			"FMP7",
			std::vector<FMEnvelopeTextType>({
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::AR1,
				FMEnvelopeTextType::DR1,
				FMEnvelopeTextType::SR1,
				FMEnvelopeTextType::RR1,
				FMEnvelopeTextType::SL1,
				FMEnvelopeTextType::TL1,
				FMEnvelopeTextType::KS1,
				FMEnvelopeTextType::ML1,
				FMEnvelopeTextType::DT1,
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::AR2,
				FMEnvelopeTextType::DR2,
				FMEnvelopeTextType::SR2,
				FMEnvelopeTextType::RR2,
				FMEnvelopeTextType::SL2,
				FMEnvelopeTextType::TL2,
				FMEnvelopeTextType::KS2,
				FMEnvelopeTextType::ML2,
				FMEnvelopeTextType::DT2,
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::AR3,
				FMEnvelopeTextType::DR3,
				FMEnvelopeTextType::SR3,
				FMEnvelopeTextType::RR3,
				FMEnvelopeTextType::SL3,
				FMEnvelopeTextType::TL3,
				FMEnvelopeTextType::KS3,
				FMEnvelopeTextType::ML3,
				FMEnvelopeTextType::DT3,
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::AR4,
				FMEnvelopeTextType::DR4,
				FMEnvelopeTextType::SR4,
				FMEnvelopeTextType::RR4,
				FMEnvelopeTextType::SL4,
				FMEnvelopeTextType::TL4,
				FMEnvelopeTextType::KS4,
				FMEnvelopeTextType::ML4,
				FMEnvelopeTextType::DT4,
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::AL,
				FMEnvelopeTextType::FB
			})
		},
		{
			"VOPM",
			std::vector<FMEnvelopeTextType>({
				// Number
				FMEnvelopeTextType::Skip,
				// LFO
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::Skip,
				// CH
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::FB,
				FMEnvelopeTextType::AL,
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::Skip,
				// Op
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::AR1,
				FMEnvelopeTextType::DR1,
				FMEnvelopeTextType::SR1,
				FMEnvelopeTextType::RR1,
				FMEnvelopeTextType::SL1,
				FMEnvelopeTextType::TL1,
				FMEnvelopeTextType::KS1,
				FMEnvelopeTextType::ML1,
				FMEnvelopeTextType::DT1,
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::AR2,
				FMEnvelopeTextType::DR2,
				FMEnvelopeTextType::SR2,
				FMEnvelopeTextType::RR2,
				FMEnvelopeTextType::SL2,
				FMEnvelopeTextType::TL2,
				FMEnvelopeTextType::KS2,
				FMEnvelopeTextType::ML2,
				FMEnvelopeTextType::DT2,
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::AR3,
				FMEnvelopeTextType::DR3,
				FMEnvelopeTextType::SR3,
				FMEnvelopeTextType::RR3,
				FMEnvelopeTextType::SL3,
				FMEnvelopeTextType::TL3,
				FMEnvelopeTextType::KS3,
				FMEnvelopeTextType::ML3,
				FMEnvelopeTextType::DT3,
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::AR4,
				FMEnvelopeTextType::DR4,
				FMEnvelopeTextType::SR4,
				FMEnvelopeTextType::RR4,
				FMEnvelopeTextType::SL4,
				FMEnvelopeTextType::TL4,
				FMEnvelopeTextType::KS4,
				FMEnvelopeTextType::ML4,
				FMEnvelopeTextType::DT4,
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::Skip
			})
		},
		{
			"NRTDRV",	// For VOICE_MODE=0
			std::vector<FMEnvelopeTextType>({
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::AL,
				FMEnvelopeTextType::FB,
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::AR1,
				FMEnvelopeTextType::DR1,
				FMEnvelopeTextType::SR1,
				FMEnvelopeTextType::RR1,
				FMEnvelopeTextType::SL1,
				FMEnvelopeTextType::TL1,
				FMEnvelopeTextType::KS1,
				FMEnvelopeTextType::ML1,
				FMEnvelopeTextType::DT1,
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::AR2,
				FMEnvelopeTextType::DR2,
				FMEnvelopeTextType::SR2,
				FMEnvelopeTextType::RR2,
				FMEnvelopeTextType::SL2,
				FMEnvelopeTextType::TL2,
				FMEnvelopeTextType::KS2,
				FMEnvelopeTextType::ML2,
				FMEnvelopeTextType::DT2,
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::AR3,
				FMEnvelopeTextType::DR3,
				FMEnvelopeTextType::SR3,
				FMEnvelopeTextType::RR3,
				FMEnvelopeTextType::SL3,
				FMEnvelopeTextType::TL3,
				FMEnvelopeTextType::KS3,
				FMEnvelopeTextType::ML3,
				FMEnvelopeTextType::DT3,
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::AR4,
				FMEnvelopeTextType::DR4,
				FMEnvelopeTextType::SR4,
				FMEnvelopeTextType::RR4,
				FMEnvelopeTextType::SL4,
				FMEnvelopeTextType::TL4,
				FMEnvelopeTextType::KS4,
				FMEnvelopeTextType::ML4,
				FMEnvelopeTextType::DT4,
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::Skip
			})
		},
		{
			"MXDRV",
			std::vector<FMEnvelopeTextType>({
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::AR1,
				FMEnvelopeTextType::DR1,
				FMEnvelopeTextType::SR1,
				FMEnvelopeTextType::RR1,
				FMEnvelopeTextType::SL1,
				FMEnvelopeTextType::TL1,
				FMEnvelopeTextType::KS1,
				FMEnvelopeTextType::ML1,
				FMEnvelopeTextType::DT1,
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::AR2,
				FMEnvelopeTextType::DR2,
				FMEnvelopeTextType::SR2,
				FMEnvelopeTextType::RR2,
				FMEnvelopeTextType::SL2,
				FMEnvelopeTextType::TL2,
				FMEnvelopeTextType::KS2,
				FMEnvelopeTextType::ML2,
				FMEnvelopeTextType::DT2,
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::AR3,
				FMEnvelopeTextType::DR3,
				FMEnvelopeTextType::SR3,
				FMEnvelopeTextType::RR3,
				FMEnvelopeTextType::SL3,
				FMEnvelopeTextType::TL3,
				FMEnvelopeTextType::KS3,
				FMEnvelopeTextType::ML3,
				FMEnvelopeTextType::DT3,
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::AR4,
				FMEnvelopeTextType::DR4,
				FMEnvelopeTextType::SR4,
				FMEnvelopeTextType::RR4,
				FMEnvelopeTextType::SL4,
				FMEnvelopeTextType::TL4,
				FMEnvelopeTextType::KS4,
				FMEnvelopeTextType::ML4,
				FMEnvelopeTextType::DT4,
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::AL,
				FMEnvelopeTextType::FB,
				FMEnvelopeTextType::Skip
			})
		},
		{
			"MMLDRV",
			std::vector<FMEnvelopeTextType>({
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::AL,
				FMEnvelopeTextType::FB,
				FMEnvelopeTextType::AR1,
				FMEnvelopeTextType::DR1,
				FMEnvelopeTextType::SR1,
				FMEnvelopeTextType::RR1,
				FMEnvelopeTextType::SL1,
				FMEnvelopeTextType::TL1,
				FMEnvelopeTextType::KS1,
				FMEnvelopeTextType::ML1,
				FMEnvelopeTextType::DT1,
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::AR2,
				FMEnvelopeTextType::DR2,
				FMEnvelopeTextType::SR2,
				FMEnvelopeTextType::RR2,
				FMEnvelopeTextType::SL2,
				FMEnvelopeTextType::TL2,
				FMEnvelopeTextType::KS2,
				FMEnvelopeTextType::ML2,
				FMEnvelopeTextType::DT2,
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::AR3,
				FMEnvelopeTextType::DR3,
				FMEnvelopeTextType::SR3,
				FMEnvelopeTextType::RR3,
				FMEnvelopeTextType::SL3,
				FMEnvelopeTextType::TL3,
				FMEnvelopeTextType::KS3,
				FMEnvelopeTextType::ML3,
				FMEnvelopeTextType::DT3,
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::AR4,
				FMEnvelopeTextType::DR4,
				FMEnvelopeTextType::SR4,
				FMEnvelopeTextType::RR4,
				FMEnvelopeTextType::SL4,
				FMEnvelopeTextType::TL4,
				FMEnvelopeTextType::KS4,
				FMEnvelopeTextType::ML4,
				FMEnvelopeTextType::DT4,
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::Skip
			})
		},
		{
			"MUCOM88",
			std::vector<FMEnvelopeTextType>({
				FMEnvelopeTextType::Skip,
				FMEnvelopeTextType::FB,
				FMEnvelopeTextType::AL,
				FMEnvelopeTextType::AR1,
				FMEnvelopeTextType::DR1,
				FMEnvelopeTextType::SR1,
				FMEnvelopeTextType::RR1,
				FMEnvelopeTextType::SL1,
				FMEnvelopeTextType::TL1,
				FMEnvelopeTextType::KS1,
				FMEnvelopeTextType::ML1,
				FMEnvelopeTextType::DT1,
				FMEnvelopeTextType::AR2,
				FMEnvelopeTextType::DR2,
				FMEnvelopeTextType::SR2,
				FMEnvelopeTextType::RR2,
				FMEnvelopeTextType::SL2,
				FMEnvelopeTextType::TL2,
				FMEnvelopeTextType::KS2,
				FMEnvelopeTextType::ML2,
				FMEnvelopeTextType::DT2,
				FMEnvelopeTextType::AR3,
				FMEnvelopeTextType::DR3,
				FMEnvelopeTextType::SR3,
				FMEnvelopeTextType::RR3,
				FMEnvelopeTextType::SL3,
				FMEnvelopeTextType::TL3,
				FMEnvelopeTextType::KS3,
				FMEnvelopeTextType::ML3,
				FMEnvelopeTextType::DT3,
				FMEnvelopeTextType::AR4,
				FMEnvelopeTextType::DR4,
				FMEnvelopeTextType::SR4,
				FMEnvelopeTextType::RR4,
				FMEnvelopeTextType::SL4,
				FMEnvelopeTextType::TL4,
				FMEnvelopeTextType::KS4,
				FMEnvelopeTextType::ML4,
				FMEnvelopeTextType::DT4
			})
		}
	};

	// Layouts
	const std::unordered_map<std::string, JamKey> mappingQWERTY = {
		{u8"Z",         JamKey::LowC},
		{u8"S",         JamKey::LowCS},
		{u8"X",         JamKey::LowD},
		{u8"D",         JamKey::LowDS},
		{u8"C",         JamKey::LowE},
		{u8"V",         JamKey::LowF},
		{u8"G",         JamKey::LowFS},
		{u8"B",         JamKey::LowG},
		{u8"H",         JamKey::LowGS},
		{u8"N",         JamKey::LowA},
		{u8"J",         JamKey::LowAS},
		{u8"M",         JamKey::LowB},
		{u8",",         JamKey::LowC2},
		{u8"L",         JamKey::LowCS2},
		{u8".",         JamKey::LowD2},

		{u8"Q",         JamKey::HighC},
		{u8"2",         JamKey::HighCS},
		{u8"W",         JamKey::HighD},
		{u8"3",         JamKey::HighDS},
		{u8"E",         JamKey::HighE},
		{u8"R",         JamKey::HighF},
		{u8"5",         JamKey::HighFS},
		{u8"T",         JamKey::HighG},
		{u8"6",         JamKey::HighGS},
		{u8"Y",         JamKey::HighA},
		{u8"7",         JamKey::HighAS},
		{u8"U",         JamKey::HighB},
		{u8"I",         JamKey::HighC2},
		{u8"9",         JamKey::HighCS2},
		{u8"O",         JamKey::HighD2},
	};
	const std::unordered_map<std::string, JamKey> mappingQWERTZ = {
		{u8"Y",         JamKey::LowC},
		{u8"S",         JamKey::LowCS},
		{u8"X",         JamKey::LowD},
		{u8"D",         JamKey::LowDS},
		{u8"C",         JamKey::LowE},
		{u8"V",         JamKey::LowF},
		{u8"G",         JamKey::LowFS},
		{u8"B",         JamKey::LowG},
		{u8"H",         JamKey::LowGS},
		{u8"N",         JamKey::LowA},
		{u8"J",         JamKey::LowAS},
		{u8"M",         JamKey::LowB},
		{u8",",         JamKey::LowC2},
		{u8"L",         JamKey::LowCS2},
		{u8".",         JamKey::LowD2},

		{u8"Q",         JamKey::HighC},
		{u8"2",         JamKey::HighCS},
		{u8"W",         JamKey::HighD},
		{u8"3",         JamKey::HighDS},
		{u8"E",         JamKey::HighE},
		{u8"R",         JamKey::HighF},
		{u8"5",         JamKey::HighFS},
		{u8"T",         JamKey::HighG},
		{u8"6",         JamKey::HighGS},
		{u8"Z",         JamKey::HighA},
		{u8"7",         JamKey::HighAS},
		{u8"U",         JamKey::HighB},
		{u8"I",         JamKey::HighC2},
		{u8"9",         JamKey::HighCS2},
		{u8"O",         JamKey::HighD2},
	};
	const std::unordered_map<std::string, JamKey> mappingAZERTY = {
		{u8"W",         JamKey::LowC},
		{u8"S",         JamKey::LowCS},
		{u8"X",         JamKey::LowD},
		{u8"D",         JamKey::LowDS},
		{u8"C",         JamKey::LowE},
		{u8"V",         JamKey::LowF},
		{u8"G",         JamKey::LowFS},
		{u8"B",         JamKey::LowG},
		{u8"H",         JamKey::LowGS},
		{u8"N",         JamKey::LowA},
		{u8"J",         JamKey::LowAS},
		{u8",",         JamKey::LowB},
		{u8";",         JamKey::LowC2},
		{u8"L",         JamKey::LowCS2},
		{u8".",         JamKey::LowD2},

		{u8"A",         JamKey::HighC},
		{u8"É",         JamKey::HighCS},   //é - \xc9
		{u8"Z",         JamKey::HighD},
		{u8"\"",        JamKey::HighDS},
		{u8"E",         JamKey::HighE},
		{u8"R",         JamKey::HighF},
		{u8"(",         JamKey::HighFS},
		{u8"T",         JamKey::HighG},
		{u8"-",         JamKey::HighGS},
		{u8"Y",         JamKey::HighA},
		{u8"È",         JamKey::HighAS},   //è - \xc8
		{u8"U",         JamKey::HighB},
		{u8"I",         JamKey::HighC2},
		{u8"Ç",         JamKey::HighCS2}, //ç - \xc7
		{u8"O",         JamKey::HighD2},
	};
	mappingCustom = {};
	mappingLayouts = {
		{ Custom, mappingCustom },
		{ QWERTY, mappingQWERTY },
		{ QWERTZ, mappingQWERTZ },
		{ AZERTY, mappingAZERTY }
	};

	// Appearance
	ptnHdFont_ = u8"";
	ptnHdFontSize_ = 10;
	ptnRowFont_ = u8"";
	ptnRowFontSize_ = 10;
	odrHdFont_ = u8"";
	odrHdFontSize_ = 10;
	odrRowFont_ = u8"";
	odrRowFontSize_ = 10;
}

// Internal //
void Configuration::setMainWindowWidth(int w)
{
	mainW_ = w;
}

int Configuration::getMainWindowWidth() const
{
	return mainW_;
}

void Configuration::setMainWindowHeight(int h)
{
	mainH_ = h;
}

int Configuration::getMainWindowHeight() const
{
	return mainH_;
}

void Configuration::setMainWindowMaximized(bool isMax)
{
	mainMax_ = isMax;
}

bool Configuration::getMainWindowMaximized() const
{
	return mainMax_;
}

void Configuration::setMainWindowX(int x)
{
	mainX_ = x;
}

int Configuration::getMainWindowX() const
{
	return mainX_;
}

void Configuration::setMainWindowY(int y)
{
	mainY_ = y;
}

int Configuration::getMainWindowY() const
{
	return mainY_;
}

void Configuration::setMainWindowVerticalSplit(int y)
{
	mainVSplit_ = y;
}

int Configuration::getMainWindowVerticalSplit() const
{
	return mainVSplit_;
}

void Configuration::setInstrumentFMWindowWidth(int w)
{
	instFMW_ = w;
}

int Configuration::getInstrumentFMWindowWidth() const
{
	return instFMW_;
}

void Configuration::setInstrumentFMWindowHeight(int h)
{
	instFMH_ = h;
}

int Configuration::getInstrumentFMWindowHeight() const
{
	return instFMH_;
}

void Configuration::setInstrumentSSGWindowWidth(int w)
{
	instSSGW_ = w;
}

int Configuration::getInstrumentSSGWindowWidth() const
{
	return instSSGW_;
}

void Configuration::setInstrumentSSGWindowHeight(int h)
{
	instSSGH_ = h;
}

int Configuration::getInstrumentSSGWindowHeight() const
{
	return instSSGH_;
}

void Configuration::setFollowMode(bool enabled)
{
	followMode_ = enabled;
}

bool Configuration::getFollowMode() const
{
	return followMode_;
}

void Configuration::setWorkingDirectory(std::string path)
{
	workDir_ = path;
}

std::string Configuration::getWorkingDirectory() const
{
	return workDir_;
}

void Configuration::setInstrumentOpenFormat(int i)
{
	instOpenFormat_ = i;
}

int Configuration::getInstrumentOpenFormat() const
{
	return instOpenFormat_;
}

void Configuration::setBankOpenFormat(int i)
{
	bankOpenFormat_ = i;
}

int Configuration::getBankOpenFormat() const
{
	return bankOpenFormat_;
}

// General //
// General settings
void Configuration::setWarpCursor(bool enabled)
{
	warpCursor_ = enabled;
}

bool Configuration::getWarpCursor() const
{
	return warpCursor_;
}

void Configuration::setWarpAcrossOrders(bool enabled)
{
	warpAcrossOrders_ = enabled;
}

bool Configuration::getWarpAcrossOrders() const
{
	return warpAcrossOrders_;
}

void Configuration::setShowRowNumberInHex(bool enabled)
{
	showRowNumHex_ = enabled;
}

bool Configuration::getShowRowNumberInHex() const
{
	return showRowNumHex_;
}

void Configuration::setShowPreviousNextOrders(bool enabled)
{
	showPrevNextOrders_ = enabled;
}

bool Configuration::getShowPreviousNextOrders() const
{
	return showPrevNextOrders_;
}

void Configuration::setBackupModules(bool enabled)
{
	backupModules_ = enabled;
}

bool Configuration::getBackupModules() const
{
	return backupModules_;
}

void Configuration::setDontSelectOnDoubleClick(bool enabled)
{
	dontSelectOnDoubleClick_ = enabled;
}

bool Configuration::getDontSelectOnDoubleClick() const
{
	return dontSelectOnDoubleClick_;
}

void Configuration::setReverseFMVolumeOrder(bool enabled)
{
	reverseFMVolumeOrder_= enabled;
}

bool Configuration::getReverseFMVolumeOrder() const
{
	return reverseFMVolumeOrder_;
}

void Configuration::setMoveCursorToRight(bool enabled)
{
	moveCursorToRight_ = enabled;
}

bool Configuration::getMoveCursorToRight() const
{
	return moveCursorToRight_;
}

void Configuration::setRetrieveChannelState(bool enabled)
{
	retrieveChannelState_ = enabled;
}

bool Configuration::getRetrieveChannelState() const
{
	return retrieveChannelState_;
}

void Configuration::setEnableTranslation(bool enabled)
{
	enableTranslation_ = enabled;
}
bool Configuration::getEnableTranslation() const
{
	return enableTranslation_;
}

void Configuration::setShowFMDetuneAsSigned(bool enabled)
{
	showFMDetuneSigned_ = enabled;
}

bool Configuration::getShowFMDetuneAsSigned() const
{
	return showFMDetuneSigned_;
}

void Configuration::setShowWaveVisual(bool enabled)
{
	showWaveVisual_ = enabled;
}

bool Configuration::getShowWaveVisual() const
{
	return showWaveVisual_;
}

void Configuration::setFill00ToEffectValue(bool enabled)
{
	fill00ToEffectValue_ = enabled;
}

bool Configuration::getFill00ToEffectValue() const
{
	return fill00ToEffectValue_;
}

void Configuration::setAutosetInstrument(bool enabled)
{
	autosetInstrument_ = enabled;
}

bool Configuration::getAutosetInstrument() const
{
	return autosetInstrument_;
}

void Configuration::setMoveCursorByHorizontalScroll(bool enabled)
{
	moveCursorHScroll_ = enabled;
}

bool Configuration::getMoveCursorByHorizontalScroll() const
{
	return moveCursorHScroll_;
}

// Edit settings
void Configuration::setPageJumpLength(size_t length)
{
	pageJumpLength_ = length;
}

size_t Configuration::getPageJumpLength() const
{
	return pageJumpLength_;
}

void Configuration::setEditableStep(size_t step)
{
	editableStep_ = step;
}

size_t Configuration::getEditableStep() const
{
	return editableStep_;
}

void Configuration::setKeyRepetition(bool enabled)
{
	keyRepetision_ = enabled;
}

bool Configuration::getKeyRepetition() const
{
	return keyRepetision_;
}

// Keys
void Configuration::setKeyOffKey(std::string key)
{
	keyOffKey_ = key;
}

std::string Configuration::getKeyOffKey() const
{
	return keyOffKey_;
}

void Configuration::setOctaveUpKey(std::string key)
{
	octUpKey_ = key;
}

std::string Configuration::getOctaveUpKey() const
{
	return octUpKey_;
}

void Configuration::setOctaveDownKey(std::string key)
{
	octDownKey_ = key;
}

std::string Configuration::getOctaveDownKey() const
{
	return octDownKey_;
}

void Configuration::setEchoBufferKey(std::string key)
{
	echoKey_ = key;
}

std::string Configuration::getEchoBufferKey() const
{
	return echoKey_;
}

void Configuration::setNoteEntryLayout(KeyboardLayout layout)
{
	noteEntryLayout_ = layout;
}

Configuration::KeyboardLayout Configuration::getNoteEntryLayout() const
{
	return noteEntryLayout_;
}

void Configuration::setCustomLayoutKeys(std::unordered_map<std::string, JamKey> mapping)
{
	mappingLayouts[KeyboardLayout::Custom] = mapping;
}

std::unordered_map<std::string, JamKey> Configuration::getCustomLayoutKeys() const
{
	return mappingLayouts.at(KeyboardLayout::Custom);
}

// Sound //
void Configuration::setSoundAPI(std::string api)
{
	sndAPI_ = api;
}

std::string Configuration::getSoundAPI() const
{
	return sndAPI_;
}

void Configuration::setSoundDevice(std::string device)
{
	sndDevice_ = device;
}

std::string Configuration::getSoundDevice() const
{
	return sndDevice_;
}

void Configuration::setRealChipInterface(RealChipInterface type)
{
	realChip_ = type;
}

RealChipInterface Configuration::getRealChipInterface() const
{
	return realChip_;
}

void Configuration::setEmulator(int emulator)
{
	emulator_ = emulator;
}

int Configuration::getEmulator() const
{
	return emulator_;
}

void Configuration::setSampleRate(uint32_t rate)
{
	sampleRate_ = rate;
}

uint32_t Configuration::getSampleRate() const
{
	return sampleRate_;
}

void Configuration::setBufferLength(size_t length)
{
	bufferLength_ = length;
}

size_t Configuration::getBufferLength() const
{
	return bufferLength_;
}

// Midi //
void Configuration::setMidiInputPort(const std::string &port)
{
	midiInPort_ = port;
}

std::string Configuration::getMidiInputPort() const
{
	return midiInPort_;
}

// Mixer //
void Configuration::setMixerVolumeMaster(int percentage)
{
	mixerVolumeMaster_ = percentage;
}

int Configuration::getMixerVolumeMaster() const
{
	return mixerVolumeMaster_;
}

void Configuration::setMixerVolumeFM(double dB)
{
	mixerVolumeFM_ = dB;
}

double Configuration::getMixerVolumeFM() const
{
	return mixerVolumeFM_;
}

void Configuration::setMixerVolumeSSG(double dB)
{
	mixerVolumeSSG_ = dB;
}

double Configuration::getMixerVolumeSSG() const
{
	return mixerVolumeSSG_;
}

// Input //
void Configuration::setFMEnvelopeTexts(std::vector<FMEnvelopeText> texts)
{
	fmEnvelopeTexts_ = texts;
}

std::vector<FMEnvelopeText> Configuration::getFMEnvelopeTexts() const
{
	return fmEnvelopeTexts_;
}

// Appearrance
void Configuration::setPatternEditorHeaderFont(std::string font)
{
	ptnHdFont_ = font;
}

std::string Configuration::getPatternEditorHeaderFont() const
{
	return ptnHdFont_;
}

void Configuration::setPatternEditorHeaderFontSize(int size)
{
	ptnHdFontSize_ = size;
}

int Configuration::getPatternEditorHeaderFontSize() const
{
	return ptnHdFontSize_;
}

void Configuration::setPatternEditorRowsFont(std::string font)
{
	ptnRowFont_ = font;
}

std::string Configuration::getPatternEditorRowsFont() const
{
	return ptnRowFont_;
}

void Configuration::setPatternEditorRowsFontSize(int size)
{
	ptnRowFontSize_ = size;
}

int Configuration::getPatternEditorRowsFontSize() const
{
	return ptnRowFontSize_;
}

void Configuration::setOrderListHeaderFont(std::string font)
{
	odrHdFont_ = font;
}

std::string Configuration::getOrderListHeaderFont() const
{
	return odrHdFont_;
}

void Configuration::setOrderListHeaderFontSize(int size)
{
	odrHdFontSize_ = size;
}

int Configuration::getOrderListHeaderFontSize() const
{
	return odrHdFontSize_;
}

void Configuration::setOrderListRowsFont(std::string font)
{
	odrRowFont_ = font;
}

std::string Configuration::getOrderListRowsFont() const
{
	return odrRowFont_;
}

void Configuration::setOrderListRowsFontSize(int size)
{
	odrRowFontSize_ = size;
}

int Configuration::getOrderListRowsFontSize() const
{
	return odrRowFontSize_;
}
