private static boolean doChoreograph() throws IOException { System.out.println("\t--CHOREOGRAPHY--"); if ((audioFile == null) || (timecodeFile == null) || (valveStateFile == null) || (timeOffsetChosen == false)) { System.out.println("Something is missing..."); printStatus(); return false; } else { System.out.println("Enter a name for the CueSheet:"); System.out.print("> "); String sheetName = Utilities.STDIN.nextLine(); System.out.println("Enter a comment for the CueSheet:"); System.out.print("> "); String sheetComment = Utilities.STDIN.nextLine(); System.out.println( "Enter a name for the CueSheet's record in the list, or leave blank to use the sheet's name:"); System.out.print("> "); String recordName = Utilities.STDIN.nextLine(); if ((recordName).equals("")) { recordName = sheetName; } CueSheet sheetMusic = Choreographer.makeCueSheet( sheetName, sheetComment, audioFile, timeOffset, timecodeFile, valveStateFile); Main.sheetList.put(recordName, sheetMusic); return true; } }
private static void loadHandler(int whichFile) { System.out.println("\t--LOAD FILES--"); boolean useGUI; System.out.println("Use GUI? (y/N)"); System.out.print("> "); switch (Utilities.STDIN.nextLine()) { case "Yes": case "yes": case "Y": case "y": useGUI = true; break; default: useGUI = false; } if (whichFile == 0 || whichFile == 3) { audioFile = chooseAudioFile(useGUI); } if (whichFile == 1 || whichFile == 3) { timecodeFile = chooseTimecodeFile(useGUI); } if (whichFile == 2 || whichFile == 3) { valveStateFile = chooseValveStateFile(useGUI); } printStatus(); }
private static File chooseValveStateFile(boolean useGUI) { File newChosenFile; if (useGUI) { return Utilities.chooseFileGUI("Select Valve State File..."); } else { System.out.println( "Enter the URI of the valve state file that accompanies these timecodes, or leave blank to leave as is."); System.out.print("> "); String userURI = Utilities.STDIN.nextLine(); if (userURI.equals("")) { return valveStateFile; } newChosenFile = new File(userURI); } return (newChosenFile == null) ? valveStateFile : newChosenFile; }
private static File chooseAudioFile(boolean useGUI) { File newChosenFile; if (useGUI) { return Utilities.chooseFileGUI("Select audio file..."); } else { System.out.println( "Enter the URI of the audio file to be played, or leave blank to leave as is."); System.out.print("> "); String userURI = Utilities.STDIN.nextLine(); if (userURI.equals("")) { return audioFile; } newChosenFile = new File(userURI); } return (newChosenFile == null) ? audioFile : newChosenFile; }
public static boolean showMenu() throws FileNotFoundException, IOException { while (true) { System.out.println("\t--PRODUCTION MENU--"); System.out.println("What next?"); System.out.println( "Status, Load Files, Calibrate Delay, Delay Set, Offset Delay, Choreograph, Return"); System.out.println("(s, l [la, lt, lv], c, d, o, h, r)"); System.out.print("> "); switch (Utilities.STDIN.nextLine()) { case "Status": case "status": case "s": printStatus(); break; case "Load": case "load": case "l": loadHandler(3); break; case "la": loadHandler(0); break; case "lt": loadHandler(1); break; case "lv": loadHandler(2); break; case "Calibrate": case "calibrate": case "c": timeOffset = Calibrate.main(); if (timeOffset != -1) { timeOffsetChosen = true; timeOffsetAuthor = "\t(Calibrated)"; } break; case "Delay": case "delay": case "d": manualDelay(); break; case "Offset": case "offset": case "o": offsetDelay(); break; case "Choreograph": case "choreograph": case "h": if (doChoreograph()) { return true; } break; case "Return": case "return": case "r": case "quit": case "exit": System.out.println("Press enter to return to main menu or enter some text to cancel:"); System.out.print("> "); if (Utilities.STDIN.nextLine().equals("")) { return false; } else { continue; } default: System.out.println( "If there were an Easter Egg in this program, I would have put it here."); continue; } } }