Subversion Repository Public Repository

FingerPrint_5.2

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
package test;

import java.io.File;
import java.io.IOException;

import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.DataLine;
import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.SourceDataLine;
import javax.sound.sampled.UnsupportedAudioFileException;
import javax.swing.JOptionPane;

import org.jdesktop.application.Application;
import org.jdesktop.application.SingleFrameApplication;

import com.nru.test.ValidateLicense;

public class SFESampleApp extends SingleFrameApplication {
/////////////for audio
/*private static final int BUFFER_SIZE = 4096;

*//**
* Play a given audio file.
* @param audioFilePath Path of the audio file.
*//*
void play(String audioFilePath) {
File audioFile = new File(audioFilePath);
try {
    AudioInputStream audioStream = AudioSystem.getAudioInputStream(audioFile);

    AudioFormat format = audioStream.getFormat();

    DataLine.Info info = new DataLine.Info(SourceDataLine.class, format);

    SourceDataLine audioLine = (SourceDataLine) AudioSystem.getLine(info);

    audioLine.open(format);

    audioLine.start();
     
    System.out.println("Playback started.");
     
    byte[] bytesBuffer = new byte[BUFFER_SIZE];
    int bytesRead = -1;

    while ((bytesRead = audioStream.read(bytesBuffer)) != -1) {
        audioLine.write(bytesBuffer, 0, bytesRead);
    }
     
    audioLine.drain();
    audioLine.close();
    audioStream.close();
     
    System.out.println("Playback completed.");
     
} catch (UnsupportedAudioFileException ex) {
    System.out.println("The specified audio file is not supported.");
    ex.printStackTrace();
} catch (LineUnavailableException ex) {
    System.out.println("Audio line for playing back is unavailable.");
    ex.printStackTrace();
} catch (IOException ex) {
    System.out.println("Error playing the audio file.");
    ex.printStackTrace();
}      
}*/
/////////////////////end audio
    @Override 
    protected void startup() {
        SFESampleView view = new SFESampleView(this);
        show(view);
        
       addExitListener(view);
    
    }
    
    @Override 
    protected void configureWindow(java.awt.Window root) {
    	
    }
    
    public static SFESampleApp getApplication() {
    	
        return Application.getInstance(SFESampleApp.class);
    }
    /*
    public static void main(String[] args) {
        launch(SFESampleApp.class, args);
    }
    */
    
    //-------------------------------------------------
    public void startApplication(String[] args){
    	ValidateLicense current_license = new ValidateLicense();
    	//current_license.checkValidity();
    	boolean isValidLicense = current_license.checkValidity();
    	if(isValidLicense){
    		launch(SFESampleApp.class, args);
    		//audio
           /*	String audioFilePath = "ext/romantic_inst1.wav";
           	SFESampleApp player = new SFESampleApp();
            player.play(audioFilePath);*/
           	//end audio
    	}else{
    		JOptionPane.showMessageDialog(null, "Your Licence has been expired !!!");
    	}
    }
    
    public static void main(String[] args) {
    	Speak speak = new Speak(); 
		boolean check = new File(System.getProperty("user.home"), "speech.properties").exists();
		System.out.println("--> speech.properties file exists in "+System.getProperty("user.home")+" = "+check);
		if(!check) speak.copyFileUsingStream(new File("speech.properties"), new File(System.getProperty("user.home")+"\\speech.properties"));
		//speak.message("NRUSINGHA NATH NAYAK","checkout");
		
    	SFESampleApp app = new SFESampleApp();
    	app.startApplication(args);
    	
    	
    }
    //-------------------------------------------------
}

Commits for FingerPrint_5.2/src/test/SFESampleApp.java

Diff revisions: vs.
Revision Author Commited Message
1 lingaraj picture lingaraj Sat 24 Nov, 2018 09:32:39 +0000