Thursday, March 27, 2014

C++ scenario and the Composite plugin

I managed to make a scenario in Simon that implements basic C++ keywords and structures via voice recognition. Finding out about the Simon plugin "Composite" was a big help in order to make programming easier. It allows us to execute various commands from different plugins in a specific order. This lets us create an entire block of code and make the cursor go back to where we would normally want to continue writing the code. For instance, by saying "while", we could create this block of code:
while (  ) {
 
}
and make the cursor go back to the parenthesis in order to put the logical condition in. This opens up many other possibilities in terms of navigating and writing code.

By calling the switch text macro, going up two times, activating the "end" key, and going left four times, the cursor will end up inside the switch statement's parenthesis.


Here's the "WHILE" command using the composite plugin.


Since creating your own identifiers and strings is still not supported, variables are limited to being things like: var, index, temp and accum as of right now. With the current available keywords, I was able to open an empty c++ file, program something basic in it, and save it:

It currently doesn't return or do anything, but the simple steps of accumulating the sum of numbers is still there. 
There are still some issues though. Additional spaces and indents will obviously not be recognized by the scenario, and removing them by backspacing time and again is a drag. Additionally, the "undo" command does not work to remove blocks of code you type since Simon types things key by key. A quick solution for this is to make a shift command that holds shift to select the text you want and then backspace it, but it's still not very efficient.

I hope I could explain myself well enough... I'll be making a video explaining everything better and hopefully making a more impressive program with voice recognition and netbeans/eclipse this weekend.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.