void DlgPrefEQ::loadSettings() { QString highEqCourse = m_pConfig->getValueString(ConfigKey(kConfigKey, "HiEQFrequency")); QString highEqPrecise = m_pConfig->getValueString(ConfigKey(kConfigKey, "HiEQFrequencyPrecise")); QString lowEqCourse = m_pConfig->getValueString(ConfigKey(kConfigKey, "LoEQFrequency")); QString lowEqPrecise = m_pConfig->getValueString(ConfigKey(kConfigKey, "LoEQFrequencyPrecise")); m_bEqAutoReset = static_cast<bool>(m_pConfig->getValueString( ConfigKey(kConfigKey, "EqAutoReset")).toInt()); CheckBoxEqAutoReset->setChecked(m_bEqAutoReset); m_bGainAutoReset = static_cast<bool>(m_pConfig->getValueString( ConfigKey(kConfigKey, "GainAutoReset")).toInt()); CheckBoxGainAutoReset->setChecked(m_bGainAutoReset); CheckBoxBypass->setChecked(m_pConfig->getValue( ConfigKey(kConfigKey, kEnableEqs), QString("yes")) == "no"); CheckBoxEqOnly->setChecked(m_pConfig->getValue( ConfigKey(kConfigKey, kEqsOnly), "yes") == "yes"); CheckBoxSingleEqEffect->setChecked(m_pConfig->getValue( ConfigKey(kConfigKey, kSingleEq), "yes") == "yes"); slotSingleEqChecked(CheckBoxSingleEqEffect->isChecked()); double lowEqFreq = 0.0; double highEqFreq = 0.0; // Precise takes precedence over course. lowEqFreq = lowEqCourse.isEmpty() ? lowEqFreq : lowEqCourse.toDouble(); lowEqFreq = lowEqPrecise.isEmpty() ? lowEqFreq : lowEqPrecise.toDouble(); highEqFreq = highEqCourse.isEmpty() ? highEqFreq : highEqCourse.toDouble(); highEqFreq = highEqPrecise.isEmpty() ? highEqFreq : highEqPrecise.toDouble(); if (lowEqFreq == 0.0 || highEqFreq == 0.0 || lowEqFreq == highEqFreq) { setDefaultShelves(); lowEqFreq = m_pConfig->getValueString(ConfigKey(kConfigKey, "LoEQFrequencyPrecise")).toDouble(); highEqFreq = m_pConfig->getValueString(ConfigKey(kConfigKey, "HiEQFrequencyPrecise")).toDouble(); } SliderHiEQ->setValue( getSliderPosition(highEqFreq, SliderHiEQ->minimum(), SliderHiEQ->maximum())); SliderLoEQ->setValue( getSliderPosition(lowEqFreq, SliderLoEQ->minimum(), SliderLoEQ->maximum())); if (m_pConfig->getValue( ConfigKey(kConfigKey, kEnableEqs), "yes") == "yes") { CheckBoxBypass->setChecked(false); } }
void DlgPrefEQ::loadSettings() { QString highEqCourse = m_pConfig->getValueString(ConfigKey(CONFIG_KEY, "HiEQFrequency")); QString highEqPrecise = m_pConfig->getValueString(ConfigKey(CONFIG_KEY, "HiEQFrequencyPrecise")); QString lowEqCourse = m_pConfig->getValueString(ConfigKey(CONFIG_KEY, "LoEQFrequency")); QString lowEqPrecise = m_pConfig->getValueString(ConfigKey(CONFIG_KEY, "LoEQFrequencyPrecise")); double lowEqFreq = 0.0; double highEqFreq = 0.0; // Precise takes precedence over course. lowEqFreq = lowEqCourse.isEmpty() ? lowEqFreq : lowEqCourse.toDouble(); lowEqFreq = lowEqPrecise.isEmpty() ? lowEqFreq : lowEqPrecise.toDouble(); highEqFreq = highEqCourse.isEmpty() ? highEqFreq : highEqCourse.toDouble(); highEqFreq = highEqPrecise.isEmpty() ? highEqFreq : highEqPrecise.toDouble(); if (lowEqFreq == 0.0 || highEqFreq == 0.0 || lowEqFreq == highEqFreq) { setDefaultShelves(); lowEqFreq = m_pConfig->getValueString(ConfigKey(CONFIG_KEY, "LoEQFrequencyPrecise")).toDouble(); highEqFreq = m_pConfig->getValueString(ConfigKey(CONFIG_KEY, "HiEQFrequencyPrecise")).toDouble(); } SliderHiEQ->setValue( getSliderPosition(highEqFreq, SliderHiEQ->minimum(), SliderHiEQ->maximum())); SliderLoEQ->setValue( getSliderPosition(lowEqFreq, SliderLoEQ->minimum(), SliderLoEQ->maximum())); if (m_pConfig->getValueString( ConfigKey(CONFIG_KEY, ENABLE_INTERNAL_EQ), "yes") == QString("yes")) { radioButton_bypass->setChecked(false); if (m_pConfig->getValueString( ConfigKey(CONFIG_KEY, "LoFiEQs")) == QString("yes")) { radioButton_bessel4->setChecked(true); radioButton_butterworth8->setChecked(false); } else { radioButton_bessel4->setChecked(false); radioButton_butterworth8->setChecked(true); } } else { radioButton_bypass->setChecked(true); radioButton_bessel4->setChecked(false); radioButton_butterworth8->setChecked(false); } }
void DlgPrefEQ::loadSettings() { QString highEqCourse = m_pConfig->getValueString(ConfigKey(CONFIG_KEY, "HiEQFrequency")); QString highEqPrecise = m_pConfig->getValueString(ConfigKey(CONFIG_KEY, "HiEQFrequencyPrecise")); QString lowEqCourse = m_pConfig->getValueString(ConfigKey(CONFIG_KEY, "LoEQFrequency")); QString lowEqPrecise = m_pConfig->getValueString(ConfigKey(CONFIG_KEY, "LoEQFrequencyPrecise")); double lowEqFreq = 0.0; double highEqFreq = 0.0; // Precise takes precedence over course. lowEqFreq = lowEqCourse.isEmpty() ? lowEqFreq : lowEqCourse.toDouble(); lowEqFreq = lowEqPrecise.isEmpty() ? lowEqFreq : lowEqPrecise.toDouble(); highEqFreq = highEqCourse.isEmpty() ? highEqFreq : highEqCourse.toDouble(); highEqFreq = highEqPrecise.isEmpty() ? highEqFreq : highEqPrecise.toDouble(); if (lowEqFreq == 0.0 || highEqFreq == 0.0 || lowEqFreq == highEqFreq) { CheckBoxLoFi->setChecked(true); setDefaultShelves(); lowEqFreq = m_pConfig->getValueString(ConfigKey(CONFIG_KEY, "LoEQFrequencyPrecise")).toDouble(); highEqFreq = m_pConfig->getValueString(ConfigKey(CONFIG_KEY, "HiEQFrequencyPrecise")).toDouble(); } SliderHiEQ->setValue( getSliderPosition(highEqFreq, SliderHiEQ->minimum(), SliderHiEQ->maximum())); SliderLoEQ->setValue( getSliderPosition(lowEqFreq, SliderLoEQ->minimum(), SliderLoEQ->maximum())); CheckBoxLoFi->setChecked(m_pConfig->getValueString( ConfigKey(CONFIG_KEY, "LoFiEQs")) == QString("yes")); // Default internal EQs to enabled. CheckBoxEnbEQ->setChecked(m_pConfig->getValueString( ConfigKey(CONFIG_KEY, ENABLE_INTERNAL_EQ), "yes") == QString("yes")); slotUpdate(); slotApply(); }
int main(void) { int addScore, position, pauseSel; // Initializations PLL_Init(); // Clock set at 80 MHz LCD_Init(); Board_Init(); Input_Init(); DAC_Init(); Random_Init(NVIC_ST_CURRENT_R); Timer2_Init(80000000); // time interrupt Timer1_Init(2000); // sound interrupt EnableInterrupts(); generateRandomTile(); drawAllTiles(); writeScore(0); writeHighscore(0); writeTime(0); displayHighestTile(); while(1) { // draw arrow if ready if (arrowReady == 1) { // acknowledge flag arrowReady = 0; // draw arrow drawArrow(); } // write time if ready if (timeReady == 1) { // acknowledge flag timeReady = 0; // write time writeTime(elapsedTime); } // Play mode and button1 is pushed if(Button1 && !pauseMode && !gameOver) { // Play sound playSound = 1; // shift and merge tiles towards arrow position = getSliderPosition(); if (position == 1) { shiftLeft(); addScore = mergeLeft(); shiftLeft(); } else if (position == 2) { shiftUp(); addScore = mergeUp(); shiftUp(); } else if (position == 3) { shiftRight(); addScore = mergeRight(); shiftRight(); } else { shiftDown(); addScore = mergeDown(); shiftDown(); } eraseBoard(); drawAllTiles(); // update score score += addScore; addScore = 0; writeScore(score); displayHighestTile(); // delay before adding new tile delay(200); // create new tile if (countEmptyTiles() != 0) { generateRandomTile(); } drawAllTiles(); // update highest tile image displayHighestTile(); // check if game over if (checkGameOver() == 1) { gameOver = 1; } // unset flag Button1 = 0; } // button 2 is pause else if (Button2 && !gameOver && !pauseMode) { pauseMode = 1; pauseSel = 0; // disable arrow and timer NVIC_ST_CTRL_R = 0; TIMER2_CTL_R = 0x00000000; LCD_DrawFilledRect(prevX,prevY,20,20,BLACK); // draw pause mode screen drawPauseMode(); // acknowledge button Button2 = 0; // wait until button is pushed while (pauseMode) { // Button 1 selects current pause selection button if (Button1) { // acknowledge button Button1 = 0; Button2 = 0; pauseMode = 0; // if pause selection = "continue" (pauseSel = 0), continue with game if (pauseSel == 0) { // redraw screen eraseBoard(); drawAllTiles(); // enable gameplay NVIC_ST_CTRL_R = 0x07; TIMER2_CTL_R = 0x00000001; } // if pause selection = "restart" (pauseSel = 0), end game else if (pauseSel == 1) { if (score > highscore) { writeHighscore(score); } score = 0; eraseScore(); writeScore(0); clearBoard(); eraseBoard(); pauseMode = 0; generateRandomTile(); drawAllTiles(); elapsedTime = 0; eraseTime(); writeTime(0); displayHighestTile(); NVIC_ST_CTRL_R = 0x07; TIMER2_CTL_R = 0x00000001; } } // Button 2 changes pause selection else if (Button2) { Button2 = 0; if (pauseSel == 0) { pauseSel = 1; LCD_DrawRect(144,112,58,16,BLACK); LCD_DrawRect(222,112,51,16,WHITE); } else if (pauseSel == 1) { pauseSel = 0; LCD_DrawRect(222,112,51,16,BLACK); LCD_DrawRect(144,112,58,16,WHITE); } } } } // game over if (gameOver == 1) { NVIC_ST_CTRL_R = 0; TIMER2_CTL_R = 0x00000000; LCD_DrawFilledRect(156,38,100,20,BLACK); LCD_SetTextColor(255,255,240); LCD_Goto(30,5); printf("GAME OVER"); while (Button1 == 0 && Button2 == 0) {} Button1 = 0; Button2 = 0; LCD_DrawFilledRect(prevX,prevY,20,20,BLACK); drawGameOver(score, elapsedTime); if (score > highscore) { writeHighscore(score); gameOverHighscore(score); } // wait til button is pushed while (Button1 == 0 && Button2 == 0) {} // acknowledge buttons Button1 = 0; Button2 = 0; // start new game score = 0; eraseScore(); writeScore(0); clearBoard(); eraseBoard(); pauseMode = 0; generateRandomTile(); drawAllTiles(); elapsedTime = 0; eraseTime(); writeTime(0); displayHighestTile(); NVIC_ST_CTRL_R = 0x07; TIMER2_CTL_R = 0x00000001; // finish game over mode gameOver = 0; } } }