Changeset 2374
- Timestamp:
- 12/27/07 17:04:57 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
Trunk/SpeechSubmission/VFSpeechSubmission/java/src/speechrecorder/CapturePlayback.java
r2367 r2374 153 153 double seconds; 154 154 long totalBytesWritten = 0L; 155 long totalBytesWritten1 = 0L; 156 long totalBytesWritten2 = 0L; 157 long totalBytesWritten3 = 0L; 158 long totalBytesWritten4 = 0L; 159 long totalBytesWritten5 = 0L; 160 long totalBytesWritten6 = 0L; 161 long totalBytesWritten7 = 0L; 162 long totalBytesWritten8 = 0L; 163 long totalBytesWritten9 = 0L; 164 long totalBytesWritten10 = 0L; 155 165 File file; 156 166 Vector lines = new Vector(); … … 699 709 700 710 private void setButtonsOff() { 701 // debug System.err.println("!!!!!!!setButtonsOff" );702 711 play1.setEnabled(false); 703 712 capt1.setEnabled(false); … … 723 732 724 733 private void saveButtonState() { 725 // debug System.err.println("!!!!!!!saveButtonState" );726 734 if (play1.isEnabled()) {play1_state = true;} else {play1_state = false;} 727 735 if (play2.isEnabled()) {play2_state = true;} else {play2_state = false;} … … 747 755 748 756 private void restoreButtonState() { 749 // debug System.err.println("!!!!!!restoreButtonState" );750 757 if (play1_state) {play1.setEnabled(true);} else {play1.setEnabled(false);} 751 758 if (play2_state) {play2.setEnabled(true);} else {play2.setEnabled(false);} … … 778 785 wavFile = wavFile1; 779 786 duration = duration1; 787 // !!!!!! 788 System.err.println("play1 totalBytesWritten1:" + totalBytesWritten1); 789 // !!!!!! 790 totalBytesWritten = totalBytesWritten1; 780 791 playback.start(); 781 792 fileName = promptID1; … … 794 805 wavFile = wavFile2; 795 806 duration = duration2; 807 // !!!!!! 808 System.err.println("play2 totalBytesWritten2:" + totalBytesWritten2); 809 // !!!!!! 810 totalBytesWritten = totalBytesWritten2; 796 811 playback.start(); 797 812 fileName = promptID2; … … 809 824 if (play3.getText().startsWith(playButton)) { 810 825 wavFile = wavFile3; 826 duration = duration3; 827 // !!!!!! 828 System.err.println("play3 totalBytesWritten3:" + totalBytesWritten3); 829 // !!!!!! 830 totalBytesWritten = totalBytesWritten3; 811 831 playback.start(); 812 duration = duration3;813 832 fileName = promptID3; 814 833 samplingGraph.start(); … … 826 845 wavFile = wavFile4; 827 846 duration = duration4; 847 // !!!!!! 848 System.err.println("play4 totalBytesWritten4:" + totalBytesWritten4); 849 // !!!!!! 850 totalBytesWritten = totalBytesWritten4; 828 851 playback.start(); 829 852 fileName = promptID4; … … 842 865 wavFile = wavFile5; 843 866 duration = duration5; 867 // !!!!!! 868 System.err.println("play5 totalBytesWritten5:" + totalBytesWritten5); 869 // !!!!!! 870 totalBytesWritten = totalBytesWritten5; 844 871 playback.start(); 845 872 fileName = promptID5; … … 858 885 wavFile = wavFile6; 859 886 duration = duration6; 887 totalBytesWritten = totalBytesWritten6; 860 888 playback.start(); 861 889 fileName = promptID6; … … 874 902 wavFile = wavFile7; 875 903 duration = duration7; 904 totalBytesWritten = totalBytesWritten7; 876 905 playback.start(); 877 906 fileName = promptID7; … … 890 919 wavFile = wavFile8; 891 920 duration = duration8; 921 totalBytesWritten = totalBytesWritten8; 892 922 playback.start(); 893 923 fileName = promptID8; … … 906 936 wavFile = wavFile9; 907 937 duration = duration9; 938 totalBytesWritten = totalBytesWritten9; 908 939 playback.start(); 909 940 fileName = promptID9; … … 922 953 wavFile = wavFile10; 923 954 duration = duration10; 955 totalBytesWritten = totalBytesWritten10; 924 956 playback.start(); 925 957 fileName = promptID10; … … 939 971 file = null; 940 972 wavFile = wavFile1; 941 duration1 = 0;942 capture.start(uploadWavFile1); 973 // duration1 = 0; 974 capture.start(uploadWavFile1); 943 975 duration1 = duration; 944 976 fileName = promptID1; … … 953 985 lines.removeAllElements(); 954 986 capture.stop(); 987 totalBytesWritten1 = totalBytesWritten; 988 // !!!!!! 989 System.err.println("capt1 totalBytesWritten1:" + totalBytesWritten1); 990 // !!!!!! 955 991 samplingGraph.stop(); 956 992 restoreButtonState(); … … 966 1002 file = null; 967 1003 wavFile = wavFile2; 968 duration2 = 0;969 capture.start(uploadWavFile2); 1004 // duration2 = 0; 1005 capture.start(uploadWavFile2); 970 1006 duration2 = duration; 971 1007 fileName = promptID2; … … 980 1016 lines.removeAllElements(); 981 1017 capture.stop(); 1018 totalBytesWritten2 = totalBytesWritten; 1019 // !!!!!! 1020 System.err.println("capt2 totalBytesWritten2:" + totalBytesWritten2); 1021 // !!!!!! 982 1022 samplingGraph.stop(); 983 1023 restoreButtonState(); … … 993 1033 file = null; 994 1034 wavFile = wavFile3; 995 duration3 = 0;1035 // duration3 = 0; 996 1036 capture.start(uploadWavFile3); 997 1037 duration3 = duration; … … 1007 1047 lines.removeAllElements(); 1008 1048 capture.stop(); 1049 totalBytesWritten3 = totalBytesWritten; 1050 // !!!!!! 1051 System.err.println("capt3 totalBytesWritten3:" + totalBytesWritten3); 1052 // !!!!!! 1009 1053 samplingGraph.stop(); 1010 1054 restoreButtonState(); … … 1019 1063 if (capt4.getText().startsWith(recordButton)) { 1020 1064 file = null; 1021 wavFile = wavFile4; 1065 wavFile = wavFile4; 1066 // duration4 = 0; 1022 1067 capture.start(uploadWavFile4); 1023 duration4 = 0;1024 1068 duration4 = duration; 1025 1069 fileName = promptID4; … … 1034 1078 lines.removeAllElements(); 1035 1079 capture.stop(); 1080 totalBytesWritten4 = totalBytesWritten; 1081 // !!!!!! 1082 System.err.println("capt4 totalBytesWritten4:" + totalBytesWritten4); 1083 // !!!!!! 1036 1084 samplingGraph.stop(); 1037 1085 restoreButtonState(); … … 1046 1094 if (capt5.getText().startsWith(recordButton)) { 1047 1095 file = null; 1048 wavFile = wavFile5; 1096 wavFile = wavFile5; 1097 // duration5 = 0; 1049 1098 capture.start(uploadWavFile5); 1050 duration5 = 0;1051 1099 duration5 = duration; 1052 1100 fileName = promptID5; … … 1061 1109 lines.removeAllElements(); 1062 1110 capture.stop(); 1111 totalBytesWritten5 = totalBytesWritten; 1112 // !!!!!! 1113 System.err.println("capt5 totalBytesWritten5:" + totalBytesWritten5); 1114 // !!!!!! 1063 1115 samplingGraph.stop(); 1064 1116 restoreButtonState(); … … 1074 1126 file = null; 1075 1127 wavFile = wavFile6; 1076 duration6 = 0;1128 // duration6 = 0; 1077 1129 capture.start(uploadWavFile6); 1130 totalBytesWritten6 = totalBytesWritten; 1078 1131 duration6 = duration; 1079 1132 fileName = promptID6; … … 1101 1154 file = null; 1102 1155 wavFile = wavFile7; 1103 duration7 = 0;1156 // duration7 = 0; 1104 1157 capture.start(uploadWavFile7); 1158 totalBytesWritten7 = totalBytesWritten; 1105 1159 duration7 = duration; 1106 1160 fileName = promptID7; … … 1128 1182 file = null; 1129 1183 wavFile = wavFile8; 1130 duration8 = 0;1184 // duration8 = 0; 1131 1185 capture.start(uploadWavFile8); 1186 totalBytesWritten8 = totalBytesWritten; 1132 1187 duration8 = duration; 1133 1188 fileName = promptID8; … … 1155 1210 file = null; 1156 1211 wavFile = wavFile9; 1157 duration9 = 0;1212 // duration9 = 0; 1158 1213 capture.start(uploadWavFile9); 1214 totalBytesWritten9 = totalBytesWritten; 1159 1215 duration9 = duration; 1160 1216 fileName = promptID9; … … 1182 1238 file = null; 1183 1239 wavFile = wavFile10; 1184 duration10 = 0; 1185 capture.start(uploadWavFile10); 1240 // duration10 = 0; 1241 capture.start(uploadWavFile10); 1242 totalBytesWritten10 = totalBytesWritten; 1186 1243 duration10 = duration; 1187 1244 fileName = promptID10; … … 1335 1392 } 1336 1393 1337 // reset to the beginn ning of the captured data1394 // reset to the beginning of the captured data 1338 1395 try { 1339 1396 audioInputStream.reset(); … … 1369 1426 1370 1427 public void start() { 1428 // !!!!!! 1429 System.err.println("=== Play ========================================================="); 1430 // !!!!!! 1431 1371 1432 errStr = null; 1372 1433 thread = new Thread(this); … … 1441 1502 } 1442 1503 */ 1443 System.err.println("calling getAudioInputStream from Capture");1504 // debug System.err.println("calling getAudioInputStream from Playback"); 1444 1505 getAudioInputStream(); 1445 1506 … … 1487 1548 } 1488 1549 outbaos.write(data, 0, numBytesRead); 1550 // !!!!!! 1551 /// System.err.println("numBytesRead" + numBytesRead); 1552 // !!!!!! 1489 1553 } catch (Exception e) { 1490 1554 shutDown("Error during playback: " + e); … … 1493 1557 } 1494 1558 byte audioBytes[] = outbaos.toByteArray(); 1559 // !!!!!! 1560 System.err.println("outbaos size:" + outbaos.size()); 1561 outbaos.reset(); 1562 outbaos = null; 1563 // !!!!!! 1495 1564 samplingGraph.createWaveForm(audioBytes); 1496 1565 samplingGraph.repaint(); … … 1553 1622 public void start(File uploadWavFile) { 1554 1623 this.uploadWavFile = uploadWavFile; 1624 // !!!!!! 1625 System.err.println("== Capture ========================================================="); 1626 // !!!!!! 1555 1627 System.err.println("Capture uploadWavFile is:" + uploadWavFile); 1556 1628 … … 1700 1772 } 1701 1773 } 1702 1703 // debug System.err.println("About to grab audio input stream from cache file"); 1774 // !!!!!! 1775 System.err.println("getAudioInputStream - totalBytesWritten:" + totalBytesWritten); 1776 // !!!!!! 1704 1777 try { 1705 1778 // audioInputStream = AudioSystem.getAudioInputStream(wavFile); 1779 1706 1780 audioInputStream = new AudioInputStream(new BufferedInputStream( 1707 1781 new FileInputStream(wavFile)), format, totalBytesWritten … … 1718 1792 1719 1793 /** 1720 * Performs the Speex compression ANDuploads the file1794 * uploads the file 1721 1795 */ 1722 1796 class ConvertAndUpload implements Runnable {