static int rotter_process_audio() { int total_samples = 0; int result; int b; for(b=0; b<2; b++) { rotter_ringbuffer_t *ringbuffer = ringbuffers[b]; int samples = 0; // Has there been a ringbuffer overflow? if (ringbuffer->overflow) { rotter_error( "Ringbuffer %c overflowed while writing audio.", ringbuffer->label); ringbuffer->overflow = 0; } // Has there been a jackd xrun? if (ringbuffer->xrun_usecs) { rotter_error( "jackd experienced a %d microsecond buffer xrun.", ringbuffer->xrun_usecs); ringbuffer->xrun_usecs = 0; } // Read some audio from the buffer samples = rotter_read_from_ringbuffer( ringbuffer, output_format->samples_per_frame ); if (samples > 0) { total_samples += samples; // Open a new file? if (ringbuffer->file_handle == NULL) { result = rotter_open_file(ringbuffer); if (result) { rotter_error("Failed to open file."); break; } } // Write some audio to disk result = encoder->write(ringbuffer->file_handle, samples, tmp_buffer); if (result) { rotter_error("An error occured while trying to write audio to disk."); break; } } // Close the old file if (samples <= 0 && ringbuffer->close_file) { rotter_close_file(ringbuffer); // Delete files older delete_hours if (delete_hours>0) deletefiles( root_directory, delete_hours ); } } // for(b=0..2) return total_samples; }
/* private */ void mainwindow::_create_actions() { _action_exit = new QAction(tr("Exit"), this); _action_loadfile = new QAction(tr("Open"), this); _action_addfile = new QAction(tr("Add"), this); // menu connect(_action_exit, SIGNAL( triggered()), this, SLOT( close_window() )); connect(_action_loadfile, SIGNAL( triggered()), this, SLOT( openfile() )); connect(_action_addfile, SIGNAL( triggered()), this, SLOT( addfile() )); connect(_button_recompile, SIGNAL( released() ), _glwindow, SLOT( recompile() )); connect(_button_set_spheremap, SIGNAL( released() ), _glwindow, SLOT( load_spheremap() )); connect(_addfile_button, SIGNAL(released()), this, SLOT(addfile())); connect(_deletefile_button, SIGNAL(released()), this, SLOT(deletefiles())); connect(_checkbox_spheremap, SIGNAL( stateChanged(int) ), _glwindow, SLOT( spheremapping(int) )); connect(_checkbox_fxaa, SIGNAL( stateChanged(int) ), _glwindow, SLOT( fxaa(int) )); connect(_checkbox_pretessellation, SIGNAL(stateChanged(int)), _glwindow, SLOT(enable_pretessellation(int))); connect(_checkbox_vsync, SIGNAL( stateChanged(int) ), _glwindow, SLOT( vsync(int) )); connect(_checkbox_culling, SIGNAL(stateChanged(int)), _glwindow, SLOT( backface_culling(int))); connect(_checkbox_counting, SIGNAL(stateChanged(int)), _glwindow, SLOT( enable_counter(int))); connect(_checkbox_tritesselation, SIGNAL(stateChanged(int)), _glwindow, SLOT(enable_triangular_tesselation(int))); connect(_checkbox_holefilling, SIGNAL(stateChanged(int)), _glwindow, SLOT(holefilling(int))); connect(_checkbox_conservative_rasterization, SIGNAL(stateChanged(int)), _glwindow, SLOT(conservative_rasterization(int))); connect(_combobox_antialiasing, SIGNAL(currentIndexChanged(int)), this, SLOT(antialiasing())); connect(_combobox_trimming, SIGNAL(currentIndexChanged(int)), this, SLOT(trimming())); connect(_combobox_rendering, SIGNAL(currentIndexChanged(int)), this, SLOT(rendering())); connect(_combobox_fillmode, SIGNAL(currentIndexChanged(int)), this, SLOT(fillmode())); connect(_combobox_preclassification, SIGNAL(currentIndexChanged(int)), this, SLOT(preclassification())); connect(_slider_trim_max_bisections, SIGNAL(valueChanged(int)), _glwindow, SLOT(trim_max_bisections(int))); connect(_slider_trim_error_tolerance, SIGNAL(valueChanged(float)), _glwindow, SLOT(trim_error_tolerance(float))); connect(_slider_tesselation_max_pixel_error, SIGNAL(valueChanged(float)), _glwindow, SLOT(tesselation_max_pixel_error(float))); connect(_slider_tesselation_max_object_error, SIGNAL(valueChanged(float)), _glwindow, SLOT(tesselation_max_geometric_error(float))); connect(_slider_raycasting_max_iterations, SIGNAL(valueChanged(int)), _glwindow, SLOT(raycasting_max_iterations(int))); connect(_slider_raycasting_error_tolerance, SIGNAL(valueChanged(float)), _glwindow, SLOT(raycasting_error_tolerance(float))); connect(_current_specular, SIGNAL(released()), this, SLOT(set_specular())); connect(_current_diffuse, SIGNAL(released()), this, SLOT(set_diffuse())); connect(_current_ambient, SIGNAL(released()), this, SLOT(set_ambient())); connect(_current_shininess, SIGNAL(valueChanged(float)), this, SLOT(set_shininess(float))); connect(_current_opacity, SIGNAL(valueChanged(float)), this, SLOT(set_opacity(float))); connect(_material_apply, SIGNAL(released()), this, SLOT(apply_material())); _file_menu->addSeparator(); _file_menu->addAction (_action_loadfile); _file_menu->addAction (_action_addfile); _file_menu->addAction (_action_exit); }
int main(int argc, char **argv) { int x; int opt; FILE *file1; FILE *file2; file_t *files = NULL; file_t *curfile; file_t **match = NULL; filetree_t *checktree = NULL; int filecount = 0; int progress = 0; char **oldargv; int firstrecurse; #ifndef OMIT_GETOPT_LONG static struct option long_options[] = { { "omitfirst", 0, 0, 'f' }, { "recurse", 0, 0, 'r' }, { "recursive", 0, 0, 'r' }, { "recurse:", 0, 0, 'R' }, { "recursive:", 0, 0, 'R' }, { "quiet", 0, 0, 'q' }, { "sameline", 0, 0, '1' }, { "size", 0, 0, 'S' }, { "symlinks", 0, 0, 's' }, { "hardlinks", 0, 0, 'H' }, { "relink", 0, 0, 'l' }, { "noempty", 0, 0, 'n' }, { "delete", 0, 0, 'd' }, { "version", 0, 0, 'v' }, { "help", 0, 0, 'h' }, { "noprompt", 0, 0, 'N' }, { "summarize", 0, 0, 'm'}, { "summary", 0, 0, 'm' }, { 0, 0, 0, 0 } }; #define GETOPT getopt_long #else #define GETOPT getopt #endif program_name = argv[0]; oldargv = cloneargs(argc, argv); while ((opt = GETOPT(argc, argv, "frRq1Ss::HlndvhNm" #ifndef OMIT_GETOPT_LONG , long_options, NULL #endif )) != EOF) { switch (opt) { case 'f': SETFLAG(flags, F_OMITFIRST); break; case 'r': SETFLAG(flags, F_RECURSE); break; case 'R': SETFLAG(flags, F_RECURSEAFTER); break; case 'q': SETFLAG(flags, F_HIDEPROGRESS); break; case '1': SETFLAG(flags, F_DSAMELINE); break; case 'S': SETFLAG(flags, F_SHOWSIZE); break; case 's': SETFLAG(flags, F_FOLLOWLINKS); break; case 'H': SETFLAG(flags, F_CONSIDERHARDLINKS); break; case 'n': SETFLAG(flags, F_EXCLUDEEMPTY); break; case 'd': SETFLAG(flags, F_DELETEFILES); break; case 'v': printf("fdupes %s\n", VERSION); exit(0); case 'h': help_text(); exit(1); case 'N': SETFLAG(flags, F_NOPROMPT); break; case 'm': SETFLAG(flags, F_SUMMARIZEMATCHES); break; default: fprintf(stderr, "Try `fdupes --help' for more information.\n"); exit(1); } } if (optind >= argc) { errormsg("no directories specified\n"); exit(1); } if (ISFLAG(flags, F_RECURSE) && ISFLAG(flags, F_RECURSEAFTER)) { errormsg("options --recurse and --recurse: are not compatible\n"); exit(1); } if (ISFLAG(flags, F_SUMMARIZEMATCHES) && ISFLAG(flags, F_DELETEFILES)) { errormsg("options --summarize and --delete are not compatible\n"); exit(1); } if (ISFLAG(flags, F_RECURSEAFTER)) { firstrecurse = nonoptafter("--recurse:", argc, oldargv, argv, optind); if (firstrecurse == argc) firstrecurse = nonoptafter("-R", argc, oldargv, argv, optind); if (firstrecurse == argc) { errormsg("-R option must be isolated from other options\n"); exit(1); } /* F_RECURSE is not set for directories before --recurse: */ for (x = optind; x < firstrecurse; x++) filecount += grokdir(argv[x], &files); /* Set F_RECURSE for directories after --recurse: */ SETFLAG(flags, F_RECURSE); for (x = firstrecurse; x < argc; x++) filecount += grokdir(argv[x], &files); } else { for (x = optind; x < argc; x++) filecount += grokdir(argv[x], &files); } if (!files) { if (!ISFLAG(flags, F_HIDEPROGRESS)) fprintf(stderr, "\r%40s\r", " "); exit(0); } curfile = files; while (curfile) { if (!checktree) registerfile(&checktree, curfile); else match = checkmatch(&checktree, checktree, curfile); if (match != NULL) { file1 = fopen(curfile->d_name, "rb"); if (!file1) { curfile = curfile->next; continue; } file2 = fopen((*match)->d_name, "rb"); if (!file2) { fclose(file1); curfile = curfile->next; continue; } if (confirmmatch(file1, file2)) { registerpair(match, curfile, sort_pairs_by_mtime); /*match->hasdupes = 1; curfile->duplicates = match->duplicates; match->duplicates = curfile;*/ } fclose(file1); fclose(file2); } curfile = curfile->next; if (!ISFLAG(flags, F_HIDEPROGRESS)) { fprintf(stderr, "\rProgress [%d/%d] %d%% ", progress, filecount, (int)((float) progress / (float) filecount * 100.0)); progress++; } } if (!ISFLAG(flags, F_HIDEPROGRESS)) fprintf(stderr, "\r%40s\r", " "); if (ISFLAG(flags, F_DELETEFILES)) { if (ISFLAG(flags, F_NOPROMPT)) { deletefiles(files, 0, 0); } else { stdin = freopen("/dev/tty", "r", stdin); deletefiles(files, 1, stdin); } } else if (ISFLAG(flags, F_SUMMARIZEMATCHES)) summarizematches(files); else printmatches(files); while (files) { curfile = files->next; free(files->d_name); free(files->crcsignature); free(files->crcpartial); free(files); files = curfile; } for (x = 0; x < argc; x++) free(oldargv[x]); free(oldargv); purgetree(checktree); return 0; }