Fex

Check-in [1c506d359b]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:allow multiple frequency exports per session
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | master
Files: files | file ages | folders
SHA3-256: 1c506d359b34b679bc213c373e827183d479373d47343b189b026e7b9a697e52
User & Date: jesse@mccluresk9.com 2015-01-11 14:34:18
Context
2015-01-11
14:35
remove broken link (wiki is moving) check-in: 616e4e5238 user: jesse@mccluresk9.com tags: trunk, master
14:34
allow multiple frequency exports per session check-in: 1c506d359b user: jesse@mccluresk9.com tags: trunk, master
2015-01-07
20:16
fix crash on bad help command in config check-in: 00c2e4c912 user: jesse@mccluresk9.com tags: trunk, master
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/xlib_actions.c.

224
225
226
227
228
229
230

231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
			DefaultVisual(dpy,scr), ww, wh);
	cairo_surface_write_to_png(t, fname);
	cairo_surface_destroy(t);
	return 0;
}

int series_export() {

	double *dat = malloc(spect->fft_w * sizeof(double));
	int i, j, f;
	/* find the peak frequency relative to max for each time bin */
	for (i = spect->fft_x; i < spect->fft_w + spect->fft_x; ++i) {
		f = 0;
		for (j = spect->fft_y; j < spect->fft_h+spect->fft_y; ++j) {
				if (spect->fft->mask[i][j]) continue;
				if (spect->fft->amp[i][j] > spect->fft->amp[i][f] || !f)
					f = j;
		}
		if (f > 0 && spect->fft->amp[i][f] > conf.thresh)
			dat[i - spect->fft_x] = spect->fft->freq[f];
		else
			dat[i - spect->fft_x] = 0.0;
	}
	char *fname = malloc(strlen(spect->name) + 6);
	sprintf(fname, "%s.freq", spect->name);
	f = open(fname, O_WRONLY | O_CREAT, 0644);
	write(f, dat, spect->fft_w * sizeof(double));
	close(f);
	free(fname);
	free(dat);
	return 0;
}







>















|
|







224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
			DefaultVisual(dpy,scr), ww, wh);
	cairo_surface_write_to_png(t, fname);
	cairo_surface_destroy(t);
	return 0;
}

int series_export() {
	static int n = 0;
	double *dat = malloc(spect->fft_w * sizeof(double));
	int i, j, f;
	/* find the peak frequency relative to max for each time bin */
	for (i = spect->fft_x; i < spect->fft_w + spect->fft_x; ++i) {
		f = 0;
		for (j = spect->fft_y; j < spect->fft_h+spect->fft_y; ++j) {
				if (spect->fft->mask[i][j]) continue;
				if (spect->fft->amp[i][j] > spect->fft->amp[i][f] || !f)
					f = j;
		}
		if (f > 0 && spect->fft->amp[i][f] > conf.thresh)
			dat[i - spect->fft_x] = spect->fft->freq[f];
		else
			dat[i - spect->fft_x] = 0.0;
	}
	char *fname = malloc(strlen(spect->name) + 10);
	sprintf(fname, "%s%d.freq", spect->name, n++);
	f = open(fname, O_WRONLY | O_CREAT, 0644);
	write(f, dat, spect->fft_w * sizeof(double));
	close(f);
	free(fname);
	free(dat);
	return 0;
}