aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2014-10-12 16:46:57 +0000
committerDimitri Sokolyuk <demon@dim13.org>2014-10-12 16:46:57 +0000
commitfbc2bfc0d781485dddf620339569e137c40dd881 (patch)
tree9062b212c5756b691f9a812247e7c4f39edc4f5b
parent9db74da6d2f42f206ab5ab7142e0566be871fd3e (diff)
drop old main
-rw-r--r--spectrogram.c192
1 files changed, 0 insertions, 192 deletions
diff --git a/spectrogram.c b/spectrogram.c
index 8d08ba0..1e05ad3 100644
--- a/spectrogram.c
+++ b/spectrogram.c
@@ -152,195 +152,3 @@ main(int argc, char **argv)
return 0;
}
-
-#if 0
-int
-main(int argc, char **argv)
-{
- Display *dsp;
- Window win, container;
- Atom delwin;
- XClassHint *class;
- XWindowAttributes wa;
- XRectangle geo;
- int scr;
-
- struct panel *left, *right;
- double *ldata, *rdata;
-
- int dflag = 0; /* daemonize */
- int fflag = 0; /* fullscreen */
- int pflag = 1; /* hide ptr */
-
- int ch;
- int width, height;
- unsigned int maxwidth, maxheight;
- unsigned long black, white;
- float factor = 0.75;
- int round = 1024; /* FFT is fastest with powers of two */
-
- while ((ch = getopt(argc, argv, "dfpr:h")) != -1)
- switch (ch) {
- case 'd':
- dflag = 1;
- break;
- case 'f':
- fflag = 1;
- break;
- case 'p':
- pflag = 0;
- break;
- case 'r':
- round = atoi(optarg);
- break;
- case 'h':
- default:
- usage();
- /* NOTREACHED */
- }
- argc -= optind;
- argv += optind;
-
- signal(SIGINT, catch);
-
- if (dflag)
- daemon(0, 0);
-
- init_sio();
- maxwidth = max_samples_sio();
- maxheight = wa.height;
-
- dsp = XOpenDisplay(NULL);
- if (!dsp)
- errx(1, "Cannot connect to X11 server");
-
- if (round > maxwidth)
- round = maxwidth;
-
- XGetWindowAttributes(dsp, DefaultRootWindow(dsp), &wa);
- width = round + HGAP;
- if (fflag || width > wa.width) {
- round = wa.width - HGAP;
- width = wa.width;
- }
-
- height = factor * width;
- if (height > wa.height)
- height = wa.height;
-
- scr = DefaultScreen(dsp);
- white = WhitePixel(dsp, scr);
- black = BlackPixel(dsp, scr);
-
- win = XCreateSimpleWindow(dsp, RootWindow(dsp, scr),
- 0, 0, width, height, 0, white, black);
-
- XStoreName(dsp, win, __progname);
- class = XAllocClassHint();
- if (class) {
- class->res_name = __progname;
- class->res_class = __progname;
- XSetClassHint(dsp, win, class);
- XFree(class);
- }
- XSelectInput(dsp, win, KeyPressMask|StructureNotifyMask);
-
- /* catch delete window */
- delwin = XInternAtom(dsp, "WM_DELETE_WINDOW", 0);
- XSetWMProtocols(dsp, win, &delwin, 1);
-
- /* set minimal size */
- restrictsize(dsp, win, width, height, maxwidth, maxheight);
-
- container = XCreateSimpleWindow(dsp, win,
- 0, 0, width, height, 0, white, black);
- XMapWindow(dsp, container);
-
- init_fft(maxwidth, round);
-
- geo.x = 0;
- geo.y = 0;
- geo.width = round / 2;
- geo.height = height;
- left = init_panel(dsp, container, geo, RTL);
- ldata = dataptr(left);
-
- geo.x = round / 2 + HGAP;
- geo.y = 0;
- geo.width = round / 2;
- geo.height = height;
- right = init_panel(dsp, container, geo, LTR);
- rdata = dataptr(right);
-
- XClearWindow(dsp, win);
- XMapRaised(dsp, win); /* XMapWindow */
-
- if (fflag) {
- fullscreen(dsp, win);
- if (pflag)
- hide_ptr(dsp, win);
- }
-
- while (!die) {
- while (XPending(dsp)) {
- XEvent ev;
-
- XNextEvent(dsp, &ev);
-
- switch (ev.type) {
- case KeyPress:
- switch (XLookupKeysym(&ev.xkey, 0)) {
- case XK_q:
- die = 1;
- break;
- case XK_1:
- toggle_mirror(left);
- break;
- case XK_2:
- toggle_mirror(right);
- break;
- case XK_3:
- toggle_mirror(left);
- toggle_mirror(right);
- break;
- default:
- break;
- }
- break;
- case ClientMessage:
- die = *ev.xclient.data.l == delwin;
- break;
- case ConfigureNotify:
- move(dsp, win, container);
- break;
- default:
- break;
- }
- }
-
- read_sio(ldata, rdata, round);
-
- exec_fft(ldata);
- exec_fft(rdata);
-
- draw_panel(left);
- draw_panel(right);
-
- flip_panel(left);
- flip_panel(right);
-
- if (fflag)
- XResetScreenSaver(dsp);
- }
-
- free_sio();
- free_fft();
- free_panel(left);
- free_panel(right);
-
- XDestroyWindow(dsp, win);
- XCloseDisplay(dsp);
-
- return 0;
-}
-#endif