import java.awt.Font;

/**
 * Driver class for the keyboard-based virtual dulcimer.
 *   @author Dave Reed
 *   @version 9/13/17
 */
public class DulcimerDriver {
   public static void main(String[] args) {
        String bassKeys = "a   s   d   f   g   h   j   k   l   ;   '";       
        String dashes = "--- --- --- --- --- --- --- --- --- --- ---";
        String bassNotes = "G-  A   B   C   D   E   F   G   A+ A#+  C+";
        
        StdDraw.setFont(new Font("Monospaced", Font.PLAIN, 12));
        StdDraw.textLeft(0.00, 1.00, "DULCIMER KEY MAPPINGS");
        StdDraw.textLeft(0.00, 0.90, "        keys:  " + bassKeys);
        StdDraw.textLeft(0.00, 0.87, "BASS          " + dashes);
        StdDraw.textLeft(0.00, 0.84, "       notes:  " + bassNotes);
        
        String keys = bassKeys.replace(" ","");  
        
        Dulcimer dulc = new Dulcimer(bassNotes);
        while (true) { 
            if (StdDraw.hasNextKeyTyped()) {
                int typed = keys.indexOf(StdDraw.nextKeyTyped());
                dulc.hammer(typed);
            }
            dulc.play();
        }
    }    
}
