forked from martinmarinov/TempestSDR
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
48 lines (36 loc) · 1.16 KB
/
Copy pathMain.java
File metadata and controls
48 lines (36 loc) · 1.16 KB
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
package martin.tempest;
import java.awt.BorderLayout;
import java.awt.image.BufferedImage;
import javax.swing.JFrame;
import martin.tempest.core.TSDRLibrary;
import martin.tempest.core.exceptions.TSDRException;
public class Main implements TSDRLibrary.FrameReadyCallback {
private static final int WIDTH = 800;
private static final int HEIGHT = 600;
private final ImageVisualizer viz = new ImageVisualizer();
private JFrame frame;
public static void main(String[] args) {
try {
new Main();
} catch(Exception e) {
System.err.println("Cannot load! Reason: "+e.getLocalizedMessage());
e.printStackTrace();
}
}
public Main() throws TSDRException {
frame = new JFrame();
frame.setLayout(new BorderLayout());
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(viz, BorderLayout.CENTER);
frame.setSize(WIDTH,HEIGHT);
frame.setVisible(true);
TSDRLibrary sdrlib = new TSDRLibrary(WIDTH, HEIGHT);
sdrlib.loadSource(TSDRLibrary.getAllSources()[0]);
sdrlib.registerFrameReadyCallback(this);
sdrlib.start();
}
@Override
public void onFrameReady(TSDRLibrary lib, BufferedImage frame) {
viz.drawImage(frame);
}
}