The logic of the question and answer sequence is another component that has no computer vision functionality. We will encapsulate it in a class called YesNoAudioTree
, which is responsible for playing the next audio clip whenever the app's computer vision component notifies it of a "Yes" or "No" answer.
Note
Remember to download the audio clips and other resources from http://nummist.com/opencv/7376_04_res.zip and extract them to the project's res/raw
folder. However, note that the audio clips in this download are by no means an exhaustive set of questions and guesses about characters in the Bond franchise. Feel free to add your own clips and your own logic for playing them.
Create a file, src/YesNoAudioTree.java
. Our YesNoAudioTree
class needs member variables to store a media player and a related context, an ID for the most recently played audio clip, and information gathered from the answers to the previous questions. Specifically, the next question...