From 2e54889ba2dc91dc34c143150258f97521fe6fa6 Mon Sep 17 00:00:00 2001 From: Rob van Son Date: Tue, 5 Jan 2016 14:57:04 +0100 Subject: [PATCH] Adaptations for displaying grades, plus read correct wordlist --- InitialiseSGC2.praat | 30 +++++++++++++++++++++++++++++- MainPage.praat | 31 +++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 1 deletion(-) diff --git a/InitialiseSGC2.praat b/InitialiseSGC2.praat index 180edef..4871f3c 100644 --- a/InitialiseSGC2.praat +++ b/InitialiseSGC2.praat @@ -245,6 +245,8 @@ procedure init_window # See feedback on earl;ier recorded words if fileReadable("'sgc.saveAudio$'/TestSpeakGoodChinese2.txt") call write_feedback Feedback + else + call write_grade 'sgc.pinyin$' endif select Table Feedback Remove @@ -615,7 +617,14 @@ procedure initialize_toneevaluation_tables # Performance table has been read. Set the wordlist to the first row select sgc2.performanceTable - wordlistName$ = Get value: 1, eval.wordlist$ + .numWords = Get number of rows + .row = 1 + wordlistName$ = "" + while .row <= .numWords and wordlistName$ = "" + wordlistName$ = Get value: .row, eval.wordlist$ + .row += 1 + endwhile + call load_word_list: localWordlistDir$, 0 else # Create new table @@ -757,6 +766,25 @@ procedure setGrade .grade$ endif endproc +procedure getGrade .pinyin$ + .grade = -1 + if .pinyin$ <> "" + call get_toneevaluation_row '.pinyin$' + .row = get_toneevaluation_row.row + + select sgc2.performanceTable + .col = Get column index... Grade + if .col <= 0 + Insert column... 2 Grade + else + .grade = Get value: .row, "Grade" + if .grade = undefined + .grade = -1 + endif + endif + endif +endproc + # Set mainPage.saveAudio$ to Grade procedure set_grade_display .pinyin$ mainPage.saveAudio$ = "" diff --git a/MainPage.praat b/MainPage.praat index ce19e4b..2c0b1ca 100644 --- a/MainPage.praat +++ b/MainPage.praat @@ -1080,6 +1080,37 @@ procedure write_feedback .table$ call set_font_size 'defaultFontSize' endproc +procedure write_grade .pinyin$ + if sgc2.performanceTable > 0 and .pinyin$ <> "" + select sgc2.performanceTable + call getGrade '.pinyin$' + if getGrade.grade > 0 + .line1$ = "'getGrade.grade'" + .line2$ = "" + + .color$ = "Blue" + if getGrade.grade <= 3 + .color$ = "Red" + elsif getGrade.grade >= 7 + .color$ = "Green" + endif + + .currentFeedbackFontSize = 40 + .maxHeight = 2* (21 - 17) + call adjustFontSizeOnHeight 'defaultFont$' '.currentFeedbackFontSize' '.maxHeight' + .currentFeedbackFontSize = adjustFontSizeOnHeight.newFontSize + + call wipeArea 'wipeFeedbackArea$' + call set_font_size '.currentFeedbackFontSize' + demo '.color$' + demo Text... 50 Centre 17 Bottom '.line1$' + demoShow() + demo 'defaultFont$' + call set_font_size 'defaultFontSize' + endif + endif +endproc + # Text display procedure display_text .color$ select sgc.currentWordlist -- 2.11.4.GIT