diff --git a/README.md b/README.md
index 7ae32456d..b2706b09c 100644
--- a/README.md
+++ b/README.md
@@ -3,7 +3,7 @@
# **RoboTutor**
-Welcome to RoboTutor:
+Welcome to RoboTutor:
## **Setup and Configuration:**
@@ -12,7 +12,7 @@ Welcome to RoboTutor:
[Install GitHub Desktop](https://desktop.github.com/)
-RoboTutor uses a large volume of external assets at runtime. To successfully run RoboTutor you must first install these assets on your target device. The [RTAsset_Publisher](https://github.com/synaptek/RTAsset_Publisher) is the tool you can use to push the Rt assets to your device. Once you have cloned and run the associated tools to push the data assets to your device you can proceed with building RoboTutor.
+RoboTutor uses a large volume of external assets at runtime. To successfully run RoboTutor you must first install these assets on your target device. The [RTAsset_Publisher](https://github.com/RoboTutorLLC/RTAsset_Publisher) is the tool you can use to push the Rt assets to your device. Once you have cloned and run the associated tools to push the data assets to your device you can proceed with building RoboTutor.
## **Building RoboTutor:**
@@ -21,12 +21,12 @@ RoboTutor uses a large volume of external assets at runtime. To successfully ru
2. **Import** the RoboTutor project into Android Studio.
-3. You may need to install different versions of the build tools and android SDKs.
-
-4. There are a number of build variants you can select to generate versions that support static language selections and also vesions that permit dynamic language selection at runtime. In order to generate any flavor that depends on the key signature, you must generate your own keystore (see next steps). Note that the version used in the XPrize code drop 1 submission usees flavor *release_sw*, which depends on a signed APK.
-
-
-5. If you do not already have one, follow the steps [here](https://stackoverflow.com/questions/3997748/how-can-i-create-a-keystore) to generate a keystore.
+3. You may need to install different versions of the build tools and android SDKs.
+
+4. There are a number of build variants you can select to generate versions that support static language selections and also vesions that permit dynamic language selection at runtime. In order to generate any flavor that depends on the key signature, you must generate your own keystore (see next steps). Note that the version used in the XPrize code drop 1 submission usees flavor *release_sw*, which depends on a signed APK.
+
+
+5. If you do not already have one, follow the steps [here](https://stackoverflow.com/questions/3997748/how-can-i-create-a-keystore) to generate a keystore.
6. Add a file named "keystore.properties" to your root project directory, and give it the following contents. The values should be based on the values you used to generate the keystore.
```
@@ -35,7 +35,7 @@ keyPassword=
keyAlias=
storeFile=
```
-
+
7. Use Android Studio or gradlew to generate a signed APK with the flavor *release_sw*. This will generate the file *robotutor.release_sw.1.8.8.1.apk*. This APK should be transferred to the apk in your local SystemBuild directory.
@@ -45,12 +45,12 @@ storeFile=
## **XPrize Submission:**
The following repositories are part of the Team-RoboTutor entry:
- * XPRIZE/GLEXP-Team-RoboTutor-RoboTutor
+ * XPRIZE/GLEXP-Team-RoboTutor-RoboTutor
* XPRIZE/GLEXP-Team-RoboTutor-SystemBuild
* XPRIZE/GLEXP-Team-RoboTutor-RTAsset_Publisher
* XPRIZE/GLEXP-Team-RoboTutor-CodeDrop1-Assets
- * XPRIZE/GLEXP-Team-RoboTutor-RoboLauncher
- * XPRIZE/GLEXP-Team-RoboTutor-RoboTransfer
+ * XPRIZE/GLEXP-Team-RoboTutor-RoboLauncher
+ * XPRIZE/GLEXP-Team-RoboTutor-RoboTransfer
diff --git a/app/src/main/assets/tutors/bubble_pop/animator_graph.json b/app/src/main/assets/tutors/bubble_pop/animator_graph.json
index 460764a5d..9ffa6e1a2 100644
--- a/app/src/main/assets/tutors/bubble_pop/animator_graph.json
+++ b/app/src/main/assets/tutors/bubble_pop/animator_graph.json
@@ -10,6 +10,54 @@
"version": "1.0.0",
"rootnode": "INTRO_STATE",
+ "queueMap": {
+
+ "SPAWN_BUBBLE_BEHAVIOR": {
+ "type": "QUEUE",
+ "COMMENT": "Display and speak the current bubble.",
+ "preenter": [],
+ "reuse": true,
+ "tracks": [
+ {"name": "LOG_EVENT", "type": "QUEUEDCOMMAND", "id": "SBubblePop", "method": "logState", "parms": "type#prompt,value#SPAWN_BUBBLE_BEHAVIOR:String", "features": ""},
+
+ {"type": "QUEUEDCOMMAND", "id": "SBubblePop", "method": "postEvent", "parms": "SPAWN_BUBBLE:String", "features": "FTR_SAY_TARGET"},
+ {"type": "QUEUEDCOMMAND", "id": "SBubblePop", "method": "postEvent", "parms": "SPAWN_BUBBLE:String|{{SBubblePop.spawnDelay}}:Integer", "features": "!FTR_SAY_TARGET"},
+
+ {"type": "QUEUEDAUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueHundreds}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "FTR_SAY_TARGET&FTR_MIS_NUM&FTR_ANS_HUNDREDS"},
+ {"type": "QUEUEDAUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage": "xprize", "volume": 1.0, "mode": "flow", "features": "FTR_SAY_TARGET&FTR_MIS_NUM&FTR_ANS_HUNDREDS&FTR_ANS_TENS"},
+ {"type": "QUEUEDAUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueTens}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "FTR_SAY_TARGET&FTR_MIS_NUM&FTR_ANS_TENS"},
+ {"type": "QUEUEDAUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueHundreds}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "FTR_SAY_TARGET&FTR_GT_LT&FTR_ANS_HUNDREDS"},
+ {"type": "QUEUEDAUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage": "xprize", "volume": 1.0, "mode": "flow", "features": "FTR_SAY_TARGET&FTR_GT_LT&FTR_ANS_HUNDREDS&FTR_ANS_TENS"},
+ {"type": "QUEUEDAUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueTens}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "FTR_SAY_TARGET&FTR_GT_LT&FTR_ANS_TENS"},
+ {"type": "QUEUEDAUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValue}}.mp3", "soundpackage": "words", "volume": 1.0, "mode": "flow", "features": "FTR_SAY_TARGET&FTR_WORDS"},
+ {"type": "QUEUEDAUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueHundreds}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "FTR_SAY_TARGET&FTR_NUMBERS&FTR_ANS_HUNDREDS"},
+ {"type": "QUEUEDAUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage": "xprize", "volume": 1.0, "mode": "flow", "features": "FTR_SAY_TARGET&FTR_NUMBERS&FTR_ANS_HUNDREDS&FTR_ANS_TENS"},
+ {"type": "QUEUEDAUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueTens}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "FTR_SAY_TARGET&FTR_NUMBERS&FTR_ANS_TENS"},
+ {"type": "QUEUEDAUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueHundreds}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "FTR_SAY_TARGET&FTR_E2N&FTR_ANS_HUNDREDS"},
+ {"type": "QUEUEDAUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage": "xprize", "volume": 1.0, "mode": "flow", "features": "FTR_SAY_TARGET&FTR_E2N&FTR_ANS_HUNDREDS&FTR_ANS_TENS"},
+ {"type": "QUEUEDAUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueTens}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "FTR_SAY_TARGET&FTR_E2N&FTR_ANS_TENS"},
+ {"type": "QUEUEDAUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueStimOneHundreds}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "FTR_SAY_TARGET&FTR_N2E&FTR_ANS_STIM_ONE_HUNDREDS"},
+ {"type": "QUEUEDAUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "FTR_SAY_TARGET&FTR_N2E&FTR_ANS_STIM_ONE_HUNDREDS"},
+ {"type": "QUEUEDAUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueStimOneTens}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "FTR_SAY_TARGET&FTR_N2E&FTR_ANS_STIM_ONE_TENS"},
+ {"type": "QUEUEDAUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage": "xprize", "volume": 1.0, "mode": "flow", "features": "FTR_SAY_TARGET&FTR_N2E&FTR_ANS_STIM_ONE_TENS"},
+ {"type": "QUEUEDAUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueStimOneOnes}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "FTR_SAY_TARGET&FTR_N2E&FTR_ANS_STIM_ONE_ONES"},
+ {"type": "QUEUEDAUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueOperand}}.mp3", "soundpackage": "xprize", "volume": 1.0, "mode": "flow", "features": "FTR_SAY_TARGET&FTR_N2E"},
+ {"type": "QUEUEDAUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueStimTwoHundreds}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "FTR_SAY_TARGET&FTR_N2E&FTR_ANS_STIM_TWO_HUNDREDS"},
+ {"type": "QUEUEDAUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage": "xprize", "volume": 1.0, "mode": "flow", "features": "FTR_SAY_TARGET&FTR_N2E&FTR_ANS_STIM_TWO_HUNDREDS"},
+ {"type": "QUEUEDAUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueStimTwoTens}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "FTR_SAY_TARGET&FTR_N2E&FTR_ANS_STIM_TWO_TENS"},
+ {"type": "QUEUEDAUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage": "xprize", "volume": 1.0, "mode": "flow", "features": "FTR_SAY_TARGET&FTR_N2E&FTR_ANS_STIM_TWO_TENS"},
+ {"type": "QUEUEDAUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueStimTwoOnes}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "FTR_SAY_TARGET&FTR_N2E&FTR_ANS_STIM_TWO_ONES"},
+ {"type": "QUEUEDAUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValue}}.mp3", "soundpackage": "letters", "volume": 1.0, "mode": "flow", "features": "FTR_SAY_TARGET&FTR_LETTERS"},
+ {"type": "QUEUEDAUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValue}}.mp3", "soundpackage": "shapes", "volume": 1.0, "mode": "flow", "features": "FTR_SAY_TARGET&FTR_SHAPES"},
+
+ {"type": "QUEUEDCOMMAND", "id": "SBubblePop", "method": "postEvent", "parms": "NEXT_BUBBLE:String", "features": "FTR_SAY_TARGET"},
+ {"type": "QUEUEDCOMMAND", "id": "SBubblePop", "method": "postEvent", "parms": "NEXT_BUBBLE:String|{{SBubblePop.spawnDelay}}:Integer", "features": "!FTR_SAY_TARGET"}
+ ],
+ "preexit": [],
+ "edges": []
+ }
+ },
+
"nodeMap": {
"COMMENT": "@@@@@ CNodes @@@@@",
@@ -17,134 +65,111 @@
"INTRO_STATE": {
"type": "NODE",
"COMMENT": "Intro Clip - we only ever visit this node once",
- "maptype":"moduleMap",
+ "maptype": "moduleMap",
"mapname": "INTROSTATE",
- "preenter": ["SET_VERSION","SET_DATASOURCE", "SET_SOUND_TRACK"],
+ "preenter": ["SET_VERSION", "SET_DATASOURCE", "SET_SOUND_TRACK"],
"preexit": [],
"edges": [
- {
- "constraint": "",
- "edge": "UPDATE_STIMULUS"
- }
+ {"constraint": "", "edge": "UPDATE_STIMULUS"}
]
},
"UPDATE_STIMULUS": {
"type": "NODE",
"COMMENT": "We may say or show the stimulus at this point",
- "maptype":"moduleMap",
+ "maptype": "moduleMap",
"mapname": "UPDATESTIMULUS",
"preenter": ["NEXT_DATASET"],
"preexit": [],
"edges": [
- {
- "constraint": "",
- "edge": "USER_INPUT"
- }
+ {"constraint": "", "edge": "SHOW_TARGETS"}
]
},
+ "SHOW_TARGETS": {
+ "type": "NODE",
+ "COMMENT": "We may say or show the targets at this point",
+ "maptype": "moduleMap",
+ "mapname": "SHOWTARGETS",
+ "preenter": ["SET_SPAWN_BUBBLE_BEHAVIOR"],
+ "preexit": [],
+ "edges": [
+ {"constraint": "", "edge": "USER_INPUT"}
+ ]
+ },
"USER_INPUT": {
"type": "NODE",
"COMMENT": "When module is complete - move to next scene in the scenegraph",
- "maptype":"moduleMap",
+ "maptype": "moduleMap",
"mapname": "USERINPUT",
- "preenter": [],
- "preexit": [],
+ "preenter": ["SET_HESITATION_TIMER"],
+ "preexit": ["CANCEL_HESITATION_TIMER"],
"edges": [
- {
- "constraint":"FTR_RIGHT",
- "edge": "PLAY_CORRECT"
- },
- {
- "constraint": "",
- "edge": "PLAY_WRONG"
- }
+ {"constraint": "FTR_RIGHT", "edge": "PLAY_CORRECT"},
+ {"constraint": "", "edge": "PLAY_WRONG"}
]
},
"PLAY_CORRECT": {
"type": "NODE",
"COMMENT": "When module is complete - move to next scene in the scenegraph",
- "maptype":"moduleMap",
+ "maptype": "moduleMap",
"mapname": "PLAYCORRECT",
"preenter": [],
"preexit": [],
"edges": [
- {
- "constraint": "FTR_EOD",
- "edge": "FINAL_SCORE"
- },
- {
- "constraint": "",
- "edge": "UPDATE_STIMULUS"
- }
+ {"constraint": "FTR_EOD", "edge": "FINAL_SCORE"},
+ {"constraint": "", "edge": "UPDATE_STIMULUS"}
]
},
"PLAY_WRONG": {
"type": "NODE",
"COMMENT": "When module is complete - move to next scene in the scenegraph",
- "maptype":"moduleMap",
+ "maptype": "moduleMap",
"mapname": "PLAYWRONG_PAUSE",
"preenter": [],
"preexit": [],
"edges": [
- {
- "constraint": "FTR_LASTATTEMPT",
- "edge": "CHECK_EOD"
- },
- {
- "constraint": "",
- "edge": "USER_INPUT"
- }
+ {"constraint": "FTR_LASTATTEMPT", "edge": "CHECK_EOD"},
+ {"constraint": "", "edge": "USER_INPUT"}
]
},
"CHECK_EOD" : {
"type": "NODE",
"COMMENT": "When they've made last attempt and still wrong - check if EOD",
- "maptype":"moduleMap",
+ "maptype": "moduleMap",
"mapname": "EMPTYMODULE",
"preenter": [],
- "preexit": [],
+ "preexit": ["CLEAR_SPAWN_BUBBLE_BEHAVIOR"],
"edges": [
- {
- "constraint": "FTR_EOD",
- "edge": "FINAL_SCORE"
- },
- {
- "constraint": "",
- "edge": "UPDATE_STIMULUS"
- }
+ {"constraint": "FTR_EOD", "edge": "FINAL_SCORE"},
+ {"constraint": "", "edge": "UPDATE_STIMULUS"}
]
},
"FINAL_SCORE": {
"type": "NODE",
"COMMENT": "When module is complete - move to next scene in the scenegraph",
- "maptype":"moduleMap",
+ "maptype": "moduleMap",
"mapname": "FINALSCORE",
"preenter": [],
"preexit": [],
"edges": [
- {
- "constraint": "",
- "edge": "NEXT_SCENE"
- }
+ {"constraint": "", "edge": "NEXT_SCENE"}
]
},
"NEXT_SCENE": {
"type": "NODE",
"COMMENT": "When module is complete - move to next scene in the scenegraph",
- "maptype":"actionMap",
+ "maptype": "actionMap",
"mapname": "NEXTSCENE",
"preenter": [],
"preexit": [],
- "edges": [
- ]
+ "edges": []
}
},
@@ -154,13 +179,13 @@
"INTROSTATE": {
"type": "MODULE",
- "reuse":true,
+ "reuse": true,
"COMMENT": "????",
"tracks": [
- {"name": "LOG_EVENT", "type": "QUEUEDCOMMAND", "id": "SBubblePop", "method": "logState", "parms": "type#node,value#INTROSTATE:String", "features":""},
+ {"name": "LOG_EVENT", "type": "QUEUEDCOMMAND", "id": "SBubblePop", "method": "logState", "parms": "type#node,value#INTROSTATE:String", "features": ""},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.sound_track}}", "soundpackage":"tutor_effect", "repeat":true, "volume": 0.10, "mode":"event", "features": ""},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "Please tap on it.mp3", "soundpackage":"default", "volume": 0.7, "mode":"flow", "features": ""}
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.sound_track}}", "soundpackage": "tutor_effect", "repeat":true, "volume": 0.10, "mode": "event", "features": ""},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "Please tap on it.mp3", "soundpackage": "default", "volume": 0.7, "mode": "flow", "features": ""}
]
},
@@ -169,43 +194,49 @@
"UPDATESTIMULUS": {
"type": "MODULE",
- "reuse":true,
+ "reuse": true,
"tracks": [
- {"name": "LOG_EVENT", "type": "QUEUEDCOMMAND", "id": "SBubblePop", "method": "logState", "parms": "type#node,value#UPDATESTIMULUS:String", "features":""},
-
- {"type": "COMMAND", "id": "SBubblePop", "method": "postEvent", "parms": "SHOW_STIMULUS:String" , "features":"FTR_SHOW"},
-
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValue}}.mp3", "soundpackage":"missing_number", "volume": 1.0, "mode":"event", "features": "FTR_SAY&FTR_MIS_NUM"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValue}}.mp3", "soundpackage":"missing_number", "volume": 1.0, "mode":"event", "features": "FTR_SAY&FTR_GT_LT"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "Neno gani huanza na.mp3", "soundpackage":"xprize", "volume": 1.0, "mode":"flow", "features": "FTR_SAY&FTR_WORDS&FTR_WORD_STARTS_WITH"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "Neno gani kuishia na.mp3", "soundpackage":"xprize", "volume": 1.0, "mode":"flow", "features": "FTR_SAY&FTR_WORDS&FTR_WORD_ENDS_WITH"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValue}}.mp3", "soundpackage":"words", "volume": 1.0, "mode":"flow", "features": "FTR_SAY&FTR_WORDS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValueHundreds}}.mp3", "soundpackage":"numbers", "volume": 1.0, "mode":"flow", "features": "FTR_SAY&FTR_NUMBERS&FTR_QUEST_HUNDREDS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage":"xprize", "volume": 1.0, "mode":"flow", "features": "FTR_SAY&FTR_NUMBERS&FTR_QUEST_HUNDREDS&FTR_QUEST_TENS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValueTens}}.mp3", "soundpackage":"numbers", "volume": 1.0, "mode":"flow", "features": "FTR_SAY&FTR_NUMBERS&FTR_QUEST_TENS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValue}}.mp3", "soundpackage":"letters", "volume": 1.0, "mode":"event", "features": "FTR_SAY&FTR_LETTERS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValue}}.mp3", "soundpackage":"shapes", "volume": 1.0, "mode":"event", "features": "FTR_SAY&FTR_SHAPES"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValueStimOneHundreds}}.mp3", "soundpackage":"numbers", "volume": 1.0, "mode":"flow", "features": "FTR_SAY&FTR_E2N&FTR_QUEST_STIM_ONE_HUNDREDS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage":"xprize", "volume": 1.0, "mode":"flow", "features": "FTR_SAY&FTR_E2N&FTR_QUEST_STIM_ONE_HUNDREDS&FTR_QUEST_STIM_ONE_TENS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValueStimOneTens}}.mp3", "soundpackage":"numbers", "volume": 1.0, "mode":"flow", "features": "FTR_SAY&FTR_E2N&FTR_QUEST_STIM_ONE_TENS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValueOperand}}.mp3", "soundpackage":"xprize", "volume": 1.0, "mode":"flow", "features": "FTR_SAY&FTR_E2N"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValueStimTwoHundreds}}.mp3", "soundpackage":"numbers", "volume": 1.0, "mode":"flow", "features": "FTR_SAY&FTR_E2N&FTR_QUEST_STIM_TWO_HUNDREDS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage":"xprize", "volume": 1.0, "mode":"flow", "features": "FTR_SAY&FTR_E2N&FTR_QUEST_STIM_TWO_HUNDREDS&FTR_QUEST_STIM_TWO_TENS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValueStimTwoTens}}.mp3", "soundpackage":"numbers", "volume": 1.0, "mode":"flow", "features": "FTR_SAY&FTR_E2N&FTR_QUEST_STIM_TWO_TENS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValueHundreds}}.mp3", "soundpackage":"numbers", "volume": 1.0, "mode":"flow", "features": "FTR_SAY&FTR_N2E&FTR_QUEST_HUNDREDS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage":"xprize", "volume": 1.0, "mode":"flow", "features": "FTR_SAY&FTR_N2E&FTR_QUEST_HUNDREDS&FTR_QUEST_TENS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValueTens}}.mp3", "soundpackage":"numbers", "volume": 1.0, "mode":"flow", "features": "FTR_SAY&FTR_N2E&FTR_QUEST_TENS"},
-
-
- //{"type": "COMMAND", "id": "SBubblePop", "method": "setVolatileBehavior", "parms": "STIMULUS_SHOWN:String|NEXTNODE:String" , "features":"FTR_SHOW&!(FTR_SAY&(FTR_E2N|FTR_WORD_STARTS_WITH|FTR_WORD_ENDS_WITH|FTR_GT_LT|FTR_QUEST_HUNDREDS|FTR_WORDS))"},
+ {"name": "LOG_EVENT", "type": "QUEUEDCOMMAND", "id": "SBubblePop", "method": "logState", "parms": "type#node,value#UPDATESTIMULUS:String", "features": ""},
+
+ {"type": "COMMAND", "id": "SBubblePop", "method": "postEvent", "parms": "SHOW_STIMULUS:String", "features": "FTR_SHOW_STIMULUS"},
+
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValue}}.mp3", "soundpackage": "missing_number", "volume": 1.0, "mode": "event", "features": "FTR_SAY_STIMULUS&FTR_MIS_NUM"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValue}}.mp3", "soundpackage": "missing_number", "volume": 1.0, "mode": "event", "features": "FTR_SAY_STIMULUS&FTR_GT_LT"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "Neno gani huanza na.mp3", "soundpackage": "xprize", "volume": 1.0, "mode": "flow", "features": "FTR_SAY_STIMULUS&FTR_WORDS&FTR_WORD_STARTS_WITH"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "Neno gani kuishia na.mp3", "soundpackage": "xprize", "volume": 1.0, "mode": "flow", "features": "FTR_SAY_STIMULUS&FTR_WORDS&FTR_WORD_ENDS_WITH"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValue}}.mp3", "soundpackage": "words", "volume": 1.0, "mode": "flow", "features": "FTR_SAY_STIMULUS&FTR_WORDS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValueHundreds}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "FTR_SAY_STIMULUS&FTR_NUMBERS&FTR_QUEST_HUNDREDS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage": "xprize", "volume": 1.0, "mode": "flow", "features": "FTR_SAY_STIMULUS&FTR_NUMBERS&FTR_QUEST_HUNDREDS&FTR_QUEST_TENS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValueTens}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "FTR_SAY_STIMULUS&FTR_NUMBERS&FTR_QUEST_TENS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValue}}.mp3", "soundpackage": "letters", "volume": 1.0, "mode": "event", "features": "FTR_SAY_STIMULUS&FTR_LETTERS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValue}}.mp3", "soundpackage": "shapes", "volume": 1.0, "mode": "event", "features": "FTR_SAY_STIMULUS&FTR_SHAPES"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValueStimOneHundreds}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "FTR_SAY_STIMULUS&FTR_E2N&FTR_QUEST_STIM_ONE_HUNDREDS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage": "xprize", "volume": 1.0, "mode": "flow", "features": "FTR_SAY_STIMULUS&FTR_E2N&FTR_QUEST_STIM_ONE_HUNDREDS&FTR_QUEST_STIM_ONE_TENS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValueStimOneTens}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "FTR_SAY_STIMULUS&FTR_E2N&FTR_QUEST_STIM_ONE_TENS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValueOperand}}.mp3", "soundpackage": "xprize", "volume": 1.0, "mode": "flow", "features": "FTR_SAY_STIMULUS&FTR_E2N"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValueStimTwoHundreds}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "FTR_SAY_STIMULUS&FTR_E2N&FTR_QUEST_STIM_TWO_HUNDREDS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage": "xprize", "volume": 1.0, "mode": "flow", "features": "FTR_SAY_STIMULUS&FTR_E2N&FTR_QUEST_STIM_TWO_HUNDREDS&FTR_QUEST_STIM_TWO_TENS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValueStimTwoTens}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "FTR_SAY_STIMULUS&FTR_E2N&FTR_QUEST_STIM_TWO_TENS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValueHundreds}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "FTR_SAY_STIMULUS&FTR_N2E&FTR_QUEST_HUNDREDS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage": "xprize", "volume": 1.0, "mode": "flow", "features": "FTR_SAY_STIMULUS&FTR_N2E&FTR_QUEST_HUNDREDS&FTR_QUEST_TENS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValueTens}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "FTR_SAY_STIMULUS&FTR_N2E&FTR_QUEST_TENS"}
+
+ //{"type": "COMMAND", "id": "SBubblePop", "method": "setVolatileBehavior", "parms": "STIMULUS_SHOWN:String|NEXTNODE:String", "features": "FTR_SHOW_STIMULUS&!(FTR_SAY_STIMULUS&(FTR_E2N|FTR_WORD_STARTS_WITH|FTR_WORD_ENDS_WITH|FTR_GT_LT))"},
//If we are showing it we have to wait for the animation to complete before continuing
//Only wait for non expression or short numbers (without hundreds) which are spoken
- // {"type": "COMMAND", "id": "SBubblePop", "method": "setVolatileBehavior", "parms": "STIMULUS_SHOWN:String|NEXTNODE:String" , "features":"FTR_SHOW&FTR_SAY&FTR_LETTERS"},
-
+ //{"type": "COMMAND", "id": "SBubblePop", "method": "setVolatileBehavior", "parms": "STIMULUS_SHOWN:String|NEXTNODE:String", "features": "FTR_SHOW_STIMULUS&FTR_SAY_STIMULUS&FTR_LETTERS"},
+ ]
+ },
- {"type": "COMMAND", "id": "SBubblePop", "method": "postEvent", "parms": "SHOW_BUBBLES:String" ,"features":""}
+ "SHOWTARGETS": {
+ "type": "MODULE",
+ "reuse":true,
+ "COMMENT": "????",
+ "tracks": [
+ {"name": "LOG_EVENT", "type": "QUEUEDCOMMAND", "id": "SBubblePop", "method": "logState", "parms": "type#node,value#SHOWTARGETS:String", "features": ""},
+ {"type": "COMMAND", "id": "SBubblePop", "method": "postEvent", "parms": "SHOW_BUBBLES:String", "features": ""}
]
},
@@ -214,170 +245,167 @@
"reuse":true,
"COMMENT": "????",
"tracks": [
- {"name": "LOG_EVENT", "type": "QUEUEDCOMMAND", "id": "SBubblePop", "method": "logState", "parms": "type#node,value#USERINPUT:String", "features":""},
+ {"name": "LOG_EVENT", "type": "QUEUEDCOMMAND", "id": "SBubblePop", "method": "logState", "parms": "type#node,value#USERINPUT:String", "features": ""},
- {"type": "COMMAND", "id": "SBubblePop", "method": "enableTouchEvents", "parms": "" ,"features":""},
- {"type": "COMMAND", "id": "SBubblePop", "method": "setVolatileBehavior", "parms": "BUBBLE_TOUCH_EVENT:String|NEXTNODE:String" ,"features":""},
- {"type": "COMMAND", "cmd": "WAIT" }
+ {"type": "COMMAND", "id": "SBubblePop", "method": "enableTouchEvents", "parms": "", "features": ""},
+ {"type": "COMMAND", "id": "SBubblePop", "method": "setVolatileBehavior", "parms": "BUBBLE_TOUCH_EVENT:String|NEXTNODE:String", "features": ""},
+ {"type": "COMMAND", "cmd": "WAIT"}
]
},
-
"PLAYCORRECT": {
"type": "MODULE",
"reuse":true,
"COMMENT": "????",
"tracks": [
- {"name": "LOG_EVENT", "type": "QUEUEDCOMMAND", "id": "SBubblePop", "method": "logState", "parms": "type#node,value#PLAYCORRECT:String", "features":""},
-
- {"type": "AUDIO", "command": "PLAY", "soundsource": "popSound.mp3", "soundpackage":"tutor_effect", "volume": 0.20, "mode":"event", "features": ""},
- {"type": "COMMAND", "id": "SBubblePop", "method": "setVolatileBehavior", "parms": "BUBBLE_POPPED:String|NEXTNODE:String" ,"features":""},
- {"type": "COMMAND", "id": "SBubblePop", "method": "postEvent", "parms": "POP_BUBBLE:String" ,"features":""},
- {"type": "COMMAND", "cmd": "WAIT" },
-
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueHundreds}}.mp3", "soundpackage":"numbers", "volume": 1.0, "mode":"flow", "features": "FTR_MIS_NUM&FTR_ANS_HUNDREDS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage":"xprize", "volume": 1.0, "mode":"flow", "features": "FTR_MIS_NUM&FTR_ANS_HUNDREDS&FTR_ANS_TENS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueTens}}.mp3", "soundpackage":"numbers", "volume": 1.0, "mode":"flow", "features": "FTR_MIS_NUM&FTR_ANS_TENS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueHundreds}}.mp3", "soundpackage":"numbers", "volume": 1.0, "mode":"flow", "features": "FTR_GT_LT&FTR_ANS_HUNDREDS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage":"xprize", "volume": 1.0, "mode":"flow", "features": "FTR_GT_LT&FTR_ANS_HUNDREDS&FTR_ANS_TENS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueTens}}.mp3", "soundpackage":"numbers", "volume": 1.0, "mode":"flow", "features": "FTR_GT_LT&FTR_ANS_TENS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValue}}.mp3", "soundpackage":"words", "volume": 1.0, "mode":"event", "features": "FTR_WORDS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueHundreds}}.mp3", "soundpackage":"numbers", "volume": 1.0, "mode":"flow", "features": "FTR_NUMBERS&FTR_ANS_HUNDREDS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage":"xprize", "volume": 1.0, "mode":"flow", "features": "FTR_NUMBERS&FTR_ANS_HUNDREDS&FTR_ANS_TENS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueTens}}.mp3", "soundpackage":"numbers", "volume": 1.0, "mode":"flow", "features": "FTR_NUMBERS&FTR_ANS_TENS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueHundreds}}.mp3", "soundpackage":"numbers", "volume": 1.0, "mode":"flow", "features": "FTR_E2N&FTR_ANS_HUNDREDS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage":"xprize", "volume": 1.0, "mode":"flow", "features": "FTR_E2N&FTR_ANS_HUNDREDS&FTR_ANS_TENS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueTens}}.mp3", "soundpackage":"numbers", "volume": 1.0, "mode":"flow", "features": "FTR_E2N&FTR_ANS_TENS"},
+ {"name": "LOG_EVENT", "type": "QUEUEDCOMMAND", "id": "SBubblePop", "method": "logState", "parms": "type#node,value#PLAYCORRECT:String", "features": ""},
+
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "popSound.mp3", "soundpackage": "tutor_effect", "volume": 0.20, "mode": "event", "features": ""},
+ {"type": "COMMAND", "id": "SBubblePop", "method": "setVolatileBehavior", "parms": "BUBBLE_POPPED:String|NEXTNODE:String", "features": ""},
+ {"type": "COMMAND", "id": "SBubblePop", "method": "postEvent", "parms": "POP_BUBBLE:String", "features": ""},
+ {"type": "COMMAND", "cmd": "WAIT"},
+
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueHundreds}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "FTR_MIS_NUM&FTR_ANS_HUNDREDS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage": "xprize", "volume": 1.0, "mode": "flow", "features": "FTR_MIS_NUM&FTR_ANS_HUNDREDS&FTR_ANS_TENS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueTens}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "FTR_MIS_NUM&FTR_ANS_TENS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueHundreds}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "FTR_GT_LT&FTR_ANS_HUNDREDS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage": "xprize", "volume": 1.0, "mode": "flow", "features": "FTR_GT_LT&FTR_ANS_HUNDREDS&FTR_ANS_TENS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueTens}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "FTR_GT_LT&FTR_ANS_TENS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValue}}.mp3", "soundpackage": "words", "volume": 1.0, "mode": "event", "features": "FTR_WORDS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueHundreds}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "FTR_NUMBERS&FTR_ANS_HUNDREDS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage": "xprize", "volume": 1.0, "mode": "flow", "features": "FTR_NUMBERS&FTR_ANS_HUNDREDS&FTR_ANS_TENS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueTens}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "FTR_NUMBERS&FTR_ANS_TENS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueHundreds}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "FTR_E2N&FTR_ANS_HUNDREDS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage": "xprize", "volume": 1.0, "mode": "flow", "features": "FTR_E2N&FTR_ANS_HUNDREDS&FTR_ANS_TENS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueTens}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "FTR_E2N&FTR_ANS_TENS"},
// Not saying the correct answer when user gets N2E correct since it takes too long
-// {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueStimOneHundreds}}.mp3", "soundpackage":"numbers", "volume": 1.0, "mode":"flow", "features": "FTR_N2E&FTR_ANS_STIM_ONE_HUNDREDS"},
-// {"type": "AUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage":"numbers", "volume": 1.0, "mode":"flow", "features": "FTR_N2E&FTR_ANS_STIM_ONE_HUNDREDS"},
-// {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueStimOneTens}}.mp3", "soundpackage":"numbers", "volume": 1.0, "mode":"flow", "features": "FTR_N2E&FTR_ANS_STIM_ONE_TENS"},
-// {"type": "AUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage":"xprize", "volume": 1.0, "mode":"flow", "features": "FTR_N2E&FTR_ANS_STIM_ONE_TENS"},
-// {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueStimOneOnes}}.mp3", "soundpackage":"numbers", "volume": 1.0, "mode":"flow", "features": "FTR_N2E&FTR_ANS_STIM_ONE_ONES"},
-// {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueOperand}}.mp3", "soundpackage":"xprize", "volume": 1.0, "mode":"flow", "features": "FTR_N2E"},
-// {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueStimTwoHundreds}}.mp3", "soundpackage":"numbers", "volume": 1.0, "mode":"flow", "features": "FTR_N2E&FTR_ANS_STIM_TWO_HUNDREDS"},
-// {"type": "AUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage":"xprize", "volume": 1.0, "mode":"flow", "features": "FTR_N2E&FTR_ANS_STIM_TWO_HUNDREDS"},
-// {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueStimTwoTens}}.mp3", "soundpackage":"numbers", "volume": 1.0, "mode":"flow", "features": "FTR_N2E&FTR_ANS_STIM_TWO_TENS"},
-// {"type": "AUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage":"xprize", "volume": 1.0, "mode":"flow", "features": "FTR_N2E&FTR_ANS_STIM_TWO_TENS"},
-// {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueStimTwoOnes}}.mp3", "soundpackage":"numbers", "volume": 1.0, "mode":"flow", "features": "FTR_N2E&FTR_ANS_STIM_TWO_ONES"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValue}}.mp3", "soundpackage":"letters", "volume": 1.0, "mode":"event", "features": "FTR_LETTERS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValue}}.mp3", "soundpackage":"shapes", "volume": 1.0, "mode":"event", "features": "FTR_SHAPES"},
-
- {"type": "COMMAND", "id": "SBubblePop", "method": "setVolatileBehavior", "parms": "BUBBLES_CLEARED:String|NEXTNODE:String" ,"features":""},
- {"type": "COMMAND", "id": "SBubblePop", "method": "postEvent", "parms": "CLEAR_CONTENT:String" ,"features":""},
- {"type": "COMMAND", "cmd": "WAIT" },
-
- {"type": "COMMAND", "id": "SBubblePop", "method": "setVolatileBehavior", "parms": "FEEDBACK_SHOWN:String|NEXTNODE:String" ,"features":""},
- {"type": "COMMAND", "id": "SBubblePop", "method": "postEvent", "parms": "SHOW_FEEDBACK:String" ,"features":""},
- {"type": "COMMAND", "cmd": "WAIT" }
+// {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueStimOneHundreds}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "FTR_N2E&FTR_ANS_STIM_ONE_HUNDREDS"},
+// {"type": "AUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "FTR_N2E&FTR_ANS_STIM_ONE_HUNDREDS"},
+// {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueStimOneTens}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "FTR_N2E&FTR_ANS_STIM_ONE_TENS"},
+// {"type": "AUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage": "xprize", "volume": 1.0, "mode": "flow", "features": "FTR_N2E&FTR_ANS_STIM_ONE_TENS"},
+// {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueStimOneOnes}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "FTR_N2E&FTR_ANS_STIM_ONE_ONES"},
+// {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueOperand}}.mp3", "soundpackage": "xprize", "volume": 1.0, "mode": "flow", "features": "FTR_N2E"},
+// {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueStimTwoHundreds}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "FTR_N2E&FTR_ANS_STIM_TWO_HUNDREDS"},
+// {"type": "AUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage": "xprize", "volume": 1.0, "mode": "flow", "features": "FTR_N2E&FTR_ANS_STIM_TWO_HUNDREDS"},
+// {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueStimTwoTens}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "FTR_N2E&FTR_ANS_STIM_TWO_TENS"},
+// {"type": "AUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage": "xprize", "volume": 1.0, "mode": "flow", "features": "FTR_N2E&FTR_ANS_STIM_TWO_TENS"},
+// {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueStimTwoOnes}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "FTR_N2E&FTR_ANS_STIM_TWO_ONES"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValue}}.mp3", "soundpackage": "letters", "volume": 1.0, "mode": "event", "features": "FTR_LETTERS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValue}}.mp3", "soundpackage": "shapes", "volume": 1.0, "mode": "event", "features": "FTR_SHAPES"},
+
+ {"type": "COMMAND", "id": "SBubblePop", "method": "setVolatileBehavior", "parms": "BUBBLES_CLEARED:String|NEXTNODE:String", "features": ""},
+ {"type": "COMMAND", "id": "SBubblePop", "method": "postEvent", "parms": "CLEAR_CONTENT:String", "features": ""},
+ {"type": "COMMAND", "cmd": "WAIT"},
+
+ {"type": "COMMAND", "id": "SBubblePop", "method": "setVolatileBehavior", "parms": "FEEDBACK_SHOWN:String|NEXTNODE:String", "features": ""},
+ {"type": "COMMAND", "id": "SBubblePop", "method": "postEvent", "parms": "SHOW_FEEDBACK:String", "features": ""},
+ {"type": "COMMAND", "cmd": "WAIT"}
]
},
"PLAYWRONG_PAUSE": {
"type": "MODULE",
- "reuse":true,
+ "reuse": true,
"COMMENT": "????",
"tracks": [
- {"name": "LOG_EVENT", "type": "QUEUEDCOMMAND", "id": "SBubblePop", "method": "logState", "parms": "type#node,value#PLAYWRONG_PAUSE:String", "features":""},
-
- {"type": "COMMAND", "id": "SBubblePop", "method": "postEvent", "parms": "PAUSE_ANIMATION:String" ,"features":""},
- {"type": "COMMAND", "id": "SBubblePop", "method": "postEvent", "parms": "SHOW_BUBBLE_MASK:String" ,"features":""},
-
- {"type": "AUDIO", "command": "PLAY", "soundsource": "wrong.mp3", "soundpackage":"tutor_effect", "volume": 0.05, "mode":"event", "features": ""},
-
- {"type": "COMMAND", "id": "SBubblePop", "method": "setVolatileBehavior", "parms": "BUBBLE_WIGGLED:String|NEXTNODE:String" ,"features":""},
- {"type": "COMMAND", "id": "SBubblePop", "method": "postEvent", "parms": "WIGGLE_BUBBLE:String" ,"features":""},
- {"type": "COMMAND", "cmd": "WAIT" },
-
- {"type": "AUDIO", "command": "PLAY", "soundsource": "Thats.mp3", "soundpackage":"default", "volume": 1.0, "mode":"flow", "features": ""},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueHundreds}}.mp3", "soundpackage":"numbers", "volume": 1.0, "mode":"flow", "features": "FTR_MIS_NUM&FTR_ANS_HUNDREDS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage":"xprize", "volume": 1.0, "mode":"flow", "features": "FTR_MIS_NUM&FTR_ANS_HUNDREDS&FTR_ANS_TENS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueTens}}.mp3", "soundpackage":"numbers", "volume": 1.0, "mode":"flow", "features": "FTR_MIS_NUM&FTR_ANS_TENS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueHundreds}}.mp3", "soundpackage":"numbers", "volume": 1.0, "mode":"flow", "features": "FTR_GT_LT&FTR_ANS_HUNDREDS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage":"xprize", "volume": 1.0, "mode":"flow", "features": "FTR_GT_LT&FTR_ANS_HUNDREDS&FTR_ANS_TENS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueTens}}.mp3", "soundpackage":"numbers", "volume": 1.0, "mode":"flow", "features": "FTR_GT_LT&FTR_ANS_TENS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValue}}.mp3", "soundpackage":"words", "volume": 1.0, "mode":"flow", "features": "FTR_WORDS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueHundreds}}.mp3", "soundpackage":"numbers", "volume": 1.0, "mode":"flow", "features": "FTR_NUMBERS&FTR_ANS_HUNDREDS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage":"xprize", "volume": 1.0, "mode":"flow", "features": "FTR_NUMBERS&FTR_ANS_HUNDREDS&FTR_ANS_TENS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueTens}}.mp3", "soundpackage":"numbers", "volume": 1.0, "mode":"flow", "features": "FTR_NUMBERS&FTR_ANS_TENS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueStimOneHundreds}}.mp3", "soundpackage":"numbers", "volume": 1.0, "mode":"flow", "features": "FTR_N2E&FTR_ANS_STIM_ONE_HUNDREDS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage":"xprize", "volume": 1.0, "mode":"flow", "features": "FTR_N2E&FTR_ANS_STIM_ONE_HUNDREDS&FTR_ANS_STIM_ONE_TENS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueStimOneTens}}.mp3", "soundpackage":"numbers", "volume": 1.0, "mode":"flow", "features": "FTR_N2E&FTR_ANS_STIM_ONE_TENS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueOperand}}.mp3", "soundpackage":"xprize", "volume": 1.0, "mode":"flow", "features": "FTR_N2E"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueStimTwoHundreds}}.mp3", "soundpackage":"numbers", "volume": 1.0, "mode":"flow", "features": "FTR_N2E&FTR_ANS_STIM_TWO_HUNDREDS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage":"xprize", "volume": 1.0, "mode":"flow", "features": "FTR_N2E&FTR_ANS_STIM_TWO_HUNDREDS&FTR_ANS_STIM_TWO_TENS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueStimTwoTens}}.mp3", "soundpackage":"numbers", "volume": 1.0, "mode":"flow", "features": "FTR_N2E&FTR_ANS_STIM_TWO_TENS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueHundreds}}.mp3", "soundpackage":"numbers", "volume": 1.0, "mode":"flow", "features": "FTR_E2N&FTR_ANS_HUNDREDS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage":"xprize", "volume": 1.0, "mode":"flow", "features": "FTR_E2N&FTR_ANS_HUNDREDS&FTR_ANS_TENS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueTens}}.mp3", "soundpackage":"numbers", "volume": 1.0, "mode":"flow", "features": "FTR_E2N&FTR_ANS_TENS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValue}}.mp3", "soundpackage":"letters", "volume": 1.0, "mode":"flow", "features": "FTR_LETTERS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValue}}.mp3", "soundpackage":"shapes", "volume": 1.0, "mode":"flow", "features": "FTR_SHAPES"},
-
- {"type": "COMMAND", "id": "SBubblePop", "method": "postEvent", "parms": "HIDE_MASK:String" ,"features":"!FTR_LASTATTEMPT"},
-
- {"type": "AUDIO", "command": "PLAY", "soundsource": "Please tap.mp3", "soundpackage":"default", "volume": 1.0, "mode":"flow", "features": "!FTR_LASTATTEMPT&!FTR_MIS_NUM&!FTR_GT_LT"},
-
- {"type": "COMMAND", "id": "SBubblePop", "method": "postEvent", "parms": "SHOW_STIMULUS_MASK:String" ,"features":"FTR_SHOW&!FTR_LASTATTEMPT"},
-
-
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValue}}.mp3", "soundpackage":"missing_number", "volume": 1.0, "mode":"flow", "features": "!FTR_LASTATTEMPT&FTR_MIS_NUM"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValue}}.mp3", "soundpackage":"missing_number", "volume": 1.0, "mode":"flow", "features": "!FTR_LASTATTEMPT&FTR_GT_LT"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "Neno gani huanza na.mp3", "soundpackage":"xprize", "volume": 1.0, "mode":"flow","features": "!FTR_LASTATTEMPT&FTR_SAY&FTR_WORDS&FTR_WORD_STARTS_WITH"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "Neno gani kuishia na.mp3", "soundpackage":"xprize", "volume": 1.0, "mode":"flow","features": "!FTR_LASTATTEMPT&FTR_SAY&FTR_WORDS&FTR_WORD_ENDS_WITH"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValue}}.mp3", "soundpackage":"words", "volume": 1.0, "mode":"flow", "features": "!FTR_LASTATTEMPT&FTR_WORDS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValueHundreds}}.mp3", "soundpackage":"numbers", "volume": 1.0, "mode":"flow", "features": "!FTR_LASTATTEMPT&FTR_NUMBERS&FTR_QUEST_HUNDREDS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage":"xprize", "volume": 1.0, "mode":"flow", "features": "!FTR_LASTATTEMPT&FTR_NUMBERS&FTR_QUEST_HUNDREDS&FTR_QUEST_TENS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValueTens}}.mp3", "soundpackage":"numbers", "volume": 1.0, "mode":"flow", "features": "!FTR_LASTATTEMPT&FTR_NUMBERS&FTR_QUEST_TENS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValueStimOneHundreds}}.mp3","soundpackage":"numbers", "volume": 1.0, "mode":"flow", "features": "!FTR_LASTATTEMPT&FTR_E2N&FTR_QUEST_STIM_ONE_HUNDREDS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage":"xprize", "volume": 1.0, "mode":"flow", "features": "!FTR_LASTATTEMPT&FTR_E2N&FTR_QUEST_STIM_ONE_HUNDREDS&FTR_QUEST_STIM_ONE_TENS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValueStimOneTens}}.mp3", "soundpackage":"numbers", "volume": 1.0, "mode":"flow", "features": "!FTR_LASTATTEMPT&FTR_E2N&FTR_QUEST_STIM_ONE_TENS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValueOperand}}.mp3", "soundpackage":"xprize", "volume": 1.0, "mode":"flow", "features": "!FTR_LASTATTEMPT&FTR_E2N"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValueStimTwoHundreds}}.mp3","soundpackage":"numbers", "volume": 1.0, "mode":"flow", "features": "!FTR_LASTATTEMPT&FTR_E2N&FTR_QUEST_STIM_TWO_HUNDREDS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage":"xprize", "volume": 1.0, "mode":"flow", "features": "!FTR_LASTATTEMPT&FTR_E2N&FTR_QUEST_STIM_TWO_HUNDREDS&FTR_QUEST_STIM_TWO_TENS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValueStimTwoTens}}.mp3", "soundpackage":"numbers", "volume": 1.0, "mode":"flow","features": "!FTR_LASTATTEMPT&FTR_E2N&FTR_QUEST_STIM_TWO_TENS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValueHundreds}}.mp3", "soundpackage":"numbers", "volume": 1.0, "mode":"flow", "features": "!FTR_LASTATTEMPT&FTR_N2E&FTR_QUEST_HUNDREDS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage":"xprize", "volume": 1.0, "mode":"flow", "features": "!FTR_LASTATTEMPT&FTR_N2E&FTR_QUEST_HUNDREDS&FTR_QUEST_TENS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValueTens}}.mp3", "soundpackage":"numbers", "volume": 1.0, "mode":"flow", "features": "!FTR_LASTATTEMPT&FTR_N2E&FTR_QUEST_TENS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValue}}.mp3", "soundpackage":"letters", "volume": 1.0, "mode":"flow", "features": "!FTR_LASTATTEMPT&FTR_LETTERS"},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValue}}.mp3", "soundpackage":"shapes", "volume": 1.0, "mode":"flow", "features": "!FTR_LASTATTEMPT&FTR_SHAPES"},
-
- {"type": "COMMAND", "id": "SBubblePop", "method": "postEvent", "parms": "HIDE_MASK:String" ,"features":"FTR_SHOW&!FTR_LASTATTEMPT"},
- {"type": "COMMAND", "id": "SBubblePop", "method": "postEvent", "parms": "RESUME_ANIMATION:String" ,"features":"!FTR_LASTATTEMPT"},
-
- {"type": "COMMAND", "id": "SBubblePop", "method": "setVolatileBehavior", "parms": "BUBBLES_CLEARED:String|NEXTNODE:String" ,"features":"FTR_LASTATTEMPT"},
- {"type": "COMMAND", "id": "SBubblePop", "method": "postEvent", "parms": "CLEAR_CONTENT:String" ,"features":"FTR_LASTATTEMPT"},
- {"type": "COMMAND", "cmd": "WAIT" ,"features":"FTR_LASTATTEMPT" },
- {"type": "COMMAND", "id": "SBubblePop", "method": "postEvent", "parms": "HIDE_MASK:String" ,"features":"FTR_LASTATTEMPT"}
+ {"name": "LOG_EVENT", "type": "QUEUEDCOMMAND", "id": "SBubblePop", "method": "logState", "parms": "type#node,value#PLAYWRONG_PAUSE:String", "features": ""},
+
+ {"type": "COMMAND", "id": "SBubblePop", "method": "postEvent", "parms": "PAUSE_ANIMATION:String", "features": ""},
+ {"type": "COMMAND", "id": "SBubblePop", "method": "postEvent", "parms": "SHOW_BUBBLE_MASK:String", "features": ""},
+
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "wrong.mp3", "soundpackage": "tutor_effect", "volume": 0.05, "mode": "event", "features": ""},
+
+ {"type": "COMMAND", "id": "SBubblePop", "method": "setVolatileBehavior", "parms": "BUBBLE_WIGGLED:String|NEXTNODE:String", "features": ""},
+ {"type": "COMMAND", "id": "SBubblePop", "method": "postEvent", "parms": "WIGGLE_BUBBLE:String", "features": ""},
+ {"type": "COMMAND", "cmd": "WAIT"},
+
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "Thats.mp3", "soundpackage": "default", "volume": 1.0, "mode": "flow", "features": ""},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueHundreds}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "FTR_MIS_NUM&FTR_ANS_HUNDREDS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage": "xprize", "volume": 1.0, "mode": "flow", "features": "FTR_MIS_NUM&FTR_ANS_HUNDREDS&FTR_ANS_TENS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueTens}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "FTR_MIS_NUM&FTR_ANS_TENS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueHundreds}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "FTR_GT_LT&FTR_ANS_HUNDREDS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage": "xprize", "volume": 1.0, "mode": "flow", "features": "FTR_GT_LT&FTR_ANS_HUNDREDS&FTR_ANS_TENS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueTens}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "FTR_GT_LT&FTR_ANS_TENS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValue}}.mp3", "soundpackage": "words", "volume": 1.0, "mode": "flow", "features": "FTR_WORDS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueHundreds}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "FTR_NUMBERS&FTR_ANS_HUNDREDS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage": "xprize", "volume": 1.0, "mode": "flow", "features": "FTR_NUMBERS&FTR_ANS_HUNDREDS&FTR_ANS_TENS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueTens}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "FTR_NUMBERS&FTR_ANS_TENS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueStimOneHundreds}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "FTR_N2E&FTR_ANS_STIM_ONE_HUNDREDS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage": "xprize", "volume": 1.0, "mode": "flow", "features": "FTR_N2E&FTR_ANS_STIM_ONE_HUNDREDS&FTR_ANS_STIM_ONE_TENS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueStimOneTens}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "FTR_N2E&FTR_ANS_STIM_ONE_TENS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueOperand}}.mp3", "soundpackage": "xprize", "volume": 1.0, "mode": "flow", "features": "FTR_N2E"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueStimTwoHundreds}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "FTR_N2E&FTR_ANS_STIM_TWO_HUNDREDS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage": "xprize", "volume": 1.0, "mode": "flow", "features": "FTR_N2E&FTR_ANS_STIM_TWO_HUNDREDS&FTR_ANS_STIM_TWO_TENS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueStimTwoTens}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "FTR_N2E&FTR_ANS_STIM_TWO_TENS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueHundreds}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "FTR_E2N&FTR_ANS_HUNDREDS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage": "xprize", "volume": 1.0, "mode": "flow", "features": "FTR_E2N&FTR_ANS_HUNDREDS&FTR_ANS_TENS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValueTens}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "FTR_E2N&FTR_ANS_TENS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValue}}.mp3", "soundpackage": "letters", "volume": 1.0, "mode": "flow", "features": "FTR_LETTERS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.ansValue}}.mp3", "soundpackage": "shapes", "volume": 1.0, "mode": "flow", "features": "FTR_SHAPES"},
+
+ {"type": "COMMAND", "id": "SBubblePop", "method": "postEvent", "parms": "HIDE_MASK:String", "features": "!FTR_LASTATTEMPT"},
+
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "Please tap.mp3", "soundpackage": "default", "volume": 1.0, "mode": "flow", "features": "!FTR_LASTATTEMPT&!FTR_MIS_NUM&!FTR_GT_LT"},
+
+ {"type": "COMMAND", "id": "SBubblePop", "method": "postEvent", "parms": "SHOW_STIMULUS_MASK:String", "features": "FTR_SHOW_STIMULUS&!FTR_LASTATTEMPT"},
+
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValue}}.mp3", "soundpackage": "missing_number", "volume": 1.0, "mode": "flow", "features": "!FTR_LASTATTEMPT&FTR_MIS_NUM"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValue}}.mp3", "soundpackage": "missing_number", "volume": 1.0, "mode": "flow", "features": "!FTR_LASTATTEMPT&FTR_GT_LT"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "Neno gani huanza na.mp3", "soundpackage": "xprize", "volume": 1.0, "mode": "flow", "features": "!FTR_LASTATTEMPT&FTR_SAY_STIMULUS&FTR_WORDS&FTR_WORD_STARTS_WITH"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "Neno gani kuishia na.mp3", "soundpackage": "xprize", "volume": 1.0, "mode": "flow", "features": "!FTR_LASTATTEMPT&FTR_SAY_STIMULUS&FTR_WORDS&FTR_WORD_ENDS_WITH"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValue}}.mp3", "soundpackage": "words", "volume": 1.0, "mode": "flow", "features": "!FTR_LASTATTEMPT&FTR_WORDS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValueHundreds}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "!FTR_LASTATTEMPT&FTR_NUMBERS&FTR_QUEST_HUNDREDS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage": "xprize", "volume": 1.0, "mode": "flow", "features": "!FTR_LASTATTEMPT&FTR_NUMBERS&FTR_QUEST_HUNDREDS&FTR_QUEST_TENS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValueTens}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "!FTR_LASTATTEMPT&FTR_NUMBERS&FTR_QUEST_TENS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValueStimOneHundreds}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "!FTR_LASTATTEMPT&FTR_E2N&FTR_QUEST_STIM_ONE_HUNDREDS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage": "xprize", "volume": 1.0, "mode": "flow", "features": "!FTR_LASTATTEMPT&FTR_E2N&FTR_QUEST_STIM_ONE_HUNDREDS&FTR_QUEST_STIM_ONE_TENS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValueStimOneTens}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "!FTR_LASTATTEMPT&FTR_E2N&FTR_QUEST_STIM_ONE_TENS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValueOperand}}.mp3", "soundpackage": "xprize", "volume": 1.0, "mode": "flow", "features": "!FTR_LASTATTEMPT&FTR_E2N"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValueStimTwoHundreds}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "!FTR_LASTATTEMPT&FTR_E2N&FTR_QUEST_STIM_TWO_HUNDREDS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage": "xprize", "volume": 1.0, "mode": "flow", "features": "!FTR_LASTATTEMPT&FTR_E2N&FTR_QUEST_STIM_TWO_HUNDREDS&FTR_QUEST_STIM_TWO_TENS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValueStimTwoTens}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "!FTR_LASTATTEMPT&FTR_E2N&FTR_QUEST_STIM_TWO_TENS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValueHundreds}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "!FTR_LASTATTEMPT&FTR_N2E&FTR_QUEST_HUNDREDS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "Na.mp3", "soundpackage": "xprize", "volume": 1.0, "mode": "flow", "features": "!FTR_LASTATTEMPT&FTR_N2E&FTR_QUEST_HUNDREDS&FTR_QUEST_TENS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValueTens}}.mp3", "soundpackage": "numbers", "volume": 1.0, "mode": "flow", "features": "!FTR_LASTATTEMPT&FTR_N2E&FTR_QUEST_TENS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValue}}.mp3", "soundpackage": "letters", "volume": 1.0, "mode": "flow", "features": "!FTR_LASTATTEMPT&FTR_LETTERS"},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.questValue}}.mp3", "soundpackage": "shapes", "volume": 1.0, "mode": "flow", "features": "!FTR_LASTATTEMPT&FTR_SHAPES"},
+
+ {"type": "COMMAND", "id": "SBubblePop", "method": "postEvent", "parms": "HIDE_MASK:String", "features": "FTR_SHOW_STIMULUS&!FTR_LASTATTEMPT"},
+ {"type": "COMMAND", "id": "SBubblePop", "method": "postEvent", "parms": "RESUME_ANIMATION:String", "features": "!FTR_LASTATTEMPT"},
+
+ {"type": "COMMAND", "id": "SBubblePop", "method": "setVolatileBehavior", "parms": "BUBBLES_CLEARED:String|NEXTNODE:String", "features": "FTR_LASTATTEMPT"},
+ {"type": "COMMAND", "id": "SBubblePop", "method": "postEvent", "parms": "CLEAR_CONTENT:String", "features": "FTR_LASTATTEMPT"},
+ {"type": "COMMAND", "cmd": "WAIT", "features": "FTR_LASTATTEMPT"},
+ {"type": "COMMAND", "id": "SBubblePop", "method": "postEvent", "parms": "HIDE_MASK:String", "features": "FTR_LASTATTEMPT"}
// TODO: is this delay required removed in 45.1
//
- // {"type": "TIMER", "id":"nextDelayTimer", "startdelay":"0", "period":"50", "repeat":"false", "action":"CREATEANDSTART", "ontimer":"NEXTNODE", "features": "" },
- // {"type": "COMMAND", "cmd": "WAIT" }
+ //{"type": "TIMER", "id": "nextDelayTimer", "startdelay": "0", "period": "50", "repeat": "false", "action": "CREATEANDSTART", "ontimer": "NEXTNODE", "features": ""},
+ //{"type": "COMMAND", "cmd": "WAIT"}
]
},
-
"EMPTYMODULE": {
"type": "MODULE",
- "reuse":true,
+ "reuse": true,
"COMMENT": "????",
"tracks": [
- {"name": "LOG_EVENT", "type": "QUEUEDCOMMAND", "id": "SBubblePop", "method": "logState", "parms": "type#node,value#EMPTYMODULE:String", "features":""}
+ {"name": "LOG_EVENT", "type": "QUEUEDCOMMAND", "id": "SBubblePop", "method": "logState", "parms": "type#node,value#EMPTYMODULE:String", "features": ""}
]
},
"FINALSCORE": {
"type": "MODULE",
- "reuse":true,
+ "reuse": true,
"COMMENT": "????",
"tracks": [
- {"name": "LOG_EVENT", "type": "QUEUEDCOMMAND", "id": "SBubblePop", "method": "logState", "parms": "type#node,value#FINALSCORE:String", "features":""},
+ {"name": "LOG_EVENT", "type": "QUEUEDCOMMAND", "id": "SBubblePop", "method": "logState", "parms": "type#node,value#FINALSCORE:String", "features": ""},
- {"type": "AUDIO", "command": "PLAY", "soundsource": "scorecard.mp3", "soundpackage":"tutor_effect", "volume": 1.00, "mode":"event", "features": ""},
+ {"type": "AUDIO", "command": "PLAY", "soundsource": "scorecard.mp3", "soundpackage": "tutor_effect", "volume": 1.00, "mode": "event", "features": ""},
- {"type": "TIMER", "id":"showScoreTimer", "startdelay":"0", "period":"4000", "repeat":"false", "action":"CREATEANDSTART", "ontimer":"NEXTNODE", "features": "" },
- {"type": "COMMAND", "id": "SBubblePop", "method": "postEvent", "parms": "SHOW_SCORE:String" ,"features":""},
- {"type": "COMMAND", "cmd": "WAIT" }
+ {"type": "TIMER", "id": "showScoreTimer", "startdelay": "0", "period": "4000", "repeat": "false", "action": "CREATEANDSTART", "ontimer": "NEXTNODE", "features": ""},
+ {"type": "COMMAND", "id": "SBubblePop", "method": "postEvent", "parms": "SHOW_SCORE:String", "features": ""},
+ {"type": "COMMAND", "cmd": "WAIT"}
]
}
},
@@ -386,57 +414,42 @@
"COMMENT": "@@@@@ CActions @@@@@ ",
- "PLAY_BACKINGTRACK": {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.sound_track}}", "soundpackage":"tutor_effect", "repeat":true, "volume": 0.20, "mode":"event", "features": ""},
- "PLAY_PROMPT": {"type": "AUDIO", "command": "PLAY", "soundsource": "Please tap on it.mp3", "soundpackage":"default", "volume": 0.7, "mode":"flow", "features": ""},
+ "PLAY_BACKINGTRACK": {"type": "AUDIO", "command": "PLAY", "soundsource": "{{SBubblePop.sound_track}}", "soundpackage": "tutor_effect", "repeat": true, "volume": 0.20, "mode": "event", "features": ""},
+ "PLAY_PROMPT": {"type": "AUDIO", "command": "PLAY", "soundsource": "Please tap on it.mp3", "soundpackage": "default", "volume": 0.7, "mode": "flow", "features": ""},
- "SET_VERSION":{"type": "COMMAND", "id": "Sbanner", "method": "setVersionID", "parms": "v.0.0.1:String","features":""},
- "SET_DATASOURCE":{"type": "COMMAND", "id": "SBubblePop", "method": "setDataSource", "parms": "[file]bp_data.json:String","features":"!DATA_SBUBBLEPOP"},
- "SET_SOUND_TRACK":{"type": "COMMAND", "id": "SBubblePop", "method": "setSoundTrack"},
- "NEXT_DATASET":{"type": "COMMAND", "id": "SBubblePop", "method": "next" ,"features":""},
+ "SET_VERSION": {"type": "COMMAND", "id": "Sbanner", "method": "setVersionID", "parms": "v.0.0.1:String", "features": ""},
+ "SET_DATASOURCE": {"type": "COMMAND", "id": "SBubblePop", "method": "setDataSource", "parms": "[file]bp_data.json:String", "features": "!DATA_SBUBBLEPOP"},
+ "SET_SOUND_TRACK": {"type": "COMMAND", "id": "SBubblePop", "method": "setSoundTrack"},
+ "NEXT_DATASET": {"type": "COMMAND", "id": "SBubblePop", "method": "next", "features": ""},
+ "SET_HESITATION_TIMER": {"type": "TIMER", "id": "HesitationTimer", "startdelay": "0", "period": "6000", "repeat": "true", "action": "CREATEANDSTART", "ontimer": "SHOW_BUBBLES", "features": ""},
+ "CANCEL_HESITATION_TIMER": {"type": "TIMER", "id": "HesitationTimer", "action": "CANCEL", "features": ""},
+ "SET_SPAWN_BUBBLE_BEHAVIOR": {"type": "COMMAND", "id": "SBubblePop", "method": "setStickyBehavior", "parms": "SPAWN_BUBBLE:String|SPAWN_BUBBLE_BEHAVIOR:String" , "features": ""},
+ "CLEAR_SPAWN_BUBBLE_BEHAVIOR": {"type": "COMMAND", "id": "SBubblePop", "method": "setStickyBehavior", "parms": "SPAWN_BUBBLE:String|NULL:String" , "features": ""},
+ "SHOW_BUBBLES": {"type": "COMMAND", "id": "SBubblePop", "method": "postEvent", "parms": "SHOW_BUBBLES:String", "features": ""},
- // "SET_SHOW":{"type": "COMMAND", "id": "SBubblePop", "method": "setEventBehavior" ,"features":""},
+// "SET_SHOW": {"type": "COMMAND", "id": "SBubblePop", "method": "setEventBehavior", "features": ""},
- "NEXTNODE": {"type": "COMMAND", "cmd": "NEXT" },
+ "NEXTNODE": {"type": "COMMAND", "cmd": "NEXT"},
- "B5_ATTACH": {
- "type": "COMMAND", "id": "button5", "method": "setButtonBehavior", "parms": "STOP:String"
- },
- "B5_DEATTACH": {
- "type": "COMMAND", "id": "button5", "method": "setButtonBehavior", "parms": "NULL:String"
- },
+ "B5_ATTACH": {"type": "COMMAND", "id": "button5", "method": "setButtonBehavior", "parms": "STOP:String"},
+ "B5_DEATTACH": {"type": "COMMAND", "id": "button5", "method": "setButtonBehavior", "parms": "NULL:String"},
-
- "NEXTSCENE": {
- "type": "COMMAND", "cmd": "NEXTSCENE"
- }
+ "NEXTSCENE": {"type": "COMMAND", "cmd": "NEXTSCENE"}
},
"constraintMap": {
"COMMENT": "@@@@@ CConstraints @@@@@ ",
- "FTR_RIGHT":{
- "type": "CONDITION",
- "test":"FTR_RIGHT"
- },
+ "FTR_RIGHT": {"type": "CONDITION", "test": "FTR_RIGHT"},
- "FTR_WRONG":{
- "type": "CONDITION",
- "test":"FTR_WRONG"
- },
+ "FTR_WRONG": {"type": "CONDITION", "test": "FTR_WRONG"},
- "FTR_EOD":{
- "type": "CONDITION",
- "test":"FTR_EOD"
- },
-
- "FTR_LASTATTEMPT":{
- "type": "CONDITION",
- "test":"FTR_LASTATTEMPT"
- }
+ "FTR_EOD": {"type": "CONDITION", "test": "FTR_EOD"},
+ "FTR_LASTATTEMPT": {"type": "CONDITION", "test": "FTR_LASTATTEMPT"}
}
}
}
diff --git a/app/src/main/java/cmu/xprize/robotutor/RoboTutor.java b/app/src/main/java/cmu/xprize/robotutor/RoboTutor.java
index 3c73345c7..6e6fcefe6 100644
--- a/app/src/main/java/cmu/xprize/robotutor/RoboTutor.java
+++ b/app/src/main/java/cmu/xprize/robotutor/RoboTutor.java
@@ -50,6 +50,7 @@
import cmu.xprize.util.CLoaderView;
import cmu.xprize.comp_logging.CLogManager;
import cmu.xprize.comp_logging.CPerfLogManager;
+import cmu.xprize.comp_logging.CAudioLogThread;
import cmu.xprize.robotutor.tutorengine.CTutorEngine;
import cmu.xprize.robotutor.tutorengine.ITutorManager;
import cmu.xprize.robotutor.tutorengine.widgets.core.IGuidView;
@@ -83,7 +84,7 @@
public class RoboTutor extends Activity implements IReadyListener, IRoboTutor {
// VARIABLES FOR QUICK DEBUG LAUNCH
- private static final boolean QUICK_DEBUG = true;
+ private static final boolean QUICK_DEBUG = false;
private static final String debugTutorVariant = "countingx";
private static final String debugTutorId = "countingx:1_10";
private static final String debugTutorFile = "[file]countingx_1_10.json";
@@ -138,9 +139,11 @@ public class RoboTutor extends Activity implements IReadyListener, IRoboTutor {
public final static String DOWNLOAD_PATH = Environment.getExternalStorageDirectory() + File.separator + Environment.DIRECTORY_DOWNLOADS;
public final static String EXT_ASSET_PATH = Environment.getExternalStorageDirectory() + File.separator + TCONST.ROBOTUTOR_ASSET_FOLDER;
- private final String TAG = "CRoboTutor";
+ private final String TAG = "CRoboTutor";
private final String ID_TAG = "StudentId";
+ private Thread audioLogThread;
+
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -206,6 +209,9 @@ protected void onCreate(Bundle savedInstanceState) {
Log.v(TAG, "External_Download:" + DOWNLOAD_PATH);
+ audioLogThread = new CAudioLogThread(readyLogPath, logFilename);
+ audioLogThread.start();
+
// Get the primary container for tutors
//
setContentView(R.layout.robo_tutor);
@@ -780,6 +786,8 @@ protected void onDestroy() {
TTS = null;
}
+ audioLogThread.interrupt();
+
logManager.postDateTimeStamp(GRAPH_MSG, "RoboTutor:SessionEnd");
logManager.stopLogging();
perfLogManager.stopLogging();
diff --git a/app/src/main/java/cmu/xprize/robotutor/tutorengine/widgets/core/TAkComponent.java b/app/src/main/java/cmu/xprize/robotutor/tutorengine/widgets/core/TAkComponent.java
index 55532923f..cbe283299 100644
--- a/app/src/main/java/cmu/xprize/robotutor/tutorengine/widgets/core/TAkComponent.java
+++ b/app/src/main/java/cmu/xprize/robotutor/tutorengine/widgets/core/TAkComponent.java
@@ -8,6 +8,7 @@
import android.content.Context;
import android.graphics.Point;
import android.os.AsyncTask;
+import android.os.Handler;
import android.support.percent.PercentRelativeLayout;
import android.util.AttributeSet;
import android.util.Log;
@@ -505,14 +506,35 @@ public void postFinishLine() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
- applyEventNode("NEXT");
ongoingAnimator.remove(finishLineAnimator);
+ postSplashScreen();
}
});
finishLineAnimator.start();
}
+ public void postSplashScreen() {
+ final PercentRelativeLayout percentLayout = (PercentRelativeLayout) getChildAt(0);
+
+ final ImageView splashScreen = new ImageView(mContext);
+ splashScreen.setScaleType(ImageView.ScaleType.FIT_CENTER);
+ LayoutParams params = new LayoutParams(getWidth(), getHeight());
+ params.addRule(CENTER_HORIZONTAL);
+ splashScreen.setImageResource(cmu.xprize.ak_component.R.drawable.splash);
+
+ percentLayout.addView(splashScreen, params);
+
+ splashScreen.bringToFront();
+
+ new Handler().postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ applyEventNode("NEXT");
+ }
+ }, 1000); //Timer is in ms heree
+ }
+
public void judge(){
reset();
switch(questionBoard.choices.length){
diff --git a/app/src/main/java/cmu/xprize/robotutor/tutorengine/widgets/core/TBpComponent.java b/app/src/main/java/cmu/xprize/robotutor/tutorengine/widgets/core/TBpComponent.java
index c3d9e60a6..b9f811a57 100644
--- a/app/src/main/java/cmu/xprize/robotutor/tutorengine/widgets/core/TBpComponent.java
+++ b/app/src/main/java/cmu/xprize/robotutor/tutorengine/widgets/core/TBpComponent.java
@@ -38,7 +38,6 @@
import cmu.xprize.bp_component.CBP_Component;
import cmu.xprize.bp_component.CBp_Data;
import cmu.xprize.bp_component.CBubble;
-import android.graphics.Rect;
import android.graphics.RectF;
import cmu.xprize.bp_component.CBubbleStimulus;
import cmu.xprize.comp_logging.ITutorLogger;
@@ -91,7 +90,6 @@ public class TBpComponent extends CBP_Component implements IBehaviorManager, ITu
private String mProblemType = "";
-
public TBpComponent(Context context) {
super(context);
}
@@ -104,45 +102,37 @@ public TBpComponent(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
- //Helper function that converts 3 digit number to list of digits
+
+ // Helper function that converts 3 digit number to list of digits
private int[] getListDigits(int num) {
int hundredsDigit = 0; int tensDigit = 0;
- if(num >= 100) {
- hundredsDigit = (num / 100) * 100;
- }
+ if (num >= 100) hundredsDigit = (num / 100) * 100;
num = num % 100;
return (new int[]{hundredsDigit, num});
}
- //Helper function that splits expression into operand1, key, and operand2
+ // Helper function that splits expression into operand1, key, and operand2
private String[] splitExpression(String exp, String key) {
int op_index = exp.indexOf(key);
String operand1 = exp.substring(0, op_index);
- if(key.equals("\n")) {
- op_index += 1;
- }
+ if (key.equals("\n")) op_index += 1;
String operation = exp.substring(op_index, op_index+1);
String operand2 = exp.substring(op_index+1);
- if (operation.equals("+") || operation.equals("plus")) {
- key = "plus";
- }
- else {
- key = "minus";
- }
+ if (operation.equals("+") || operation.equals("plus")) key = "plus";
+ else key = "minus";
return (new String[]{operand1, key, operand2});
}
+
//***********************************************************
// Event Listener/Dispatcher - Start
-
@Override
public void addEventListener(String linkedView) {
-
mListeners.add((IEventListener) mTutor.getViewByName(linkedView));
}
@@ -150,41 +140,43 @@ public void addEventListener(String linkedView) {
//***********************************************************
-
//**********************************************************
//**********************************************************
//***************** Tutor Interface
-
@Override
public void setVisibility(String visible) {
-
mSceneObject.setVisibility(visible);
}
-
private void reset() {
-
resetValid();
resetState();
}
-
private void resetValid() {
-
retractFeature(TCONST.GENERIC_RIGHT);
retractFeature(TCONST.GENERIC_WRONG);
retractFeature(TCONST.LAST_ATTEMPT);
-
}
-
private void resetState() {
-
retractFeature(TCONST.SAY_STIMULUS);
retractFeature(TCONST.SHOW_STIMULUS);
+ retractFeature(TCONST.SAY_TARGET);
+ retractFeature(TCONST.SHOW_TARGET);
+ }
+
+ @Override
+ public void setFeature(String feature, boolean fadd) {
+ if (fadd) publishFeature(feature);
+ else retractFeature(feature);
}
+ @Override
+ public boolean testFeature(String feature) {
+ return mTutor.testFeature(feature);
+ }
/**
* Preprocess the data set
@@ -193,22 +185,23 @@ private void resetState() {
*/
@Override
protected void updateDataSet(CBp_Data data) {
+ resetState();
+
+ if (data.question_say) publishFeature(TCONST.SAY_STIMULUS);
+ if (data.question_show) publishFeature(TCONST.SHOW_STIMULUS);
+ if (data.target_say) publishFeature(TCONST.SAY_TARGET);
+ if (data.target_show) publishFeature(TCONST.SHOW_TARGET);
- // Let the compoenent process the new data set
- //
super.updateDataSet(data);
mProblemType = problem_type;
publishQuestionState(data);
}
-
/**
* @param dataNameDescriptor
*/
public void setDataSource(String dataNameDescriptor) {
-
- // Ensure flags are reset so we don't trigger reset of the ALLCORRECCT flag
- // on the first pass.
+ // Ensure flags are reset so we don't trigger reset of the ALLCORRECCT flag on the first pass.
//
reset();
@@ -222,7 +215,7 @@ public void setDataSource(String dataNameDescriptor) {
String dataFile = dataNameDescriptor.substring(TCONST.LOCAL_FILE.length());
- // Generate a langauage specific path to the data source -
+ // Generate a language specific path to the data source -
// i.e. tutors/word_copy/assets/data//
// e.g. tutors/word_copy/assets/data/sw/
//
@@ -241,9 +234,7 @@ public void setDataSource(String dataNameDescriptor) {
// these two code statements below are the same as in the "startsWith SOURCEFILE" condition
// set the total number of questions
- if(question_count == 0) {
- mTutor.setTotalQuestions(gen_stimulusSet.length);
- }
+ if (question_count == 0) mTutor.setTotalQuestions(gen_stimulusSet.length);
// preprocess the datasource e.g. populate instance arrays with general types
//
@@ -253,7 +244,7 @@ public void setDataSource(String dataNameDescriptor) {
String dataFile = dataNameDescriptor.substring(TCONST.SOURCEFILE.length());
- // Generate a langauage specific path to the data source -
+ // Generate a language specific path to the data source -
// i.e. tutors/word_copy/assets/data//
// e.g. tutors/word_copy/assets/data/sw/
//
@@ -267,9 +258,7 @@ public void setDataSource(String dataNameDescriptor) {
//
// set the total number of questions
- if(question_count == 0) {
- mTutor.setTotalQuestions(gen_stimulusSet.length);
- }
+ if (question_count == 0) mTutor.setTotalQuestions(gen_stimulusSet.length);
// preprocess the datasource e.g. populate instance arrays with general types
//
@@ -277,12 +266,12 @@ public void setDataSource(String dataNameDescriptor) {
} else if (dataNameDescriptor.startsWith("db|")) {
-
} else if (dataNameDescriptor.startsWith("{")) {
loadJSON(new JSONObject(dataNameDescriptor), null);
} else {
+
throw (new Exception("BadDataSource"));
}
} catch (Exception e) {
@@ -290,12 +279,10 @@ public void setDataSource(String dataNameDescriptor) {
}
}
-
/**
* Chooses one track randomly out of a list kept in string.xml
*/
public void setSoundTrack() {
-
Resources res = getResources();
String[] sound_tracks = res.getStringArray(cmu.xprize.bp_component.R.array.sound_tracks);
Random rand = new Random();
@@ -306,18 +293,12 @@ public void setSoundTrack() {
publishValue(BP_CONST.SOUND_TRACK, sound_track);
}
-
public void next() {
-
// If wrong reset ALLCORRECT
//
- if (mTutor.testFeatureSet(TCONST.GENERIC_WRONG)) {
-
- retractFeature(TCONST.ALL_CORRECT);
- }
+ if (mTutor.testFeatureSet(TCONST.GENERIC_WRONG)) retractFeature(TCONST.ALL_CORRECT);
reset();
-
super.next();
if (dataExhausted()) {
@@ -326,32 +307,26 @@ public void next() {
}
}
-
public void enable(Boolean enable) {
}
-
public void setButtonBehavior(String command) {
mSceneObject.setButtonBehavior(command);
}
-
/**
* Broadcast bubble exclusion and mask the screen during feedback
*
*/
public void maskBubble() {
-
int[] screenCoord = new int[2];
PointF centerPoint = _touchedBubble.getCenterPosition();
getLocationOnScreen(screenCoord);
PointF centerPt = new PointF(screenCoord[0] + centerPoint.x, screenCoord[1] + centerPoint.y);
-
PointF center = Scontent.localToGlobal(centerPt);
-
// Add an exclusion around the bubble the (incorrect) user tapped
//
Intent msg = new Intent(MASK_ADDEXCL);
@@ -363,7 +338,6 @@ public void maskBubble() {
bManager.sendBroadcast(msg);
-
// Set the mask transparency
//
msg = new Intent(MASK_SETALPHA);
@@ -371,7 +345,6 @@ public void maskBubble() {
bManager.sendBroadcast(msg);
-
// Show the mask while the feedback is in progress
//
msg = new Intent(MASK_SHOWHIDE);
@@ -400,17 +373,14 @@ public void maskStimulus() {
msg.putExtra(MASK_ALPHA, mask_alpha);
bManager.sendBroadcast(msg);
-
// Show the mask while the feedback is in progress
//
msg = new Intent(MASK_SHOWHIDE);
msg.putExtra(MASK_SHOWHIDE, VISIBLE);
bManager.sendBroadcast(msg);
-
}
-
/**
* Clear the feedback mask
*/
@@ -427,37 +397,34 @@ public void clearMask() {
bManager.sendBroadcast(msg);
}
+
//**********************************************************
//**********************************************************
//***************** Scripting Interface
-
public void postEvent(String event) {
+ postEvent(event, 0);
+ }
+ public void postEvent(String event, Integer delay) {
switch (event) {
-
case BP_CONST.PAUSE_ANIMATION:
-
post(BP_CONST.PAUSE_ANIMATION);
break;
case BP_CONST.RESUME_ANIMATION:
-
post(BP_CONST.RESUME_ANIMATION);
break;
case BP_CONST.SHOW_BUBBLE_MASK:
-
maskBubble();
break;
case BP_CONST.HIDE_MASK:
-
clearMask();
break;
case BP_CONST.SHOW_STIMULUS_MASK:
-
maskStimulus();
break;
@@ -477,6 +444,14 @@ public void postEvent(String event) {
post(BP_CONST.SHOW_BUBBLES);
break;
+ case BP_CONST.SPAWN_BUBBLE:
+ post(BP_CONST.SPAWN_BUBBLE, (long)delay);
+ break;
+
+ case BP_CONST.NEXT_BUBBLE:
+ post(BP_CONST.NEXT_BUBBLE, (long)delay);
+ break;
+
case BP_CONST.POP_BUBBLE:
post(BP_CONST.POP_BUBBLE, _touchedBubble);
break;
@@ -491,7 +466,6 @@ public void postEvent(String event) {
}
}
-
public void enableTouchEvents() {
super.enableTouchEvents();
}
@@ -506,35 +480,24 @@ public void enableTouchEvents() {
// IBehaviorManager Interface START
public void setVolatileBehavior(String event, String behavior) {
-
if (behavior.toUpperCase().equals(TCONST.NULL)) {
-
- if (volatileMap.containsKey(event)) {
- volatileMap.remove(event);
- }
+ if (volatileMap.containsKey(event)) volatileMap.remove(event);
} else {
volatileMap.put(event, behavior);
}
}
-
public void setStickyBehavior(String event, String behavior) {
-
if (behavior.toUpperCase().equals(TCONST.NULL)) {
-
- if (stickyMap.containsKey(event)) {
- stickyMap.remove(event);
- }
+ if (stickyMap.containsKey(event)) stickyMap.remove(event);
} else {
stickyMap.put(event, behavior);
}
}
-
- // Execute scirpt target if behavior is defined for this event
+ // Execute script target if behavior is defined for this event
//
public boolean applyBehavior(String event) {
-
boolean result = false;
if (volatileMap.containsKey(event)) {
RoboTutor.logManager.postEvent_D(QGRAPH_MSG, "target:" + TAG + ",action:applybehavior,type:volatile,behavior:" + event);
@@ -543,18 +506,15 @@ public boolean applyBehavior(String event) {
volatileMap.remove(event);
result = true;
-
} else if (stickyMap.containsKey(event)) {
RoboTutor.logManager.postEvent_D(QGRAPH_MSG, "target:" + TAG + ",action:applybehavior,type:sticky,behavior:" + event);
applyBehaviorNode(stickyMap.get(event));
result = true;
}
-
return result;
}
-
/**
* Apply Events in the Tutor Domain.
*
@@ -564,7 +524,6 @@ public boolean applyBehavior(String event) {
public void applyBehaviorNode(String nodeName) {
IScriptable2 obj = null;
if (nodeName != null && !nodeName.equals("") && !nodeName.toUpperCase().equals("NULL")) {
-
try {
obj = mTutor.getScope().mapSymbol(nodeName);
@@ -574,12 +533,10 @@ public void applyBehaviorNode(String nodeName) {
switch(obj.getType()) {
case TCONST.SUBGRAPH:
-
mTutor.getSceneGraph().post(this, TCONST.SUBGRAPH_CALL, nodeName);
break;
case TCONST.MODULE:
-
// Disallow module "calls"
RoboTutor.logManager.postEvent_E(QGRAPH_MSG, "target:" + TAG + ",action:applybehaviornode,type:modulecall,behavior:" + nodeName + ",ERROR:MODULE Behaviors are not supported");
break;
@@ -588,22 +545,17 @@ public void applyBehaviorNode(String nodeName) {
// which is done internally.
//
case TCONST.QUEUE:
-
- if(obj.testFeatures()) {
- obj.applyNode();
- }
+ if (obj.testFeatures()) obj.applyNode();
break;
default:
-
- if(obj.testFeatures()) {
+ if (obj.testFeatures()) {
obj.preEnter();
obj.applyNode();
}
break;
}
}
-
} catch (Exception e) {
// TODO: Manage invalid Behavior
e.printStackTrace();
@@ -611,18 +563,15 @@ public void applyBehaviorNode(String nodeName) {
}
}
-
// IBehaviorManager Interface END
//************************************************************************
//************************************************************************
-
//************************************************************************
//************************************************************************
// IEventSource Interface START
-
@Override
public String getEventSourceName() {
return name();
@@ -633,66 +582,40 @@ public String getEventSourceType() {
return "BubblePop_Component";
}
-
// IEventSource Interface END
//************************************************************************
//************************************************************************
-
//***********************************************************
// ITutorLogger - Start
private void extractHashContents(StringBuilder builder, HashMap map) {
-
- Iterator> tObjects = map.entrySet().iterator();
-
- while(tObjects.hasNext() ) {
-
- builder.append(',');
-
- Map.Entry entry = (Map.Entry) tObjects.next();
-
- String key = entry.getKey().toString();
- String value = "#" + entry.getValue().toString();
-
- builder.append(key);
- builder.append(value);
+ for (Object entry : map.entrySet()) {
+ builder.append("," + ((Map.Entry)entry).getKey().toString());
+ builder.append("#" + ((Map.Entry)entry).getValue().toString());
}
}
private void extractFeatureContents(StringBuilder builder, HashMap map) {
-
- StringBuilder featureset = new StringBuilder();
-
- Iterator> tObjects = map.entrySet().iterator();
-
// Scan to build a list of active features
//
- while(tObjects.hasNext() ) {
-
- Map.Entry entry = (Map.Entry) tObjects.next();
+ StringBuilder featureSet = new StringBuilder();
- Boolean value = (Boolean) entry.getValue();
-
- if(value) {
- featureset.append(entry.getKey().toString() + ";");
- }
+ for (Object entry : map.entrySet()) {
+ if ((Boolean)((Map.Entry)entry).getValue()) featureSet.append(((Map.Entry)entry).getKey().toString() + ";");
}
- // If there are active features then trim the last ',' and add the
- // comma delimited list as the "$features" object.
+ // If there are active features then trim the last ',' and add the comma delimited list as the "$features" object.
//
- if(featureset.length() != 0) {
- featureset.deleteCharAt(featureset.length()-1);
-
- builder.append(",$features#" + featureset.toString());
+ if (featureSet.length() != 0) {
+ featureSet.deleteCharAt(featureSet.length() - 1);
+ builder.append(",$features#" + featureSet.toString());
}
}
@Override
public void logState(String logData) {
-
StringBuilder builder = new StringBuilder();
extractHashContents(builder, _StringVar);
@@ -706,126 +629,117 @@ public void logState(String logData) {
//***********************************************************
-
//************************************************************************
//************************************************************************
// IPublish component state data - START
- /**
- * Publish the Stimulus value as Scope variables for script access
- */
@Override
- protected void publishState(CBubble bubble, CBubbleStimulus bubbleStimulus) {
-
+ protected void prepareState(CBubble bubble, CBubbleStimulus bubbleStimulus) {
_touchedBubble = bubble;
_bubbleStimulus = bubbleStimulus;
+ publishState(bubble);
+ checkBubble(bubble);
+ trackAndLogPerformance(bubble);
+ }
- TScope scope = mTutor.getScope();
+ /**
+ * Publish the Stimulus value as Scope variables for script access
+ */
+ @Override
+ protected void publishState(CBubble bubble) {
String answer = bubble.getStimulus();
// Ensure letters are lowercase for mp3 matching
//
- if(answer.length() == 1) {
- answer = answer.toLowerCase();
- }
+ if (answer.length() == 1) answer = answer.toLowerCase();
- if(mProblemType.equals("EXPRESSION_N2E")) {
+ if (mProblemType.equals("EXPRESSION_N2E")) {
publishFeature(BP_CONST.FTR_N2E);
String[] expTerms = splitExpression(answer, "\n");
- int operand1 = Integer.parseInt(expTerms[0]); int operand2 = Integer.parseInt(expTerms[2]);
+ int operand1 = Integer.parseInt(expTerms[0]);
+ int operand2 = Integer.parseInt(expTerms[2]);
String operation = expTerms[1];
- int[] operand1Digits = getListDigits(operand1); int[] operand2Digits = getListDigits(operand2);
+ int[] operand1Digits = getListDigits(operand1);
+ int[] operand2Digits = getListDigits(operand2);
- //Publish features and values for each digit of first operand so that audios for each digit can be played separately
- if(operand1Digits[0] >= 100) {
+ // Publish features and values for each digit of first operand so that audios for each digit can be played separately
+ if (operand1Digits[0] >= 100) {
publishFeature(BP_CONST.FTR_ANS_STIM_ONE_HUNDREDS);
publishValue(BP_CONST.ANS_VAR_STIM_ONE_HUNDREDS, operand1Digits[0]);
- }
- else {
+ } else {
removeFeature(BP_CONST.FTR_ANS_STIM_ONE_HUNDREDS);
}
- if(operand1Digits[1] >= 1 || operand1Digits[0] == 0) {
+ if (operand1Digits[1] >= 1 || operand1Digits[0] == 0) {
publishFeature(BP_CONST.FTR_ANS_STIM_ONE_TENS);
publishValue(BP_CONST.ANS_VAR_STIM_ONE_TENS, operand1Digits[1]);
- }
- else {
+ } else {
removeFeature(BP_CONST.FTR_ANS_STIM_ONE_TENS);
}
publishValue(BP_CONST.ANS_VAR_OPERAND, operation);
- //Publish features and values for each digit of second operand so that audios for each digit can be played separately
- if(operand2Digits[0] >= 100) {
+ // Publish features and values for each digit of second operand so that audios for each digit can be played separately
+ if (operand2Digits[0] >= 100) {
publishFeature(BP_CONST.FTR_ANS_STIM_TWO_HUNDREDS);
publishValue(BP_CONST.ANS_VAR_STIM_TWO_HUNDREDS, operand2Digits[0]);
- }
- else {
+ } else {
removeFeature(BP_CONST.FTR_ANS_STIM_TWO_HUNDREDS);
}
- if(operand2Digits[1] >= 1 || operand2Digits[0] == 0 ) {
+ if (operand2Digits[1] >= 1 || operand2Digits[0] == 0) {
publishFeature(BP_CONST.FTR_ANS_STIM_TWO_TENS);
publishValue(BP_CONST.ANS_VAR_STIM_TWO_TENS, operand2Digits[1]);
- }
- else {
+ } else {
removeFeature(BP_CONST.FTR_ANS_STIM_TWO_TENS);
}
- }
- else {
- if(mProblemType.startsWith("EXPRESSION_E2N")) {
- publishFeature(BP_CONST.FTR_E2N);
- }
+ } else {
+ if (mProblemType.startsWith("EXPRESSION_E2N")) publishFeature(BP_CONST.FTR_E2N);
- if(answer != null && answer.matches("[-+]?\\d*\\.?\\d+")) {
+ if (answer != null && answer.matches("[-+]?\\d*\\.?\\d+")) {
int ans = Integer.parseInt(answer);
int[] ansDigits = getListDigits(ans);
-
- if(ansDigits[0] >= 100) {
+ if (ansDigits[0] >= 100) {
publishFeature(BP_CONST.FTR_ANS_HUNDREDS);
publishValue(BP_CONST.ANS_VAR_HUNDREDS, ansDigits[0]);
- }
- else {
+ } else {
removeFeature(BP_CONST.FTR_ANS_HUNDREDS);
}
- if(ansDigits[1] >= 1 || ansDigits[0] == 0) {
+ if (ansDigits[1] >= 1 || ansDigits[0] == 0) {
publishFeature(BP_CONST.FTR_ANS_TENS);
publishValue(BP_CONST.ANS_VAR_TENS, ansDigits[1]);
- }
- else {
+ } else {
removeFeature(BP_CONST.FTR_ANS_TENS);
}
- }
- else {
+ } else {
publishValue(BP_CONST.ANS_VAR, answer);
-
}
}
+ }
+ private void checkBubble(CBubble bubble) {
resetValid();
if (bubble.isCorrect()) {
publishFeature(TCONST.GENERIC_RIGHT);
- Log.d("BPOP", "Correct" );
+ Log.d(TAG, "Correct");
correct_Count++;
-
} else {
publishFeature(TCONST.GENERIC_WRONG);
- Log.d("BPOP", "Wrong" );
+ Log.d(TAG, "Wrong");
attempt_count--;
- if(attempt_count <= 0) {
+ if (attempt_count <= 0) {
publishFeature(TCONST.LAST_ATTEMPT);
- Log.d("BPOP", "Publish Last Attempt" );
+ Log.d(TAG, "Publish Last Attempt");
}
}
- Log.d("BPOP", "Publish correct Count: " + correct_Count);
- Log.d("BPOP", "Publish attempt Count: " + attempt_count);
+ Log.d(TAG, "Publish correct Count: " + correct_Count);
+ Log.d(TAG, "Publish attempt Count: " + attempt_count);
trackAndLogPerformance(bubble);
-
}
/**
@@ -833,21 +747,14 @@ protected void publishState(CBubble bubble, CBubbleStimulus bubbleStimulus) {
* tracking performance for Activity Selection and for Logging.
*/
private void trackAndLogPerformance(CBubble bubble) {
- // XXX_LL Begin changes
-
- if (bubble.isCorrect()) {
- mTutor.countCorrect();
- } else {
- mTutor.countIncorrect();
- }
+ if (bubble.isCorrect()) mTutor.countCorrect();
+ else mTutor.countIncorrect();
PerformanceLogItem event = new PerformanceLogItem();
String problemName = "BPOP_" + _currData.answer + "_";
- for(int i = 0; i < _currData.response_set.length-1; i++) {
- problemName += _currData.response_set[i] + "-";
- }
- problemName += _currData.response_set[_currData.response_set.length-1] + "";
+ for (int i = 0; i < _currData.response_set.length - 1; i++) problemName += _currData.response_set[i] + "-";
+ problemName += _currData.response_set[_currData.response_set.length - 1] + "";
String promptType = "";
if (_currData.question_say) promptType += "say";
@@ -870,9 +777,8 @@ private void trackAndLogPerformance(CBubble bubble) {
event.setExpectedAnswer(_currData.answer);
StringBuilder distractors = new StringBuilder();
- for(int i = 0; i < _currData.response_set.length; i++) {
- if(!_currData.response_set[i].equals(_currData.answer))
- distractors.append(_currData.response_set[i]+"+");
+ for (int i = 0; i < _currData.response_set.length; i++) {
+ if (!_currData.response_set[i].equals(_currData.answer)) distractors.append(_currData.response_set[i] + "+");
}
event.setDistractors(distractors.toString().substring(0, distractors.toString().length() - 1));
@@ -888,10 +794,8 @@ private void trackAndLogPerformance(CBubble bubble) {
}
protected void publishQuestionState(CBp_Data data) {
-
TScope scope = mTutor.getScope();
- resetState();
String correctVal = data.stimulus;
// Ensure letters are lowercase for mp3 matching
@@ -899,17 +803,12 @@ protected void publishQuestionState(CBp_Data data) {
correctVal = correctVal.toLowerCase();
//Cases over the problem type to publish diffferent features and values
- if(mProblemType.startsWith("EXPRESSION_E2N")) {
-
+ if (mProblemType.startsWith("EXPRESSION_E2N")) {
publishFeature("FTR_E2N");
String key = "\n";
- if(mProblemType.equals("EXPRESSION_E2N_ADD")) {
- key = "+";
- }
- else if(mProblemType.equals("EXPRESSION_E2N_SUB")) {
- key = "-";
- }
+ if (mProblemType.equals("EXPRESSION_E2N_ADD")) key = "+";
+ else if (mProblemType.equals("EXPRESSION_E2N_SUB")) key = "-";
String[] expTerms = splitExpression(correctVal, key);
int operand1 = Integer.parseInt(expTerms[0]); int operand2 = Integer.parseInt(expTerms[2]);
@@ -918,146 +817,112 @@ else if(mProblemType.equals("EXPRESSION_E2N_SUB")) {
int[] operand1Digits = getListDigits(operand1); int[] operand2Digits = getListDigits(operand2);
//Publish features and values for each digit of first operand so that audios can be played separately
- if(operand1Digits[0] >= 100) {
+ if (operand1Digits[0] >= 100) {
publishFeature(BP_CONST.FTR_QUEST_STIM_ONE_HUNDREDS);
publishValue(BP_CONST.QUEST_VAR_STIM_ONE_HUNDREDS, operand1Digits[0]);
- }
- else {
+ } else {
removeFeature(BP_CONST.FTR_QUEST_STIM_ONE_HUNDREDS);
}
- if(operand1Digits[1] >= 1 || operand1Digits[0] == 0) {
+ if (operand1Digits[1] >= 1 || operand1Digits[0] == 0) {
publishFeature(BP_CONST.FTR_QUEST_STIM_ONE_TENS);
publishValue(BP_CONST.QUEST_VAR_STIM_ONE_TENS, operand1Digits[1]);
- }
- else {
+ } else {
removeFeature(BP_CONST.FTR_QUEST_STIM_ONE_TENS);
}
publishValue(BP_CONST.QUEST_VAR_OPERAND, operation);
//Publish features and values for each digit of second operand so that audios can be played separately
- if(operand2Digits[0] >= 100) {
+ if (operand2Digits[0] >= 100) {
publishFeature(BP_CONST.FTR_QUEST_STIM_TWO_HUNDREDS);
publishValue(BP_CONST.QUEST_VAR_STIM_TWO_HUNDREDS, operand2Digits[0]);
- }
- else {
+ } else {
removeFeature(BP_CONST.FTR_QUEST_STIM_TWO_HUNDREDS);
}
- if(operand2Digits[1] >= 1 || operand2Digits[0] == 0) {
+ if (operand2Digits[1] >= 1 || operand2Digits[0] == 0) {
publishFeature(BP_CONST.FTR_QUEST_STIM_TWO_TENS);
publishValue(BP_CONST.QUEST_VAR_STIM_TWO_TENS, operand2Digits[1]);
- }
- else {
+ } else {
removeFeature(BP_CONST.FTR_QUEST_STIM_TWO_TENS);
}
- }
- else if(mProblemType.equals("EXPRESSION_N2E")) {
+ } else if (mProblemType.equals("EXPRESSION_N2E")) {
publishFeature(BP_CONST.FTR_N2E);
int ans = Integer.parseInt(correctVal);
int[] ansDigits = getListDigits(ans);
- if(ansDigits[0] >= 100) {
+ if (ansDigits[0] >= 100) {
publishFeature(BP_CONST.FTR_QUEST_HUNDREDS);
publishValue(BP_CONST.QUEST_VAR_HUNDREDS, ansDigits[0]);
- }
- else {
+ } else {
removeFeature(BP_CONST.FTR_QUEST_HUNDREDS);
}
- if(ansDigits[1] >= 1 || ansDigits[0] == 0) {
+ if (ansDigits[1] >= 1 || ansDigits[0] == 0) {
publishFeature(BP_CONST.FTR_QUEST_TENS);
publishValue(BP_CONST.QUEST_VAR_TENS, ansDigits[1]);
- }
- else {
+ } else {
removeFeature(BP_CONST.FTR_QUEST_TENS);
}
- }
- else {
- if(mProblemType.equals("MIS_NUM")) {
- correctVal = "What number belongs here";
- }
- if(mProblemType.equals("GL_GT")) {
- correctVal = "Touch the largest number";
- }
- if(mProblemType.equals("GL_LT")) {
- correctVal = "Touch the smallest number";
- }
- if(correctVal != null && correctVal.matches("[-+]?\\d*\\.?\\d+")) {
+ } else {
+ if (mProblemType.equals("MIS_NUM")) correctVal = "What number belongs here";
+ if (mProblemType.equals("GL_GT")) correctVal = "Touch the largest number";
+ if (mProblemType.equals("GL_LT")) correctVal = "Touch the smallest number";
+
+ if (correctVal != null && correctVal.matches("[-+]?\\d*\\.?\\d+")) {
int ans = Integer.parseInt(correctVal);
int[] ansDigits = getListDigits(ans);
- if(ansDigits[0] >= 100) {
+ if (ansDigits[0] >= 100) {
publishFeature(BP_CONST.FTR_QUEST_HUNDREDS);
publishValue(BP_CONST.QUEST_VAR_HUNDREDS, ansDigits[0]);
- }
- else {
+ } else {
removeFeature(BP_CONST.FTR_QUEST_HUNDREDS);
}
- if(ansDigits[1] >= 1 || ansDigits[0] == 0) {
+ if (ansDigits[1] >= 1 || ansDigits[0] == 0) {
publishFeature(BP_CONST.FTR_QUEST_TENS);
publishValue(BP_CONST.QUEST_VAR_TENS, ansDigits[1]);
- }
- else {
+ } else {
removeFeature(BP_CONST.FTR_QUEST_TENS);
}
- }
- else {
- if(mProblemType.equals("WORD_STARTS_WITH")) {
+ } else {
+ if (mProblemType.equals("WORD_STARTS_WITH")) {
publishFeature(BP_CONST.FTR_WRD_STARTS_WITH);
publishValue(BP_CONST.QUEST_VAR, correctVal);
}
- if(mProblemType.equals("WORD_ENDS_WITH")) {
+ if (mProblemType.equals("WORD_ENDS_WITH")) {
publishFeature(BP_CONST.FTR_WRD_ENDS_WITH);
publishValue(BP_CONST.QUEST_VAR, correctVal);
- }
- else {
+ } else {
publishValue(BP_CONST.QUEST_VAR, correctVal);
}
}
}
-
- if (data.question_say) {
- publishFeature(TCONST.SAY_STIMULUS);
- }
-
- if (data.question_show) {
- publishFeature(TCONST.SHOW_STIMULUS);
- }
}
-
+
@Override
public void publishState() {
}
@Override
public void publishValue(String varName, String value) {
-
_StringVar.put(varName,value);
// update the response variable "."
mTutor.getScope().addUpdateVar(name() + varName, new TString(value));
-
}
@Override
public void publishValue(String varName, int value) {
-
_IntegerVar.put(varName,value);
// update the response variable "."
mTutor.getScope().addUpdateVar(name() + varName, new TInteger(value));
-
}
@Override
public void publishFeatureSet(String featureSet) {
-
- // Add new features - no duplicates
- List featArray = Arrays.asList(featureSet.split(","));
-
- for(String feature : featArray) {
-
+ for (String feature : Arrays.asList(featureSet.split(","))) {
_FeatureMap.put(feature, true);
publishFeature(feature);
}
@@ -1065,12 +930,7 @@ public void publishFeatureSet(String featureSet) {
@Override
public void retractFeatureSet(String featureSet) {
-
- // Add new features - no duplicates
- List featArray = Arrays.asList(featureSet.split(","));
-
- for(String feature : featArray) {
-
+ for (String feature : Arrays.asList(featureSet.split(","))) {
_FeatureMap.put(feature, false);
retractFeature(feature);
}
@@ -1078,7 +938,6 @@ public void retractFeatureSet(String featureSet) {
@Override
public void publishFeature(String feature) {
-
_FeatureMap.put(feature, true);
mTutor.addFeature(feature);
}
@@ -1097,7 +956,6 @@ public void removeFeature(String feature) {
*/
@Override
public void retractFeature(String feature) {
-
_FeatureMap.put(feature, false);
mTutor.delFeature(feature);
}
@@ -1108,20 +966,8 @@ public void retractFeature(String feature) {
*/
@Override
public void publishFeatureMap(HashMap featureMap) {
-
- Iterator> tObjects = featureMap.entrySet().iterator();
-
- while(tObjects.hasNext() ) {
-
- Map.Entry entry = (Map.Entry) tObjects.next();
-
- Boolean active = (Boolean)entry.getValue();
-
- if(active) {
- String feature = (String)entry.getKey();
-
- mTutor.addFeature(feature);
- }
+ for (Object entry : featureMap.entrySet()) {
+ if ((Boolean)((Map.Entry)entry).getValue()) mTutor.addFeature((String)((Map.Entry)entry).getKey());
}
}
@@ -1131,52 +977,34 @@ public void publishFeatureMap(HashMap featureMap) {
*/
@Override
public void retractFeatureMap(HashMap featureMap) {
-
- Iterator> tObjects = featureMap.entrySet().iterator();
-
- while(tObjects.hasNext() ) {
-
- Map.Entry entry = (Map.Entry) tObjects.next();
-
- Boolean active = (Boolean)entry.getValue();
-
- if(active) {
- String feature = (String)entry.getKey();
-
- mTutor.delFeature(feature);
- }
+ for (Object entry : featureMap.entrySet()) {
+ if ((Boolean)((Map.Entry)entry).getValue()) mTutor.delFeature((String)((Map.Entry)entry).getKey());
}
}
// IPublish component state data - EBD
//************************************************************************
//************************************************************************
-
-
-
+
+
//**********************************************************
//**********************************************************
//***************** ITutorObjectImpl Implementation
@Override
public void init(Context context, AttributeSet attrs) {
-
super.init(context, attrs);
mSceneObject = new CObjectDelegate(this);
mSceneObject.init(context, attrs);
}
-
@Override
public void onCreate() {
-
// Do deferred listeners configuration - this cannot be done until after the tutor is instantiated
//
- if(!mListenerConfigured) {
- for (String linkedView : mLinkedViews) {
- addEventListener(linkedView);
- }
+ if (!mListenerConfigured) {
+ for (String linkedView : mLinkedViews) addEventListener(linkedView);
mListenerConfigured = true;
}
}
@@ -1186,7 +1014,6 @@ public void onDestroy() {
super.onDestroy();
}
-
@Override
public void setName(String name) {
mSceneObject.setName(name);
@@ -1223,7 +1050,6 @@ public void setLogManager(ILogManager logManager) {
mSceneObject.setLogManager(logManager);
}
-
@Override
public CObjectDelegate getimpl() {
return mSceneObject;
@@ -1231,26 +1057,20 @@ public CObjectDelegate getimpl() {
@Override
public void zoomInOut(Float scale, Long duration) {
-
}
@Override
public void wiggle(String direction, Float magnitude, Long duration, Integer repetition) {
-
}
@Override
public void setAlpha(Float alpha) {
-
}
-
// *** Serialization
-
@Override
public void loadJSON(JSONObject jsonObj, IScope scope) {
-
// Log.d(TAG, "Loader iteration");
super.loadJSON(jsonObj, (IScope2) scope);
diff --git a/comp_akira/src/main/java/cmu/xprize/ak_component/CAkPlayer.java b/comp_akira/src/main/java/cmu/xprize/ak_component/CAkPlayer.java
index a03c0ae38..d4a728171 100644
--- a/comp_akira/src/main/java/cmu/xprize/ak_component/CAkPlayer.java
+++ b/comp_akira/src/main/java/cmu/xprize/ak_component/CAkPlayer.java
@@ -182,10 +182,12 @@ public void onTouch(MotionEvent event){
touchX = event.getX()/xratio; touchY = event.getY()/yratio;}
//Change to left lane
- float line1 = (float)(-1.018*touchY +1678);
+ //float line1 = (float)(-1.018*touchY +1678);
+ float line1 = (float)(-1.018*touchY +1287); // 400 pixel offset to exapnd left tap area
float line2 = (float)(-0.3353*touchY+1398);
float line3 = (float)(0.3736*touchY+1101);
- float line4 = (float)(0.9898*touchY+860);
+ //float line4 = (float)(0.9898*touchY+860);
+ float line4 = (float)(0.9898*touchY+1260); // 400 pixel offset to expand right tap area
if(touchY>750){
if (touchX>=line1 && touchX
-
-
-
+
+
+
\ No newline at end of file
diff --git a/comp_banner/src/main/res/drawable/back_button_focus.xml b/comp_banner/src/main/res/drawable/back_button_focus.xml
index 952a61b69..883301162 100644
--- a/comp_banner/src/main/res/drawable/back_button_focus.xml
+++ b/comp_banner/src/main/res/drawable/back_button_focus.xml
@@ -8,35 +8,35 @@
+ android:pathData="M 20.7 12.7 H 96.8 V 49.3 H 20.7 V 12.7 Z" />
+ android:pathData="M25.7,50h66.1c2.8,0,5-2.3,5-5V18.4c0-2.8-2.3-5-5-5H25.7c-2.8,0-5,2.3-5,5V45C20.7,47.8,23,50,25.7,50z" />
+ android:pathData="M73.7,23.1v14.2c0,0,0.4,1.5-1.7,1.5s-18.9,0-18.9,0l-8.5-7.8c0,0-1.1-1.2,0-1.9c1.1-0.7,8.7-7.2,8.7-7.2h19.7
+C72.8,21.8,73.8,21.7,73.7,23.1z" />
+ android:pathData="M25.7,49.3h66.1c2.8,0,5-2.3,5-5V17.7c0-2.8-2.3-5-5-5H25.7c-2.8,0-5,2.3-5,5v26.6C20.7,47,23,49.3,25.7,49.3z" />
+ android:pathData="M73.8,23.1v14.2c0,0,0.3,1.6-1.9,1.6s-18.9,0-18.9,0l-8.5-7.9c0,0-1.1-1.2,0-1.9c1.1-0.7,8.7-7.2,8.7-7.2h19.7
+C72.8,21.8,73.8,21.8,73.8,23.1z" />
+ android:pathData="M25.7,49.3h66.1c2.8,0,5-2.3,5-5V17.7c0-2.8-2.3-5-5-5H25.7c-2.8,0-5,2.3-5,5v26.6C20.7,47,23,49.3,25.7,49.3z" />
+ android:pathData="M73.8,23.1v14.2c0,0,0.3,1.6-1.9,1.6s-18.9,0-18.9,0l-8.5-7.9c0,0-1.1-1.2,0-1.9c1.1-0.7,8.7-7.2,8.7-7.2h19.7
+C72.8,21.8,73.8,21.8,73.8,23.1z" />
\ No newline at end of file
diff --git a/comp_banner/src/main/res/drawable/back_button_normal.xml b/comp_banner/src/main/res/drawable/back_button_normal.xml
index 606ef0734..952a61b69 100644
--- a/comp_banner/src/main/res/drawable/back_button_normal.xml
+++ b/comp_banner/src/main/res/drawable/back_button_normal.xml
@@ -8,35 +8,35 @@
+ android:pathData="M 5.1 5 H 112.6 V 56.7 H 5.1 V 5 Z" />
+ android:pathData="M10.1,57.7h97.5c2.8,0,5-2.3,5-5V11c0-2.8-2.3-5-5-5H10.1c-2.8,0-5,2.3-5,5v41.7C5.1,55.4,7.3,57.7,10.1,57.7z" />
+ android:pathData="M79.8,19.7v20c0,0,0.5,2.1-2.5,2.1s-26.7,0-26.7,0l-12-11.1c0,0-1.5-1.7,0-2.7s12.3-10.2,12.3-10.2h27.7
+C78.6,17.8,79.9,17.8,79.8,19.7z" />
+ android:pathData="M10.1,56.6h97.5c2.8,0,5-2.3,5-5V10c0-2.8-2.3-5-5-5H10.1c-2.8,0-5,2.3-5,5v41.7C5.1,54.4,7.3,56.6,10.1,56.6z" />
+ android:pathData="M79.8,19.7v20c0,0,0.5,2.1-2.5,2.1s-26.7,0-26.7,0l-12-11.1c0,0-1.5-1.7,0-2.7s12.3-10.2,12.3-10.2h27.7
+C78.6,17.8,79.9,17.9,79.8,19.7z" />
+ android:pathData="M10.1,56.6h97.5c2.8,0,5-2.3,5-5V10c0-2.8-2.3-5-5-5H10.1c-2.8,0-5,2.3-5,5v41.7C5.1,54.4,7.3,56.6,10.1,56.6z" />
+ android:pathData="M79.8,19.7v20c0,0,0.5,2.1-2.5,2.1s-26.7,0-26.7,0l-12-11.1c0,0-1.5-1.7,0-2.7s12.3-10.2,12.3-10.2h27.7
+C78.6,17.8,79.8,16.7,79.8,19.7z" />
\ No newline at end of file
diff --git a/comp_banner/src/main/res/drawable/back_button_pressed.xml b/comp_banner/src/main/res/drawable/back_button_pressed.xml
index a51f8db6f..883301162 100644
--- a/comp_banner/src/main/res/drawable/back_button_pressed.xml
+++ b/comp_banner/src/main/res/drawable/back_button_pressed.xml
@@ -8,35 +8,35 @@
+ android:pathData="M 20.7 12.7 H 96.8 V 49.3 H 20.7 V 12.7 Z" />
+ android:pathData="M25.7,50h66.1c2.8,0,5-2.3,5-5V18.4c0-2.8-2.3-5-5-5H25.7c-2.8,0-5,2.3-5,5V45C20.7,47.8,23,50,25.7,50z" />
+ android:pathData="M73.7,23.1v14.2c0,0,0.4,1.5-1.7,1.5s-18.9,0-18.9,0l-8.5-7.8c0,0-1.1-1.2,0-1.9c1.1-0.7,8.7-7.2,8.7-7.2h19.7
+C72.8,21.8,73.8,21.7,73.7,23.1z" />
+ android:pathData="M25.7,49.3h66.1c2.8,0,5-2.3,5-5V17.7c0-2.8-2.3-5-5-5H25.7c-2.8,0-5,2.3-5,5v26.6C20.7,47,23,49.3,25.7,49.3z" />
+ android:pathData="M73.8,23.1v14.2c0,0,0.3,1.6-1.9,1.6s-18.9,0-18.9,0l-8.5-7.9c0,0-1.1-1.2,0-1.9c1.1-0.7,8.7-7.2,8.7-7.2h19.7
+C72.8,21.8,73.8,21.8,73.8,23.1z" />
+ android:pathData="M25.7,49.3h66.1c2.8,0,5-2.3,5-5V17.7c0-2.8-2.3-5-5-5H25.7c-2.8,0-5,2.3-5,5v26.6C20.7,47,23,49.3,25.7,49.3z" />
+ android:pathData="M73.8,23.1v14.2c0,0,0.3,1.6-1.9,1.6s-18.9,0-18.9,0l-8.5-7.9c0,0-1.1-1.2,0-1.9c1.1-0.7,8.7-7.2,8.7-7.2h19.7
+C72.8,21.8,73.8,21.8,73.8,23.1z" />
\ No newline at end of file
diff --git a/comp_bubblepop/src/main/java/cmu/xprize/bp_component/BP_CONST.java b/comp_bubblepop/src/main/java/cmu/xprize/bp_component/BP_CONST.java
index 7c79f73cb..cc7f4c3b1 100644
--- a/comp_bubblepop/src/main/java/cmu/xprize/bp_component/BP_CONST.java
+++ b/comp_bubblepop/src/main/java/cmu/xprize/bp_component/BP_CONST.java
@@ -54,10 +54,10 @@ public class BP_CONST {
public static final String SHOW_BUBBLES = "SHOW_BUBBLES";
public static final String CLEAR_CONTENT = "CLEAR_CONTENT";
public static final String SPAWN_BUBBLE = "SPAWN_BUBBLE";
+ public static final String NEXT_BUBBLE = "NEXT_BUBBLE";
public static final String WIGGLE_BUBBLE = "WIGGLE_BUBBLE";
public static final String POP_BUBBLE = "POP_BUBBLE";
- public static final String INFLATE = "INFLATE_BUBBLE";
- public static final long INFLATE_DELAY = 200;
+ public static final int SPAWN_DELAY = 200;
public static final String SHOW_STIMULUS = "SHOW_STIMULUS";
public static final String REMOVE_BUBBLE = "REMOVE_BUBBLE";
public static final String REPLACE_BUBBLE = "REPLACE_BUBBLE";
@@ -102,29 +102,22 @@ public class BP_CONST {
public static final String RESUME_ANIMATION = "RESUME_ANIMATION";
public static final int MAX_ATTEMPT = 3;
+ public static final String SPAWN_DELAY_VAR = ".spawnDelay";
public static final String SOUND_TRACK = ".sound_track";
public static final String QUEST_VAR = ".questValue";
- public static final String ANSWER_VAR = ".ansValue";
-
- public static final String QUEST_VAR_TWO = ".questValueTwo";
- public static final String ANSWER_VAR_TWO = ".ansValueTwo";
-
- public static final String QUEST_VAR_THREE = ".questValueThree";
- public static final String ANSWER_VAR_THREE = ".ansValueThree";
-
- public static final String ANS_VAR = ".ansValue";
+ public static final String ANS_VAR = ".ansValue";
public static final String QUEST_VAR_HUNDREDS = ".questValueHundreds";
public static final String QUEST_VAR_TENS = ".questValueTens";
- public static final String QUEST_VAR_ONES = ".questValueOnes";
- public static final String ANS_VAR_HUNDREDS= ".ansValueHundreds";
- public static final String ANS_VAR_TENS = ".ansValueTens";
- public static final String ANS_VAR_ONES = ".ansValueOnes";
+ public static final String QUEST_VAR_ONES = ".questValueOnes";
+ public static final String ANS_VAR_HUNDREDS = ".ansValueHundreds";
+ public static final String ANS_VAR_TENS = ".ansValueTens";
+ public static final String ANS_VAR_ONES = ".ansValueOnes";
public static final String QUEST_VAR_STIM_ONE_HUNDREDS = ".questValueStimOneHundreds";
public static final String QUEST_VAR_STIM_ONE_TENS = ".questValueStimOneTens";
- public static final String QUEST_VAR_OPERAND = ".questValueOperand";
+ public static final String QUEST_VAR_OPERAND = ".questValueOperand";
public static final String QUEST_VAR_STIM_TWO_HUNDREDS = ".questValueStimTwoHundreds";
public static final String QUEST_VAR_STIM_TWO_TENS = ".questValueStimTwoTens";
diff --git a/comp_bubblepop/src/main/java/cmu/xprize/bp_component/CBP_Component.java b/comp_bubblepop/src/main/java/cmu/xprize/bp_component/CBP_Component.java
index fae375c3a..9e8be5a85 100644
--- a/comp_bubblepop/src/main/java/cmu/xprize/bp_component/CBP_Component.java
+++ b/comp_bubblepop/src/main/java/cmu/xprize/bp_component/CBP_Component.java
@@ -71,7 +71,7 @@ public class CBP_Component extends FrameLayout implements IEventDispatcher, ILoa
protected IBubbleMechanic _mechanics;
- private boolean correct = false;
+ private boolean correct = false;
public int attempt_count;
protected int correct_Count;
@@ -79,8 +79,7 @@ public class CBP_Component extends FrameLayout implements IEventDispatcher, ILoa
private HashMap queueMap = new HashMap();
private boolean _qDisabled = false;
- protected LocalBroadcastManager bManager;
-
+ protected LocalBroadcastManager bManager;
// Working data sets
//
@@ -97,7 +96,6 @@ public class CBP_Component extends FrameLayout implements IEventDispatcher, ILoa
public ArrayList wrk_stimTypeSet = null; // text/reference - for mixed stimulus items
public ArrayList wrk_stimulus_script = null; // List of uttereances describing each question
-
// Note: Having independent response sets and answer sets means that the response sets are not limited to the
// set of answers to questions.
//
@@ -135,7 +133,6 @@ public class CBP_Component extends FrameLayout implements IEventDispatcher, ILoa
static final String TAG = "CBP_Component";
-
public CBP_Component(Context context) {
super(context);
init(context, null);
@@ -152,34 +149,22 @@ public CBP_Component(Context context, AttributeSet attrs, int defStyleAttr) {
}
-
public void init(Context context, AttributeSet attrs) {
-
mContext = context;
inflate(getContext(), R.layout.bubblepop_container, this);
- if(attrs != null) {
-
- TypedArray a = context.getTheme().obtainStyledAttributes(
- attrs,
- R.styleable.RoboTutor,
- 0, 0);
+ if (attrs != null) {
+ TypedArray attributes = context.getTheme().obtainStyledAttributes(attrs, R.styleable.RoboTutor, 0, 0);
try {
+ mDataSource = attributes.getString(R.styleable.RoboTutor_dataSource);
- mDataSource = a.getString(R.styleable.RoboTutor_dataSource);
-
- String linkedViews;
-
- linkedViews = a.getNonResourceString(R.styleable.RoboTutor_linked_views);
-
- if(linkedViews != null) {
- mLinkedViews = Arrays.asList(linkedViews.split(","));
- }
+ String linkedViews = attributes.getNonResourceString(R.styleable.RoboTutor_linked_views);
+ if (linkedViews != null) mLinkedViews = Arrays.asList(linkedViews.split(","));
} finally {
- a.recycle();
+ attributes.recycle();
}
}
@@ -207,20 +192,28 @@ public CBP_LetterBoxLayout getContainer() {
return Scontent;
}
-
public void onDestroy() {
-
terminateQueue();
- if(_mechanics != null) {
+ if (_mechanics != null) {
_mechanics.onDestroy();
_mechanics = null;
}
}
+ /**
+ * Override in TClass
+ * @param feature
+ * @param fadd
+ */
+ public void setFeature(String feature, boolean fadd) {
+ }
+
+ public boolean testFeature(String feature) {
+ return false;
+ }
public void setDataSource(CBp_Data[] _dataSource) {
-
dataSource = _dataSource;
_dataIndex = 0;
@@ -231,66 +224,52 @@ public void setDataSource(CBp_Data[] _dataSource) {
correct_Count = 0;
}
-
private String[] populateArray(String source, int size) {
-
String[] target = new String[size];
- for(int i1 = 0 ; i1 < size ; i1++) {
- target[i1] = source;
- }
+ for (int i1 = 0 ; i1 < size ; i1++) target[i1] = source;
return target;
}
-
/**
* These are convenience operations so the datasource doesn't need redundant info
* in its encoded JSON form.
*/
protected void preProcessDataSource() {
-
// If question count is 0 - show all item in the stimulus set
//
- if(question_count == 0) {
- question_count = gen_stimulusSet.length;
- }
+ if (question_count == 0) question_count = gen_stimulusSet.length;
// gen_xxx...type values are used when the type is consistent throughout
// so we populate the xxx...typeSet array with this value.
//
- if(gen_responsetype != null)
- gen_respTypeSet = populateArray(gen_responsetype, gen_responseSet.length);
+ if (gen_responsetype != null) gen_respTypeSet = populateArray(gen_responsetype, gen_responseSet.length);
- if(gen_answertype != null)
- gen_answerTypeSet = populateArray(gen_answertype, gen_answerSet.length);
+ if (gen_answertype != null) gen_answerTypeSet = populateArray(gen_answertype, gen_answerSet.length);
- if(gen_stimulustype != null)
- gen_stimTypeSet = populateArray(gen_stimulustype, gen_stimulusSet.length);
+ if (gen_stimulustype != null) gen_stimTypeSet = populateArray(gen_stimulustype, gen_stimulusSet.length);
// Once per problem set we init these arraylists.
// populate the working ArrayList so we can easily delete elements on demand
// TODO: update jSONHelper to support ArrayList serialization if possible.
//
- wrk_answerSet = new ArrayList(Arrays.asList(gen_answerSet));
- wrk_answerTypeSet = new ArrayList(Arrays.asList(gen_answerTypeSet));
+ wrk_answerSet = new ArrayList(Arrays.asList(gen_answerSet));
+ wrk_answerTypeSet = new ArrayList(Arrays.asList(gen_answerTypeSet));
- if(gen_answer_script != null)
- wrk_answer_script = new ArrayList(Arrays.asList(gen_answer_script));
+ if (gen_answer_script != null) wrk_answer_script = new ArrayList(Arrays.asList(gen_answer_script));
+ wrk_stimulusSet = new ArrayList(Arrays.asList(gen_stimulusSet));
+ wrk_stimTypeSet = new ArrayList(Arrays.asList(gen_stimTypeSet));
- wrk_stimulusSet = new ArrayList(Arrays.asList(gen_stimulusSet));
- wrk_stimTypeSet = new ArrayList(Arrays.asList(gen_stimTypeSet));
-
- if(gen_stimulus_script != null)
- wrk_stimulus_script = new ArrayList(Arrays.asList(gen_stimulus_script));
+ if (gen_stimulus_script != null) wrk_stimulus_script = new ArrayList(Arrays.asList(gen_stimulus_script));
// Preprocess the response set data so the size is available for the randomizer
//
preProcessQuestion();
//Randomly shuffle questions in datasource (from stackoverflow)
- if(question_sequence.equals("RANDOM")) {
+ if (question_sequence.equals("RANDOM")) {
for (int i = dataSource.length - 1; i > 0; i--) {
int j = (int)(Math.floor(Math.random() * (i + 1)));
CBp_Data f = dataSource[i];
@@ -298,16 +277,11 @@ protected void preProcessDataSource() {
dataSource[j] = f;
}
}
-
}
-
public void next() {
-
try {
-
if (dataSource != null) {
-
updateDataSet(dataSource[_dataIndex]);
// We cycle through the dataSource question types iteratively
@@ -328,28 +302,23 @@ public void next() {
} else {
CErrorManager.logEvent(TAG, "Error no DataSource : ", null, false);
}
- }
- catch(Exception e) {
+ } catch(Exception e) {
CErrorManager.logEvent(TAG, "Data Exhuasted: call past end of data", e, false);
}
}
-
public boolean dataExhausted() {
return (question_count <= 0)? true:false;
}
-
protected void updateDataSet(CBp_Data data) {
-
_currData = data;
- if(_mechanics != null) {
+ if (_mechanics != null) {
_mechanics.onDestroy();
_mechanics = null;
}
- switch(data.question_type.toLowerCase()) {
-
+ switch (data.question_type.toLowerCase()) {
case "mc":
case "multiplechoice":
case "multiple-choice":
@@ -367,10 +336,7 @@ protected void updateDataSet(CBp_Data data) {
requestLayout();
}
-
protected void selectQuestion(CBp_Data data) {
-
-
//***** Select the question from the stimulus set
//
// Get the number of questions available.
@@ -381,154 +347,117 @@ protected void selectQuestion(CBp_Data data) {
// current correct index in the "correct" i.e. stimulus bubble. To
// ensure there is at least one correct answer.
//
- if(question_sequence.toUpperCase().equals(BP_CONST.SEQUENTIAL)) {
-
- // cycle on the wrk_stimulusSet
- //
- question_Index %= questionCount;
- }
- else {
-
- question_Index = (int) (Math.random() * questionCount);
- }
+ // cycle on the wrk_stimulusSet
+ //
+ if (question_sequence.toUpperCase().equals(BP_CONST.SEQUENTIAL)) question_Index %= questionCount;
+ else question_Index = (int)(Math.random() * questionCount);
- data.stimulus = wrk_stimulusSet.get(question_Index);
- data.stimulus_type = wrk_stimTypeSet.get(question_Index);
- if(wrk_stimulus_script != null)
- data.stimulus_script = wrk_stimulus_script.get(question_Index);
+ data.stimulus = wrk_stimulusSet.get(question_Index);
+ data.stimulus_type = wrk_stimTypeSet.get(question_Index);
+ if (wrk_stimulus_script != null) data.stimulus_script = wrk_stimulus_script.get(question_Index);
- data.answer = wrk_answerSet.get(question_Index);
- data.answer_type = wrk_answerTypeSet.get(question_Index);
- if(wrk_answer_script != null)
- data.answer_script = wrk_answer_script.get(question_Index);
+ data.answer = wrk_answerSet.get(question_Index);
+ data.answer_type = wrk_answerTypeSet.get(question_Index);
+ if (wrk_answer_script != null) data.answer_script = wrk_answer_script.get(question_Index);
// If not using replacement on random selection - i.e. if questions may NOT be repeated
// then remove the question/answer entry
//
- if(!question_replacement && !question_sequence.toUpperCase().equals(BP_CONST.SEQUENTIAL)) {
-
+ if (!question_replacement && !question_sequence.toUpperCase().equals(BP_CONST.SEQUENTIAL)) {
wrk_stimulusSet.remove(question_Index);
wrk_stimTypeSet.remove(question_Index);
- if(wrk_stimulus_script != null)
- wrk_stimulus_script.remove(question_Index);
+ if (wrk_stimulus_script != null) wrk_stimulus_script.remove(question_Index);
wrk_answerSet.remove(question_Index);
wrk_answerTypeSet.remove(question_Index);
- if(wrk_answer_script != null)
- wrk_answer_script.remove(question_Index);
+ if (wrk_answer_script != null) wrk_answer_script.remove(question_Index);
}
}
-
/**
*
*/
protected void preProcessQuestion() {
-
// For each question we repopulate these arraylists
// populate the working ArrayList so we can easily delete elements on demand
//
- wrk_responseSet = new ArrayList(Arrays.asList(gen_responseSet));
- wrk_respTypeSet = new ArrayList(Arrays.asList(gen_respTypeSet));
+ wrk_responseSet = new ArrayList(Arrays.asList(gen_responseSet));
+ wrk_respTypeSet = new ArrayList(Arrays.asList(gen_respTypeSet));
- if(gen_response_script != null)
- wrk_response_script = new ArrayList(Arrays.asList(gen_response_script));
+ if (gen_response_script != null) wrk_response_script = new ArrayList(Arrays.asList(gen_response_script));
}
-
protected void selectRandResponse(CBp_Data data, int count, int ansIndex) {
-
// First find the actual answer in the response set and trim it out
// to avoid duplicate answer items in the respsonse set
//
String question = data.answer;
String questype = data.answer_type;
- for(int i1 = 0 ; i1 < wrk_responseSet.size() ; i1++) {
-
- if(wrk_responseSet.get(i1).equals(question) &&
- wrk_respTypeSet.get(i1).equals(questype)) {
-
+ for (int i1 = 0; i1 < wrk_responseSet.size(); i1++) {
+ if (wrk_responseSet.get(i1).equals(question) && wrk_respTypeSet.get(i1).equals(questype)) {
wrk_responseSet.remove(i1);
wrk_respTypeSet.remove(i1);
- if(wrk_response_script != null)
- wrk_response_script.remove(i1);
+ if (wrk_response_script != null) wrk_response_script.remove(i1);
break;
}
}
- // Reset the presenation / response set
+ // Reset the presentation / response set
//
data.response_set = new String[count];
data.responsetype_set = new String[count];
- if(data.response_script != null)
- data.response_script = new String[count][];
+ if (data.response_script != null) data.response_script = new String[count][];
// Build a presentation set from the responseset samples
//
-
- for (int i1 = 0; i1 < count ; i1++) {
-
+ for (int i1 = 0; i1 < count; i1++) {
// Place the answer at the requested location in the presentation array
//
- if(i1 == ansIndex) {
-
+ if (i1 == ansIndex) {
data.response_set[ansIndex] = data.stimulus;
data.responsetype_set[ansIndex] = data.stimulus_type; // YOGURT is reference when shouldn't be
data.responsetype_set[ansIndex] = wrk_respTypeSet.get(0); // YOGURT hacky
- if(data.response_script != null)
- data.response_script[ansIndex] = data.stimulus_script;
- }
-
- // Otherwise place a random choice from the responseSet with or without
- // replacement
- //
- else {
-
- int randIndex = (int) (Math.random() * wrk_responseSet.size());
+ if (data.response_script != null) data.response_script[ansIndex] = data.stimulus_script;
+ } else {
+ // Otherwise place a random choice from the responseSet with or without
+ // replacement
+ //
+ int randIndex = (int)(Math.random() * wrk_responseSet.size());
data.response_set[i1] = wrk_responseSet.get(randIndex);
data.responsetype_set[i1] = wrk_respTypeSet.get(randIndex);
- if (wrk_response_script != null)
- data.response_script[i1] = wrk_response_script.get(randIndex);
+ if (wrk_response_script != null) data.response_script[i1] = wrk_response_script.get(randIndex);
// If not using replacement - i.e. if responses may NOT be repeated then remove
// the response entry
//
if (!response_replacement) {
-
wrk_responseSet.remove(randIndex);
wrk_respTypeSet.remove(randIndex);
- if (wrk_response_script != null)
- wrk_response_script.remove(randIndex);
+ if (wrk_response_script != null) wrk_response_script.remove(randIndex);
}
}
}
}
-
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
-
super.onLayout(changed, l, t, r, b);
- if(changed || ((_mechanics != null) && !_mechanics.isInitialized())) {
+ if (changed || ((_mechanics != null) && !_mechanics.isInitialized())) {
int width = r - l;
int height = b - t;
- if(_mechanics != null)
- _mechanics.doLayout(Scontent.getWidth(), Scontent.getHeight(), _currData);
+ if (_mechanics != null) _mechanics.doLayout(Scontent.getWidth(), Scontent.getHeight(), _currData);
}
}
-
@Override
public void onDraw(Canvas canvas) {
-
super.onDraw(canvas);
}
-
public IBubbleMechanic getMechanics() {
return _mechanics;
}
@@ -536,37 +465,30 @@ public IBubbleMechanic getMechanics() {
public void UpdateValue(int value) {
}
-
protected boolean isCorrect() {
return correct;
}
-
public boolean allCorrect(int numCorrect) {
return (numCorrect == dataSource.length);
}
-
//************************************************************************
//************************************************************************
// Tutor Scriptable methods Start
-
// Must override in TClass
// TClass domain where TScope lives providing access to tutor scriptables
//
- public boolean applyBehavior(String event){ return false;}
-
+ public boolean applyBehavior(String event) {
+ return false;
+ }
public void enableTouchEvents() {
-
- if(_mechanics != null) {
- _mechanics.enableTouchEvents();
- }
+ if (_mechanics != null) _mechanics.enableTouchEvents();
}
-
// Tutor methods End
//************************************************************************
//************************************************************************
@@ -576,12 +498,16 @@ public void enableTouchEvents() {
//************************************************************************
// publish component state data - START
-
// Must override in TClass
// TClass domain where TScope lives providing access to tutor scriptables
//
- protected void publishState(CBubble bubble, CBubbleStimulus bubbleStimulus) {
+ protected void prepareState(CBubble bubble, CBubbleStimulus bubbleStimulus) {
+ }
+ // Must override in TClass
+ // TClass domain where TScope lives providing access to tutor scriptables
+ //
+ protected void publishState(CBubble bubble) {
}
// Must override in TClass
@@ -596,20 +522,16 @@ public void publishValue(String varName, String value) {
public void publishValue(String varName, int value) {
}
-
// publish component state data - EBD
//************************************************************************
//************************************************************************
-
//************************************************************************
//************************************************************************
// Component Message Queue -- Start
-
public class Queue implements Runnable {
-
protected String _command;
protected Object _target;
@@ -626,56 +548,42 @@ public String getCommand() {
return _command;
}
-
@Override
public void run() {
-
try {
queueMap.remove(this);
- if(_mechanics != null) {
- _mechanics.execCommand(_command, _target);
- }
- }
- catch(Exception e) {
+ if (_mechanics != null) _mechanics.execCommand(_command, _target);
+ } catch(Exception e) {
CErrorManager.logEvent(TAG, "Run Error: cmd:" + _command + " tar: " + _target + " >", e, false);
}
}
}
-
/**
- * Disable the input queues permenantly in prep for destruction
- * walks the queue chain to diaable scene queue
+ * Disable the input queues permanently in prep for destruction
+ * walks the queue chain to disable scene queue
*
*/
private void terminateQueue() {
-
- // disable the input queue permenantly in prep for destruction
+ // disable the input queue permanently in prep for destruction
//
_qDisabled = true;
flushQueue();
}
-
/**
* Remove any pending scenegraph commands.
*
*/
private void flushQueue() {
+ for (Object entry : queueMap.entrySet()) {
+ Log.d(TAG, "Post Cancelled on Flush: " + ((Queue)((Map.Entry)entry).getValue()).getCommand());
- Iterator> tObjects = queueMap.entrySet().iterator();
-
- while(tObjects.hasNext() ) {
- Map.Entry entry = (Map.Entry) tObjects.next();
-
- Log.d(TAG, "Post Cancelled on Flush: " + ((Queue)entry.getValue()).getCommand());
-
- mainHandler.removeCallbacks((Queue)(entry.getValue()));
+ mainHandler.removeCallbacks((Queue)((Map.Entry)entry).getValue());
}
}
-
/**
* Keep a mapping of pending messages so we can flush the queue if we want to terminate
* the tutor before it finishes naturally.
@@ -685,17 +593,13 @@ private void flushQueue() {
private void enQueue(Queue qCommand) {
enQueue(qCommand, 0);
}
- private void enQueue(Queue qCommand, long delay) {
- if(!_qDisabled) {
+ private void enQueue(Queue qCommand, long delay) {
+ if (!_qDisabled) {
queueMap.put(qCommand, qCommand);
- if(delay > 0) {
- mainHandler.postDelayed(qCommand, delay);
- }
- else {
- mainHandler.post(qCommand);
- }
+ if (delay > 0) mainHandler.postDelayed(qCommand, delay);
+ else mainHandler.post(qCommand);
}
}
@@ -707,12 +611,11 @@ private void enQueue(Queue qCommand, long delay) {
public void post(String command) {
post(command, 0);
}
- public void post(String command, long delay) {
+ public void post(String command, long delay) {
enQueue(new Queue(command), delay);
}
-
/**
* Post a command and target to this scenegraph queue
*
@@ -721,22 +624,19 @@ public void post(String command, long delay) {
public void post(String command, Object target) {
post(command, target, 0);
}
- public void post(String command, Object target, long delay) {
+ public void post(String command, Object target, long delay) {
enQueue(new Queue(command, target), delay);
}
-
// Component Message Queue -- End
//************************************************************************
//************************************************************************
-
//***********************************************************
// Event Listener/Dispatcher - Start
-
@Override
public boolean isGraphEventSource() {
return false;
@@ -744,32 +644,23 @@ public boolean isGraphEventSource() {
@Override
public void addEventListener(String linkedView) {
-
}
@Override
public void addEventListener(IEventListener listener) {
-
}
@Override
public void dispatchEvent(IEvent event) {
-
- for (IEventListener listener : mListeners) {
- listener.onEvent(event);
- }
+ for (IEventListener listener : mListeners) listener.onEvent(event);
}
// Event Listener/Dispatcher - End
//***********************************************************
-
-
//************ Serialization
-
-
/**
* Load the data source
*
@@ -777,16 +668,12 @@ public void dispatchEvent(IEvent event) {
*/
@Override
public void loadJSON(JSONObject jsonData, IScope scope) {
-
JSON_Helper.parseSelf(jsonData, this, CClassMap.classMap, scope);
_dataIndex = 0;
addView(view_background);
bringChildToFront(Scontent);
- if(banner_color != null) {
-// dispatchEvent(new CEvent(TCONST.SET_BANNER_COLOR, TCONST.VALUE , banner_color));
-
- }
+// if (banner_color != null) dispatchEvent(new CEvent(TCONST.SET_BANNER_COLOR, TCONST.VALUE , banner_color));
}
}
diff --git a/comp_bubblepop/src/main/java/cmu/xprize/bp_component/CBp_Data.java b/comp_bubblepop/src/main/java/cmu/xprize/bp_component/CBp_Data.java
index 7a3867f82..79d1762f0 100644
--- a/comp_bubblepop/src/main/java/cmu/xprize/bp_component/CBp_Data.java
+++ b/comp_bubblepop/src/main/java/cmu/xprize/bp_component/CBp_Data.java
@@ -28,27 +28,30 @@
public class CBp_Data implements ILoadableObject {
// json loadable
- public String question_type = "MC"; // MC (MultipleChoice) or RISEing bubbles
+ public String question_type = "MC"; // MC (MultipleChoice) or RISE (Rising) bubbles
public boolean question_say = false; // Narrate stimulus (question) value
public boolean question_show = false; // show stimulus (question)
+ public boolean target_say = false; // Narrate target (answer) value
+ public boolean target_show = false; // show target (answer)
+
public boolean gen_question = true; // Are questions generated or pre-defined
public int answer_index = -1; // Where answer is placed in response_set (neg -> random)
public String[] response_set = null; // Values for this iteration
public String[] responsetype_set = null; // types for mixed response sets
- public String[][] response_script = null; // List of uttereances describing the individual responses
+ public String[][] response_script = null; // List of utterances describing the individual responses
public int respCountExact = 0; // Number of bubbles to present 0 == gen # in CountRange
- public int[] respCountRange = {5,5}; // Number of bubbles to present in response set
+ public int[] respCountRange = {5, 5}; // Number of bubbles to present in response set
public String stimulus = null; // question value
public String stimulus_type = null; // question type - reference / text_data
- public String [] stimulus_script = null; // List of uttereances describing the question
+ public String [] stimulus_script = null; // List of utterances describing the question
public String answer; // must match unique value in response set
public String answer_type = null; // answer type - reference / text_data
- public String [] answer_script = null; // List of uttereances describing the answer
+ public String [] answer_script = null; // List of utterances describing the answer
public String comp_start_end = null;
public String comp_with_like = null;
@@ -57,7 +60,6 @@ public class CBp_Data implements ILoadableObject {
@Override
public void loadJSON(JSONObject jsonObj, IScope scope) {
-
JSON_Helper.parseSelf(jsonObj, this, CClassMap.classMap, scope);
}
}
diff --git a/comp_bubblepop/src/main/java/cmu/xprize/bp_component/CBp_Mechanic_Base.java b/comp_bubblepop/src/main/java/cmu/xprize/bp_component/CBp_Mechanic_Base.java
index 19d88a1ed..304a39c83 100644
--- a/comp_bubblepop/src/main/java/cmu/xprize/bp_component/CBp_Mechanic_Base.java
+++ b/comp_bubblepop/src/main/java/cmu/xprize/bp_component/CBp_Mechanic_Base.java
@@ -27,7 +27,6 @@
import android.graphics.drawable.Drawable;
import android.support.v4.content.LocalBroadcastManager;
import android.util.Log;
-import android.util.TypedValue;
import android.view.MotionEvent;
import android.view.View;
import android.view.animation.AnticipateInterpolator;
@@ -37,16 +36,12 @@
import android.widget.LinearLayout;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.HashMap;
-import java.util.List;
import cmu.xprize.util.CAnimatorUtil;
import cmu.xprize.util.TCONST;
import static cmu.xprize.util.TCONST.QGRAPH_MSG;
-import static cmu.xprize.util.TCONST.SPEAK_BUTTON;
-import static cmu.xprize.util.TCONST.SUBGRAPH;
public class CBp_Mechanic_Base implements IBubbleMechanic, View.OnTouchListener, View.OnClickListener {
@@ -62,7 +57,7 @@ public class CBp_Mechanic_Base implements IBubbleMechanic, View.OnTouchListener,
private int[] _screenCoord = new int[2];
private long _time;
private long _prevTime;
- protected boolean _enabled = true;
+ protected boolean _enabled = true;
protected float _alpha = 0.80f;
protected float[] _scaleRange = {0.85f, 1.3f};
@@ -70,7 +65,7 @@ public class CBp_Mechanic_Base implements IBubbleMechanic, View.OnTouchListener,
protected CBp_Data _currData;
protected CBubble[] SBubbles;
- protected CBubbleStimulus SbubbleStumulus;
+ protected CBubbleStimulus SbubbleStimulus;
protected CBubbleStimulus SfeedBack;
protected HashMap inflators = new HashMap();
@@ -78,13 +73,10 @@ public class CBp_Mechanic_Base implements IBubbleMechanic, View.OnTouchListener,
private LocalBroadcastManager bManager;
- private String mProblemType;
-
- static final String TAG = "CBp_Mechanic_Base";
+ static final String TAG = "CBp_Mechanic_Base";
protected void init(Context context, CBP_Component parent) {
-
mContext = context;
mComponent = parent;
mParent = parent.getContainer();
@@ -96,20 +88,17 @@ protected void init(Context context, CBP_Component parent) {
@Override
public void onDestroy() {
-
_isRunning = false;
- if(SBubbles != null) {
-
+ if (SBubbles != null) {
for (int i1 = 0; i1 < SBubbles.length; i1++) {
if (SBubbles[i1] != null) {
- mParent.removeView((View) SBubbles[i1]);
+ mParent.removeView(SBubbles[i1]);
SBubbles[i1].onDestroy();
SBubbles[i1] = null;
}
}
- if (SbubbleStumulus != null)
- mParent.removeView((View) SbubbleStumulus);
+ if (SbubbleStimulus != null) mParent.removeView(SbubbleStimulus);
SBubbles = null;
}
@@ -117,7 +106,6 @@ public void onDestroy() {
@Override
public void onDraw(Canvas canvas) {
-
}
@Override
@@ -127,20 +115,16 @@ public boolean isInitialized() {
@Override
public void populateView(CBp_Data data) {
-
}
+
@Override
public void doLayout(int width, int height, CBp_Data data) {
-
}
-
public void removeBubble(CBubble bubble) {
-
mParent.removeView(bubble);
for (int i1 = 0; i1 < SBubbles.length; i1++) {
-
if (SBubbles[i1] == bubble) {
SBubbles[i1] = null;
break;
@@ -148,20 +132,17 @@ public void removeBubble(CBubble bubble) {
}
}
-
public void replaceBubble(CBubble bubble) {
-
CBubble newBubble;
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
mParent.removeView(bubble);
- newBubble = (CBubble) View.inflate(mContext, R.layout.bubble_view, null);
+ newBubble = (CBubble)View.inflate(mContext, R.layout.bubble_view, null);
newBubble.setAlpha(0);
for (int i1 = 0; i1 < SBubbles.length; i1++) {
-
if (SBubbles[i1] == bubble) {
SBubbles[i1] = newBubble;
@@ -170,47 +151,37 @@ public void replaceBubble(CBubble bubble) {
}
}
- mParent.bringChildToFront(SbubbleStumulus);
+ mParent.bringChildToFront(SbubbleStimulus);
}
-
private void showStimulus(CBp_Data data) {
-
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
- SbubbleStumulus = (CBubbleStimulus) View.inflate(mContext, R.layout.bubble_stimulus, null);
+ SbubbleStimulus = (CBubbleStimulus)View.inflate(mContext, R.layout.bubble_stimulus, null);
// Set Color: pass in String e.g. "RED" - Cycle through the colors repetitively
//
- SbubbleStumulus.setScale(0);
- SbubbleStumulus.setAlpha(1.0f);
+ SbubbleStimulus.setScale(0);
+ SbubbleStimulus.setAlpha(1.0f);
switch (data.stimulus_type) {
-
case BP_CONST.REFERENCE:
-
int[] shapeSet = BP_CONST.drawableMap.get(data.stimulus);
-
- Drawable qDrawable = mParent.getResources().getDrawable(shapeSet[0], null);
-
- SbubbleStumulus.setContents(shapeSet[(int) (Math.random() * shapeSet.length)], null, false);
+ SbubbleStimulus.setContents(shapeSet[(int)(Math.random() * shapeSet.length)], null, false);
break;
case BP_CONST.TEXTDATA:
- SbubbleStumulus.setContents(0, data.stimulus, false);
+ SbubbleStimulus.setContents(0, data.stimulus, false);
break;
}
- mParent.addView(SbubbleStumulus, layoutParams);
+ mParent.addView(SbubbleStimulus, layoutParams);
}
-
private void showFeedback(Integer correctCount) {
+ SfeedBack = mParent.findViewById(R.id.Sfeedback);
- SfeedBack = (CBubbleStimulus) mParent.findViewById(R.id.Sfeedback);
-
- if(SfeedBack == null) {
-
+ if (SfeedBack == null) {
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(BP_CONST.FEEDBACK_SIZE, BP_CONST.FEEDBACK_SIZE);
- SfeedBack = (CBubbleStimulus) View.inflate(mContext, R.layout.bubble_stimulus, null);
+ SfeedBack = (CBubbleStimulus)View.inflate(mContext, R.layout.bubble_stimulus, null);
SfeedBack.setScale(0f);
SfeedBack.setAlpha(1.0f);
@@ -225,51 +196,42 @@ private void showFeedback(Integer correctCount) {
mParent.bringChildToFront(SfeedBack);
}
-
- public void execCommand(String command, Object target ) {
-
+ public void execCommand(String command, Object target) {
CBubble bubble;
Animator inflator;
long delay = 0;
- switch(command) {
-
+ switch (command) {
case BP_CONST.WIGGLE_BUBBLE:
bubble = (CBubble)target;
broadcastLocation(TCONST.GLANCEAT, mParent.localToGlobal(bubble.getCenterPosition()));
- Animator wiggler = CAnimatorUtil.configWiggle(bubble, "horizontal",70, 5, 0, 0.10f );
+ Animator wiggler = CAnimatorUtil.configWiggle(bubble, "horizontal",70, 5, 0, 0.10f);
wiggler.addListener(new Animator.AnimatorListener() {
@Override
- public void onAnimationCancel(Animator arg0) {
- //Functionality here
+ public void onAnimationCancel(Animator animation) {
}
@Override
- public void onAnimationStart(Animator arg0) {
- //Functionality here
+ public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
-
mComponent.applyBehavior(BP_CONST.BUBBLE_WIGGLED);
}
@Override
- public void onAnimationRepeat(Animator arg0) {
- //Functionality here
+ public void onAnimationRepeat(Animator animation) {
}
});
wiggler.start();
-
break;
case BP_CONST.REMOVE_BUBBLE:
-
bubble = (CBubble)target;
removeBubble(bubble);
@@ -278,7 +240,6 @@ public void onAnimationRepeat(Animator arg0) {
break;
case BP_CONST.REPLACE_BUBBLE:
-
bubble = (CBubble)target;
replaceBubble(bubble);
@@ -287,20 +248,17 @@ public void onAnimationRepeat(Animator arg0) {
break;
case BP_CONST.SHOW_STIMULUS:
-
// This is a 2 step process - first the stimulus is zoomed then moved to the bottom
// of the screen.
//
- showStimulus((CBp_Data) target);
+ showStimulus((CBp_Data)target);
mComponent.post(BP_CONST.ZOOM_STIMULUS);
break;
-
case BP_CONST.SHOW_SCORE:
-
// We have to be sure that the feedback has been created even if they always
// were in error - where no "SHOW_FEEDBACK" would be given
- showFeedback((Integer) target);
+ showFeedback((Integer)target);
SfeedBack.setX((mParent.getWidth() - SfeedBack.getWidth()) / 2);
SfeedBack.setY((mParent.getHeight() - SfeedBack.getHeight()) / 2);
@@ -308,17 +266,14 @@ public void onAnimationRepeat(Animator arg0) {
inflator = CAnimatorUtil.configZoomIn(SfeedBack, 600, 0, new BounceInterpolator(), 0f, 3.0f);
inflator.start();
-
break;
case BP_CONST.SHOW_FEEDBACK:
-
- showFeedback((Integer) target);
+ showFeedback((Integer)target);
mComponent.post(BP_CONST.ZOOM_FEEDBACK);
break;
case BP_CONST.ZOOM_FEEDBACK:
-
Log.d(TAG, "Width: " + mParent.getWidth() + " - HEIGHT: " + mParent.getHeight());
Log.d(TAG, "Width: " + SfeedBack.getWidth() + " - HEIGHT: " + SfeedBack.getHeight());
@@ -329,24 +284,20 @@ public void onAnimationRepeat(Animator arg0) {
inflator.addListener(new Animator.AnimatorListener() {
@Override
- public void onAnimationCancel(Animator arg0) {
- //Functionality here
+ public void onAnimationCancel(Animator animation) {
}
@Override
- public void onAnimationStart(Animator arg0) {
- //Functionality here
+ public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
-
mComponent.applyBehavior(BP_CONST.FEEDBACK_SHOWN);
}
@Override
- public void onAnimationRepeat(Animator arg0) {
- //Functionality here
+ public void onAnimationRepeat(Animator animation) {
}
});
@@ -354,39 +305,28 @@ public void onAnimationRepeat(Animator arg0) {
break;
case BP_CONST.ZOOM_STIMULUS:
-
// Persona - look at the stimulus
Log.d(TAG, "Width: " + mParent.getWidth() + " - HEIGHT: " + mParent.getHeight());
broadcastLocation(TCONST.GLANCEAT, mParent.localToGlobal(new PointF(mParent.getWidth() / 2, mParent.getHeight() / 2)));
- float height = SbubbleStumulus.getHeight();
- float width = SbubbleStumulus.getWidth();
+ float height = SbubbleStimulus.getHeight();
+ float width = SbubbleStimulus.getWidth();
- SbubbleStumulus.setX((mParent.getWidth() - width) / 2);
- SbubbleStumulus.setY((mParent.getHeight() - height) / 2);
+ SbubbleStimulus.setX((mParent.getWidth() - width) / 2);
+ SbubbleStimulus.setY((mParent.getHeight() - height) / 2);
- float scaleStimulusVal = 3.0f;
- if(width > 500) {
- scaleStimulusVal = 2.5f;
- }
- if(width > 1000) {
- scaleStimulusVal = 1.25f;
- }
- if(width > 2000) {
- scaleStimulusVal = 1.0f;
- }
- inflator = CAnimatorUtil.configZoomIn(SbubbleStumulus, 600, 0, new BounceInterpolator(), 0f, scaleStimulusVal);
+ float scaleStimulusVal = width > 2000 ? 1.0f : width > 1000 ? 1.25f : width > 500 ? 2.5f : 3.0f;
+
+ inflator = CAnimatorUtil.configZoomIn(SbubbleStimulus, 600, 0, new BounceInterpolator(), 0f, scaleStimulusVal);
inflator.addListener(new Animator.AnimatorListener() {
@Override
- public void onAnimationCancel(Animator arg0) {
- //Functionality here
+ public void onAnimationCancel(Animator animation) {
}
@Override
- public void onAnimationStart(Animator arg0) {
- //Functionality here
+ public void onAnimationStart(Animator animation) {
}
@Override
@@ -395,18 +335,15 @@ public void onAnimationEnd(Animator animation) {
}
@Override
- public void onAnimationRepeat(Animator arg0) {
- //Functionality here
+ public void onAnimationRepeat(Animator animation) {
}
});
inflator.start();
-
break;
case BP_CONST.MOVE_STIMULUS:
-
- height = SbubbleStumulus.getHeight();
+ height = SbubbleStimulus.getHeight();
float[] scale = new float[]{(BP_CONST.MARGIN_BOTTOM * .9f) / 381};
float scaledHeight = height * scale[0];
@@ -414,14 +351,13 @@ public void onAnimationRepeat(Animator arg0) {
PointF wayPoints[] = new PointF[1];
PointF posFinal = new PointF();
- posFinal.x = SbubbleStumulus.getX();
+ posFinal.x = SbubbleStimulus.getX();
posFinal.y = mParent.getHeight() - (scaledHeight + ((height - scaledHeight) / 2) + BP_CONST.STIM_PAD_BOTTOM);
wayPoints[0] = posFinal;
- SbubbleStumulus.setCenterPoint(new PointF(SbubbleStumulus.getX(), mParent.getHeight() - (height / 2)));
-
- AnimatorSet inflatorSet = CAnimatorUtil.configZoomIn(SbubbleStumulus, 300, 0, new LinearInterpolator(), scale);
- Animator translator = CAnimatorUtil.configTranslate(SbubbleStumulus, 300, 0, wayPoints);
+ SbubbleStimulus.setCenterPoint(new PointF(SbubbleStimulus.getX(), mParent.getHeight() - (height / 2)));
+ AnimatorSet inflatorSet = CAnimatorUtil.configZoomIn(SbubbleStimulus, 300, 0, new LinearInterpolator(), scale);
+ Animator translator = CAnimatorUtil.configTranslate(SbubbleStimulus, 300, 0, wayPoints);
inflatorSet.addListener(new Animator.AnimatorListener() {
@Override
@@ -450,31 +386,25 @@ public void onAnimationRepeat(Animator arg0) {
break;
case BP_CONST.CLEAR_CONTENT:
-
AnimatorSet deflator = new AnimatorSet();
ArrayList animations = new ArrayList();
- for(int i1 = 0; i1 < SBubbles.length ; i1++) {
- if(SBubbles[i1] != null)
- animations.add(CAnimatorUtil.configZoomIn(SBubbles[i1], 600, 0, new AnticipateInterpolator(), 0f));
- }
- if(SbubbleStumulus != null)
- animations.add(CAnimatorUtil.configZoomIn(SbubbleStumulus, 600, 0, new AnticipateInterpolator(), 0f));
+ for (int i1 = 0; i1 < SBubbles.length ; i1++) {
+ if (SBubbles[i1] != null) animations.add(CAnimatorUtil.configZoomIn(SBubbles[i1], 600, 0, new AnticipateInterpolator(), 0f));
+ }
+ if (SbubbleStimulus != null) animations.add(CAnimatorUtil.configZoomIn(SbubbleStimulus, 600, 0, new AnticipateInterpolator(), 0f));
deflator.addListener(new Animator.AnimatorListener() {
@Override
- public void onAnimationCancel(Animator arg0) {
- //Functionality here
+ public void onAnimationCancel(Animator animation) {
}
@Override
- public void onAnimationStart(Animator arg0) {
- //Functionality here
+ public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
-
// If the bubble still exist. If the tutor is terminated while this
// animation is running this may be null.
//
@@ -486,8 +416,7 @@ public void onAnimationEnd(Animator animation) {
SBubbles[i1] = null;
}
}
- if (SbubbleStumulus != null)
- mParent.removeView((View) SbubbleStumulus);
+ if (SbubbleStimulus != null) mParent.removeView((View) SbubbleStimulus);
SBubbles = null;
@@ -496,97 +425,83 @@ public void onAnimationEnd(Animator animation) {
}
@Override
- public void onAnimationRepeat(Animator arg0) {
- //Functionality here
+ public void onAnimationRepeat(Animator animation) {
}
});
deflator.playTogether(animations);
deflator.start();
-
break;
}
}
-
@Override
public void enableTouchEvents() {
_enableTouchEvent = true;
}
-
@Override
public void onClick(View view) {
-
Log.v(QGRAPH_MSG, "event.click: " + " CBp_Mechanic_Base: bubble touch");
CBubble bubble = (CBubble)view;
- if(_enableTouchEvent) {
+ if (_enableTouchEvent) {
_enableTouchEvent = false;
- mComponent.publishState(bubble, SbubbleStumulus);
+ mComponent.prepareState(bubble, SbubbleStimulus);
mComponent.applyBehavior(BP_CONST.BUBBLE_TOUCH_EVENT);
}
}
-
protected void broadcastLocation(String Action, PointF touchPt) {
-
- if(_watchable) {
+ if (_watchable) {
mParent.getLocationOnScreen(_screenCoord);
// Let the persona know where to look
Intent msg = new Intent(Action);
- msg.putExtra(TCONST.SCREENPOINT, new float[]{touchPt.x + _screenCoord[0], (float) touchPt.y + _screenCoord[1]});
+ msg.putExtra(TCONST.SCREENPOINT, new float[]{touchPt.x + _screenCoord[0], touchPt.y + _screenCoord[1]});
bManager.sendBroadcast(msg);
}
}
-
/**
* Add Root vector to path
*
* @param touchPt
*/
private void startTouch(PointF touchPt) {
-
broadcastLocation(TCONST.LOOKATSTART, touchPt);
}
-
/**
* Update the glyph path if motion is greater than tolerance - remove jitter
*
* @param touchPt
*/
private void moveTouch(PointF touchPt) {
-
broadcastLocation(TCONST.LOOKAT, touchPt);
}
-
/**
* End the current glyph path
* TODO: Manage debouncing
*
*/
private void endTouch(PointF touchPt) {
-
broadcastLocation(TCONST.LOOKATEND, touchPt);
}
-
public boolean onTouch(View view, MotionEvent event) {
PointF touchPt;
long delta;
final int action = event.getAction();
// TODO: switch back to setting onTouchListener
- if(_enabled) {
+ if (_enabled) {
mParent.onTouchEvent(event);
@@ -600,10 +515,12 @@ public boolean onTouch(View view, MotionEvent event) {
_prevTime = _time = System.nanoTime();
startTouch(touchPt);
break;
+
case MotionEvent.ACTION_MOVE:
_time = System.nanoTime();
moveTouch(touchPt);
break;
+
case MotionEvent.ACTION_UP:
_time = System.nanoTime();
endTouch(touchPt);
@@ -618,18 +535,12 @@ public boolean onTouch(View view, MotionEvent event) {
public void generateRandomData(CBp_Data data) {
-
int respSize; // response set size - # to select from
int ansIndex;
- if(data.gen_question) {
-
- if(data.respCountExact > 0) {
- respSize = data.respCountExact;
- }
- else {
- respSize = getRandInRange(data.respCountRange);
- }
+ if (data.gen_question) {
+ if (data.respCountExact > 0) respSize = data.respCountExact;
+ else respSize = getRandInRange(data.respCountRange);
//***** build a presentation set from the response sample set
//
@@ -642,16 +553,13 @@ public void generateRandomData(CBp_Data data) {
// Constrain the presentation set size - in case there is an error
// in the problem generator.
//
- if(respSize > setSize)
- respSize = setSize;
+ if (respSize > setSize) respSize = setSize;
// If requested, select which bubble is correct at random
// within the response set
//
- if(data.answer_index < 0)
- ansIndex = (int) (Math.random() * respSize);
- else
- ansIndex = data.answer_index;
+ if (data.answer_index < 0) ansIndex = (int)(Math.random() * respSize);
+ else ansIndex = data.answer_index;
//***** Select the question from the stimulus set
// This populates the stimulus and answer fields of "data"
@@ -667,45 +575,35 @@ public void generateRandomData(CBp_Data data) {
}
}
-
/**
*
* @param valueRange
* @return
*/
protected float getRandInRange(float[] valueRange) {
-
float range = valueRange[BP_CONST.MAX] - valueRange[BP_CONST.MIN];
float rand = valueRange[BP_CONST.MIN];
// check if less than error tolerance.
//
- if( range > 0.01) {
- rand = (float)(valueRange[BP_CONST.MIN] + Math.random() * range);
- }
+ if (range > 0.01) rand = (float)(valueRange[BP_CONST.MIN] + Math.random() * range);
return rand;
}
-
/**
*
* @param valueRange
* @return
*/
protected int getRandInRange(int[] valueRange) {
-
int range = valueRange[BP_CONST.MAX] - valueRange[BP_CONST.MIN];
int rand = valueRange[BP_CONST.MIN];
// check if less than error tolerance.
//
- if( range > 0) {
- rand = (int)(valueRange[BP_CONST.MIN] + Math.random() * range);
- }
+ if (range > 0) rand = (int)(valueRange[BP_CONST.MIN] + Math.random() * range);
return rand;
}
-
-
}
diff --git a/comp_bubblepop/src/main/java/cmu/xprize/bp_component/CBp_Mechanic_MC.java b/comp_bubblepop/src/main/java/cmu/xprize/bp_component/CBp_Mechanic_MC.java
index c6d01f45a..594a997ce 100644
--- a/comp_bubblepop/src/main/java/cmu/xprize/bp_component/CBp_Mechanic_MC.java
+++ b/comp_bubblepop/src/main/java/cmu/xprize/bp_component/CBp_Mechanic_MC.java
@@ -62,18 +62,20 @@ public class CBp_Mechanic_MC extends CBp_Mechanic_Base implements IBubbleMechani
static final String TAG = "CBp_Mechanic_MC";
private String mProblemType;
+ private int mIndex;
+
public CBp_Mechanic_MC(Context context, CBP_Component parent, String problem_type) {
super.init(context, parent);
mProblemType = problem_type;
}
+
@Override
protected void init(Context context, CBP_Component parent) {
super.init(context, parent);
}
-
@Override
public boolean isInitialized() {
return mInitialized;
@@ -86,8 +88,7 @@ public void onDestroy() {
@Override
public void onDraw(Canvas canvas) {
-
- // Create a paint object to deine the line parameters
+ // Create a paint object to define the line parameters
mPaint = new Paint();
mViewRegion = new Rect();
@@ -109,8 +110,7 @@ public void onDraw(Canvas canvas) {
int _bubbleIntrinsicRadius = (mParent.getResources().getDrawable(BP_CONST.BUBBLE_SAMPLE, null).getIntrinsicWidth()) / 2;
- for(int i1 = 0; i1 < SBubbles.length ; i1++) {
-
+ for (int i1 = 0; i1 < SBubbles.length; i1++) {
float[] range = SBubbles[i1].getRange();
float angle = SBubbles[i1].getAngle();
@@ -122,116 +122,132 @@ public void onDraw(Canvas canvas) {
float srad = brad * BP_CONST.STRETCH_MAGNITUDE;
mPaint.setColor(Color.parseColor("#00FFFF"));
- canvas.drawCircle(pos2.x, pos2.y , irad, mPaint);
+ canvas.drawCircle(pos2.x, pos2.y, irad, mPaint);
mPaint.setColor(Color.parseColor("#000000"));
- canvas.drawCircle(pos2.x, pos2.y , 10, mPaint);
+ canvas.drawCircle(pos2.x, pos2.y, 10, mPaint);
mPaint.setColor(Color.parseColor("#000000"));
mPaint.setStyle(Paint.Style.STROKE);
- canvas.drawCircle(pos2.x, pos2.y , brad, mPaint);
+ canvas.drawCircle(pos2.x, pos2.y, brad, mPaint);
mPaint.setColor(Color.parseColor("#00FF00"));
mPaint.setStyle(Paint.Style.STROKE);
- canvas.drawCircle(pos2.x, pos2.y , srad, mPaint);
+ canvas.drawCircle(pos2.x, pos2.y, srad, mPaint);
mPaint.setColor(Color.parseColor("#FF0000"));
mPaint.setStyle(Paint.Style.FILL);
- canvas.drawCircle(pos1.x, pos1.y , 13f, mPaint);
+ canvas.drawCircle(pos1.x, pos1.y, 13f, mPaint);
mPaint.setColor(Color.parseColor("#0000FF"));
mPaint.setStyle(Paint.Style.FILL);
PointF pos3 = SBubbles[i1].getCenterPosition();
mPaint.setAlpha(100);
- canvas.drawCircle(pos3.x, pos3.y , irad, mPaint);
+ canvas.drawCircle(pos3.x, pos3.y, irad, mPaint);
mPaint.setAlpha(255);
- canvas.drawCircle(pos3.x, pos3.y , 13f, mPaint);
-
+ canvas.drawCircle(pos3.x, pos3.y, 13f, mPaint);
mPaint.setColor(Color.parseColor("#000000"));
- canvas.drawLine(_viewCenter.x, _viewCenter.y ,pos2.x, pos2.y , mPaint);
+ canvas.drawLine(_viewCenter.x, _viewCenter.y, pos2.x, pos2.y, mPaint);
}
}
-
protected void setupWiggle(View target, long delay) {
+ AnimatorSet animation = CAnimatorUtil.configWiggle(target, "vertical", 3000, ValueAnimator.INFINITE, delay, BP_CONST.BOUNCE_MAGNITUDE);
- AnimatorSet animation = CAnimatorUtil.configWiggle(target, "vertical", 3000, ValueAnimator.INFINITE, delay, BP_CONST.BOUNCE_MAGNITUDE );
+ float[] wayPoints = new float[]{target.getScaleY(), target.getScaleY() * BP_CONST.STRETCH_MAGNITUDE, target.getScaleY()};
- float[] wayPoints = new float[]{target.getScaleY(),
- target.getScaleY() * BP_CONST.STRETCH_MAGNITUDE,
- target.getScaleY()};
-
- AnimatorSet stretch = CAnimatorUtil.configStretch(target, "vertical", 2100, ValueAnimator.INFINITE, delay, wayPoints );
+ AnimatorSet stretch = CAnimatorUtil.configStretch(target, "vertical", 2100, ValueAnimator.INFINITE, delay, wayPoints);
animation.start();
stretch.start();
}
-
- public void execCommand(String command, Object target ) {
-
+ public void execCommand(String command, Object target) {
CBubble bubble;
long delay = 0;
super.execCommand(command, target);
- switch(command) {
-
+ switch (command) {
case BP_CONST.SHOW_BUBBLES:
- delay = BP_CONST.INFLATE_DELAY;
-
if (mInitialized) {
+ _isRunning = true;
- for(CBubble ibubble : SBubbles) {
- mComponent.post(BP_CONST.INFLATE, ibubble, delay);
- delay += BP_CONST.INFLATE_DELAY;
- }
+ mComponent.publishValue(BP_CONST.SPAWN_DELAY_VAR, BP_CONST.SPAWN_DELAY);
+ mIndex = 0;
+ mComponent.publishState(SBubbles[mIndex]);
+ mComponent.applyBehavior(BP_CONST.SPAWN_BUBBLE);
+ }
+ break;
+
+ case BP_CONST.PAUSE_ANIMATION:
+ if (_isRunning) {
+ for (Animator animation : translators.keySet()) animation.pause();
+ _isRunning = false;
}
break;
- case BP_CONST.INFLATE:
- bubble = (CBubble)target;
+ case BP_CONST.RESUME_ANIMATION:
+ if (!_isRunning) {
+ _isRunning = true;
+
+ for (Animator animation : translators.keySet()) animation.resume();
+ mIndex = 0;
+ mComponent.publishState(SBubbles[mIndex]);
+ mComponent.applyBehavior(BP_CONST.SPAWN_BUBBLE);
+ }
+ break;
- // Persona - look at the stimulus
- broadcastLocation(TCONST.GLANCEAT, mParent.localToGlobal(new PointF(bubble.getX() + bubble.getWidth()/2, bubble.getY()+ bubble.getHeight()/2)));
+ case BP_CONST.SPAWN_BUBBLE:
+ if (_isRunning) {
+ bubble = SBubbles[mIndex];
- Animator inflator = CAnimatorUtil.configZoomIn(bubble, 600, 0, new BounceInterpolator(), 0f, bubble.getAssignedScale());
+ // Persona - look at the stimulus
+ broadcastLocation(TCONST.GLANCEAT, mParent.localToGlobal(new PointF(bubble.getX() + bubble.getWidth() / 2, bubble.getY() + bubble.getHeight() / 2)));
- inflator.addListener(new Animator.AnimatorListener() {
- @Override
- public void onAnimationCancel(Animator arg0) {
- //Functionality here
- }
+ Animator inflator = CAnimatorUtil.configZoomIn(bubble, 600, 0, new BounceInterpolator(), 0f, bubble.getAssignedScale());
- @Override
- public void onAnimationStart(Animator arg0) {
- //Functionality here
- }
+ inflator.addListener(new Animator.AnimatorListener() {
+ @Override
+ public void onAnimationCancel(Animator animation) {
+ }
- @Override
- public void onAnimationEnd(Animator animation) {
+ @Override
+ public void onAnimationStart(Animator animation) {
+ }
- CBubble bubble = inflators.get(animation);
- inflators.remove(animation);
+ @Override
+ public void onAnimationEnd(Animator animation) {
- setupWiggle(bubble, 0);
- bubble.setOnClickListener(CBp_Mechanic_MC.this);
- }
+ CBubble bubble = inflators.get(animation);
+ inflators.remove(animation);
- @Override
- public void onAnimationRepeat(Animator arg0) {
- //Functionality here
- }
- });
+ setupWiggle(bubble, 0);
+ bubble.setOnClickListener(CBp_Mechanic_MC.this);
+ }
- inflators.put(inflator, bubble);
- inflator.start();
+ @Override
+ public void onAnimationRepeat(Animator animation) {
+ }
+ });
+
+ inflators.put(inflator, bubble);
+ inflator.start();
+ }
break;
- case BP_CONST.POP_BUBBLE:
+ case BP_CONST.NEXT_BUBBLE:
+ if (_isRunning) {
+ if (mIndex < SBubbles.length - 1) {
+ mComponent.publishState(SBubbles[++mIndex]);
+ mComponent.applyBehavior(BP_CONST.SPAWN_BUBBLE);
+ }
+ }
+ break;
+ case BP_CONST.POP_BUBBLE:
bubble = (CBubble)target;
delay = bubble.pop();
@@ -242,11 +258,9 @@ public void onAnimationRepeat(Animator arg0) {
mComponent.post(BP_CONST.REMOVE_BUBBLE, bubble, delay);
break;
-
}
}
-
/**
* We are looking for the furthest we can push the bubble out along its vector before it
* impinges on either the top bottom or sides. Note that this is sensitive to the aspect
@@ -262,8 +276,7 @@ public void onAnimationRepeat(Animator arg0) {
* @param angle
* @param radius
*/
- private float[] calcVectorRange(float angle, float radius ) {
-
+ private float[] calcVectorRange(float angle, float radius) {
// Account for the bubble bounce and stretch so that it doesn't go outside the margin bounds.
// Note: BOUNCE_MAGNITUDE is a relative value while STRETCH_MAGNITUDE is an absolute multiple
//
@@ -272,62 +285,28 @@ private float[] calcVectorRange(float angle, float radius ) {
float distIntercept = 0;
Point coordCenter = new Point(_viewCenter.x - _margins.right, _viewCenter.y - _margins.top);
- float criticalAngle = (float) Math.atan((coordCenter.y - radius) / (coordCenter.x - radius));
+ float criticalAngle = (float)Math.atan((coordCenter.y - radius) / (coordCenter.x - radius));
float quadrant = (float)(Math.PI / 2f);
-
- if(angle <= quadrant) {
-
- if(angle < criticalAngle) {
-
- distIntercept = (float) ((coordCenter.x - radius) / Math.cos(angle));
- }
- else {
-
- distIntercept = (float) ((coordCenter.y - radius) / Math.sin(angle));
- }
- }
- else if(angle <= (quadrant * 2)) {
-
- if(angle > (Math.PI - criticalAngle)) {
-
- distIntercept = (float) ((radius - coordCenter.x) / Math.cos(angle));
- }
- else {
-
- distIntercept = (float) ((coordCenter.y - radius) / Math.sin(angle));
- }
- }
- else if(angle <= (quadrant * 3)) {
-
- if(angle < (Math.PI + criticalAngle)) {
-
- distIntercept = (float) ((radius - coordCenter.x) / Math.cos(angle));
- }
- else {
-
- distIntercept = (float) ((radius - coordCenter.y) / Math.sin(angle));
- }
- }
- else {
-
- if(angle > ((2*Math.PI) - criticalAngle)) {
-
- distIntercept = (float) ((coordCenter.x - radius) / Math.cos(angle));
- }
- else {
-
- distIntercept = (float) ((radius - coordCenter.y) / Math.sin(angle));
- }
+ if (angle <= quadrant) {
+ if (angle < criticalAngle) distIntercept = (float)((coordCenter.x - radius) / Math.cos(angle));
+ else distIntercept = (float)((coordCenter.y - radius) / Math.sin(angle));
+ } else if (angle <= (quadrant * 2)) {
+ if (angle > (Math.PI - criticalAngle)) distIntercept = (float)((radius - coordCenter.x) / Math.cos(angle));
+ else distIntercept = (float)((coordCenter.y - radius) / Math.sin(angle));
+ } else if (angle <= (quadrant * 3)) {
+ if (angle < (Math.PI + criticalAngle)) distIntercept = (float)((radius - coordCenter.x) / Math.cos(angle));
+ else distIntercept = (float)((radius - coordCenter.y) / Math.sin(angle));
+ } else {
+ if (angle > ((2 * Math.PI) - criticalAngle)) distIntercept = (float)((coordCenter.x - radius) / Math.cos(angle));
+ else distIntercept = (float)((radius - coordCenter.y) / Math.sin(angle));
}
- //return new float[]{radius * 1.5f, distIntercept};
+// return new float[]{radius * 1.5f, distIntercept};
return new float[]{distIntercept * BP_CONST.MIN_VRANGE, distIntercept};
}
-
public void populateView(CBp_Data data) {
-
CBubble newBubble;
// Check if the response_set needs to be generated
@@ -343,21 +322,18 @@ public void populateView(CBp_Data data) {
SBubbles = new CBubble[data.response_set.length];
for (int i1 = 0; i1 < SBubbles.length; i1++) {
-
- newBubble = (CBubble) View.inflate(mContext, R.layout.bubble_view, null);
+ newBubble = (CBubble)View.inflate(mContext, R.layout.bubble_view, null);
String bubbleColor = BP_CONST.bubbleColors[colorNdx];
// Set Color: pass in String e.g. "RED" - Cycle through the colors repetitively
//
-// if(data.stimulus_type.equals(TCONST.AUDIO_REF)) {
+// if (data.stimulus_type.equals(TCONST.AUDIO_REF)) {
// newBubble.setFeedbackColor(bubbleColor);
// }
-
colorNdx = (colorNdx + 1) % BP_CONST.bubbleColors.length;
-
newBubble.setScale(0);
newBubble.setAlpha(_alpha);
@@ -368,68 +344,67 @@ public void populateView(CBp_Data data) {
String responseVal = data.response_set[i1];
String responseTyp = data.responsetype_set[i1];
- switch (responseTyp) {
-
- case BP_CONST.REFERENCE:
-
- try {
- int[] shapeSet = BP_CONST.drawableMap.get(responseVal);
-
+ if (!mComponent.testFeature(TCONST.SHOW_TARGET)) {
+ newBubble.configData(responseVal, correctVal, mProblemType);
+ newBubble.setContents(0, "");
+
+ // Moved set color to here too so that text would be known when setting the color (generating bubble)
+ newBubble.setColor(bubbleColor);
+ } else {
+ switch (responseTyp) {
+ case BP_CONST.REFERENCE:
+ try {
+ int[] shapeSet = BP_CONST.drawableMap.get(responseVal);
+
+ newBubble.configData(responseVal, correctVal, mProblemType);
+ newBubble.setContents(shapeSet[(int) (Math.random() * shapeSet.length)], null);
+
+ // Moved set color to here to so that text would be known when setting the color (generating bubble)
+ newBubble.setColor(bubbleColor);
+ } catch (Exception e) {
+ Log.e(TAG, "Invalid Dataset: " + responseVal);
+ }
+ break;
+
+ case BP_CONST.TEXTDATA:
newBubble.configData(responseVal, correctVal, mProblemType);
- newBubble.setContents(shapeSet[(int) (Math.random() * shapeSet.length)], null);
+ newBubble.setContents(0, responseVal);
- //Moved set color to here to so that text would be known when setting the color(generating bubble)
+ // Moved set color to here too so that text would be known when setting the color (generating bubble)
newBubble.setColor(bubbleColor);
-
- }
- catch(Exception e) {
- Log.e(TAG, "Invalid Datatset: " + responseVal);
- }
- break;
-
- case BP_CONST.TEXTDATA:
-
- newBubble.configData(responseVal, correctVal, mProblemType);
- newBubble.setContents(0, responseVal);
-
- //Moved set color to here too so that text would be known when setting the color(generating bubble)
- newBubble.setColor(bubbleColor);
- break;
+ break;
+ }
}
}
}
-
public void doLayout(int width, int height, CBp_Data data) {
-
- // Now we have the bubbles we position them on rays(vectors) eminating from the center of the
- // view.
+ // Now we have the bubbles we position them on rays(vectors) emanating from the center of the view.
//
_viewCenter.set((width + _margins.left - _margins.right) / 2, (height + _margins.top - _margins.bottom) / 2);
- if(_angleRange != null)
- _angle = getRandInRange(_angleRange);
-
- _angleInc = (float)((2 * Math.PI) / data.response_set.length);
+ if (_angleRange != null) _angle = getRandInRange(_angleRange);
- for(int i1 = 0; i1 < SBubbles.length ; i1++) {
+ _angleInc = (float)((2 * Math.PI) / data.response_set.length);
+ for (int i1 = 0; i1 < SBubbles.length; i1++) {
// This is the scale the bubble will expand too.
//
- SBubbles[i1].setAssignedScale(getRandInRange(_scaleRange));
+ //SBubbles[i1].setAssignedScale(getRandInRange(_scaleRange));
+ SBubbles[i1].setAssignedScale(1.0f);
Paint paint = new Paint();
String text = SBubbles[i1].getTextView().getText().toString();
String singleLine = text;
- //Calculate approximations of height and width of bubble instantenously so that calculations for
- //arranging the bubble can be done
+ // Calculate approximations of height and width of bubble instantaneously so that calculations for
+ // arranging the bubble can be done
int bubbleHeight = BP_CONST.BUBBLE_DESIGN_RADIUS;
int bubbleWidth = BP_CONST.BUBBLE_DESIGN_RADIUS;
- //If multiple lines, change what one line is
- if(text.matches(".*\n.*")) {
+ // If multiple lines, change what one line is
+ if (text.matches(".*\n.*")) {
int index = text.indexOf("\n");
singleLine = text.substring(0, index);
}
@@ -439,7 +414,7 @@ public void doLayout(int width, int height, CBp_Data data) {
bubbleWidth = 190;
float[] _widthRange = calcVectorRange(_angle, bubbleWidth * SBubbles[i1].getAssignedScale());
- float[] _heightRange = calcVectorRange(_angle, bubbleHeight * SBubbles[i1].getAssignedScale());
+ float[] _heightRange = calcVectorRange(_angle, bubbleHeight * SBubbles[i1].getAssignedScale());
SBubbles[i1].setVectorPosition(_viewCenter, getRandInRange(_widthRange), getRandInRange(_heightRange), _angle);
_angle += _angleInc;
@@ -447,6 +422,4 @@ public void doLayout(int width, int height, CBp_Data data) {
mInitialized = true;
}
-
-
}
diff --git a/comp_bubblepop/src/main/java/cmu/xprize/bp_component/CBp_Mechanic_RISE.java b/comp_bubblepop/src/main/java/cmu/xprize/bp_component/CBp_Mechanic_RISE.java
index dd75549ab..f11e567ed 100644
--- a/comp_bubblepop/src/main/java/cmu/xprize/bp_component/CBp_Mechanic_RISE.java
+++ b/comp_bubblepop/src/main/java/cmu/xprize/bp_component/CBp_Mechanic_RISE.java
@@ -53,43 +53,35 @@ public CBp_Mechanic_RISE(Context context, CBP_Component parent, String problem_t
mProblemType = problem_type;
}
+
@Override
protected void init(Context context, CBP_Component parent) {
super.init(context, parent);
}
-
@Override
public void onDraw(Canvas canvas) {
-
}
-
@Override
public boolean isInitialized() {
return mInitialized;
}
-
@Override
public void onDestroy() {
super.onDestroy();
}
-
- public void execCommand(String command, Object target ) {
-
+ public void execCommand(String command, Object target) {
CBubble bubble;
long delay = 0;
super.execCommand(command, target);
- switch(command) {
-
+ switch (command) {
case BP_CONST.SHOW_BUBBLES:
-
- if (!_isRunning && mInitialized) {
-
+ if (mInitialized) {
_isRunning = true;
mComponent.post(BP_CONST.SPAWN_BUBBLE);
@@ -97,22 +89,16 @@ public void execCommand(String command, Object target ) {
break;
case BP_CONST.PAUSE_ANIMATION:
-
if (_isRunning) {
- for(Animator animation : translators.keySet()) {
- animation.pause();
- }
+ for (Animator animation : translators.keySet()) animation.pause();
_isRunning = false;
}
break;
case BP_CONST.RESUME_ANIMATION:
-
if (!_isRunning) {
- for(Animator animation : translators.keySet()) {
- animation.resume();
- }
+ for (Animator animation : translators.keySet()) animation.resume();
_isRunning = true;
mComponent.post(BP_CONST.SPAWN_BUBBLE);
@@ -120,10 +106,8 @@ public void execCommand(String command, Object target ) {
break;
case BP_CONST.SPAWN_BUBBLE:
-
- if(_isRunning) {
+ if (_isRunning) {
if (launchBubble()) {
-
int[] launchRange = {_travelTime / _currData.respCountRange[BP_CONST.MAX], _travelTime / _currData.respCountRange[BP_CONST.MIN]};
delay = getRandInRange(launchRange);
@@ -136,7 +120,6 @@ public void execCommand(String command, Object target ) {
break;
case BP_CONST.POP_BUBBLE:
-
bubble = (CBubble)target;
delay = bubble.pop();
@@ -147,14 +130,11 @@ public void execCommand(String command, Object target ) {
mComponent.post(BP_CONST.REPLACE_BUBBLE, bubble, delay);
break;
-
}
}
-
@Override
public void populateView(CBp_Data data) {
-
CBubble newBubble;
// Check if the response_set needs to be generated
@@ -167,8 +147,7 @@ public void populateView(CBp_Data data) {
SBubbles = new CBubble[_currData.respCountRange[BP_CONST.MAX]];
for (int i1 = 0; i1 < _currData.respCountRange[BP_CONST.MAX]; i1++) {
-
- newBubble = (CBubble) View.inflate(mContext, R.layout.bubble_view, null);
+ newBubble = (CBubble)View.inflate(mContext, R.layout.bubble_view, null);
newBubble.setAlpha(0);
SBubbles[i1] = newBubble;
@@ -176,22 +155,18 @@ public void populateView(CBp_Data data) {
mParent.addView(newBubble, layoutParams);
}
mInitialized = true;
-
}
-
@Override
- public void doLayout(int width, int height, CBp_Data data) {}
-
+ public void doLayout(int width, int height, CBp_Data data) {
+ }
private boolean launchBubble() {
-
CBubble nextBubble = null;
boolean launched = false;
int colorNdx;
if (SBubbles != null) {
-
// Find a bubble that is not currently on screen.
//
for (CBubble bubble : SBubbles) {
@@ -205,13 +180,11 @@ private boolean launchBubble() {
// If there is a free bubble then set it up and launch it
//
if (nextBubble != null) {
-
launched = true;
try {
-
do {
- colorNdx = (int) (Math.random() * BP_CONST.bubbleColors.length);
+ colorNdx = (int)(Math.random() * BP_CONST.bubbleColors.length);
} while (colorNdx == _prevColorNdx);
_prevColorNdx = colorNdx;
@@ -219,7 +192,8 @@ private boolean launchBubble() {
String correctVal = _currData.answer;
nextBubble.setColor(BP_CONST.bubbleColors[colorNdx]);
- nextBubble.setScale(getRandInRange(_scaleRange));
+ //nextBubble.setScale(getRandInRange(_scaleRange));
+ nextBubble.setScale(1.0f);
// Cycle on the indexes to display
//
@@ -233,23 +207,21 @@ private boolean launchBubble() {
long timeOfFlight = 0;
switch (responseTyp) {
-
case BP_CONST.REFERENCE:
-
//Moved set color and scale here after text has been set
nextBubble.setColor(BP_CONST.bubbleColors[colorNdx]);
- nextBubble.setScale(getRandInRange(_scaleRange));
+ //nextBubble.setScale(getRandInRange(_scaleRange));
+ nextBubble.setScale(1.0f);
int[] shapeSet = BP_CONST.drawableMap.get(responseVal);
nextBubble.configData(responseVal, correctVal, mProblemType);
nextBubble.setContents(shapeSet[(int) (Math.random() * shapeSet.length)], null);
xRange = new float[]{0, mParent.getWidth() - (BP_CONST.BUBBLE_DESIGN_RADIUS * nextBubble.getAssignedScale())};
- timeOfFlight = (long) (_travelTime / nextBubble.getAssignedScale());
+ timeOfFlight = (long)(_travelTime / nextBubble.getAssignedScale());
break;
case BP_CONST.TEXTDATA:
-
nextBubble.configData(responseVal, correctVal, mProblemType);
nextBubble.setContents(0, responseVal);
@@ -257,12 +229,12 @@ private boolean launchBubble() {
//Should subtract nextBubble.getMeasuredWidth() * nextBubble.getAssignedScale() but
//width doesn't load quick enough first bubbles, so use 600 instead as upper bound
xRange = new float[]{0, mParent.getWidth() - MAX_BUBBLE_WIDTH};
- timeOfFlight = (long) (_travelTime);
+ timeOfFlight = (long)(_travelTime);
//Moved set color and scale here after text has been set
nextBubble.setColor(BP_CONST.bubbleColors[colorNdx]);
- nextBubble.setScale(getRandInRange(_scaleRange));
-
+ //nextBubble.setScale(getRandInRange(_scaleRange));
+ nextBubble.setScale(1.0f);
break;
}
@@ -271,7 +243,7 @@ private boolean launchBubble() {
} while (Math.abs(xPos - _prevXpos) < nextBubble.getWidth());
_prevXpos = xPos;
- nextBubble.setPosition((int) xPos, mParent.getHeight());
+ nextBubble.setPosition((int)xPos, mParent.getHeight());
nextBubble.setAlpha(1.0f);
PointF wayPoints[] = new PointF[1];
@@ -289,18 +261,15 @@ private boolean launchBubble() {
translator.addListener(new Animator.AnimatorListener() {
@Override
- public void onAnimationCancel(Animator arg0) {
- //Functionality here
+ public void onAnimationCancel(Animator animation) {
}
@Override
- public void onAnimationStart(Animator arg0) {
- //Functionality here
+ public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
-
CBubble bubble = translators.get(animation);
translators.remove(animation);
@@ -308,8 +277,7 @@ public void onAnimationEnd(Animator animation) {
}
@Override
- public void onAnimationRepeat(Animator arg0) {
- //Functionality here
+ public void onAnimationRepeat(Animator animation) {
}
});
@@ -318,9 +286,7 @@ public void onAnimationRepeat(Animator arg0) {
translators.put(translator, nextBubble);
translator.start();
- }
- catch(Exception ex) {
-
+ } catch (Exception ex) {
Log.e(TAG, "Error : " + ex);
}
}
@@ -329,16 +295,11 @@ public void onAnimationRepeat(Animator arg0) {
return launched;
}
-
protected void setupWiggle(View target, long delay) {
+ float[] wayPoints = new float[]{target.getScaleY() * BP_CONST.STRETCH_MIN, target.getScaleY() * BP_CONST.STRETCH_MAX, target.getScaleY() * BP_CONST.STRETCH_MIN};
- float[] wayPoints = new float[]{target.getScaleY() * BP_CONST.STRETCH_MIN,
- target.getScaleY() * BP_CONST.STRETCH_MAX,
- target.getScaleY() * BP_CONST.STRETCH_MIN};
-
- AnimatorSet stretch = CAnimatorUtil.configStretch(target, "vertical", 2100, ValueAnimator.INFINITE, delay, wayPoints );
+ AnimatorSet stretch = CAnimatorUtil.configStretch(target, "vertical", 2100, ValueAnimator.INFINITE, delay, wayPoints);
stretch.start();
}
-
}
diff --git a/comp_listener/src/main/java/edu/cmu/xprize/listener/SpeechRecognizer.java b/comp_listener/src/main/java/edu/cmu/xprize/listener/SpeechRecognizer.java
index d7aed62a1..760d280f6 100644
--- a/comp_listener/src/main/java/edu/cmu/xprize/listener/SpeechRecognizer.java
+++ b/comp_listener/src/main/java/edu/cmu/xprize/listener/SpeechRecognizer.java
@@ -61,6 +61,8 @@
import edu.cmu.pocketsphinx.Hypothesis;
import edu.cmu.pocketsphinx.RecognitionListener;
+import static cmu.xprize.comp_logging.CAudioLogThread.BUFFER_SIZE;
+import static cmu.xprize.comp_logging.CAudioLogThread.readBuffer;
import static java.lang.String.format;
/**
@@ -192,7 +194,7 @@ public boolean startListening(String searchName, String label) {
*/
public void setRestartListener(boolean pause) {
- if(recognizerThread != null) {
+ if (recognizerThread != null) {
setPauseRecognizer(pause);
// If restarting then the recognizer is paused at this point -
@@ -216,7 +218,7 @@ public void setRestartListener(boolean pause) {
*/
public void setPauseRecognizer(boolean pausing) {
- if(recognizerThread != null) {
+ if (recognizerThread != null) {
// If we are releasing the thread and it is paused then notify the monitor
// Don't send notifies when not required
@@ -233,7 +235,7 @@ public void setPauseRecognizer(boolean pausing) {
try {
recognizerThread.notify();
}
- catch(Exception e) {
+ catch (Exception e) {
Log.d("ASR", "Exception: " + e);
}
}
@@ -245,7 +247,7 @@ public void setPauseRecognizer(boolean pausing) {
// Wait for the thread to pause - Once inside this block we know the
// recognizerThread is sitting at PAUSED_TAG (search text)
//
- else if(pausing && !isPausedRecognizer) {
+ else if (pausing && !isPausedRecognizer) {
isPausedRecognizer = true;
@@ -287,7 +289,7 @@ private boolean stopRecognizerThread() {
}
// Release the resource and reset the flag so it will restart if
- // there is a new recognizerthread created.
+ // there is a new recognizer thread created.
//
recognizerThread = null;
isDecoding = false;
@@ -316,7 +318,7 @@ public boolean stop() {
// processing results by the time this happens so in general you don't want the final
// hypothesis.
//
- if(wantFinal)
+ if (wantFinal)
postResult(hypothesis, TCONST.FINAL_HYPOTHESIS);
}
return result;
@@ -412,7 +414,7 @@ public synchronized boolean isListening() {
boolean _listening = false;
- if(isRunningRecognizer && !isPausedRecognizer) {
+ if (isRunningRecognizer && !isPausedRecognizer) {
_listening = true;
}
@@ -449,44 +451,43 @@ public void run() {
String lastAudioEvent = TCONST.UNKNOWN_TYPE;
- AudioRecord recorder = null;
+// AudioRecord recorder = null;
+
+// try {
+// recorder = new AudioRecord(AudioSource.VOICE_RECOGNITION, sampleRate, AudioFormat.CHANNEL_IN_MONO, AudioFormat.ENCODING_PCM_16BIT, 8192);
+// }
+// catch (Exception e) {
+// Log.d("ASR", "AudioRecorder Create Failed: " + e);
+// }
- try {
- recorder = new AudioRecord(
- AudioSource.VOICE_RECOGNITION, sampleRate,
- AudioFormat.CHANNEL_IN_MONO,
- AudioFormat.ENCODING_PCM_16BIT, 8192);
- }
- catch(Exception e) {
- Log.d("ASR", "AudioRecorder Create Failed: " + e);
- }
isRunningRecognizer = true;
// Collect audio samples continuously while not paused and until the
// Thread is killed. This allow UI/UX activity while the listener is still
// listening to the mic
//
- while(isRunningRecognizer) {
+ while (isRunningRecognizer) {
// We always start the thread in the paused state
//
if (isPausedRecognizer) {
try {
- recorder.stop();
+// recorder.stop();
isRecording = false;
- // If we are starting a new uttereance stop recording and
+ // If we are starting a new utterance stop recording and
// flush the input - i.e. clear the recorder
//
- if(!isDecoding) {
+ if (!isDecoding) {
- recorder.stop();
+// recorder.stop();
do {
- nread = recorder.read(buffer, 0, buffer.length);
-
- }while(nread > 0);
+// nread = recorder.read(buffer, 0, buffer.length);
+ nread = readBuffer(buffer, BUFFER_SIZE);
+ Log.i("ASR", "Flush buffer: nread = " + nread);
+ } while (nread > 0);
}
// PAUSED_TAG
@@ -495,7 +496,7 @@ public void run() {
// TODO: understand why interrupt causes freeze while in wait state
// You should not interrupt() while in a wait
//
- while(isPausedRecognizer) {
+ while (isPausedRecognizer) {
Log.i("ASR","Recognizer Paused");
recognizerThread.wait();
}
@@ -506,23 +507,23 @@ public void run() {
}
}
- // Thread interrupt is not currently used but this is the recommened mechanism
+ // Thread interrupt is not currently used but this is the recommended mechanism
// should it be required.
//
- if(isInterrupted()) {
+ if (isInterrupted()) {
isRunningRecognizer = false;
}
- if(!isRunningRecognizer) {
+ if (!isRunningRecognizer) {
Log.d("ASR", "Terminating ASR Thread");
continue;
}
// We start the thread with the decoder stopped and also when we
- // restart for a new utterance - we end the uttereance prior to
+ // restart for a new utterance - we end the utterance prior to
// the decoder fsgsearch update
//
- if(!isDecoding) {
+ if (!isDecoding) {
Log.i("ASR","Start Decoder");
// label utterance with passed-in id
@@ -537,45 +538,45 @@ public void run() {
// Ensure we are recording while the thread is running.
//
- if(!isRecording) {
+ if (!isRecording) {
// Don't want to do this - misses front end of utterance
//
// Flush the input buffer
// int readf = recorder.read(buffer, 0, buffer.length);
//
-// if(readf > 0) {
+// if (readf > 0) {
// Log.i("ASR", "Flushed input buffer: " + readf);
// }
Log.i("ASR", "Resume recording");
- recorder.startRecording();
+// recorder.startRecording();
isRecording = true;
nread = 0;
}
else {
// Clean out the buffered input
- nread = recorder.read(buffer, 0, buffer.length);
+// nread = recorder.read(buffer, 0, buffer.length);
+ nread = readBuffer(buffer, BUFFER_SIZE);
+ Log.i("ASR", "Clean out buffer: nread = " + nread);
}
//Log.i("ASR","ASR RAW-BYTES: " + nread);
- if (-1 == nread) {
+ if (nread == AudioRecord.ERROR_INVALID_OPERATION || nread == AudioRecord.ERROR_BAD_VALUE) {
Log.i("ASR","Read Error");
throw new RuntimeException("error reading audio buffer");
} else if (nread > 0) {
- double RMS = publishRMS(buffer, nread);
-
// This filters low power segments that otherwise cause false positives
// in number_speaking tutor
//
- //`if(RMS > 4)
- {
- //ASRTimer = System.currentTimeMillis();
+// double RMS = publishRMS(buffer, nread);
+// if (RMS > 4) {
+ ASRTimer = System.currentTimeMillis();
decoder.processRaw(buffer, nread, false, false);
- //Log.d("ASR", "Time in processRaw: " + (System.currentTimeMillis() - ASRTimer));
+ Log.d("ASR", "Time in processRaw: " + (System.currentTimeMillis() - ASRTimer));
nSamples += nread;
@@ -590,7 +591,7 @@ public void run() {
// 1. The last time the mic heard anything
// 2. The last time the mic went silent.
- //Log.i("ASR","State Changed: " + inSpeech);
+ Log.i("ASR","State Changed: " + inSpeech);
if (inSpeech) {
eventManager.fireStaticEvent(TCONST.SOUND_EVENT);
@@ -605,9 +606,9 @@ public void run() {
// Get the hypothesis words from the Sphinx decoder
//
- //ASRTimer = System.currentTimeMillis();
+ ASRTimer = System.currentTimeMillis();
Hypothesis hypothesis = decoder.hyp();
- //Log.d("ASR", "Time in Decoder: " + (System.currentTimeMillis() - ASRTimer));
+ Log.d("ASR", "Time in Decoder: " + (System.currentTimeMillis() - ASRTimer));
// If there is a valid hypothesis string from the decoder continue
// Once the decoder returns a hypothesis it will not go back to
@@ -624,7 +625,7 @@ public void run() {
break;
}
}
- }
+// }
}
// While running we continuously watch for timed event firings (timeouts)
@@ -634,16 +635,16 @@ public void run() {
Log.i("ASR","Stop session");
- recorder.stop();
- nread = recorder.read(buffer, 0, buffer.length);
- recorder.release();
+// recorder.stop();
+// nread = recorder.read(buffer, 0, buffer.length);
+ nread = readBuffer(buffer, BUFFER_SIZE);
+ Log.i("ASR", "Read buffer: nread = " + nread);
+// recorder.release();
decoder.processRaw(buffer, nread, false, false);
nSamples += nread;
decoder.endUtt();
// Remove all pending notifications.
mainHandler.removeCallbacksAndMessages(null);
- // convert raw capture to wav format
- //convertRawToWav(new File(captureDir, label + ".raw"), new File(captureDir, label + ".wav"));
}
}
}
@@ -692,7 +693,7 @@ private void publishRawHypothesis(Hypothesis hypothesis ) {
// Update the eventTimer to indicate the last thing that happened
// Updating the word event resets silence and noise
//
- if(hypChanged) {
+ if (hypChanged) {
eventManager.fireStaticEvent(TCONST.WORD_EVENT);
eventManager.updateStartTime(TCONST.TIMEDWORD_EVENT,
TCONST.TIMEDSILENCE_EVENT | TCONST.TIMEDSOUND_EVENT);
@@ -815,16 +816,16 @@ private double publishRMS(short[] buffer, int count) {
double sum = 0;
Short peak= 0;
- if(count > 0) {
+ if (count > 0) {
for (int i1 = 0; i1 < count; i1++) {
Short sample = buffer[i1];
sum = Math.pow(sample, 2);
- if(sample > peak)
+ if (sample > peak)
peak = sample;
- if(sample > mPeak)
+ if (sample > mPeak)
mPeak = sample;
}
@@ -837,43 +838,6 @@ private double publishRMS(short[] buffer, int count) {
}
- /**
- * utility to convert raw audio capture file to wav format. Assumes 16Khz mono
- */
- public static void convertRawToWav(File rawFile, File wavFile) {
- InputStream input = null;
- OutputStream output = null;
- try {
- input = new FileInputStream(rawFile);
- output = new FileOutputStream(wavFile);
- // first write appropriate wave file header
- ByteArrayOutputStream hdrBytes = new ByteArrayOutputStream();
- new WaveHeader(WaveHeader.FORMAT_PCM, (short) 1, 16000, (short) 16, (int) rawFile.length()).write(hdrBytes);
- output.write(hdrBytes.toByteArray());
- // then copy raw bytes to output file
- byte[] buffer = new byte[4096];
- int nRead;
- while ((nRead = input.read(buffer)) > 0) {
- output.write(buffer, 0, nRead);
- }
- // finish up
- output.close();
- input.close();
- // on success, delete raw file
- rawFile.delete();
- } catch (Exception e) {
- Log.e("convertRawToWav", "Exception " + e.getMessage());
- } finally {
- try {
- if (input != null) input.close();
- if (output != null) output.close();
- } catch (IOException e) {
- Log.e("convertRawToWav", "Closing streams: " + e.getMessage());
- }
- }
- }
-
-
/**
* Manage Looper queue so we don't have unprocessed hypotheses stacking up
* Throw away previous hypothesis and only process the new one.
@@ -970,7 +934,7 @@ protected void execute(ITutorListener listener) {
Log.d("ASR", "Handle Recognizer ResultEvent");
- switch(resultType) {
+ switch (resultType) {
case TCONST.FINAL_HYPOTHESIS:
listener.onResult(hypothesis);
break;
@@ -1082,7 +1046,7 @@ public ASREvents() {
*/
public synchronized void configTimedEvent(int eventType, long newTimeout) {
- switch(eventType) {
+ switch (eventType) {
case TCONST.TIMEDSTART_EVENT:
Log.d("ASR", "CONFIG TIMED START: " + newTimeout);
@@ -1122,7 +1086,7 @@ public synchronized void configTimedEvent(int eventType, long newTimeout) {
*/
public synchronized void resetTimedEvent(int resetMap) {
- if((resetMap & TCONST.TIMEDSTART_EVENT) != 0) {
+ if ((resetMap & TCONST.TIMEDSTART_EVENT) != 0) {
Log.d("ASR", "RESET TIMED START: ");
WaitAfterStart = false;
@@ -1131,7 +1095,7 @@ public synchronized void resetTimedEvent(int resetMap) {
startTime = Long.MAX_VALUE;
}
- if((resetMap & TCONST.TIMEDSILENCE_EVENT) != 0) {
+ if ((resetMap & TCONST.TIMEDSILENCE_EVENT) != 0) {
Log.d("ASR", "RESET TIMED SILENCE: ");
WaitAfterSilence = false;
@@ -1140,7 +1104,7 @@ public synchronized void resetTimedEvent(int resetMap) {
lastSilence = Long.MAX_VALUE;
}
- if((resetMap & TCONST.TIMEDSOUND_EVENT) != 0) {
+ if ((resetMap & TCONST.TIMEDSOUND_EVENT) != 0) {
Log.d("ASR", "RESET TIMED SOUND: ");
WaitAfterSound = false;
isNoiseTriggered = false;
@@ -1148,7 +1112,7 @@ public synchronized void resetTimedEvent(int resetMap) {
lastSoundHeard = Long.MAX_VALUE;
}
- if((resetMap & TCONST.TIMEDWORD_EVENT) != 0) {
+ if ((resetMap & TCONST.TIMEDWORD_EVENT) != 0) {
Log.d("ASR", "RESET TIMED WORD: ");
WaitAfterWord = false;
@@ -1168,7 +1132,7 @@ public synchronized void resetTimedEvent(int resetMap) {
*/
public synchronized void configStaticEvent(int eventType, boolean listen) {
- switch(eventType) {
+ switch (eventType) {
case TCONST.SILENCE_EVENT:
listenForSilence = listen;
@@ -1251,15 +1215,15 @@ public synchronized void updateStartTime(int eventType, int resetMap) {
break;
}
- if((resetMap & TCONST.TIMEDSILENCE_EVENT) != 0) {
+ if ((resetMap & TCONST.TIMEDSILENCE_EVENT) != 0) {
isSilenceTriggered = false;
lastSilence = Long.MAX_VALUE;
}
- if((resetMap & TCONST.TIMEDSOUND_EVENT) != 0) {
+ if ((resetMap & TCONST.TIMEDSOUND_EVENT) != 0) {
isNoiseTriggered = false;
lastSoundHeard = Long.MAX_VALUE;
}
- if((resetMap & TCONST.TIMEDWORD_EVENT) != 0) {
+ if ((resetMap & TCONST.TIMEDWORD_EVENT) != 0) {
isWordTriggered = false;
lastWordHeard = Long.MAX_VALUE;
}
@@ -1276,19 +1240,19 @@ public synchronized void fireStaticEvent(int eventType) {
switch (eventType) {
case TCONST.SILENCE_EVENT:
- if(listenForSilence) {
+ if (listenForSilence) {
Log.i("ASR", "Silence Started");
mainHandler.post(new timeOutEvent(TCONST.SILENCE_EVENT));
}
break;
case TCONST.SOUND_EVENT:
- if(listenForSound) {
+ if (listenForSound) {
Log.i("ASR", "Sound Heard");
mainHandler.post(new timeOutEvent(TCONST.SOUND_EVENT));
}
break;
case TCONST.WORD_EVENT:
- if(listenForWords) {
+ if (listenForWords) {
Log.i("ASR", "Word Heard - Hyp updated");
mainHandler.post(new timeOutEvent(TCONST.WORD_EVENT));
}
@@ -1355,7 +1319,7 @@ else if (WaitAfterSound && isNoiseTriggered) {
}
}
- else if(WaitAfterWord && isWordTriggered) {
+ else if (WaitAfterWord && isWordTriggered) {
if (attemptGap > wordHeardTimeout) {
resetTimedEvent(TCONST.TIMEDWORD_EVENT);
diff --git a/comp_logging/src/main/java/cmu/xprize/comp_logging/CAudioLogThread.java b/comp_logging/src/main/java/cmu/xprize/comp_logging/CAudioLogThread.java
new file mode 100644
index 000000000..b99eb49da
--- /dev/null
+++ b/comp_logging/src/main/java/cmu/xprize/comp_logging/CAudioLogThread.java
@@ -0,0 +1,169 @@
+package cmu.xprize.comp_logging;
+
+import android.media.AudioFormat;
+import android.media.AudioRecord;
+import android.media.MediaRecorder;
+import android.util.Log;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+public class CAudioLogThread extends Thread {
+
+ /**
+ * size of the buffer to use. For mapping stream-based frame time, we want buffer size to be a multiple of
+ * centisecond frame size = 160. This size receives updated hypothesis 10 times a second
+ */
+ static final int SAMPLERATE = 16000; // for sample rate check
+ static final int AUDIO_BUFFER_SIZE = SAMPLERATE / 1; // 1 second worth of data
+ public static final int BUFFER_SIZE = SAMPLERATE / 10; // 1/10 seconds worth at 16 Khz
+
+ public static short[] audioBuffer = new short[AUDIO_BUFFER_SIZE];
+ static int readIndex = 0;
+ static int writeIndex = 0;
+
+ private boolean isRecording = false;
+
+ private final String logDir;
+ private final String logFileName;
+
+ public CAudioLogThread(String logDir, String logFileName) {
+ this.logFileName = logFileName;
+ this.logDir = logDir;
+ }
+
+ @Override
+ public void run() {
+
+ OutputStream output = null;
+ AudioRecord recorder = null;
+ short[] buffer = new short[BUFFER_SIZE];
+ int readCount;
+
+ try {
+ android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_BACKGROUND);
+
+ output = new FileOutputStream(new File(logDir, logFileName + ".raw"));
+
+ recorder = new AudioRecord(MediaRecorder.AudioSource.VOICE_RECOGNITION, SAMPLERATE, AudioFormat.CHANNEL_IN_MONO, AudioFormat.ENCODING_PCM_16BIT, AUDIO_BUFFER_SIZE);
+
+ while (!Thread.interrupted()) {
+ // Ensure we are recording while the thread is running.
+ //
+ if (!isRecording) {
+ Log.i("AudioLog", "Resume recording");
+ recorder.startRecording();
+ isRecording = true;
+ readCount = 0;
+ } else {
+ readCount = recorder.read(buffer, 0, BUFFER_SIZE);
+ Log.i("AudioLog", "Read from recorder: read_count = " + readCount);
+ }
+
+ if (readCount == AudioRecord.ERROR_INVALID_OPERATION || readCount == AudioRecord.ERROR_BAD_VALUE) {
+ Log.i("AudioLog", "Read Error");
+ throw new RuntimeException("error reading from recorder");
+ } else {
+ try {
+ writeBuffer(buffer, readCount);
+ for (int i = 0; i < readCount; i++) writeShort(output, buffer[i]);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ } catch (Exception e) {
+ Log.e("AudioLog", "Exception " + e.getMessage());
+
+ } finally {
+ try {
+ Log.i("AudioLog", "Stop session");
+
+ recorder.stop();
+
+ readCount = recorder.read(buffer, 0, buffer.length);
+ for (int i = 0; i < readCount; i++) writeShort(output, buffer[i]);
+ Log.i("AudioLog", "Final read from recorder: read_count = " + readCount);
+
+ recorder.release();
+
+ output.close();
+
+ // convert raw capture to wav format
+ convertRawToWav(new File(logDir, logFileName + ".raw"), new File(logDir, logFileName + ".wav"));
+
+ } catch (IOException e) {
+ Log.e("AudioLog", "Closing streams: " + e.getMessage());
+ }
+ }
+ }
+
+ private static void writeShort(OutputStream out, short val) throws IOException {
+ out.write(val >> 0);
+ out.write(val >> 8);
+ }
+
+ synchronized public static int readBuffer(short[] buffer, int length) {
+ for (int i = 0; i < length; i++) {
+ if (readIndex == writeIndex) return i;
+ buffer[i] = audioBuffer[readIndex];
+ readIndex = ++readIndex % AUDIO_BUFFER_SIZE;
+ }
+ return length;
+ }
+
+ synchronized static void writeBuffer(short[] buffer, int length) {
+ if (!(length == AudioRecord.ERROR_INVALID_OPERATION || length == AudioRecord.ERROR_BAD_VALUE)) {
+ for (int i = 0; i < length; i++) {
+ audioBuffer[writeIndex] = buffer[i];
+ if ((writeIndex = ++writeIndex % AUDIO_BUFFER_SIZE) == readIndex) readIndex = ++readIndex % AUDIO_BUFFER_SIZE;
+ }
+ }
+ }
+
+ /**
+ * utility to convert raw audio capture file to wav format. Assumes 16Khz mono
+ */
+ public static void convertRawToWav(File rawFile, File wavFile) {
+
+ InputStream input = null;
+ OutputStream output = null;
+
+ try {
+ input = new FileInputStream(rawFile);
+ output = new FileOutputStream(wavFile);
+ // first write appropriate wave file header
+ ByteArrayOutputStream hdrBytes = new ByteArrayOutputStream();
+ new WaveHeader(WaveHeader.FORMAT_PCM, (short) 1, 16000, (short) 16, (int) rawFile.length()).write(hdrBytes);
+ output.write(hdrBytes.toByteArray());
+ // then copy raw bytes to output file
+ byte[] audioBuffer = new byte[4096];
+ int nRead;
+ while ((nRead = input.read(audioBuffer)) > 0) {
+ output.write(audioBuffer, 0, nRead);
+ }
+ // finish up
+ output.close();
+ input.close();
+ // on success, delete raw file
+ rawFile.delete();
+
+ } catch (Exception e) {
+ Log.e("convertRawToWav", "Exception " + e.getMessage());
+
+ } finally {
+ try {
+ if (input != null) input.close();
+ if (output != null) output.close();
+ } catch (IOException e) {
+ Log.e("convertRawToWav", "Closing streams: " + e.getMessage());
+ }
+ }
+ }
+}
diff --git a/comp_listener/src/main/java/edu/cmu/xprize/listener/WaveHeader.java b/comp_logging/src/main/java/cmu/xprize/comp_logging/WaveHeader.java
similarity index 99%
rename from comp_listener/src/main/java/edu/cmu/xprize/listener/WaveHeader.java
rename to comp_logging/src/main/java/cmu/xprize/comp_logging/WaveHeader.java
index 005b83ea7..ab9d08020 100644
--- a/comp_listener/src/main/java/edu/cmu/xprize/listener/WaveHeader.java
+++ b/comp_logging/src/main/java/cmu/xprize/comp_logging/WaveHeader.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package edu.cmu.xprize.listener;
+package cmu.xprize.comp_logging;
import java.io.IOException;
import java.io.InputStream;
diff --git a/util/src/main/java/cmu/xprize/util/TCONST.java b/util/src/main/java/cmu/xprize/util/TCONST.java
index b5ee78e1b..e4ee13ffa 100644
--- a/util/src/main/java/cmu/xprize/util/TCONST.java
+++ b/util/src/main/java/cmu/xprize/util/TCONST.java
@@ -114,9 +114,10 @@ public class TCONST {
public static final String SET_LANG_FTR = "SET_LANGUAGE_FEATURE";
public static final String VALUE = "VALUE";
public static final String NULL = "NULL";
- public static final String SAY_STIMULUS = "FTR_SAY";
- public static final String SHOW_STIMULUS = "FTR_SHOW";
-
+ public static final String SAY_STIMULUS = "FTR_SAY_STIMULUS";
+ public static final String SHOW_STIMULUS = "FTR_SHOW_STIMULUS";
+ public static final String SAY_TARGET = "FTR_SAY_TARGET";
+ public static final String SHOW_TARGET = "FTR_SHOW_TARGET";
public static final String ASM_DIGIT_OR_OVERHEAD_CORRECT = "ASM_DIGIT_OR_OVERHEAD_CORRECT";
public static final String ASM_DIGIT_OR_OVERHEAD_WRONG = "ASM_DIGIT_OR_OVERHEAD_WRONG";
@@ -618,7 +619,7 @@ public class TCONST {
public static final String HOT_LOG_FOLDER = "/RoboTutor_HOT/";
public static final String READY_LOG_FOLDER = "/RoboTutor/";
- public static final String HOT_LOG_FOLDER_PERF = "/RoboTutor_HOT/"; // use same as normal logs
+ public static final String HOT_LOG_FOLDER_PERF = "/RoboTutor_HOT/"; // use same as normal logs
public static final String READY_LOG_FOLDER_PERF = "/RoboTutor/"; // use same as normal logs
public static final String ROBOTUTOR_ASSET_FOLDER = "/robotutor_assets/";