Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | fixed typo in crop(); added cursor to audio play |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
06cadb9928fa9926092d1c3514e85e8c |
User & Date: | jesse@mccluresk9.com 2014-05-29 17:50:54 |
Context
2014-05-29
| ||
21:34 | experimenting with debian build check-in: 4fc946e7bd user: jesse@mccluresk9.com tags: trunk | |
17:50 | fixed typo in crop(); added cursor to audio play check-in: 06cadb9928 user: jesse@mccluresk9.com tags: trunk | |
15:40 | reverting check-in: 322bd85a7f user: jesse@mccluresk9.com tags: trunk | |
Changes
Changes to doc/fex-help-1.tex.
︙ | ︙ | |||
51 52 53 54 55 56 57 58 59 60 61 62 63 64 | \item[\Opt{F1}] Show this help page \item[\Opt{F2}] Toggle visibility of the tool window \item[\Opt{t}] Toggle spectrogram layers \item[\Opt{c}] Toggle crop mode \item[\Opt{e}] Toggle eraser mode \item[\Opt{p}] Play the currently displayed signal \item[\Opt{Shift+p}] Play the currently displayed signal at half speed \item[\Opt{Esc}] Return to normal mode \item[\Opt{u}] Undo last erase, in erase mode only, up to 7 undo levels \end{description} \section{Tool Window} The tool window displays the current cursor position and the currently | > > > > | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | \item[\Opt{F1}] Show this help page \item[\Opt{F2}] Toggle visibility of the tool window \item[\Opt{t}] Toggle spectrogram layers \item[\Opt{c}] Toggle crop mode \item[\Opt{e}] Toggle eraser mode \item[\Opt{p}] Play the currently displayed signal \item[\Opt{Shift+p}] Play the currently displayed signal at half speed \item[\Opt{Ctrl+p}] Play the currently displayed signal at 1/3 speed \item[\Opt{Alt+p}] Play the currently displayed signal at 1/4 speed \item[\Opt{Shift+Ctrl+p}] Play the currently displayed signal at 1/6 speed \item[\Opt{Shift+Alt+p}] Play the currently displayed signal at 1/12 speed \item[\Opt{Esc}] Return to normal mode \item[\Opt{u}] Undo last erase, in erase mode only, up to 7 undo levels \end{description} \section{Tool Window} The tool window displays the current cursor position and the currently |
︙ | ︙ |
Changes to src/fex.c.
︙ | ︙ | |||
34 35 36 37 38 39 40 | int main(int argc, const char **argv) { const char *fname = configure(argc,argv); Wave *wav = create_wave(fname); FFT *fft = create_fft(wav); create_spectro(fft, fname); | < | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | int main(int argc, const char **argv) { const char *fname = configure(argc,argv); Wave *wav = create_wave(fname); FFT *fft = create_fft(wav); create_spectro(fft, fname); free_wave(&wav); xlib_event_loop(); if (spect->fex > 0 && conf.long_out) fprintf(stdout,"%.3lf\t%.3lf\t%.3lf\n", spect->pex, spect->tex, spect->fex); else if (spect->fex > 0) |
︙ | ︙ |
Changes to src/fex.h.
︙ | ︙ | |||
67 68 69 70 71 72 73 | } Wave; typedef struct FFT { double **amp; double *time; double *freq; double max, min; | < | 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | } Wave; typedef struct FFT { double **amp; double *time; double *freq; double max, min; int nfreq, ntime; char **mask; } FFT; typedef struct WindowFunction { const char *type; double a[4]; |
︙ | ︙ |
Changes to src/spectro.c.
︙ | ︙ | |||
31 32 33 34 35 36 37 | int spectro_draw() { cairo_t *c = xlib_context(); cairo_set_source_rgba(c,1.0,1.0,1.0,1.0); cairo_rectangle(c,0,0,spect->fft_w,spect->fft_h); cairo_fill(c); set_color(c,RGBA_SPECT); cairo_mask_surface(c,spect->m_spec,0,0); | | < > | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | int spectro_draw() { cairo_t *c = xlib_context(); cairo_set_source_rgba(c,1.0,1.0,1.0,1.0); cairo_rectangle(c,0,0,spect->fft_w,spect->fft_h); cairo_fill(c); set_color(c,RGBA_SPECT); cairo_mask_surface(c,spect->m_spec,0,0); if (conf.layers) { set_color(c,RGBA_THRESH); cairo_mask_surface(c,spect->m_thresh,0,0); cairo_scale(c,1.0/conf.scale,1.0/conf.scale); cairo_set_source_surface(c,spect->s_points,0,0); cairo_paint(c); } cairo_destroy(c); } int create_spectro(FFT *fft, const char *fname) { spect = (Spectro *) calloc(1, sizeof(Spectro)); /* names */ spect->fname = fname; |
︙ | ︙ |
Changes to src/xlib.c.
︙ | ︙ | |||
149 150 151 152 153 154 155 | spect->fex = 0; running = False; } if (sym == XK_j || sym == XK_Down) threshold(-0.05); else if (sym == XK_k || sym == XK_Up) threshold(0.05); else if (sym == XK_h || sym == XK_Left) sp_floor(-0.05); else if (sym == XK_l || sym == XK_Right) sp_floor(0.05); | | > > > | > | | 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | spect->fex = 0; running = False; } if (sym == XK_j || sym == XK_Down) threshold(-0.05); else if (sym == XK_k || sym == XK_Up) threshold(0.05); else if (sym == XK_h || sym == XK_Left) sp_floor(-0.05); else if (sym == XK_l || sym == XK_Right) sp_floor(0.05); else if (sym == XK_p) play(0.1666); } else if (mod == (Mod1Mask | ShiftMask)) { if (sym == XK_p) play(0.08333); } else if (mod == ControlMask) { if (sym == XK_q) running = False; if (sym == XK_s) screenshot(); else if (sym == XK_j || sym == XK_Down) zoom(-0.025); else if (sym == XK_k || sym == XK_Up) zoom(0.025); else if (sym == XK_h || sym == XK_Left) return; else if (sym == XK_l || sym == XK_Right) return; else if (sym == XK_p) play(0.33); } else if (mod == Mod1Mask) { if (sym == XK_j || sym == XK_Down) eraser_cursor(-1,-1); else if (sym == XK_k || sym == XK_Up) eraser_cursor(1,1); else if (sym == XK_h || sym == XK_Left) eraser_cursor(-1,1); else if (sym == XK_l || sym == XK_Right) eraser_cursor(1,-1); else if (sym == XK_p) play(0.25); } else if (mod == ShiftMask) { if (sym == XK_j || sym == XK_Down) pt_line(-0.2,0); else if (sym == XK_k || sym == XK_Up) pt_line(0.2,0); else if (sym == XK_h || sym == XK_Left) pt_line(0,-0.2); else if (sym == XK_l || sym == XK_Right) pt_line(0,0.2); else if (sym == XK_p) play(0.5); } else if (sym == XK_j || sym == XK_Down) move(0,0.02); else if (sym == XK_k || sym == XK_Up) move(0,-0.02); else if (sym == XK_h || sym == XK_Left) move(0.02,0); else if (sym == XK_l || sym == XK_Right) move(-0.02,0); else if (sym == XK_F1) { if (fork() == 0) |
︙ | ︙ | |||
259 260 261 262 263 264 265 | mode = MODE_NULL; info_draw(info); if (e.type == KeyPress) { spectro_draw(); XCopyArea(dpy, buf, win, gc, 0, 0, ww, wh, 0, 0); return 0; } | < < < | | < < | 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 | mode = MODE_NULL; info_draw(info); if (e.type == KeyPress) { spectro_draw(); XCopyArea(dpy, buf, win, gc, 0, 0, ww, wh, 0, 0); return 0; } int oldy = spect->fft_y; spect->fft_x = spect->fft_w * x1/(ww*xsc) - 1.0*xoff + spect->fft_x; spect->fft_y = spect->fft_h*(1.0-y1/(wh*ysc))-1.0*yoff+spect->fft_y; spect->fft_w = spect->fft_w * x2/(ww*xsc) - 1.0*xoff - spect->fft_x; spect->fft_h = spect->fft_h*(1.0-y2/(wh*ysc))-1.0*yoff + oldy - spect->fft_y; spectro_spec(); spectro_thresh(); spectro_points(); spectro_draw(); XCopyArea(dpy, buf, win, gc, 0, 0, ww, wh, 0, 0); return 0; } |
︙ | ︙ | |||
370 371 372 373 374 375 376 | if (x || y) { /* don't redraw for offset checks */ spectro_draw(); XCopyArea(dpy, buf, win, gc, 0, 0, ww, wh, 0, 0); } } int play(float speed) { | | | | | > > > > | | | | | | > > > > > | > | > | | < | | | | | | < > | | | 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 | if (x || y) { /* don't redraw for offset checks */ spectro_draw(); XCopyArea(dpy, buf, win, gc, 0, 0, ww, wh, 0, 0); } } int play(float speed) { /* calculate fft coordinates of current view window */ int tw = spect->fft_w / xsc; int th = spect->fft_h / ysc; int tx = spect->fft_x - xoff; int ty = spect->fft_y - yoff + spect->fft_h - th; if (tx + tw >= spect->fft->ntime) tw = spect->fft->ntime - tx - 1; if (ty + th >= spect->fft->nfreq) th = spect->fft->nfreq - ty - 1; /* get time and frequency values of current view window */ double _start = spect->fft->time[tx]; double _end = spect->fft->time[tx+tw]; double _low = spect->fft->freq[ty]; double _hi = spect->fft->freq[ty+th]; double _mid = (_hi+_low)/2.0; double _wid = (_hi-_low)/2.0; /* fork and play */ if (!fork()==0) { close(ConnectionNumber(dpy)); char start[12], end[12], mid[12], wid[12], sp[8]; snprintf(sp,7,"%3f",speed); sprintf(start,"=%lf",_start); sprintf(end,"=%lf",_end); sprintf(mid,"%lfk",_mid); sprintf(wid,"%lfk",_wid); execl("/usr/bin/play", "play", "-q", spect->fname, "trim", start, end, "bandpass", mid, wid, "speed", sp, NULL); perror("Fex Play"); exit(1); } /* draw cursor while playing */ int i, step = 12; double dur = _end - _start; useconds_t usec = dur * 1000000.0 * step / (double) ww; step = speed * step + 0.5; for (i = 0; i < ww; i+=step) { XCopyArea(dpy, buf, win, gc, 0, 0, ww, wh, 0, 0); XDrawLine(dpy, win, gc, i, 0, i, wh); XDrawLine(dpy, win, gc, i+step, 0, i+step, wh); XFlush(dpy); usleep(usec); } XCopyArea(dpy, buf, win, gc, 0, 0, ww, wh, 0, 0); XFlush(dpy); } int pt_line(double p, double l) { conf.col[RGBA_POINTS].w += p; conf.col[RGBA_LINES].w += l; if (conf.col[RGBA_POINTS].w < 0) conf.col[RGBA_POINTS].w = 0.0; if (conf.col[RGBA_LINES].w < 0) conf.col[RGBA_LINES].w = 0.0; |
︙ | ︙ |