/* Sphinx wrapper for use in Processing. Works with Sphinx-4 1.0beta5 build from Hellow World example in Sphinx-4 Application Programmers Guide: http://cmusphinx.sourceforge.net/sphinx4/doc/ProgrammersGuide.html#helloworld with reference to Listen.java from Chatter project by Mie Sorensen et al.: http://www.lilwondermat.com/downloads/Chatter.zip rtwomey@u.washington.edu */ // processing stuff import processing.core.*; public class Scripter { PApplet parent; ArrayList tokens; String in_f; int pos; // global position counter PFont font; // text display parameters final int NUMCHARS=12; final int NUMLINES=5; final int FONT_SIZE=100; final int LINE_SPACING=120; public Scripter(PApplet _p, String _in_f) { this.parent = _p; this.in_f = _in_f; pos=0; tokens = new ArrayList(); init(); } private void init() { System.out.println("Initializing Scripter:"); System.out.println(" input file " + in_f); loadText(this.in_f); textAlign(LEFT); font = createFont("Helvetica-Bold", 255); fill(255); textFont(font, FONT_SIZE); } public void checkNext(String next) { } private void loadText(String filename) { String lines[] = loadStrings(filename); if(lines != null) { System.out.println(" " + lines.length + " lines"); } else { System.out.println("error, no text in file "+filename+". exiting."); exit(); }; // split lines into tokens for(int i=0; itokens.size()) pos=0; } public void showText() { for(int i=0; i