~ubuntu-branches/ubuntu/oneiric/denemo/oneiric

« back to all changes in this revision

Viewing changes to actions/menus/MainMenu/Educational/Note-Reading/ReadingNoteNamesSolfege

  • Committer: Bazaar Package Importer
  • Author(s): Alessio Treglia
  • Date: 2010-10-27 08:00:18 UTC
  • mfrom: (1.2.7 upstream) (3.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20101027080018-suwj9ozy99d0a5a2
Tags: 0.8.16-1ubuntu1
* Merge with Debian testing (LP: #638617), Ubuntu remaining changes:
  - debian/patches/ubuntuize.diff:
    + Provide a Ubuntu-specific customization.
  - debian/patches/fix_desktop.diff:
    + Add missing trailing semicolon.
    + Add MIME types.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0"?>
 
2
<Denemo>
 
3
  <merge>
 
4
    <title>A Denemo Keymap</title>
 
5
    <author>AT, JRR, RTS</author>
 
6
    <map>
 
7
      <row>
 
8
        <after/>
 
9
        <action>ReadingNoteNamesSolfege</action>
 
10
        <scheme>;;;;;;;;;;;;;;;
 
11
;;ReadingNoteNamesSolfege NEW VERSION
 
12
;; tests solfege note name recognition.
 
13
 
 
14
 
 
15
(define ReadingNoteNamesSolfege::score 0)
 
16
(define ReadingNoteNamesSolfege::interval 8)
 
17
(define ReadingNoteNamesSolfege::start (current-time))
 
18
(define ReadingNoteNamesSolfege::end (current-time))
 
19
(define ReadingNoteNamesSolfege::note_position 0)
 
20
(define ReadingNoteNamesSolfege::notewas #f)
 
21
(define ReadingNoteNamesSolfege::LastNoteCorrect? #t)
 
22
(define ReadingNoteNamesSolfege::ExtraChances 2)
 
23
 
 
24
(define (ReadingNoteNamesSolfege::showscore)
 
25
  (d-DirectivePut-score-display "ReadingNoteNamesSolfege::GameScore" (string-append "&lt;b&gt;Score: " (object-&gt;string ReadingNoteNamesSolfege::score) "&lt;/b&gt; in " (object-&gt;string (- ReadingNoteNamesSolfege::end ReadingNoteNamesSolfege::start)) " Secs.")))
 
26
 
 
27
;#t give differnt note
 
28
(define (ReadingNoteNamesSolfege::AnotherChance?)
 
29
  (and
 
30
    (not ReadingNoteNamesSolfege::LastNoteCorrect?)
 
31
    (>=  ReadingNoteNamesSolfege::ExtraChances 0)))
 
32
 
 
33
;;;;;;;;; callback when user chooses a note
 
34
(define (ReadingNoteNamesSolfege::notechosen usernote)
 
35
                      (begin
 
36
                        (set! ReadingNoteNamesSolfege::end (current-time))
 
37
                        ;(let gotoEnd () (if  (d-NextObject) (gotoEnd)))
 
38
                        (EducationGames::gotoEnd)
 
39
                        (if  (string=? ReadingNoteNamesSolfege::notewas usernote)
 
40
                             (begin
 
41
                               (set! ReadingNoteNamesSolfege::score (+ ReadingNoteNamesSolfege::score 1))
 
42
                               (set! ReadingNoteNamesSolfege::LastNoteCorrect? #t)
 
43
                               (EducationGames::PlaceAnswerStatus "CheckMark"))
 
44
                             (begin
 
45
                               (set! ReadingNoteNamesSolfege::score (- ReadingNoteNamesSolfege::score 1))
 
46
                               (set! ReadingNoteNamesSolfege::LastNoteCorrect? #f)
 
47
                               (set! ReadingNoteNamesSolfege::ExtraChances (- ReadingNoteNamesSolfege::ExtraChances 1))
 
48
                               (EducationGames::PlaceAnswerStatus "CrossSign"))
 
49
                               ) 
 
50
                        (ReadingNoteNamesSolfege::offerNote)))
 
51
 
 
52
 
 
53
(define (ReadingNoteNamesSolfege::print)
 
54
 (d-DeletePreviousObject)
 
55
 (SetHeaderField "title" "Note Naming Game")
 
56
 (SetHeaderField "subtitle" (string-append "Score was: "  (object-&gt;string ReadingNoteNamesSolfege::score) 
 
57
  " in "  (object-&gt;string (- ReadingNoteNamesSolfege::end ReadingNoteNamesSolfege::start)) " Seconds"))
 
58
 (SetHeaderField "piece" "user: anonymous")
 
59
 (DenemoPrintAllHeaders)
 
60
 (d-PrintPreview)
 
61
 (d-DirectiveDelete-header "Movement-title")
 
62
 (d-DirectiveDelete-header "Movement-subtitle")
 
63
 (d-DirectiveDelete-header "Movement-piece")
 
64
 (ReadingNoteNamesSolfege::offerNote)
 
65
 (d-SetSaved))
 
66
(define (ReadingNoteNamesSolfege::quit) 
 
67
  (d-Close))
 
68
(define (ReadingNoteNamesSolfege::help) 
 
69
  (d-InfoDialog "Click on the bottom of the range of notes you want to learn.
 
70
Use the Interval button to choose how many notes above that you want to try.
 
71
Print out your score when you have finished.")
 
72
)
 
73
 
 
74
(define (ReadingNoteNamesSolfege::plus)
 
75
  (set! ReadingNoteNamesSolfege::interval (+ ReadingNoteNamesSolfege::interval 1))
 
76
  (if (&gt; ReadingNoteNamesSolfege::interval 32)
 
77
      (set! ReadingNoteNamesSolfege::interval 32))
 
78
  (d-DirectivePut-score-display "ReadingNoteNamesSolfege::GameInterval"
 
79
                                (string-append "&lt;span font_desc=\"12\"&gt;Interval: " (object-&gt;string ReadingNoteNamesSolfege::interval) "&lt;/span&gt;")))
 
80
 
 
81
(define (ReadingNoteNamesSolfege::minus)
 
82
  (set! ReadingNoteNamesSolfege::interval (- ReadingNoteNamesSolfege::interval 1))
 
83
  (if (&lt; ReadingNoteNamesSolfege::interval 2)
 
84
      (set! ReadingNoteNamesSolfege::interval 2))
 
85
  (d-DirectivePut-score-display "ReadingNoteNamesSolfege::GameInterval"
 
86
                                (string-append "&lt;span font_desc=\"12\"&gt;Interval: " (object-&gt;string ReadingNoteNamesSolfege::interval) "&lt;/span&gt;")))
 
87
 
 
88
(define (ReadingNoteNamesSolfege::setInterval)
 
89
  (set! ReadingNoteNamesSolfege::interval (string-&gt;number (d-GetUserInput "Interval" "Give number of steps you want to name note over" (object-&gt;string ReadingNoteNamesSolfege::interval))))
 
90
  (if (boolean? ReadingNoteNamesSolfege::interval)
 
91
       (set! ReadingNoteNamesSolfege::interval 8))
 
92
  (if (&lt; ReadingNoteNamesSolfege::interval 2)
 
93
       (set! ReadingNoteNamesSolfege::interval 2))
 
94
  (if (&gt; ReadingNoteNamesSolfege::interval 32)
 
95
      (set! ReadingNoteNamesSolfege::interval 32))
 
96
  (d-DirectivePut-score-display "ReadingNoteNamesSolfege::GameInterval"
 
97
                                (string-append "&lt;span font_desc=\"12\"&gt;Interval: " (object-&gt;string ReadingNoteNamesSolfege::interval) "&lt;/span&gt;")))
 
98
 
 
99
 
 
100
;;;
 
101
(define (ReadingNoteNamesSolfege::go)
 
102
  (if (not (zero? ReadingNoteNamesSolfege::score))
 
103
      (let ((response #f))
 
104
        (set! response (d-GetUserInput "Reset Score" "Do you want to reset your score" "y"))
 
105
        (if (equal? response "y")
 
106
            (begin
 
107
              (set! ReadingNoteNamesSolfege::start (current-time))
 
108
              (set! ReadingNoteNamesSolfege::end (current-time))
 
109
 
 
110
              (set! ReadingNoteNamesSolfege::score 0)))))
 
111
  (d-DeletePreviousObject)
 
112
  (ReadingNoteNamesSolfege::offerNote))
 
113
 
 
114
 
 
115
 
 
116
;;;;;;;; the main function to run the test - just goes to end and places a note at a random height above the cursor, returning the cursor to where it was.
 
117
(define (ReadingNoteNamesSolfege::offerNote) 
 
118
    (if #t
 
119
        (let (    
 
120
              (usernote #t)
 
121
              (steps 0)
 
122
              
 
123
              )
 
124
        ;;  (d-GoToEnd)
 
125
          ;(let gotoEnd () (if  (d-NextObject) (gotoEnd)))
 
126
          (EducationGames::gotoEnd)
 
127
          (if (ReadingNoteNamesSolfege::AnotherChance?)
 
128
            (begin
 
129
              ;(d-CursorToNote (EducationalGames::middle_c_offset->lily ReadingNoteNamesSolfege::note_position))
 
130
              (d-Insert2))
 
131
            (begin
 
132
              (set! steps (+ 1 (random ReadingNoteNamesSolfege::interval)))      
 
133
              ;(EducationGames::shiftup steps)
 
134
              (set! ReadingNoteNamesSolfege::note_position (+ ReadingNoteNamesSolfege::note_position steps))
 
135
              (d-CursorToNote (EducationalGames::middle_c_offset->lily ReadingNoteNamesSolfege::note_position))
 
136
              (d-Insert2)
 
137
              (set! ReadingNoteNamesSolfege::ExtraChances 2)))
 
138
          (set! ReadingNoteNamesSolfege::notewas (d-GetNoteName))       
 
139
          (ReadingNoteNamesSolfege::showscore)
 
140
          ;(EducationGames::shiftdown steps)
 
141
          (if ReadingNoteNamesSolfege::LastNoteCorrect?
 
142
            (set! ReadingNoteNamesSolfege::note_position (- ReadingNoteNamesSolfege::note_position steps)))
 
143
          )
 
144
        ))
 
145
(EducationGames::Chime)
 
146
 
 
147
(d-New)
 
148
 
 
149
(CreateButton "ReadingNoteNamesSolfege::GameScore" "&lt;span font_desc=\"24\"&gt;Click to start&lt;/span&gt;")
 
150
(CreateButton "ReadingNoteNamesSolfege::GameHelp" "&lt;b&gt;Help&lt;/b&gt;")
 
151
(d-SetDirectiveTagActionScript "ReadingNoteNamesSolfege::GameHelp" "(ReadingNoteNamesSolfege::help)")
 
152
 
 
153
 
 
154
 
 
155
(CreateButton "ReadingNoteNamesSolfege::GamePlus" "&lt;b&gt;+&lt;/b&gt;")
 
156
(d-SetDirectiveTagActionScript "ReadingNoteNamesSolfege::GamePlus" "(ReadingNoteNamesSolfege::plus)")
 
157
(CreateButton "ReadingNoteNamesSolfege::GameInterval" (string-append "&lt;span font_desc=\"12\"&gt;Interval: " (object-&gt;string ReadingNoteNamesSolfege::interval) "&lt;/span&gt;"))
 
158
(d-SetDirectiveTagActionScript "ReadingNoteNamesSolfege::GameInterval" "(ReadingNoteNamesSolfege::setInterval)")
 
159
(CreateButton "ReadingNoteNamesSolfege::GameMinus" "&lt;b&gt;-&lt;/b&gt;")
 
160
(d-SetDirectiveTagActionScript "ReadingNoteNamesSolfege::GameMinus" "(ReadingNoteNamesSolfege::minus)")
 
161
 
 
162
 
 
163
 
 
164
 
 
165
(CreateButton "ReadingNoteNamesSolfege::GameGo" "&lt;span font_desc=\"24\"&gt;start&lt;/span&gt;")
 
166
(d-SetDirectiveTagActionScript "ReadingNoteNamesSolfege::GameGo" "(ReadingNoteNamesSolfege::go)")
 
167
(d-SetDirectiveTagActionScript "ReadingNoteNamesSolfege::GameScore" "(ReadingNoteNamesSolfege::go)")
 
168
 
 
169
 
 
170
(CreateButton "ReadingNoteNamesSolfege::GamePrint" "&lt;span font_desc=\"24\"&gt;Print&lt;/span&gt;")
 
171
(d-SetDirectiveTagActionScript "ReadingNoteNamesSolfege::GamePrint" "(ReadingNoteNamesSolfege::print)")
 
172
 
 
173
 
 
174
(CreateButton "ReadingNoteNamesSolfege::Close" "&lt;span font_desc=\"24\"&gt;Quit&lt;/span&gt;")
 
175
(d-SetDirectiveTagActionScript "ReadingNoteNamesSolfege::Close" "(ReadingNoteNamesSolfege::quit)")
 
176
 
 
177
 
 
178
 
 
179
 
 
180
(define (ReadingNoteNamesSolfege::createbuttons solfege note)
 
181
(CreateButton (string-append "ReadingNoteNamesSolfege::" solfege)  (string-append " &lt;span font_desc=\"24\" foreground=\"blue\"&gt;" solfege  "&lt;/span&gt;"))
 
182
  (d-SetDirectiveTagActionScript  (string-append "ReadingNoteNamesSolfege::" solfege) (string-append "(ReadingNoteNamesSolfege::notechosen \"" note "\")")))
 
183
 
 
184
 
 
185
(CreateButton "ReadingNoteNamesSolfege::spacer1" "&lt;span font_desc=\"28\"&gt;    &lt;/span&gt;")
 
186
(d-SetDirectiveTagActionScript "ReadingNoteNamesSolfege::spacer1" "(d-PlayMidiKey #xF03001)")
 
187
 
 
188
(ReadingNoteNamesSolfege::createbuttons "do" "c")
 
189
(ReadingNoteNamesSolfege::createbuttons "re" "d")
 
190
(ReadingNoteNamesSolfege::createbuttons "me" "e")
 
191
(ReadingNoteNamesSolfege::createbuttons "fa" "f")
 
192
(ReadingNoteNamesSolfege::createbuttons "so" "g")
 
193
(ReadingNoteNamesSolfege::createbuttons "la" "a")
 
194
(ReadingNoteNamesSolfege::createbuttons "si" "b")
 
195
 
 
196
(CreateButton "ReadingNoteNamesSolfege::spacer2" "&lt;span font_desc=\"28\"&gt;    &lt;/span&gt;")
 
197
(d-SetDirectiveTagActionScript "ReadingNoteNamesSolfege::spacer2" "(d-PlayMidiKey #xF03001)")
 
198
 
 
199
(EducationGames::Chime)
 
200
</scheme>
 
201
        <label>Solfege Note Name Recognition</label>
 
202
        <tooltip>%tests your ability to name the notes of the scale</tooltip>
 
203
      </row>
 
204
    </map>
 
205
  </merge>
 
206
</Denemo>