//--------------------------------------------------------------------------------------- wxString IdfyScalesCtrol::set_new_problem() { //This method must prepare the problem score and set variables: // m_pProblemScore - The score with the problem to propose // m_pSolutionScore - The score with the solution or NULL if it is the // same score than the problem score. // m_sAnswer - the message to present when displaying the solution // m_nRespIndex - the number of the button for the right answer // m_nPlayMM - the speed to play the score // //It must return the message to display to introduce the problem. //select a random mode m_fAscending = m_pConstrains->GetRandomPlayMode(); // generate a random scale EScaleType nScaleType = m_pConstrains->GetRandomScaleType(); // select a key signature RandomGenerator oGenerator; m_nKey = oGenerator.generate_key( m_pConstrains->GetKeyConstrains() ); // for minor scales use minor key signature and for major scales use a major key if (Scale::is_minor(nScaleType) && is_major_key(m_nKey)) m_nKey = get_relative_minor_key(m_nKey); else if (!Scale::is_minor(nScaleType) && is_minor_key(m_nKey)) m_nKey = get_relative_major_key(m_nKey); //Generate a random root note EClef nClef = k_clef_G2; m_fpRootNote = oGenerator.get_best_root_note(nClef, m_nKey); //hide key signature if requested or not tonal scale bool fDisplayKey = m_pConstrains->DisplayKey() && Scale::is_tonal(nScaleType); if (!fDisplayKey) m_nKey = k_key_C; //create the score m_sAnswer = prepare_score(nClef, nScaleType, &m_pProblemScore); //compute the index for the button that corresponds to the right answer int i; for (i = 0; i < k_num_buttons; i++) { if (m_nRealScale[i] == nScaleType) break; } m_nRespIndex = i; //if two solutions (minor/major or Gregorian mode) disable answer buttons //for the not valid answer DisableGregorianMajorMinor(nScaleType); //return string to introduce the problem if (m_pConstrains->is_theory_mode()) return _("Identify the next scale:"); else return ""; // return _("Press 'Play' to hear it again"); }
//--------------------------------------------------------------------------------------- wxString IdfyTonalityCtrol::set_new_problem() { //This method must prepare the problem score and set variables: // m_pProblemScore, m_pSolutionScore, m_sAnswer, m_nRespIndex and m_nPlayMM // select a key signature RandomGenerator oGenerator; m_nKey = oGenerator.generate_key( m_pConstrains->GetKeyConstrains() ); //create the score EClef nClef = k_clef_G2; m_sAnswer = prepare_score(nClef, m_nKey, &m_pProblemScore); //compute the index for the button that corresponds to the right answer ComputeRightAnswerButtons(); //return string to introduce the problem return _("Press 'Play' to hear the problem again."); }