Changeset 2468
- Timestamp:
- 03/17/08 00:15:00 (9 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
Trunk/SpeechSubmission/VFSpeechSubmission/java/src/speechrecorder/CapturePlayback.java
r2467 r2468 62 62 // !!!!!! 63 63 import speechrecorder.MultiLineLabel; 64 // !!!!!!65 64 66 65 /** … … 87 86 AudioInputStream audioInputStream; 88 87 SamplingGraph samplingGraph; 89 88 // !!!!!! 89 int numberofPrompts = 5; 90 JButton [] playA = new JButton [numberofPrompts]; //creates the array, not the objects! 91 JButton [] captA = new JButton [numberofPrompts]; //creates the array, not the objects! 92 /* 90 93 JButton play1; 91 94 JButton capt1; … … 108 111 JButton play10; 109 112 JButton capt10; 113 !!!!!! */ 114 110 115 JButton uploadB; 111 116 JButton moreInfoB; 112 117 JButton aboutB; 113 118 119 // !!!!!! 120 boolean [] play_stateA = new boolean [numberofPrompts]; 121 boolean [] capt_stateA = new boolean [numberofPrompts]; 122 /* 114 123 boolean play1_state; 115 124 boolean capt1_state; … … 132 141 boolean play10_state; 133 142 boolean capt10_state; 134 143 !!!!!! */ 135 144 License licenseObject = new License(); 136 145 String license = licenseObject.getLicense(); … … 142 151 String errStr; 143 152 153 // !!!!!! 154 double [] durationA= new double [numberofPrompts]; 144 155 double duration = 0; 156 /* 145 157 double duration1 = 0; 146 158 double duration2 = 0; … … 152 164 double duration8 = 0; 153 165 double duration9 = 0; 154 double duration10 = 0; 155 166 double duration10 = 0; 167 !!!!!! */ 156 168 double seconds; 169 // !!!!!! 170 long [] totalBytesWrittenA= new long [numberofPrompts]; 157 171 long totalBytesWritten = 0L; 172 /* 158 173 long totalBytesWritten1 = 0L; 159 174 long totalBytesWritten2 = 0L; … … 166 181 long totalBytesWritten9 = 0L; 167 182 long totalBytesWritten10 = 0L; 183 !!!!!! */ 184 168 185 File file; 169 186 Vector lines = new Vector(); 170 187 171 188 private File wavFile; 172 189 // !!!!!! 190 private File[] wavFileA = new File [numberofPrompts]; 191 /* 173 192 private File wavFile1; 174 193 private File wavFile2; … … 180 199 private File wavFile8; 181 200 private File wavFile9; 182 private File wavFile10; 201 private File wavFile10; 202 !!!!!! */ 203 private File [] uploadWavFileA = new File [numberofPrompts]; 204 /* 183 205 private File uploadWavFile1; 184 206 private File uploadWavFile2; … … 191 213 private File uploadWavFile9; 192 214 private File uploadWavFile10; 215 !!!!!! */ 193 216 private File promptsFile; 194 217 private File readmeFile; … … 203 226 JTextField subjectBox; 204 227 String subject; 205 JTextField prompt1Box; 206 JTextField prompt2Box; 207 JTextField prompt3Box; 208 JTextField prompt4Box; 209 JTextField prompt5Box; 228 // !!!!!! 229 String [] promptA = new String [numberofPrompts]; 230 /* 210 231 String prompt1; 211 232 String prompt2; … … 218 239 String prompt9; 219 240 String prompt10; 241 !!!!!! */ 242 // !!!!!! 243 String [] promptidA = new String [numberofPrompts];; 244 /* 220 245 String promptID1; 221 246 String promptID2; … … 228 253 String promptID9; 229 254 String promptID10; 230 // !!!!!! required for the PHP uploader to work properly 255 !!!!!! */ 256 // required for the PHP uploader to work properly 231 257 String fileFieldName = "userfile"; 232 // !!!!!!233 258 // ############ Localized Fields #################################### 234 259 JTextField usernameTextField; … … 296 321 // ############ Localized Fields #################################### 297 322 //this.language = language; 298 this.language = "RU"; //test299 //this.language = "EN"; //test323 //this.language = "RU"; //test 324 this.language = "EN"; //test 300 325 // debug System.err.println("CapturePlayback Language:" + this.language + ":"); 301 326 … … 347 372 uploadCompletedMessageLabel = labels.getUploadCompletedMessageLabel(); 348 373 // ############ Localized Fields #################################### 349 if (prompt1 == null || prompt1.length() == 0) { 350 Prompts prompts = new Prompts(10, this.language); 351 352 String [][] promptArray = prompts.getPrompts(); 353 this.promptID1 = promptArray[0][0]; 374 // if (promptA[0] == null || promptA[0].length() == 0) { 375 //Prompts prompts = new Prompts(numberofPrompts, this.language); 376 //String [][] promptArray = prompts.getPrompts(); 377 378 // !!!!!! 379 String [][] promptArray = (new Prompts(numberofPrompts,this.language)).getPrompts(); 380 for (int i = 0; i < numberofPrompts; i++) { 381 this.promptidA [i] = promptArray[0][i]; 382 this.promptA [i] = promptArray[1][i]; 383 } 384 385 // !!!!!! 386 /* !!!!!! 387 * this.promptID1 = promptArray[0][0]; 354 388 this.prompt1 = promptArray[1][0]; 355 389 this.promptID2 = promptArray[0][1]; … … 370 404 this.prompt9 = promptArray[1][8]; 371 405 this.promptID10 = promptArray[0][9]; 372 this.prompt10 = promptArray[1][9]; 373 } 406 this.prompt10 = promptArray[1][9]; 407 !!!!!! */ 408 //} 374 409 375 410 // this.language = language; … … 381 416 capturePlayback = this; 382 417 383 // Create a single WAV file that will hold ourrecordings418 // Create WAV files to hold recordings 384 419 try { 420 // !!!!!! 421 for (int i = 0; i < numberofPrompts; i++) { 422 wavFileA [i] = new File(tempdir + "wavFile" + i + ".wav"); 423 wavFileA[i].deleteOnExit(); 424 } 425 /* 385 426 wavFile1 = new File(tempdir + "wavFile1.wav"); 386 427 wavFile1.deleteOnExit(); … … 403 444 wavFile10 = new File(tempdir + "wavFile10.wav"); 404 445 wavFile10.deleteOnExit(); 405 446 */ 447 for (int i = 0; i < numberofPrompts; i++) { 448 uploadWavFileA[i] = new File(tempdir + this.promptidA [i] + ".wav"); 449 uploadWavFileA[i].deleteOnExit(); 450 } 451 /* 406 452 uploadWavFile1 = new File(tempdir + this.promptID1 + ".wav"); 407 453 uploadWavFile1.deleteOnExit(); … … 423 469 uploadWavFile9.deleteOnExit(); 424 470 uploadWavFile10 = new File(tempdir + this.promptID10 + ".wav"); 425 uploadWavFile10.deleteOnExit(); 471 uploadWavFile10.deleteOnExit(); 472 */ 426 473 promptsFile = new File(tempdir + "prompts.txt"); 427 474 promptsFile.deleteOnExit(); … … 436 483 return; 437 484 } 485 // !!!!!! 486 for (int i = 0; i < numberofPrompts; i++) { 487 System.err.println("CapturePlayback's WAV file for recording uploadWavFile" + i + "is:" + uploadWavFileA[i]); 488 } 489 /* 438 490 System.err.println("CapturePlayback's WAV file for recording uploadWavFile1 is:" + uploadWavFile1); 439 491 System.err.println("CapturePlayback's WAV file for recording uploadWavFile2 is:" + uploadWavFile2); … … 447 499 System.err.println("CapturePlayback's WAV file for recording uploadWavFile10 is:" + uploadWavFile10); 448 500 System.err.println("---------------------------------------------------------------------------"); 449 501 !!!!!! */ 450 502 setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); 451 503 EmptyBorder eb = new EmptyBorder(5,5,5,5); … … 519 571 Color voxforgeColour = new Color(197, 216, 234); 520 572 prompts.setBorder(BorderFactory.createLineBorder (voxforgeColour, 3)); 521 // ############ Prompts ####################################573 522 574 int maxWidth = 40; 523 // ############ Prompt1 #################################### 575 // !!!!!! 576 JPanel promptPanelA[] = new JPanel[numberofPrompts]; 577 JPanel promptInnerPanelA[] = new JPanel[numberofPrompts]; 578 579 for (int i = 1; i < numberofPrompts; i++) { 580 promptPanelA[i] = new JPanel(); 581 promptPanelA[i].setLayout(new FlowLayout(FlowLayout.LEFT)); 582 promptInnerPanelA [i]= new JPanel(); 583 promptInnerPanelA[i].setBorder(BorderFactory.createLineBorder (voxforgeColour, 1)); 584 promptInnerPanelA[i].add(new MultiLineLabel(promptPanelA[i], this.promptA[i], maxWidth)); 585 promptPanelA[i].add(promptInnerPanelA[i]); 586 playA[i] = addButton(playButton, promptPanelA[i], false); 587 captA[i] = addButton(recordButton, promptPanelA[i], false); 588 prompts.add(promptPanelA[i]); 589 } 590 // ############ Prompts container #################################### 591 promptsContainer.add(prompts); 592 p2.add(promptsContainer); 593 /* 594 // ############ Prompt1 #################################### 524 595 JPanel prompt1Panel = new JPanel(); 525 prompt1Panel.setLayout(new FlowLayout(FlowLayout.LEFT)); 526 JPanel prompt1InnerPanel = new JPanel(); 596 prompt1Panel.setLayout(new FlowLayout(FlowLayout.LEFT)); 597 JPanel prompt1InnerPanel = new JPanel(); 527 598 prompt1InnerPanel.setBorder(BorderFactory.createLineBorder (voxforgeColour, 1)); 528 // !!!!!! 529 //prompt1InnerPanel.add(new JLabel(this.prompt1)); 530 prompt1InnerPanel.add(new MultiLineLabel(prompt1InnerPanel, this.prompt1, maxWidth)); 531 // !!!!!! 599 prompt1InnerPanel.add(new MultiLineLabel(prompt1Panel, this.prompt1, maxWidth)); 532 600 prompt1Panel.add(prompt1InnerPanel); 533 601 play1 = addButton(playButton, prompt1Panel, false); 534 play1.setSize(10,10); 535 capt1 = addButton(recordButton, prompt1Panel, true); 536 prompts.add(prompt1Panel); 602 capt1 = addButton(recordButton, prompt1Panel, false); 603 prompts.add(prompt1Panel); 537 604 // ############ Prompt2 #################################### 538 605 JPanel prompt2Panel = new JPanel(); … … 540 607 JPanel prompt2InnerPanel = new JPanel(); 541 608 prompt2InnerPanel.setBorder(BorderFactory.createLineBorder (voxforgeColour, 1)); 542 // !!!!!!543 //prompt2InnerPanel.add(new JLabel(this.prompt2));544 609 prompt2InnerPanel.add(new MultiLineLabel(prompt2Panel, this.prompt2, maxWidth)); 545 // !!!!!!546 610 prompt2Panel.add(prompt2InnerPanel); 547 611 play2 = addButton(playButton, prompt2Panel, false); … … 553 617 JPanel prompt3InnerPanel = new JPanel(); 554 618 prompt3InnerPanel.setBorder(BorderFactory.createLineBorder (voxforgeColour, 1)); 555 // !!!!!!556 //prompt3InnerPanel.add(new JLabel(this.prompt3));557 619 prompt3InnerPanel.add(new MultiLineLabel(prompt3Panel, this.prompt3, maxWidth)); 558 // !!!!!!559 620 prompt3Panel.add(prompt3InnerPanel); 560 621 play3 = addButton(playButton, prompt3Panel, false); … … 566 627 JPanel prompt4InnerPanel = new JPanel(); 567 628 prompt4InnerPanel.setBorder(BorderFactory.createLineBorder (voxforgeColour, 1)); 568 // !!!!!!569 //prompt4InnerPanel.add(new JLabel(this.prompt4));570 629 prompt4InnerPanel.add(new MultiLineLabel(prompt4Panel, this.prompt4, maxWidth)); 571 // !!!!!!572 630 prompt4Panel.add(prompt4InnerPanel); 573 631 play4 = addButton(playButton, prompt4Panel, false); … … 579 637 JPanel prompt5InnerPanel = new JPanel(); 580 638 prompt5InnerPanel.setBorder(BorderFactory.createLineBorder (voxforgeColour, 1)); 581 // !!!!!!582 //prompt5InnerPanel.add(new JLabel(this.prompt5));583 639 prompt5InnerPanel.add(new MultiLineLabel(prompt5Panel, this.prompt5, maxWidth)); 584 // !!!!!!585 640 prompt5Panel.add(prompt5InnerPanel); 586 641 play5 = addButton(playButton, prompt5Panel, false); … … 592 647 JPanel prompt6InnerPanel = new JPanel(); 593 648 prompt6InnerPanel.setBorder(BorderFactory.createLineBorder (voxforgeColour, 1)); 594 // !!!!!!595 //prompt6InnerPanel.add(new JLabel(this.prompt6));596 649 prompt6InnerPanel.add(new MultiLineLabel(prompt6Panel, this.prompt6, maxWidth)); 597 // !!!!!!598 650 prompt6Panel.add(prompt6InnerPanel); 599 651 play6 = addButton(playButton, prompt6Panel, false); … … 606 658 JPanel prompt7InnerPanel = new JPanel(); 607 659 prompt7InnerPanel.setBorder(BorderFactory.createLineBorder (voxforgeColour, 1)); 608 // !!!!!!609 //prompt7InnerPanel.add(new JLabel(this.prompt7));610 660 prompt7InnerPanel.add(new MultiLineLabel(prompt7Panel, this.prompt7, maxWidth)); 611 // !!!!!!612 661 prompt7Panel.add(prompt7InnerPanel); 613 662 play7 = addButton(playButton, prompt7Panel, false); … … 619 668 JPanel prompt8InnerPanel = new JPanel(); 620 669 prompt8InnerPanel.setBorder(BorderFactory.createLineBorder (voxforgeColour, 1)); 621 // !!!!!!622 //prompt8InnerPanel.add(new JLabel(this.prompt8));623 670 prompt8InnerPanel.add(new MultiLineLabel(prompt8Panel, this.prompt8, maxWidth)); 624 // !!!!!!625 671 prompt8Panel.add(prompt8InnerPanel); 626 672 play8 = addButton(playButton, prompt8Panel, false); … … 632 678 JPanel prompt9InnerPanel = new JPanel(); 633 679 prompt9InnerPanel.setBorder(BorderFactory.createLineBorder (voxforgeColour, 1)); 634 // !!!!!!635 //prompt9InnerPanel.add(new JLabel(this.prompt9));636 680 prompt9InnerPanel.add(new MultiLineLabel(prompt9Panel, this.prompt9, maxWidth)); 637 // !!!!!!638 681 prompt9Panel.add(prompt9InnerPanel); 639 682 play9 = addButton(playButton, prompt9Panel, false); … … 645 688 JPanel prompt10InnerPanel = new JPanel(); 646 689 prompt10InnerPanel.setBorder(BorderFactory.createLineBorder (voxforgeColour, 1)); 647 // !!!!!!648 //prompt10InnerPanel.add(new JLabel(this.prompt10));649 690 prompt10InnerPanel.add(new MultiLineLabel(prompt10Panel, this.prompt10, maxWidth)); 650 // !!!!!!651 691 prompt10Panel.add(prompt10InnerPanel); 652 692 play10 = addButton(playButton, prompt10Panel, false); … … 658 698 promptsContainer.add(prompts); 659 699 p2.add(promptsContainer); 700 */ 660 701 // ############ Sampling Graph #################################### 661 702 JPanel samplingPanel = new JPanel(new BorderLayout()); … … 717 758 public void close() { 718 759 if (playback.thread != null) { 760 // !!!!!! 761 for (int i = 0; i < numberofPrompts; i++) { 762 playA[i].doClick(0); 763 } 764 /* 719 765 play1.doClick(0); 720 766 play2.doClick(0); … … 727 773 play9.doClick(0); 728 774 play10.doClick(0); 775 !!!!!! */ 729 776 } 730 777 if (capture.thread != null) { 731 // captB.doClick(0); 778 // !!!!!! 779 for (int i = 0; i < numberofPrompts; i++) { 780 captA[i].doClick(0); 781 } 782 /* 732 783 capt1.doClick(0); 733 784 capt2.doClick(0); … … 740 791 capt9.doClick(0); 741 792 capt10.doClick(0); 793 !!!!!! */ 742 794 } 743 795 } … … 751 803 752 804 private void setButtonsOff() { 805 // !!!!!! 806 for (int i = 0; i < numberofPrompts; i++) { 807 playA[i].setEnabled(false); 808 captA[i].setEnabled(false); 809 } 810 /* 753 811 play1.setEnabled(false); 754 812 capt1.setEnabled(false); … … 771 829 play10.setEnabled(false); 772 830 capt10.setEnabled(false); 831 !!!!!! */ 773 832 } 774 833 775 834 private void saveButtonState() { 835 // !!!!!! 836 for (int i = 0; i < numberofPrompts; i++) { 837 playA[i].setEnabled(false); 838 if (playA[i].isEnabled()) {play_stateA [i] = true;} else {play_stateA [i] = false;} 839 if (captA[i].isEnabled()) {capt_stateA [i] = true;} else {capt_stateA [i] = false;} 840 } 841 /* 776 842 if (play1.isEnabled()) {play1_state = true;} else {play1_state = false;} 777 843 if (play2.isEnabled()) {play2_state = true;} else {play2_state = false;} … … 793 859 if (capt8.isEnabled()) {capt8_state = true;} else {capt8_state = false;} 794 860 if (capt9.isEnabled()) {capt9_state = true;} else {capt9_state = false;} 795 if (capt10.isEnabled()) {capt10_state = true;} else {capt10_state = false;} 861 if (capt10.isEnabled()) {capt10_state = true;} else {capt10_state = false;} 862 !!!!!! */ 796 863 } 797 864 798 865 private void restoreButtonState() { 866 // !!!!!! 867 for (int i = 0; i < numberofPrompts; i++) { 868 playA[i].setEnabled(false); 869 if (play_stateA[i]) {playA[i].setEnabled(true);} else {playA[i].setEnabled(false);} 870 if (capt_stateA[i]) {captA[i].setEnabled(true);} else {captA[i].setEnabled(false);} 871 } 872 /* 799 873 if (play1_state) {play1.setEnabled(true);} else {play1.setEnabled(false);} 800 874 if (play2_state) {play2.setEnabled(true);} else {play2.setEnabled(false);} … … 816 890 if (capt8_state) {capt8.setEnabled(true);} else {capt8.setEnabled(false);} 817 891 if (capt9_state) {capt9.setEnabled(true);} else {capt9.setEnabled(false);} 818 if (capt10_state) {capt10.setEnabled(true);} else {capt10.setEnabled(false);} 892 if (capt10_state) {capt10.setEnabled(true);} else {capt10.setEnabled(false);} 893 !!!!!! */ 819 894 } 820 895 … … 822 897 Object obj = e.getSource(); 823 898 824 // ################### Play ####################################### 899 // ################### Play ####################################### 900 // !!!!!! 901 if (obj.equals(playA)) { // does not work!!!!!! 902 System.err.println("Object: playA"); 903 904 for (int i = 0; i < numberofPrompts; i++) { 905 if (obj.equals(playA[i])) { 906 if (playA[i].getText().startsWith(playButton)) { 907 wavFile = wavFileA[i]; 908 duration = durationA[i]; 909 totalBytesWritten = totalBytesWrittenA[i]; 910 System.err.println("=== Play1 ===");// !!!!!! 911 playback.start(); 912 System.err.println("duration:" + duration); 913 fileName = promptidA[i]; 914 samplingGraph.start(); 915 captA[i].setEnabled(false); 916 playA[i].setText(stopButton); 917 } else { 918 playback.stop(); 919 samplingGraph.stop(); 920 captA[i].setEnabled(true); 921 playA[i].setText(playButton); 922 } 923 } 924 } 925 } else if (obj.equals(captA)) {// does not work!!!!!! 926 System.err.println("Object: captA"); 927 for (int x = 0; x < numberofPrompts; x++) { 928 if (obj.equals(captA[x])) { 929 if (captA[x].getText().startsWith(recordButton)) { 930 file = null; 931 wavFile = wavFileA[x]; 932 System.err.println("=== Record1 ==="); // !!!!!! 933 capture.start(uploadWavFileA[x]); 934 fileName = promptidA[x]; 935 samplingGraph.start(); 936 saveButtonState(); 937 setButtonsOff(); 938 captA[x].setEnabled(true); 939 captA[x].setText(stopButton); 940 moreInfoB.setEnabled(false); 941 aboutB.setEnabled(false); 942 } else { 943 lines.removeAllElements(); 944 capture.stop(); 945 totalBytesWrittenA[x] = totalBytesWritten; // !!!!!! 946 durationA[x]= totalBytesWritten / (double) (format.getSampleRate() * format.getSampleSizeInBits()/ 8); 947 System.err.println("duration1:" + durationA[x]); 948 samplingGraph.stop(); 949 restoreButtonState(); 950 playA[x].setEnabled(true); 951 captA[x].setText(recordButton); 952 moreInfoB.setEnabled(true); 953 aboutB.setEnabled(true); 954 captA[x].setEnabled(true); 955 } 956 } 957 } 958 } 959 /* 825 960 if (obj.equals(play1)) { 826 961 if (play1.getText().startsWith(playButton)) { … … 1013 1148 } 1014 1149 } 1015 // ################### Record ####################################### 1150 1151 // ################### Record ####################################### 1016 1152 else if (obj.equals(capt1)) { 1017 1153 if (capt1.getText().startsWith(recordButton)) { … … 1031 1167 lines.removeAllElements(); 1032 1168 capture.stop(); 1033 // !!!!!!1034 // duration1 = duration; // !!!!!!1035 1169 totalBytesWritten1 = totalBytesWritten; // !!!!!! 1036 1170 duration1 = totalBytesWritten / (double) (format.getSampleRate() * format.getSampleSizeInBits()/ 8); 1037 1171 System.err.println("duration1:" + duration1); 1038 // !!!!!!1039 1172 samplingGraph.stop(); 1040 1173 restoreButtonState(); … … 1063 1196 lines.removeAllElements(); 1064 1197 capture.stop(); 1065 // !!!!!!1066 // duration2 = duration; // !!!!!!1067 1198 totalBytesWritten2 = totalBytesWritten; // !!!!!! 1068 1199 duration2 = totalBytesWritten / (double) (format.getSampleRate() * format.getSampleSizeInBits()/ 8); 1069 1200 System.err.println("duration2:" + duration2); 1070 // !!!!!!1071 1201 samplingGraph.stop(); 1072 1202 restoreButtonState(); … … 1095 1225 lines.removeAllElements(); 1096 1226 capture.stop(); 1097 // !!!!!!1098 // duration3 = duration; // !!!!!!1099 1227 totalBytesWritten3 = totalBytesWritten; // !!!!!! 1100 1228 duration3 = totalBytesWritten / (double) (format.getSampleRate() * format.getSampleSizeInBits()/ 8); 1101 1229 System.err.println("duration3:" + duration3); 1102 // !!!!!!1103 1230 samplingGraph.stop(); 1104 1231 restoreButtonState(); … … 1127 1254 lines.removeAllElements(); 1128 1255 capture.stop(); 1129 // !!!!!!1130 // duration4 = duration; // !!!!!!1131 1256 totalBytesWritten4 = totalBytesWritten; // !!!!!! 1132 1257 duration4 = totalBytesWritten / (double) (format.getSampleRate() * format.getSampleSizeInBits()/ 8); 1133 1258 samplingGraph.stop(); 1134 1259 System.err.println("duration4:" + duration4); 1135 // !!!!!!1136 1260 restoreButtonState(); 1137 1261 play4.setEnabled(true); … … 1159 1283 lines.removeAllElements(); 1160 1284 capture.stop(); 1161 // !!!!!!1162 // duration5 = duration; // !!!!!!1163 1285 totalBytesWritten5 = totalBytesWritten; // !!!!!! 1164 1286 duration5 = totalBytesWritten / (double) (format.getSampleRate() * format.getSampleSizeInBits()/ 8); 1165 1287 System.err.println("duration5:" + duration5); 1166 // !!!!!!1167 1288 samplingGraph.stop(); 1168 1289 restoreButtonState(); … … 1191 1312 lines.removeAllElements(); 1192 1313 capture.stop(); 1193 // !!!!!!1194 // duration6 = duration; // !!!!!!1195 1314 totalBytesWritten6 = totalBytesWritten; // !!!!!! 1196 1315 duration6 = totalBytesWritten / (double) (format.getSampleRate() * format.getSampleSizeInBits()/ 8); 1197 1316 System.err.println("duration6:" + duration6); 1198 // !!!!!!1199 1317 samplingGraph.stop(); 1200 1318 restoreButtonState(); … … 1223 1341 lines.removeAllElements(); 1224 1342 capture.stop(); 1225 // !!!!!!1226 // duration7 = duration; // !!!!!!1227 1343 totalBytesWritten7 = totalBytesWritten; // !!!!!! 1228 1344 duration7 = totalBytesWritten / (double) (format.getSampleRate() * format.getSampleSizeInBits()/ 8); 1229 1345 System.err.println("duration7:" + duration7); 1230 // !!!!!!1231 1346 samplingGraph.stop(); 1232 1347 restoreButtonState(); … … 1255 1370 lines.removeAllElements(); 1256 1371 capture.stop(); 1257 // !!!!!!1258 // duration8 = duration; // !!!!!!1259 1372 totalBytesWritten8 = totalBytesWritten; // !!!!!! 1260 1373 duration8 = totalBytesWritten / (double) (format.getSampleRate() * format.getSampleSizeInBits()/ 8); 1261 1374 System.err.println("duration8:" + duration8); 1262 // !!!!!!1263 1375 samplingGraph.stop(); 1264 1376 restoreButtonState(); … … 1287 1399 lines.removeAllElements(); 1288 1400 capture.stop(); 1289 // !!!!!!1290 // duration9 = duration; // !!!!!!1291 1401 totalBytesWritten9 = totalBytesWritten; // !!!!!! 1292 1402 duration9 = totalBytesWritten / (double) (format.getSampleRate() * format.getSampleSizeInBits()/ 8); 1293 1403 System.err.println("duration9:" + duration9); 1294 // !!!!!!1295 1404 samplingGraph.stop(); 1296 1405 restoreButtonState(); … … 1319 1428 lines.removeAllElements(); 1320 1429 capture.stop(); 1321 // !!!!!!1322 // duration10 = duration; // !!!!!!1323 1430 totalBytesWritten10 = totalBytesWritten; // !!!!!! 1324 1431 duration10 = totalBytesWritten / (double) (format.getSampleRate() * format.getSampleSizeInBits()/ 8); 1325 1432 System.err.println("duration10:" + duration10); 1326 // !!!!!!1327 1433 samplingGraph.stop(); 1328 1434 restoreButtonState(); … … 1334 1440 } 1335 1441 } 1442 !!!!!! */ 1336 1443 // ################### Upload ####################################### 1337 1444 else if (obj.equals(uploadB)) { 1445 //!!!!!! 1446 for (int i = 0; i < numberofPrompts; i++) { 1447 playA[i].setEnabled(false); 1448 captA[i].setEnabled(false); 1449 } 1450 /* 1338 1451 play1.setEnabled(false); 1339 1452 capt1.setEnabled(false); … … 1356 1469 play10.setEnabled(false); 1357 1470 capt10.setEnabled(false); 1358 1471 !!!!!! */ 1359 1472 uploadB.setEnabled(false); 1360 1473 try { … … 1517 1630 thread = null; 1518 1631 samplingGraph.stop(); 1632 // !!!!!! 1633 for (int i = 0; i < numberofPrompts; i++) { 1634 if (playA[i].getText().startsWith(stopButton)) { //play button gets set to "Stop" after play is pressed 1635 captA[i].setEnabled(true); 1636 } 1637 } 1638 /* 1519 1639 if (play1.getText().startsWith(stopButton)) { //play button gets set to "Stop" after play is pressed 1520 1640 capt1.setEnabled(true); … … 1538 1658 capt10.setEnabled(true); 1539 1659 } 1660 !!!!!!! */ 1661 // !!!!!! 1662 for (int i = 0; i < numberofPrompts; i++) { 1663 playA[i].setText(playButton); 1664 } 1665 /* 1540 1666 play1.setText(playButton); 1541 1667 play2.setText(playButton); … … 1547 1673 play8.setText(playButton); 1548 1674 play9.setText(playButton); 1549 play10.setText(playButton); 1675 play10.setText(playButton); 1676 !!!!!! */ 1550 1677 } 1551 1678 } 1552 1679 1553 1680 public void run() { 1554 // reload the file if loaded by file1555 /* !!!!!! if (file != null) {1556 createAudioInputStream(file, false);1557 // !!!!!!1558 System.err.println("playback ...createAudioInputStream file:" + file);1559 // !!!!!!1560 }1561 1562 // make sure we have something to play1563 if (audioInputStream == null) {1564 shutDown("No loaded audio to play back");1565 return;1566 }1567 !!!!!! */1568 // reset to the beginning of the stream1569 1570 /* try {1571 audioInputStream.reset();1572 } catch (Exception e) {1573 shutDown("Unable to reset the stream\n" + e);1574 return;1575 }1576 */1577 // debug System.err.println("calling getAudioInputStream from Playback");1578 1681 getAudioInputStream(); 1579 1682 … … 1817 1920 1818 1921 duration = totalBytesWritten / (double) (format.getSampleRate() * format.getSampleSizeInBits()/ 8); 1819 // !!!!!!1820 1922 System.err.println("capture duration:" + duration); 1821 // !!!!!!1822 1923 // debug System.err.println("Calculated duration"); 1823 1924 samplingGraph.createWaveForm(audioBytes); … … 1871 1972 thread = new Thread(this); 1872 1973 thread.setName("ConvertAndUpload"); 1873 // !!!!!!1874 1974 System.err.println("=== Upload ==="); 1875 // !!!!!!1876 1975 thread.start(); 1877 1976 } … … 1885 1984 progBar.setStringPainted(true); 1886 1985 progBar.setMaximum(100); 1887 // !!!!!!1888 //progBar.setString("Uploading...");1889 1986 progBar.setString(uploadingMessageLabel); 1890 // !!!!!!1891 1987 progBar.setIndeterminate(false); 1892 1988 progBar.setMinimum(0); … … 1900 1996 1901 1997 File[] files = new File[15]; 1902 //############ audio files #################################### 1998 //############ audio files #################################### 1999 // !!!!!! 2000 for (int i = 0; i < numberofPrompts; i++) { 2001 files[i] = uploadWavFileA[i]; 2002 } 2003 /* 1903 2004 files[1] = uploadWavFile1; 1904 2005 files[2] = uploadWavFile2; … … 1911 2012 files[9] = uploadWavFile9; 1912 2013 files[10] = uploadWavFile10; 2014 !!!!!! */ 1913 2015 //############ prompt files #################################### 1914 2016 try { 1915 2017 BufferedWriter out_prompts = new BufferedWriter(new FileWriter(promptsFile)); 2018 // !!!!!! 2019 for (int i = 0; i < numberofPrompts; i++) { 2020 out_prompts.write(promptidA[i] + " " + promptA[i] + System.getProperty("line.separator")); 2021 } 2022 /* 1916 2023 out_prompts.write(promptID1 + " " + prompt1 + System.getProperty("line.separator")); 1917 2024 out_prompts.write(promptID2 + " " + prompt2 + System.getProperty("line.separator")); … … 1923 2030 out_prompts.write(promptID8 + " " + prompt8 + System.getProperty("line.separator")); 1924 2031 out_prompts.write(promptID9 + " " + prompt9 + System.getProperty("line.separator")); 1925 out_prompts.write(promptID10 + " " + prompt10 + System.getProperty("line.separator")); 2032 out_prompts.write(promptID10 + " " + prompt10 + System.getProperty("line.separator")); 2033 !!!!!! */ 1926 2034 out_prompts.close(); 1927 2035 } catch (IOException e) { … … 1931 2039 //############ ReadMe file#################################### 1932 2040 try { 1933 // !!!!!!1934 2041 BufferedWriter out_readme = new BufferedWriter(new FileWriter(readmeFile)); 1935 1936 //OutputStream out_readme = new FileOutputStream(readmeFile); 1937 //Writer writer = new OutputStreamWriter(out_readme, "UTF-8"); 1938 1939 //System.err.println(System.getProperty("line.separator") + "getPromptTextFile Character Encoding:" + out_readme.getEncoding()); // doesn't work ???? 1940 // !!!!!! 2042 1941 2043 out_readme.write("User Name:" + userName + System.getProperty("line.separator")); 1942 2044 out_readme.write(System.getProperty("line.separator")); … … 1975 2077 try { 1976 2078 Calendar cal = Calendar.getInstance(); 1977 int year = cal.get(Calendar.YEAR);2079 //int year = cal.get(Calendar.YEAR); 1978 2080 BufferedWriter out_licenseNoticeFile = new BufferedWriter(new FileWriter(licenseNoticeFile)); 1979 2081 String licenseNotice = "Copyright " + cal.get(Calendar.YEAR) + " " + copyrightName + System.getProperty("line.separator") … … 2232 2334 g2.setColor(Color.black); 2233 2335 g2.setFont(font12); 2234 // !!!!!!2235 //g2.drawString("Length: " + String.valueOf(seconds), 3, h-4);2236 2336 g2.drawString(sampleGraphLengthLabel + String.valueOf(seconds), 3, h-4); 2237 // !!!!!!2238 2337 } else { 2239 2338 g2.setColor(Color.black); … … 2315 2414 <