voxforge.org
VoxForge Dev

Changeset 2468

Show
Ignore:
Timestamp:
03/17/08 00:15:00 (9 months ago)
Author:
kmaclean
Message:

SpeechSubmission refactor to use array for prompt list - snapshot

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Trunk/SpeechSubmission/VFSpeechSubmission/java/src/speechrecorder/CapturePlayback.java

    r2467 r2468  
    6262// !!!!!! 
    6363import speechrecorder.MultiLineLabel; 
    64 // !!!!!! 
    6564 
    6665/** 
     
    8786    AudioInputStream audioInputStream; 
    8887    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/* 
    9093    JButton play1; 
    9194    JButton capt1; 
     
    108111    JButton play10; 
    109112    JButton capt10; 
     113 !!!!!! */        
     114     
    110115    JButton uploadB; 
    111116    JButton moreInfoB;     
    112117    JButton aboutB;  
    113    
     118  
     119    // !!!!!! 
     120    boolean [] play_stateA = new boolean [numberofPrompts]; 
     121    boolean [] capt_stateA = new boolean [numberofPrompts]; 
     122/* 
    114123    boolean play1_state; 
    115124    boolean capt1_state; 
     
    132141    boolean play10_state; 
    133142    boolean capt10_state; 
    134      
     143 !!!!!! */ 
    135144    License licenseObject = new License(); 
    136145    String license = licenseObject.getLicense(); 
     
    142151    String errStr; 
    143152 
     153    // !!!!!! 
     154    double [] durationA= new double [numberofPrompts]; 
    144155    double duration = 0; 
     156/* 
    145157    double duration1 = 0; 
    146158    double duration2 = 0; 
     
    152164    double duration8 = 0; 
    153165    double duration9 = 0;   
    154     double duration10 = 0;    
    155  
     166    double duration10 = 0; 
     167 !!!!!! */ 
    156168    double seconds; 
     169    // !!!!!! 
     170    long [] totalBytesWrittenA= new long [numberofPrompts]; 
    157171    long totalBytesWritten = 0L; 
     172    /* 
    158173    long totalBytesWritten1 = 0L; 
    159174    long totalBytesWritten2 = 0L; 
     
    166181    long totalBytesWritten9 = 0L; 
    167182    long totalBytesWritten10 = 0L; 
     183        !!!!!! */     
     184     
    168185    File file; 
    169186    Vector lines = new Vector(); 
    170187   
    171188    private File wavFile; 
    172  
     189    // !!!!!! 
     190    private File[] wavFileA = new File [numberofPrompts]; 
     191    /* 
    173192    private File wavFile1; 
    174193    private File wavFile2; 
     
    180199    private File wavFile8; 
    181200    private File wavFile9; 
    182     private File wavFile10;  
     201    private File wavFile10; 
     202    !!!!!! */ 
     203    private File [] uploadWavFileA = new File [numberofPrompts]; 
     204    /* 
    183205    private File uploadWavFile1; 
    184206    private File uploadWavFile2; 
     
    191213    private File uploadWavFile9; 
    192214    private File uploadWavFile10;   
     215    !!!!!! */       
    193216    private File promptsFile;   
    194217    private File readmeFile;     
     
    203226    JTextField subjectBox; 
    204227    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    /* 
    210231    String prompt1; 
    211232    String prompt2; 
     
    218239    String prompt9; 
    219240    String prompt10;   
     241    !!!!!! */ 
     242    // !!!!!! 
     243    String [] promptidA = new String [numberofPrompts];; 
     244    /* 
    220245    String promptID1; 
    221246    String promptID2; 
     
    228253    String promptID9; 
    229254    String promptID10;   
    230 // !!!!!! required for the PHP uploader to work properly 
     255    !!!!!! */   
     256//  required for the PHP uploader to work properly 
    231257    String fileFieldName = "userfile";  
    232 // !!!!!!     
    233258//  ############ Localized Fields ####################################    
    234259    JTextField usernameTextField;   
     
    296321//  ############ Localized Fields ####################################    
    297322        //this.language = language; 
    298         this.language = "RU"; //test 
    299         //this.language = "EN"; //test 
     323        //this.language = "RU"; //test 
     324        this.language = "EN"; //test 
    300325        // debug System.err.println("CapturePlayback Language:" + this.language + ":"); 
    301326 
     
    347372    uploadCompletedMessageLabel = labels.getUploadCompletedMessageLabel(); 
    348373//  ############ 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]; 
    354388        this.prompt1 = promptArray[1][0]; 
    355389                this.promptID2 = promptArray[0][1]; 
     
    370404                this.prompt9 = promptArray[1][8]; 
    371405                this.promptID10 = promptArray[0][9]; 
    372                 this.prompt10 = promptArray[1][9];               
    373     }  
     406                this.prompt10 = promptArray[1][9]; 
     407!!!!!!  */                       
     408    //}  
    374409 
    375410//        this.language = language; 
     
    381416        capturePlayback = this; 
    382417 
    383                 // Create a single WAV file that will hold our recordings 
     418                // Create WAV files to hold recordings 
    384419                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                /* 
    385426                        wavFile1 = new File(tempdir + "wavFile1.wav"); 
    386427                        wavFile1.deleteOnExit(); 
     
    403444                        wavFile10 = new File(tempdir + "wavFile10.wav"); 
    404445                        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                /* 
    406452                        uploadWavFile1 = new File(tempdir + this.promptID1 + ".wav"); 
    407453                        uploadWavFile1.deleteOnExit(); 
     
    423469                        uploadWavFile9.deleteOnExit(); 
    424470                        uploadWavFile10 = new File(tempdir + this.promptID10 + ".wav"); 
    425                         uploadWavFile10.deleteOnExit();                  
     471                        uploadWavFile10.deleteOnExit(); 
     472                        */                       
    426473                        promptsFile = new File(tempdir + "prompts.txt");                         
    427474                        promptsFile.deleteOnExit();              
     
    436483                        return; 
    437484                } 
     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                /* 
    438490                System.err.println("CapturePlayback's WAV file for recording uploadWavFile1 is:" + uploadWavFile1); 
    439491                System.err.println("CapturePlayback's WAV file for recording uploadWavFile2 is:" + uploadWavFile2); 
     
    447499                System.err.println("CapturePlayback's WAV file for recording uploadWavFile10 is:" + uploadWavFile10);            
    448500                System.err.println("---------------------------------------------------------------------------");               
    449  
     501                !!!!!! */ 
    450502                setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); 
    451503        EmptyBorder eb = new EmptyBorder(5,5,5,5); 
     
    519571        Color voxforgeColour    = new Color(197, 216, 234); 
    520572        prompts.setBorder(BorderFactory.createLineBorder (voxforgeColour, 3)); 
    521 //             ############ Prompts ####################################          
     573     
    522574        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 ####################################      
    524595        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();  
    527598        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)); 
    532600        prompt1Panel.add(prompt1InnerPanel); 
    533601        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);     
    537604//              ############ Prompt2 ####################################             
    538605        JPanel prompt2Panel = new JPanel();  
     
    540607        JPanel prompt2InnerPanel = new JPanel();  
    541608        prompt2InnerPanel.setBorder(BorderFactory.createLineBorder (voxforgeColour, 1)); 
    542         // !!!!!! 
    543         //prompt2InnerPanel.add(new JLabel(this.prompt2)); 
    544609        prompt2InnerPanel.add(new MultiLineLabel(prompt2Panel, this.prompt2, maxWidth)); 
    545         // !!!!!! 
    546610        prompt2Panel.add(prompt2InnerPanel); 
    547611        play2 = addButton(playButton, prompt2Panel, false); 
     
    553617        JPanel prompt3InnerPanel = new JPanel();  
    554618        prompt3InnerPanel.setBorder(BorderFactory.createLineBorder (voxforgeColour, 1)); 
    555         // !!!!!! 
    556         //prompt3InnerPanel.add(new JLabel(this.prompt3)); 
    557619        prompt3InnerPanel.add(new MultiLineLabel(prompt3Panel, this.prompt3, maxWidth)); 
    558         // !!!!!! 
    559620        prompt3Panel.add(prompt3InnerPanel); 
    560621        play3 = addButton(playButton, prompt3Panel, false); 
     
    566627        JPanel prompt4InnerPanel = new JPanel();  
    567628        prompt4InnerPanel.setBorder(BorderFactory.createLineBorder (voxforgeColour, 1)); 
    568         // !!!!!! 
    569         //prompt4InnerPanel.add(new JLabel(this.prompt4)); 
    570629        prompt4InnerPanel.add(new MultiLineLabel(prompt4Panel, this.prompt4, maxWidth)); 
    571         // !!!!!! 
    572630        prompt4Panel.add(prompt4InnerPanel);      
    573631        play4 = addButton(playButton, prompt4Panel, false); 
     
    579637        JPanel prompt5InnerPanel = new JPanel();  
    580638        prompt5InnerPanel.setBorder(BorderFactory.createLineBorder (voxforgeColour, 1)); 
    581         // !!!!!! 
    582         //prompt5InnerPanel.add(new JLabel(this.prompt5)); 
    583639        prompt5InnerPanel.add(new MultiLineLabel(prompt5Panel, this.prompt5, maxWidth)); 
    584         // !!!!!!         
    585640        prompt5Panel.add(prompt5InnerPanel); 
    586641        play5 = addButton(playButton, prompt5Panel, false); 
     
    592647        JPanel prompt6InnerPanel = new JPanel(); 
    593648        prompt6InnerPanel.setBorder(BorderFactory.createLineBorder (voxforgeColour, 1)); 
    594         // !!!!!! 
    595         //prompt6InnerPanel.add(new JLabel(this.prompt6)); 
    596649        prompt6InnerPanel.add(new MultiLineLabel(prompt6Panel, this.prompt6, maxWidth)); 
    597         // !!!!!!   
    598650        prompt6Panel.add(prompt6InnerPanel); 
    599651        play6 = addButton(playButton, prompt6Panel, false); 
     
    606658        JPanel prompt7InnerPanel = new JPanel();  
    607659        prompt7InnerPanel.setBorder(BorderFactory.createLineBorder (voxforgeColour, 1)); 
    608         // !!!!!! 
    609         //prompt7InnerPanel.add(new JLabel(this.prompt7)); 
    610660        prompt7InnerPanel.add(new MultiLineLabel(prompt7Panel, this.prompt7, maxWidth)); 
    611         // !!!!!!   
    612661        prompt7Panel.add(prompt7InnerPanel); 
    613662        play7 = addButton(playButton, prompt7Panel, false); 
     
    619668        JPanel prompt8InnerPanel = new JPanel();  
    620669        prompt8InnerPanel.setBorder(BorderFactory.createLineBorder (voxforgeColour, 1)); 
    621         // !!!!!! 
    622         //prompt8InnerPanel.add(new JLabel(this.prompt8)); 
    623670        prompt8InnerPanel.add(new MultiLineLabel(prompt8Panel, this.prompt8, maxWidth)); 
    624         // !!!!!!   
    625671        prompt8Panel.add(prompt8InnerPanel); 
    626672        play8 = addButton(playButton, prompt8Panel, false); 
     
    632678        JPanel prompt9InnerPanel = new JPanel();  
    633679        prompt9InnerPanel.setBorder(BorderFactory.createLineBorder (voxforgeColour, 1)); 
    634         // !!!!!! 
    635         //prompt9InnerPanel.add(new JLabel(this.prompt9)); 
    636680        prompt9InnerPanel.add(new MultiLineLabel(prompt9Panel, this.prompt9, maxWidth)); 
    637         // !!!!!!   
    638681        prompt9Panel.add(prompt9InnerPanel);      
    639682        play9 = addButton(playButton, prompt9Panel, false); 
     
    645688        JPanel prompt10InnerPanel = new JPanel();  
    646689        prompt10InnerPanel.setBorder(BorderFactory.createLineBorder (voxforgeColour, 1)); 
    647         // !!!!!! 
    648         //prompt10InnerPanel.add(new JLabel(this.prompt10)); 
    649690        prompt10InnerPanel.add(new MultiLineLabel(prompt10Panel, this.prompt10, maxWidth)); 
    650         // !!!!!!   
    651691        prompt10Panel.add(prompt10InnerPanel); 
    652692        play10 = addButton(playButton, prompt10Panel, false); 
     
    658698        promptsContainer.add(prompts); 
    659699        p2.add(promptsContainer); 
     700        */ 
    660701//      ############ Sampling Graph ####################################           
    661702        JPanel samplingPanel = new JPanel(new BorderLayout()); 
     
    717758    public void close() { 
    718759        if (playback.thread != null) { 
     760                // !!!!!! 
     761            for (int i = 0; i < numberofPrompts; i++) { 
     762                playA[i].doClick(0); 
     763            } 
     764            /* 
    719765            play1.doClick(0); 
    720766            play2.doClick(0); 
     
    727773            play9.doClick(0); 
    728774            play10.doClick(0); 
     775            !!!!!! */ 
    729776        } 
    730777        if (capture.thread != null) { 
    731      //       captB.doClick(0); 
     778                // !!!!!! 
     779            for (int i = 0; i < numberofPrompts; i++) { 
     780                captA[i].doClick(0); 
     781            } 
     782            /* 
    732783            capt1.doClick(0);  
    733784            capt2.doClick(0); 
     
    740791            capt9.doClick(0);    
    741792            capt10.doClick(0); 
     793            !!!!!! */ 
    742794        } 
    743795    } 
     
    751803     
    752804    private void setButtonsOff() { 
     805        // !!!!!! 
     806        for (int i = 0; i < numberofPrompts; i++) { 
     807                playA[i].setEnabled(false);  
     808                captA[i].setEnabled(false);  
     809        } 
     810        /* 
    753811        play1.setEnabled(false);  
    754812        capt1.setEnabled(false);  
     
    771829        play10.setEnabled(false);  
    772830        capt10.setEnabled(false);  
     831        !!!!!! */ 
    773832    } 
    774833     
    775834    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        /* 
    776842        if (play1.isEnabled()) {play1_state = true;} else {play1_state = false;} 
    777843        if (play2.isEnabled()) {play2_state = true;} else {play2_state = false;}   
     
    793859        if (capt8.isEnabled()) {capt8_state = true;} else {capt8_state = false;}         
    794860        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        !!!!!! */ 
    796863    } 
    797864     
    798865    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        /* 
    799873        if (play1_state) {play1.setEnabled(true);} else {play1.setEnabled(false);} 
    800874        if (play2_state) {play2.setEnabled(true);} else {play2.setEnabled(false);} 
     
    816890        if (capt8_state) {capt8.setEnabled(true);} else {capt8.setEnabled(false);} 
    817891        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        !!!!!! */  
    819894    } 
    820895 
     
    822897        Object obj = e.getSource(); 
    823898          
    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       /*  
    825960       if (obj.equals(play1)) { 
    826961            if (play1.getText().startsWith(playButton)) { 
     
    10131148            } 
    10141149        }            
    1015 // ################### Record #######################################           
     1150 
     1151// ################### Record #######################################      
    10161152      else if (obj.equals(capt1)) { 
    10171153        if (capt1.getText().startsWith(recordButton)) { 
     
    10311167            lines.removeAllElements();   
    10321168            capture.stop(); 
    1033             // !!!!!! 
    1034             // duration1 = duration; // !!!!!! 
    10351169            totalBytesWritten1 = totalBytesWritten; // !!!!!! 
    10361170                duration1 = totalBytesWritten / (double) (format.getSampleRate() * format.getSampleSizeInBits()/ 8); 
    10371171                System.err.println("duration1:" + duration1); 
    1038             // !!!!!! 
    10391172                samplingGraph.stop(); 
    10401173            restoreButtonState();  
     
    10631196              lines.removeAllElements();   
    10641197              capture.stop(); 
    1065               // !!!!!! 
    1066               // duration2 = duration; // !!!!!! 
    10671198              totalBytesWritten2 = totalBytesWritten; // !!!!!! 
    10681199              duration2 = totalBytesWritten / (double) (format.getSampleRate() * format.getSampleSizeInBits()/ 8); 
    10691200              System.err.println("duration2:" + duration2); 
    1070               // !!!!!! 
    10711201              samplingGraph.stop(); 
    10721202              restoreButtonState();  
     
    10951225              lines.removeAllElements();   
    10961226              capture.stop(); 
    1097               // !!!!!! 
    1098               // duration3 = duration; // !!!!!! 
    10991227              totalBytesWritten3 = totalBytesWritten; // !!!!!! 
    11001228              duration3 = totalBytesWritten / (double) (format.getSampleRate() * format.getSampleSizeInBits()/ 8); 
    11011229              System.err.println("duration3:" + duration3); 
    1102               // !!!!!! 
    11031230              samplingGraph.stop(); 
    11041231              restoreButtonState();  
     
    11271254              lines.removeAllElements();   
    11281255              capture.stop(); 
    1129               // !!!!!! 
    1130               // duration4 = duration; // !!!!!! 
    11311256              totalBytesWritten4 = totalBytesWritten; // !!!!!! 
    11321257              duration4 = totalBytesWritten / (double) (format.getSampleRate() * format.getSampleSizeInBits()/ 8); 
    11331258              samplingGraph.stop(); 
    11341259                  System.err.println("duration4:" + duration4); 
    1135               // !!!!!! 
    11361260              restoreButtonState();  
    11371261              play4.setEnabled(true); 
     
    11591283              lines.removeAllElements();   
    11601284              capture.stop(); 
    1161               // !!!!!! 
    1162               // duration5 = duration; // !!!!!! 
    11631285              totalBytesWritten5 = totalBytesWritten; // !!!!!! 
    11641286              duration5 = totalBytesWritten / (double) (format.getSampleRate() * format.getSampleSizeInBits()/ 8); 
    11651287                  System.err.println("duration5:" + duration5); 
    1166               // !!!!!! 
    11671288              samplingGraph.stop(); 
    11681289              restoreButtonState();  
     
    11911312              lines.removeAllElements();   
    11921313              capture.stop(); 
    1193               // !!!!!! 
    1194               // duration6 = duration; // !!!!!! 
    11951314              totalBytesWritten6 = totalBytesWritten; // !!!!!!        
    11961315              duration6 = totalBytesWritten / (double) (format.getSampleRate() * format.getSampleSizeInBits()/ 8); 
    11971316              System.err.println("duration6:" + duration6); 
    1198               // !!!!!! 
    11991317              samplingGraph.stop(); 
    12001318              restoreButtonState();  
     
    12231341                lines.removeAllElements();   
    12241342                capture.stop(); 
    1225                 // !!!!!! 
    1226                 // duration7 = duration; // !!!!!! 
    12271343                totalBytesWritten7 = totalBytesWritten; // !!!!!! 
    12281344                duration7 = totalBytesWritten / (double) (format.getSampleRate() * format.getSampleSizeInBits()/ 8); 
    12291345                System.err.println("duration7:" + duration7); 
    1230                 // !!!!!! 
    12311346                samplingGraph.stop(); 
    12321347                restoreButtonState();  
     
    12551370                lines.removeAllElements();   
    12561371                capture.stop(); 
    1257                 // !!!!!! 
    1258                 // duration8 = duration; // !!!!!! 
    12591372                totalBytesWritten8 = totalBytesWritten; // !!!!!! 
    12601373                duration8 = totalBytesWritten / (double) (format.getSampleRate() * format.getSampleSizeInBits()/ 8); 
    12611374                System.err.println("duration8:" + duration8); 
    1262                 // !!!!!! 
    12631375                samplingGraph.stop(); 
    12641376                restoreButtonState();  
     
    12871399                lines.removeAllElements();   
    12881400                capture.stop(); 
    1289                 // !!!!!! 
    1290                 // duration9 = duration; // !!!!!! 
    12911401                totalBytesWritten9 = totalBytesWritten; // !!!!!! 
    12921402                duration9 = totalBytesWritten / (double) (format.getSampleRate() * format.getSampleSizeInBits()/ 8); 
    12931403                System.err.println("duration9:" + duration9); 
    1294                 // !!!!!! 
    12951404                samplingGraph.stop(); 
    12961405                restoreButtonState();  
     
    13191428                lines.removeAllElements();   
    13201429                capture.stop(); 
    1321                 // !!!!!! 
    1322                 // duration10 = duration; // !!!!!! 
    13231430                totalBytesWritten10 = totalBytesWritten; // !!!!!! 
    13241431                duration10 = totalBytesWritten / (double) (format.getSampleRate() * format.getSampleSizeInBits()/ 8); 
    13251432                System.err.println("duration10:" + duration10); 
    1326                 // !!!!!! 
    13271433                samplingGraph.stop(); 
    13281434                restoreButtonState();  
     
    13341440            } 
    13351441          }   
     1442          !!!!!! */ 
    13361443//          ################### Upload #######################################                
    13371444        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                /* 
    13381451               play1.setEnabled(false); 
    13391452               capt1.setEnabled(false); 
     
    13561469               play10.setEnabled(false); 
    13571470               capt10.setEnabled(false);    
    1358                 
     1471             !!!!!! */ 
    13591472               uploadB.setEnabled(false);                
    13601473                try { 
     
    15171630                thread = null; 
    15181631                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                /* 
    15191639              if (play1.getText().startsWith(stopButton)) { //play button gets set to "Stop" after play is pressed 
    15201640                  capt1.setEnabled(true);  
     
    15381658                  capt10.setEnabled(true);  
    15391659              } 
     1660              !!!!!!! */ 
     1661              // !!!!!! 
     1662              for (int i = 0; i < numberofPrompts; i++) { 
     1663                  playA[i].setText(playButton); 
     1664              } 
     1665              /* 
    15401666              play1.setText(playButton); 
    15411667              play2.setText(playButton); 
     
    15471673              play8.setText(playButton); 
    15481674              play9.setText(playButton); 
    1549               play10.setText(playButton);  
     1675              play10.setText(playButton); 
     1676              !!!!!! */  
    15501677            }  
    15511678        } 
    15521679 
    15531680        public void run() { 
    1554             // reload the file if loaded by file 
    1555    /* !!!!!!        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 play 
    1563             if (audioInputStream == null) { 
    1564                 shutDown("No loaded audio to play back"); 
    1565                 return; 
    1566             } 
    1567   !!!!!! */ 
    1568             // reset to the beginning of the stream 
    1569  
    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"); 
    15781681                        getAudioInputStream(); 
    15791682 
     
    18171920         
    18181921                duration = totalBytesWritten / (double) (format.getSampleRate() * format.getSampleSizeInBits()/ 8); 
    1819             // !!!!!! 
    18201922                System.err.println("capture duration:" + duration); 
    1821             // !!!!!! 
    18221923                // debug        System.err.println("Calculated duration"); 
    18231924            samplingGraph.createWaveForm(audioBytes); 
     
    18711972            thread = new Thread(this); 
    18721973            thread.setName("ConvertAndUpload"); 
    1873                 // !!!!!! 
    18741974                System.err.println("=== Upload ==="); 
    1875                 // !!!!!! 
    18761975            thread.start(); 
    18771976        } 
     
    18851984            progBar.setStringPainted(true); 
    18861985            progBar.setMaximum(100); 
    1887             // !!!!!! 
    1888             //progBar.setString("Uploading..."); 
    18891986            progBar.setString(uploadingMessageLabel); 
    1890             // !!!!!! 
    18911987            progBar.setIndeterminate(false); 
    18921988            progBar.setMinimum(0); 
     
    19001996                         
    19011997                        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                /* 
    19032004                        files[1] = uploadWavFile1; 
    19042005                        files[2] = uploadWavFile2; 
     
    19112012                        files[9] = uploadWavFile9; 
    19122013                        files[10] = uploadWavFile10; 
     2014                        !!!!!! */ 
    19132015                        //############ prompt files ####################################  
    19142016                        try { 
    19152017                                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                        /* 
    19162023                                out_prompts.write(promptID1 + " " + prompt1 + System.getProperty("line.separator")); 
    19172024                                out_prompts.write(promptID2 + " " + prompt2 + System.getProperty("line.separator")); 
     
    19232030                                out_prompts.write(promptID8 + " " + prompt8 + System.getProperty("line.separator")); 
    19242031                                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                            !!!!!! */    
    19262034                            out_prompts.close(); 
    19272035                        } catch (IOException e) { 
     
    19312039                        //############ ReadMe file####################################  
    19322040                        try { 
    1933                                 // !!!!!! 
    19342041                                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                 
    19412043                                out_readme.write("User Name:" + userName + System.getProperty("line.separator")); 
    19422044                                out_readme.write(System.getProperty("line.separator"));  
     
    19752077                        try { 
    19762078                                Calendar cal = Calendar.getInstance(); 
    1977                                 int year = cal.get(Calendar.YEAR); 
     2079                                //int year = cal.get(Calendar.YEAR); 
    19782080                                BufferedWriter out_licenseNoticeFile = new BufferedWriter(new FileWriter(licenseNoticeFile)); 
    19792081                                String licenseNotice = "Copyright " + cal.get(Calendar.YEAR) + " " + copyrightName + System.getProperty("line.separator")  
     
    22322334                g2.setColor(Color.black); 
    22332335                g2.setFont(font12); 
    2234                 // !!!!!! 
    2235                 //g2.drawString("Length: " + String.valueOf(seconds), 3, h-4); 
    22362336                g2.drawString(sampleGraphLengthLabel + String.valueOf(seconds), 3, h-4); 
    2237                 // !!!!!! 
    22382337            } else { 
    22392338                g2.setColor(Color.black); 
     
    23152414<