Changeset 688
- Timestamp:
- 12/28/09 08:51:06 (2 years ago)
- Files:
-
- sweep/trunk/plugins/fade/fade.c (modified) (1 diff)
- sweep/trunk/plugins/ladspa/ladspameta.c (modified) (1 diff)
- sweep/trunk/plugins/reverse/reverse.c (modified) (2 diffs)
- sweep/trunk/src/about_dialog.c (modified) (1 diff)
- sweep/trunk/src/callbacks.c (modified) (1 diff)
- sweep/trunk/src/channelops.c (modified) (1 diff)
- sweep/trunk/src/db_ruler.c (modified) (1 diff)
- sweep/trunk/src/db_slider.c (modified) (1 diff)
- sweep/trunk/src/driver.c (modified) (2 diffs)
- sweep/trunk/src/driver_alsa.c (modified) (4 diffs)
- sweep/trunk/src/edit.c (modified) (2 diffs)
- sweep/trunk/src/file_dialogs.c (modified) (3 diffs)
- sweep/trunk/src/file_mad.c (modified) (1 diff)
- sweep/trunk/src/file_sndfile1.c (modified) (2 diffs)
- sweep/trunk/src/file_speex.c (modified) (4 diffs)
- sweep/trunk/src/file_vorbis.c (modified) (1 diff)
- sweep/trunk/src/head.c (modified) (1 diff)
- sweep/trunk/src/interface.c (modified) (2 diffs)
- sweep/trunk/src/levelmeter.c (modified) (1 diff)
- sweep/trunk/src/main.c (modified) (6 diffs)
- sweep/trunk/src/notes.c (modified) (1 diff)
- sweep/trunk/src/param.c (modified) (2 diffs)
- sweep/trunk/src/paste_dialogs.c (modified) (2 diffs)
- sweep/trunk/src/play.c (modified) (5 diffs)
- sweep/trunk/src/preferences.c (modified) (2 diffs)
- sweep/trunk/src/sample-display.c (modified) (18 diffs)
- sweep/trunk/src/sweep_sample.c (modified) (11 diffs)
- sweep/trunk/src/sweep_selection.c (modified) (1 diff)
- sweep/trunk/src/sweep_sounddata.c (modified) (3 diffs)
- sweep/trunk/src/sweep_undo.c (modified) (2 diffs)
- sweep/trunk/src/time_ruler.c (modified) (1 diff)
- sweep/trunk/src/undo_dialog.c (modified) (5 diffs)
- sweep/trunk/src/view.c (modified) (19 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sweep/trunk/plugins/fade/fade.c
r526 r688 51 51 if (op_total == 0) op_total = 1; 52 52 run_total = 0; 53 54 #if 055 /* Find max */56 for (gl = sounddata->sels; active && gl; gl = gl->next) {57 sel = (sw_sel *)gl->data;58 59 offset = 0;60 remaining = sel->sel_end - sel->sel_start;61 62 while (active && remaining > 0) {63 g_mutex_lock (sample->ops_mutex);64 65 if (sample->edit_state == SWEEP_EDIT_STATE_CANCEL) {66 active = FALSE;67 } else {68 69 d = sounddata->data + frames_to_bytes (f, sel->sel_start + offset);70 71 n = MIN(remaining, 1024);72 73 for (i=0; i < n * f->channels; i++) {74 if(d[i]>=0) max = MAX(max, d[i]);75 else max = MAX(max, -d[i]);76 }77 78 remaining -= n;79 offset += n;80 81 run_total += n;82 sample_set_progress_percent (sample, run_total / op_total);83 }84 85 g_mutex_unlock (sample->ops_mutex);86 }87 }88 89 if (max != 0) factor = SW_AUDIO_T_MAX / (gfloat)max;90 #endif91 53 92 54 /* Fade */ sweep/trunk/plugins/ladspa/ladspameta.c
r684 r688 144 144 145 145 if LADSPA_IS_HINT_SAMPLE_RATE (prhd) { 146 #if 0147 lower *= format->rate;148 upper *= format->rate;149 #else150 146 lower *= 44100; 151 147 upper *= 44100; 152 #endif153 148 } 154 149 sweep/trunk/plugins/reverse/reverse.c
r125 r688 27 27 28 28 #include "../src/sweep_app.h" /* XXX */ 29 30 #if 031 static void32 region_reverse (gpointer data, sw_format * format, int nr_frames,33 sw_param_set pset, gpointer custom_data)34 {35 glong i, sw;36 gpointer d, e, t;37 38 sw = frames_to_bytes (format, 1);39 t = g_malloc (sw);40 41 d = data;42 e = d + frames_to_bytes (format, nr_frames);43 44 for (i = 0; i <= nr_frames/2; i++) {45 memcpy (t, d, sw);46 memcpy (d, e, sw);47 memcpy (e, t, sw);48 49 d += sw;50 e -= sw;51 }52 53 g_free (t);54 }55 #endif56 29 57 30 static sw_sample * … … 125 98 apply_reverse (sw_sample * sample, sw_param_set pset, gpointer custom_data) 126 99 { 127 #if 0128 return129 perform_filter_region_op (sample, _("Reverse"),130 (SweepFilterRegion)region_reverse, pset, NULL);131 #endif132 133 100 return 134 101 perform_filter_op (sample, _("Reverse"), sweep/trunk/src/about_dialog.c
r668 r688 103 103 gtk_widget_show(label); 104 104 105 #if 0106 label = gtk_label_new("Copyright (c) 2000 Conrad Parker, conrad@vergenet.net");107 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, TRUE, 0);108 gtk_widget_show(label);109 #endif110 111 105 /* FIXME: old style code 112 106 * gtk_widget_pop_style(); 113 107 */ 114 115 #if 0116 alignment = gtk_alignment_new(0.5, 0.5, 0.0, 0.0);117 gtk_box_pack_start(GTK_BOX(vbox), alignment, FALSE, TRUE, 0);118 gtk_widget_show(alignment);119 120 label = gtk_label_new(_("http://sweep.sourceforge.net/"));121 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, TRUE, 0);122 gtk_widget_show(label);123 #endif124 108 125 109 button = gtk_button_new_with_label ("http://sweep.sourceforge.net/"); sweep/trunk/src/callbacks.c
r557 r688 179 179 set_tool_cb (GtkWidget * widget, gpointer data) 180 180 { 181 #if 0182 gint tool = (gint)data;183 184 /* current_tool = tool;*/185 #endif186 181 g_print ("NOOOOOOOOOOOOOO global current_tool\n"); 187 182 } sweep/trunk/src/channelops.c
r211 r688 211 211 main_vbox = GTK_DIALOG(dialog)->vbox; 212 212 213 #if 0214 current = g_strdup_printf (_("Currently: %d channels"),215 sample->sounddata->format->channels);216 label = gtk_label_new (current);217 gtk_box_pack_start (GTK_BOX(main_vbox), label, TRUE, TRUE, 8);218 gtk_widget_show (label);219 #endif220 221 213 chooser = channelcount_chooser_new (_("Output channels")); 222 214 gtk_box_pack_start (GTK_BOX(main_vbox), chooser, TRUE, TRUE, 0); sweep/trunk/src/db_ruler.c
r340 r688 263 263 gtk_ruler_draw_pos (ruler); 264 264 265 #if 0266 printf ("%f\t%f dB\n", ruler->position, 20 * log10 (fabs(ruler->position)));267 #endif268 269 265 return FALSE; 270 266 } sweep/trunk/src/db_slider.c
r298 r688 99 99 } 100 100 101 #if 0102 static int103 slider_get_value (GtkWidget * slider)104 {105 return106 GPOINTER_TO_INT (g_object_get_data (G_OBJECT(slider), "value"));107 }108 109 static int110 slider_set_value (GtkWidget * slider, int value)111 {112 GtkWidget * combo_entry;113 int i;114 115 combo_entry =116 GTK_WIDGET (g_object_get_data (G_OBJECT(slider), "combo_entry"));117 118 for (i = 0; choices[i].name != NULL; i++) {119 if (value == choices[i].value) {120 gtk_entry_set_text (GTK_ENTRY(combo_entry), choices[i].name);121 return value;122 }123 }124 125 /* not in the entry -- assume first choice is "Custom" and set that */126 gtk_entry_set_text (GTK_ENTRY(combo_entry), choices[0].name);127 128 return slider_set_value_direct (slider, value);;129 }130 #endif131 132 101 #define VALUE_TO_DB(v) (20 * log10(v)) 133 102 #define DB_TO_VALUE(d) (pow (10, ((d) / 20))) sweep/trunk/src/driver.c
r687 r688 544 544 g_object_set_data (G_OBJECT (dialog), "main_combo", main_combo); 545 545 546 #if 0547 button = gtk_button_new_with_label (_("Default"));548 gtk_box_pack_start (GTK_BOX(hbox), button, FALSE, FALSE, 0);549 gtk_widget_show (button);550 g_signal_connect (G_OBJECT(button), "clicked",551 G_CALLBACK(default_devicename_cb), NULL);552 #endif553 554 546 separator = gtk_hseparator_new (); 555 547 gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, FALSE, 8); … … 698 690 gtk_widget_show (hbox); 699 691 700 #if 0701 checkbutton =702 gtk_check_button_new_with_label (_("Remember these options"));703 gtk_box_pack_start (GTK_BOX (hbox), checkbutton, TRUE, TRUE, 0);704 gtk_widget_show (checkbutton);705 706 g_object_set_data (G_OBJECT (dialog), "rem_options_chb", checkbutton);707 708 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(checkbutton), TRUE);709 #endif710 711 692 hbox2 = gtk_hbox_new (TRUE, 4); 712 693 gtk_box_pack_end (GTK_BOX (hbox), hbox2, FALSE, TRUE, 0); sweep/trunk/src/driver_alsa.c
r687 r688 176 176 snd_pcm_uframes_t period_size = PBUF_SIZE/format->channels; 177 177 178 #if 1179 178 if (handle->driver_flags == O_RDONLY) { 180 179 dir = (int)SND_PCM_STREAM_CAPTURE; … … 184 183 return; 185 184 } 186 #else187 dir = 0;188 #endif189 185 190 186 snd_pcm_hw_params_alloca (&hwparams); … … 339 335 int err; 340 336 341 #if 0342 gint16 * bbuf;343 size_t byte_count;344 ssize_t bytes_written;345 int need_bswap;346 int i;347 348 if (handle == NULL) {349 #ifdef DEBUG350 g_print ("handle NULL in write()\n");351 #endif352 return -1;353 }354 355 byte_count = count * sizeof (gint16);356 bbuf = alloca (byte_count);357 358 for (i = 0; i < count; i++) {359 bbuf[i] = (gint16)(PLAYBACK_SCALE * buf[i]);360 }361 362 err = snd_pcm_writei(pcm_handle, bbuf, uframes);363 #else364 337 /*printf ("sweep: alsa_write \n");*/ 365 338 … … 369 342 // this basicaly ripped straight out of alsaplayer alsa-final driver: 370 343 err = snd_pcm_writei(pcm_handle, buf, uframes); 371 #endif372 344 373 345 if (err == -EPIPE) { sweep/trunk/src/edit.c
r124 r688 1499 1499 } 1500 1500 1501 #if 01502 static sw_operation paste_in_op = {1503 SWEEP_EDIT_MODE_ALLOC,1504 (SweepCallback)do_paste_in,1505 (SweepFunction)NULL,1506 (SweepCallback)undo_by_splice_out,1507 (SweepFunction)splice_data_destroy,1508 (SweepCallback)redo_by_splice_in,1509 (SweepFunction)splice_data_destroy1510 };1511 1512 /* XXX: why is this **out ?? */1513 sw_op_instance *1514 do_paste_in (sw_sample * in, sw_sample ** out)1515 {1516 sw_op_instance * inst;1517 sw_edit_buffer * eb;1518 1519 if (ebuf == NULL) return NULL;1520 1521 inst = sw_op_instance_new (in, "Paste in", &paste_in_op);1522 /*eb = edit_buffer_copy (ebuf);*/1523 eb = edit_buffer_ref (ebuf);1524 1525 (*out)->sounddata = splice_in_eb (in->sounddata, ebuf);1526 1527 inst->redo_data = inst->undo_data =1528 splice_data_new (eb, NULL);1529 1530 sample_refresh_views (*out);1531 1532 return inst;1533 }1534 #endif1535 1536 1501 static void 1537 1502 do_paste_insert_thread (sw_op_instance * inst) … … 1758 1723 } 1759 1724 1760 #if 01761 static sw_operation paste_over_op = {1762 SWEEP_EDIT_MODE_FILTER,1763 (SweepCallback)NULL,1764 (SweepFunction)NULL,1765 (SweepCallback)undo_by_paste_over,1766 (SweepFunction)paste_over_data_destroy,1767 (SweepCallback)redo_by_paste_over,1768 (SweepFunction)paste_over_data_destroy1769 };1770 1771 sw_op_instance *1772 do_paste_over (sw_sample * in, sw_sample **out)1773 {1774 sw_op_instance * inst;1775 sw_edit_buffer * old_eb, * new_eb;1776 1777 if (ebuf == NULL) return NULL;1778 1779 inst = sw_op_instance_new (in, "Paste over", &paste_over_op);1780 old_eb = edit_buffer_from_sample (in);1781 1782 *out = paste_over (in, ebuf);1783 new_eb = edit_buffer_from_sample (*out);1784 1785 inst->redo_data = inst->undo_data =1786 paste_over_data_new (old_eb, new_eb);1787 1788 sample_refresh_views (*out);1789 1790 return inst;1791 }1792 #endif1793 1794 1725 sw_sample * 1795 1726 do_paste_as_new (void) sweep/trunk/src/file_dialogs.c
r557 r688 635 635 gtk_widget_show (menuitem); 636 636 637 #if 1638 637 /* MP3 (encoding not supported due to patent restrictions) */ 639 638 … … 642 641 gtk_menu_append (GTK_MENU(menu), menuitem); 643 642 gtk_widget_show (menuitem); 644 #endif645 643 646 644 #ifdef HAVE_OGGVORBIS … … 860 858 break; 861 859 default: 862 #if 0863 g_assert_not_reached ();864 #else865 860 sample_save_as_cb (widget, data); 866 #endif867 861 break; 868 862 } sweep/trunk/src/file_mad.c
r305 r688 388 388 if (!file_is_mpeg_audio (pathname)) return NULL; 389 389 390 #if 0391 fd = open (pathname, O_RDONLY);392 393 if (fstat (fd, &statbuf) == -1 || statbuf.st_size == 0) return NULL;394 #endif395 396 390 /* Create the sample/sounddata, initially with length 0, to be grown 397 391 * as the file is decoded sweep/trunk/src/file_sndfile1.c
r277 r688 137 137 update_save_options_caps (sndfile_save_options * so) 138 138 { 139 140 /*- SF_INFO * sfinfo;141 sndfile_subformat_caps * fcaps, * caps;142 143 sfinfo = so->sfinfo;144 fcaps = get_format_caps (sfinfo->format);145 caps = get_subformat_caps (fcaps, sfinfo->format);146 147 if (caps) {148 gtk_widget_set_sensitive (so->radio_mono, caps->cap_mono);149 gtk_widget_set_sensitive (so->radio_stereo, caps->cap_stereo);150 } else {151 gtk_widget_set_sensitive (so->radio_mono, FALSE);152 gtk_widget_set_sensitive (so->radio_stereo, FALSE);153 }154 -*/155 #if 0156 157 SF_INFO tmp_sfinfo;158 159 memcpy (&tmp_sfinfo, so->sfinfo, sizeof (SF_INFO));160 161 tmp_sfinfo.channels = 1;162 gtk_widget_set_sensitive (so->radio_mono, sf_format_check (&tmp_sfinfo));163 164 tmp_sfinfo.channels = 2;165 gtk_widget_set_sensitive (so->radio_stereo, sf_format_check (&tmp_sfinfo));166 #endif167 168 139 update_ok_button (so); 169 140 } … … 180 151 181 152 sfinfo = so->sfinfo; 182 183 #if 0184 #define BLOCK_AND_SET(r,d) \185 gtk_signal_handler_block_by_data(GTK_OBJECT((r)), (d)); \186 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON((r)), TRUE); \187 gtk_signal_handler_unblock_by_data(GTK_OBJECT((r)), (d));188 189 switch (sfinfo->channels) {190 case 1:191 BLOCK_AND_SET(so->radio_mono, so);192 break;193 case 2:194 BLOCK_AND_SET(so->radio_stereo, so);195 break;196 default:197 break;198 }199 #endif200 153 201 154 update_ok_button (so); sweep/trunk/src/file_speex.c
r668 r688 746 746 run_total = 0; 747 747 748 #if 0749 if (format->channels != 1) {750 fprintf (stderr, "Unsupported channel count for Speex encoding\n");751 return -1;752 }753 #endif754 755 748 if (!(outfile = fopen (pathname, "w"))) { 756 749 sweep_perror (errno, pathname); … … 928 921 op.b_o_s = 0; 929 922 /* op.e_o_s was set above */ 930 #if 0 /* XXX: was set above */931 if (eos)932 op.e_o_s = 1;933 else934 op.e_o_s = 0;935 #endif936 923 op.granulepos = id * frame_size; 937 924 op.packetno = 2 + (id-1)/so->framepack; … … 961 948 } 962 949 963 #if 0964 /*Flush all pages left to be written*/965 while (ogg_stream_flush(&os, &og))966 {967 n = fwrite (og.header, 1, og.header_len, outfile);968 n += fwrite (og.body, 1, og.body_len, outfile);969 970 if (fflush (outfile) == 0) {971 bytes_written += n;972 } else {973 errno_save = errno;974 active = FALSE;975 }976 }977 #endif978 979 950 /* clean up and exit. speex_info_clear() must be called last */ 980 951 … … 993 964 char time_buf[BUF_LEN], bytes_buf[BUF_LEN]; 994 965 995 #if 1996 966 sample_store_and_free_pathname (sample, pathname); 997 #else998 g_free (pathname);999 #endif1000 967 1001 968 /* Mark the last mtime for this sample */ sweep/trunk/src/file_vorbis.c
r277 r688 620 620 char time_buf[BUF_LEN], bytes_buf[BUF_LEN]; 621 621 622 #if 1623 622 sample_store_and_free_pathname (sample, pathname); 624 #else625 g_free (pathname);626 #endif627 623 628 624 /* Mark the last mtime for this sample */ sweep/trunk/src/head.c
r284 r688 489 489 gtk_box_pack_start (GTK_BOX (tool_hbox), button, FALSE, TRUE, 0); 490 490 gtk_widget_show (button); 491 #if 0 492 gtk_widget_add_accelerator (button, "clicked", accel_group, 493 GDK_r, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); 494 #endif 495 g_signal_handlers_block_matched (GTK_OBJECT(button), G_SIGNAL_MATCH_DATA, 0, 491 g_signal_handlers_block_matched (GTK_OBJECT(button), G_SIGNAL_MATCH_DATA, 0, 496 492 0, 0, 0, hctl); 497 493 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(button), head->going); sweep/trunk/src/interface.c
r557 r688 225 225 style_LCD = create_style(color_LCD, color_LCD, FALSE); 226 226 style_light_grey = create_style (color_light_grey, color_light_grey, TRUE); 227 #if 0228 style_green_grey = create_style (color_green_grey, color_green_grey, TRUE);229 #else230 227 style_green_grey = style_light_grey; 231 #endif232 228 233 229 style_red_grey = create_style (color_red_grey, color_red_grey, TRUE); 234 230 235 #if 0236 style_dark_grey = create_style(&gdkwhite, color_dark_grey, TRUE);237 #else238 231 style_dark_grey = style_light_grey; 239 #endif240 232 241 233 style_red = create_style (&gdkblack, color_red, FALSE); … … 300 292 } 301 293 302 303 #if 0304 static void305 main_destroy_cb (GtkWidget * widget, gpointer data)306 {307 gtk_main_quit();308 }309 310 311 GtkWidget*312 create_toolbox (void)313 {314 GtkWidget *window1;315 GtkWidget *vbox1;316 GtkWidget *handlebox2;317 GtkWidget *menubar1;318 GtkWidget *handlebox1;319 GtkWidget *toolbar1;320 GtkWidget *button1, * button;321 GtkWidget *pixmap1, *pixmap3;322 GtkWidget *menu;323 GtkWidget *menuitem;324 GtkAccelGroup *accel_group;325 326 window1 = gtk_window_new (GTK_WINDOW_TOPLEVEL);327 gtk_window_set_title (GTK_WINDOW (window1), _("Sweep"));328 gtk_widget_realize (window1);329 330 g_signal_connect (G_OBJECT(window1), "destroy",331 G_CALLBACK(main_destroy_cb), NULL);332 333 334 vbox1 = gtk_vbox_new (FALSE, 0);335 gtk_widget_show (vbox1);336 gtk_container_add (GTK_CONTAINER (window1), vbox1);337 338 handlebox2 = gtk_handle_box_new ();339 gtk_widget_show (handlebox2);340 gtk_box_pack_start (GTK_BOX (vbox1), handlebox2, FALSE, FALSE, 0);341 342 menubar1 = gtk_menu_bar_new ();343 gtk_widget_show (menubar1);344 gtk_container_add (GTK_CONTAINER (handlebox2), menubar1);345 346 /* Create a GtkAccelGroup and add it to the window. */347 accel_group = gtk_accel_group_new();348 gtk_window_add_accel_group (GTK_WINDOW(window1), accel_group);349 350 menu = gtk_menu_new();351 352 menuitem = gtk_menu_item_new_with_label (_("File"));353 gtk_menu_item_set_submenu (GTK_MENU_ITEM(menuitem), menu);354 gtk_menu_bar_append (GTK_MENU_BAR(menubar1), menuitem);355 gtk_widget_show(menuitem);356 357 menuitem = gtk_menu_item_new_with_label (_("New"));358 gtk_menu_append (GTK_MENU(menu), menuitem);359 g_signal_connect (G_OBJECT(menuitem), "activate",360 G_CALLBACK(sample_new_empty_cb), NULL);361 gtk_widget_show(menuitem);362 gtk_widget_add_accelerator (menuitem, "activate", accel_group,363 GDK_n, GDK_CONTROL_MASK,364 GTK_ACCEL_VISIBLE);365 366 menuitem = gtk_menu_item_new_with_label (_("Open"));367 gtk_menu_append (GTK_MENU(menu), menuitem);368 g_signal_connect (G_OBJECT(menuitem), "activate",369 G_CALLBACK(sample_load_cb), window1);370 gtk_widget_show(menuitem);371 gtk_widget_add_accelerator (menuitem, "activate", accel_group,372 GDK_o, GDK_CONTROL_MASK,373 GTK_ACCEL_VISIBLE);374 375 menuitem = gtk_menu_item_new_with_label (_("Quit"));376 gtk_menu_append (GTK_MENU(menu), menuitem);377 g_signal_connect (G_OBJECT(menuitem), "activate",378 G_CALLBACK(exit_cb), window1);379 gtk_widget_show(menuitem);380 gtk_widget_add_accelerator (menuitem, "activate", accel_group,381 GDK_q, GDK_CONTROL_MASK,382 GTK_ACCEL_VISIBLE);383 384 menu = gtk_menu_new();385 386 menuitem = gtk_menu_item_new_with_label (_("Help"));387 gtk_menu_item_set_submenu (GTK_MENU_ITEM(menuitem), menu);388 gtk_menu_bar_append (GTK_MENU_BAR(menubar1), menuitem);389 gtk_widget_show(menuitem);390 391 menuitem = gtk_menu_item_new_with_label (_("About..."));392 gtk_menu_append (GTK_MENU(menu), menuitem);393 g_signal_connect (G_OBJECT(menuitem), "activate",394 G_CALLBACK(about_dialog_create), NULL);395 gtk_widget_show(menuitem);396 397 #if 0398 handlebox1 = gtk_handle_box_new ();399 gtk_widget_show (handlebox1);400 gtk_box_pack_start (GTK_BOX (vbox1), handlebox1, FALSE, FALSE, 0);401 402 toolbar1 = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH);403 gtk_widget_show (toolbar1);404 gtk_container_add (GTK_CONTAINER (handlebox1), toolbar1);405 406 /* SELECT */407 408 pixmap1 = create_widget_from_xpm (toolbar1, rect_xpm);409 gtk_widget_show (pixmap1);410 411 button1 = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar1),412 GTK_TOOLBAR_CHILD_RADIOBUTTON,413 NULL, /* Radio group */414 _("Select"),415 _("Select regions of a sample"),416 _("This tool allows you to select"417 " regions of a sample. You can then"418 " apply edits and effects to the:"419 " selected regions. Hold down shift"420 " whilst selecting to add"421 " discontinuous regions to the"422 " selection."),423 pixmap1, /* icon */424 set_tool_cb, (gpointer)TOOL_SELECT);425 gtk_widget_show (button1);426 427 #if 0428 /* MOVE */429 430 button = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar1),431 GTK_TOOLBAR_CHILD_RADIOBUTTON,432 button1, /* Radio group */433 _("Move"),434 _("Move regions in a sample"),435 _("With this tool you can move"436 " selected regions of a sample."),437 NULL, /* icon */438 set_tool_cb, (gpointer)TOOL_MOVE);439 gtk_widget_show (button);440 #endif441 442 /* SCRUB */443 444 button = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar1),445 GTK_TOOLBAR_CHILD_RADIOBUTTON,446 button1, /* Radio group */447 _("Scrub"),448 _("Locate sounds directly"),449 _("Place the play marker on a sample."450 " Click anywhere in a view to"451 " instantly move the playback"452 " position to that part of the"453 " sample."),454 NULL, /* icon */455 set_tool_cb, (gpointer)TOOL_SCRUB);456 gtk_widget_show (button);457 458 /* ZOOM */459 460 pixmap3 = create_widget_from_xpm (window1, magnify_xpm);461 gtk_widget_show (pixmap3);462 463 button = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar1),464 GTK_TOOLBAR_CHILD_RADIOBUTTON,465 button1, /* Radio group */466 _("Zoom"),467 _("Zoom in & out"),468 _("Zoom in and out of a view. Click"469 " anywhere in a view to zoom in on"470 " that part of the sample. Hold"471 " down shift and click on the view"472 " to zoom out."),473 pixmap3, /* icon */474 set_tool_cb, (gpointer)TOOL_ZOOM);475 gtk_widget_show (button);476 477 #if 1 /* These need undos! */478 479 /* PENCIL */480 481 button = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar1),482 GTK_TOOLBAR_CHILD_RADIOBUTTON,483 button1, /* Radio group */484 _("Pencil"),485 _("Edit PCM sample values"),486 _("When zoomed down to individual "487 " samples, click to edit"),488 NULL, /* icon */489 set_tool_cb, (gpointer)TOOL_PENCIL);490 gtk_widget_show (button);491 492 /* NOISE */493 494 button = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar1),495 GTK_TOOLBAR_CHILD_RADIOBUTTON,496 button1, /* Radio group */497 _("Noise"),498 _("Add noise"),499 _("Randomise PCM values"),500 NULL, /* icon */501 set_tool_cb, (gpointer)TOOL_NOISE);502 gtk_widget_show (button);503 #endif504 505 #endif /* TOOLBAR */506 507 return window1;508 }509 510 #endif511 512 294 /* 513 295 * close the window when Ctrl and w are pressed. sweep/trunk/src/levelmeter.c
r278 r688 92 92 attributes.event_mask = gtk_widget_get_events(widget) | 93 93 GDK_EXPOSURE_MASK 94 #if 095 | GDK_BUTTON_PRESS_MASK |96 GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK |97 GDK_POINTER_MOTION_HINT_MASK98 #endif99 94 ; 100 95 attributes.visual = gtk_widget_get_visual(widget); sweep/trunk/src/main.c
r684 r688 76 76 } 77 77 78 #if 079 static gint80 initial_sample_new (gpointer data)81 {82 sample_new_empty_cb (NULL, NULL);83 84 return FALSE;85 }86 #endif87 88 78 static gint 89 79 initial_sample_ask (gpointer data) … … 107 97 { 108 98 int i; 109 #if 0110 GtkWidget *toolbox;111 #endif112 99 113 100 gboolean show_version = FALSE; … … 130 117 #ifdef DEVEL_CODE 131 118 g_print (_("WARNING: Build includes incomplete development code.\n")); 132 #endif133 134 #if 0135 #if defined (SNDFILE_1)136 if (sizeof (sw_framecount_t) != sizeof (sf_count_t)) {137 puts ("Software was configured incorrectly. Cannot run.\n") ;138 exit (1) ;139 }140 #endif141 119 #endif 142 120 … … 169 147 ignore_failed_tdb_lock = TRUE; 170 148 argv[i] = NULL; 171 #if 0172 } else if (strcmp (argv[i], "--no-toolbox") == 0) {173 show_toolbox = FALSE;174 argv[i] = NULL;175 #endif176 149 177 150 #ifdef DEVEL_CODE … … 207 180 " file system. (possibly unsafe) \n" )); 208 181 209 #if 0210 g_print (_(" --no-toolbox Do not show the toolbox window.\n"));211 #endif212 182 } 213 183 … … 241 211 init_playback (); 242 212 243 #if 0244 if (show_toolbox) {245 toolbox = create_toolbox ();246 gtk_widget_show (toolbox);247 }248 #endif249 250 251 213 252 214 gtk_main (); sweep/trunk/src/notes.c
r435 r688 91 91 { N_("D#5"), 2.378414, GDK_0, "D#5"}, 92 92 { N_("E5") , 2.519842, GDK_p, "E5" }, 93 #if 094 { N_("F5") , 2.669680, GDK_bracketleft, "F5" },95 { N_("F#5"), 2.828427, GDK_None, "F#5" },96 { N_("G5") , 2.996614, GDK_None, "G5" },97 { N_("G#5"), 3.174802, GDK_None, "G#5" },98 { N_("A5") , 3.363586, GDK_None, "A5" },99 { N_("Bb5"), 3.563595, GDK_None, "Bb5" },100 { N_("B5") , 3.775497, GDK_None, "B5" },101 #endif102 103 93 } ; 104 94 sweep/trunk/src/param.c
r557 r688 248 248 ps_adjuster_destroy (sw_ps_adjuster * ps) 249 249 { 250 #if 0 /* XXX */251 GList * gl;252 253 g_free (ps->pset);254 255 for (gl = ps->plsk_list; gl; gl = gl->next) {256 g_free (gl->data);257 }258 #endif259 250 } 260 251 … … 766 757 ps->table = table; 767 758 768 #if 0769 frame = gtk_frame_new (_("Preview"));770 gtk_box_pack_start (GTK_BOX(hbox), frame, TRUE, TRUE, 8);771 gtk_widget_show (frame);772 773 vbox = gtk_vbox_new (FALSE, 4);774 gtk_container_add (GTK_CONTAINER (frame), vbox);775 gtk_container_set_border_width (GTK_CONTAINER(vbox), 8);776 gtk_widget_show (vbox);777 #endif778 779 759 ok_button = gtk_button_new_with_label (_("OK")); 780 760 GTK_WIDGET_SET_FLAGS (GTK_WIDGET (ok_button), GTK_CAN_DEFAULT); sweep/trunk/src/paste_dialogs.c
r557 r688 50 50 51 51 52 #if 053 static GtkWidget *54 create_pixmap_button (GtkWidget * widget, gchar ** xpm_data,55 const gchar * label_text, const gchar * tip_text,56 GCallback clicked)57 {58 GtkWidget * hbox;59 GtkWidget * label;60 GtkWidget * pixmap;61 GtkWidget * button;62 GtkTooltips * tooltips;63 64 button = gtk_button_new ();65 66 hbox = gtk_hbox_new (FALSE, 2);67 gtk_container_add (GTK_CONTAINER(button), hbox);68 gtk_container_set_border_width (GTK_CONTAINER(button), 8);69 gtk_widget_show (hbox);70 71 if (xpm_data != NULL) {72 pixmap = create_widget_from_xpm (widget, xpm_data);73 gtk_box_pack_start (GTK_BOX(hbox), pixmap, FALSE, FALSE, 8);74 gtk_widget_show (pixmap);75 }76 77 if (label_text != NULL) {78 label = gtk_label_new (label_text);79 gtk_box_pack_start (GTK_BOX(hbox), label, FALSE, FALSE, 8);80 gtk_widget_show (label);81 }82 83 if (tip_text != NULL) {84 tooltips = gtk_tooltips_new ();85 gtk_tooltips_set_tip (tooltips, button, tip_text, NULL);86 }87 88 if (clicked != NULL) {89 g_signal_connect (G_OBJECT (button), "clicked",90 G_CALLBACK(clicked), NULL);91 }92 93 return button;94 }95 #endif96 97 52 static void 98 53 paste_dialog_destroy (GtkWidget * widget, gpointer data) … … 242 197 G_CALLBACK (paste_dialog_destroy), sample); 243 198 244 #if 0245 gtk_accel_group_add (accel_group, GDK_w, GDK_CONTROL_MASK, GDK_NONE,246 GTK_OBJECT(dialog), "destroy");247 #endif248 249 199 main_vbox = GTK_DIALOG(dialog)->vbox; 250 200 sweep/trunk/src/play.c
r687 r688 139 139 (gpointer)s); 140 140 } 141 142 #if 0143 static struct timeval tv_instant = {0, 0};144 #endif145 141 146 142 static sw_framecount_t … … 679 675 } 680 676 681 #if 0682 {683 fd_set fds;684 685 FD_ZERO (&fds);686 FD_SET (handle->driver_fd, &fds);687 688 if (select (handle->driver_fd+1, &fds, NULL, NULL, &tv_instant) == 0);689 }690 #else691 677 device_wait (handle); 692 #endif693 678 694 679 return; … … 733 718 734 719 head_read (head, pbuf, n, handle->driver_rate); 735 736 #if 0 737 if (f->channels != handle->driver_channels) { 738 channel_convert (pbuf, f->channels, devbuf, 739 handle->driver_channels, n); 740 } 741 #else 720 742 721 channel_convert_adding (pbuf, f->channels, devbuf, 743 722 handle->driver_channels, n); 744 #endif745 723 746 724 /* XXX: store the head->offset NOW for device_offset referencing */ … … 748 726 g_mutex_lock (s->play_mutex); 749 727 750 #if 0751 head->realoffset = head->offset;752 #else753 728 head->realoffset = device_offset (handle); 754 729 if (head->realoffset == -1) { 755 730 head->realoffset = head->offset; 756 731 } 757 #endif758 732 759 733 head->offset = head->realoffset; … … 903 877 } 904 878 905 #if 0906 if (!head->looping) {907 device_drain (handle);908 909 HEAD_SET_GOING (head, FALSE);910 }911 #endif912 913 879 if (use_monitor) { 914 880 device_reset (monitor_handle); sweep/trunk/src/preferences.c
r666 r688 210 210 211 211 nval = * (long *)val_data.dptr; 212 #if 0213 val = g_ntohl (nval);214 #else215 212 val = nval; 216 #endif217 213 218 214 * (long *)val_data.dptr = val; … … 232 228 key_data.dsize = strlen (key); 233 229 234 #if 0235 nval = g_htonl (val);236 #else237 230 nval = val; 238 #endif239 231 240 232 val_data.dptr = (char *)&nval; sweep/trunk/src/sample-display.c
r557 r688 93 93 ((sw_audio_t)(CHANNEL_HEIGHT/2 - (y - (YPOS_TO_CHANNEL(y) * CHANNEL_HEIGHT)))/(CHANNEL_HEIGHT/2)) 94 94 95 #if 096 #define YPOS_TO_CHANNEL(y) \97 (s->view->sample->sounddata->format->channels == 2 ? (y > s->height/2) : 0)98 99 #define YPOS_TO_VALUE_1(y) \100 ((sw_audio_t)(s->height/2 - y)/(s->height/2))101 102 #define YPOS_TO_VALUE_L(y) \103 ((sw_audio_t)(s->height/4 - y)/(s->height/4))104 105 #define YPOS_TO_VALUE_R(y) \106 ((sw_audio_t)(3*s->height/4 - y)/(s->height/4))107 108 #define YPOS_TO_VALUE_2(y) \109 (YPOS_TO_CHANNEL(y) ? YPOS_TO_VALUE_R(y) : YPOS_TO_VALUE_L(y))110 #endif111 112 95 #define MARCH_INTERVAL 300 113 96 #define PULSE_INTERVAL 450 … … 120 103 * last_tmp_view 121 104 */ 122 123 #if 1124 105 125 106 static const int default_colors[] = { … … 131 112 240, 230, 240, /* sel box */ 132 113 110, 110, 100, /* tmp_sel XOR mask */ 133 #if 1134 114 108, 115, 134, /* sel bg */ 135 #else136 62, 68, 118, /* sel bg */137 #endif138 115 166, 166, 154, /* minmax */ 139 116 240, 250, 240, /* highlight */ … … 142 119 }; 143 120 144 #else145 146 static const int default_colors[] = {147 #if 0148 86, 86, 80, /* bg */149 #elif 0150 220, 220, 210, /* bg */151 #else152 200, 200, 193, /* bg */153 #endif154 199, 203, 158, /* fg */155 20, 230, 0, /* play */156 200, 200, 200, /* user */157 200, 200, 200, /* zero */158 240, 230, 240, /* sel box */159 110, 110, 100, /* tmp_sel XOR mask */160 118, 118, 108, /* sel bg XOR mask */161 154, 166, 154, /* minmax */162 219, 219, 211, /* highlight */163 81, 101, 81, /* lowlight */164 240, 0, 0, /* rec */165 };166 #endif167 168 121 static const int bg_colors[] = { 169 122 250, 250, 237, /* black bg */ … … 171 124 147, 147, 140, /* orange bg */ 172 125 160, 160, 150, /* yellow bg */ 173 #if 0174 210, 210, 193, /* blue bg */175 #else176 126 250, 250, 237, /* blue bg */ 177 #endif178 127 160, 160, 150, /* white bg */ 179 128 0, 0, 0, /* greenscreen bg */ … … 702 651 attributes.wclass = GDK_INPUT_OUTPUT; 703 652 attributes.window_type = GDK_WINDOW_CHILD; 704 #if 0705 attributes.event_mask = gtk_widget_get_events (widget)706 | GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK707 | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK708 | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK |709 GDK_FOCUS_CHANGE_MASK | GDK_KEY_PRESS_MASK;710 #else711 653 attributes.event_mask = GDK_ALL_EVENTS_MASK; 712 #endif713 654 714 655 attributes.visual = gtk_widget_get_visual (widget); … … 1035 976 } 1036 977 1037 #if 01038 cheight = (sh+3)/channels;1039 cerr = (sh+3) - (channels * cheight);1040 if (cerr == channels - 1) {1041 cheight++;1042 cerr = 0;1043 }1044 cy = 0;1045 #else1046 978 cheight = sh / channels; 1047 979 cerr = sh - (channels * cheight); … … 1051 983 } 1052 984 cy = 0; 1053 #endif1054 985 1055 986 for (i = 0; i < channels; i++) { … … 1059 990 x, cy, width, 1); 1060 991 cy += 1; 1061 1062 #if 01063 if (i == channels/2) {1064 gtk_style_apply_default_background (GTK_WIDGET(s)->style, win,1065 TRUE, GTK_STATE_NORMAL, NULL,1066 x, cy, width, cerr);1067 cy += cerr;1068 }1069 #endif1070 992 } 1071 993 … … 1279 1201 } 1280 1202 1281 1282 /*** PLAY MARKER, CURSOR ***/1283 1284 #if 01285 static int1286 sample_display_startoffset_to_xpos (SampleDisplay *s,1287 int offset)1288 {1289 int d = offset - s->view->start;1290 1291 if(d < 0)1292 return 0;1293 if(d >= (s->view->end - s->view->start))1294 return s->width;1295 1296 return d * s->width / (s->view->end - s->view->start);1297 }1298 1299 1300 static int1301 sample_display_endoffset_to_xpos (SampleDisplay *s,1302 int offset)1303 {1304 if((s->view->end - s->view->start) < s->width) {1305 return sample_display_startoffset_to_xpos(s, offset);1306 } else {1307 int d = offset - s->view->start;1308 int l = (1 - (s->view->end - s->view->start)) / s->width;1309 1310 /* you get these tests by setting the complete formula below1311 * equal to 0 or s->width, respectively, and then resolving1312 * towards d.1313 */1314 if(d < l)1315 return 0;1316 if(d > (s->view->end - s->view->start) + l)1317 return s->width;1318 1319 return (d * s->width + (s->view->end - s->view->start) - 1) / (s->view->end - s->view->start);1320 }1321 }1322 #endif /* _{start,end}offset_to_xpos */1323 1203 1324 1204 static gint … … 1481 1361 1482 1362 if(x >= x_min && x <= x_max) { 1483 #if 01484 gdk_draw_rectangle(win, gc, TRUE,1485 x-1, 0,1486 3, s->height);1487 #endif1488 1489 1363 gdk_draw_line(win, s->zeroline_gc, 1490 1364 x-2, 0, 1491 1365 x-2, s->height); 1492 #if 1 1366 1493 1367 gdk_draw_line(win, gc, 1494 1368 x-1, 0, … … 1497 1371 x+1, 0, 1498 1372 x+1, s->height); 1499 #endif1500 1373 1501 1374 gdk_draw_line(win, s->zeroline_gc, … … 1541 1414 TRUE, GTK_STATE_NORMAL, 1542 1415 NULL, 0, 0, s->width, s->height); 1543 #if 01544 area->x, area->y,1545 area->width, area->height);1546 #endif1547 1416 } else { 1548 1417 const int x_min = area->x; … … 1570 1439 x_min, x_max); 1571 1440 } else { 1572 #if 11573 1441 /* Draw play offset */ 1574 1442 sample_display_draw_play_offset (drawable, s->play_gc, 1575 1443 s, s->play_offset_x, 1576 1444 x_min, x_max); 1577 #endif1578 1445 /* Draw user offset */ 1579 1446 sample_display_draw_user_offset (drawable, s->user_gc, … … 1589 1456 x_min, x_max); 1590 1457 } 1591 1592 #if 01593 /* Draw focus indicator */1594 if (GTK_WIDGET_HAS_FOCUS(widget)) {1595 /* ??? */1596 }1597 #endif1598 1458 1599 1459 #ifdef DOUBLE_BUFFER … … 1902 1762 sampledata[offset*channels + channel] = value; 1903 1763 1904 #if 01905 if (sample->sounddata->format->channels == 1) {1906 value = YPOS_TO_VALUE_1(y);1907 sampledata[offset] = value;1908 } else {1909 channel = YPOS_TO_CHANNEL(y);1910 value = YPOS_TO_VALUE_2(y);1911 sampledata[offset*2 + channel] = value;1912 }1913 #endif1914 1915 1764 sample_refresh_views (sample); 1916 1765 } … … 2215 2064 if (sample_display_on_sel (s, x, y)) { 2216 2065 sample_display_handle_sel_button_press (s, x, y, state); 2217 #if 02218 } else if (sample_display_on_playmarker (s, x, y)) {2219 /* If the cursor is near the play marker, move that */2220 s->selecting = SELECTING_PLAYMARKER;2221 SET_CURSOR(widget, NEEDLE);2222 #ifndef SEL_SCRUBS2223 sample_set_scrubbing (sample, TRUE);2224 sample_display_handle_playmarker_motion (s, x, y);2225 #endif2226 #endif2227 2066 } else { 2228 2067 sample_display_handle_sel_button_press (s, x, y, state); … … 2503 2342 gdk_window_set_cursor (widget->window, NULL); 2504 2343 } 2505 2506 #if 02507 /* Consistency check: without this, some button release events2508 * are lost if they occur during motion. Here, we ensure that2509 * if this sample_display s is not selecting yet has a selection2510 */2511 if(s->selection_mode && s->view->sample->tmp_sel) {2512 sample_display_sink_tmp_sel (s);2513 }2514 #endif2515 2344 } 2516 2345 sweep/trunk/src/sweep_sample.c
r557 r688 162 162 163 163 s->play_mutex = g_mutex_new (); 164 #if 0165 s->play_mode = SWEEP_TRANSPORT_STOP;166 s->stop_offset = 0;167 s->play_offset = 0;168 s->play_looping = FALSE;169 s->play_scrubbing = FALSE;170 s->previewing = FALSE;171 s->play_reverse = FALSE;172 s->play_mute = FALSE;173 #endif174 164 s->user_offset = 0; 175 165 s->by_user = 0; … … 179 169 s->rate = 1.0; 180 170 181 #if 0182 s->color = ((int)random()) % VIEW_COLOR_MAX;183 #else184 171 s->color = filename_color_hash ((gchar *)g_basename (s->pathname)); 185 #endif186 172 187 173 s->info_clist = NULL; … … 1068 1054 head_set_scrubbing (head, scrubbing); 1069 1055 1070 #if 01071 g_mutex_lock (s->play_mutex);1072 1073 s->play_scrubbing = scrubbing;1074 1075 g_mutex_unlock (s->play_mutex);1076 #endif1077 1078 1056 sample_set_progress_ready (s); 1079 1057 } … … 1088 1066 head_set_looping (head, looping); 1089 1067 1090 #if 01091 g_mutex_lock (s->play_mutex);1092 1093 s->play_looping = looping;1094 #endif1095 1096 1068 for(gl = s->views; gl; gl = gl->next) { 1097 1069 v = (sw_view *)gl->data; 1098 1070 view_refresh_looping (v); 1099 1071 } 1100 1101 #if 01102 g_mutex_unlock (s->play_mutex);1103 #endif1104 1072 } 1105 1073 … … 1112 1080 1113 1081 head_set_reverse (head, reverse); 1114 1115 #if 01116 g_mutex_lock (s->play_mutex);1117 1118 s->play_reverse = reverse;1119 #endif1120 1082 1121 1083 for(gl = s->views; gl; gl = gl->next) { … … 1123 1085 view_refresh_playrev (v); 1124 1086 } 1125 1126 #if 01127 g_mutex_unlock (s->play_mutex);1128 #endif1129 1087 } 1130 1088 … … 1137 1095 1138 1096 head_set_mute (head, mute); 1139 1140 #if 01141 g_mutex_lock (s->play_mutex);1142 1143 s->play_mute = mute;1144 #endif1145 1097 1146 1098 for(gl = s->views; gl; gl = gl->next) { … … 1148 1100 view_refresh_mute (v); 1149 1101 } 1150 1151 #if 01152 g_mutex_unlock (s->play_mutex);1153 #endif1154 1102 } 1155 1103 … … 1173 1121 { 1174 1122 head_set_previewing (s->play_head, previewing); 1175 #if 01176 g_mutex_lock (s->play_mutex);1177 1178 s->previewing = previewing;1179 1180 g_mutex_unlock (s->play_mutex);1181 #endif1182 1123 } 1183 1124 … … 1420 1361 g_mutex_lock (sounddata->sels_mutex); 1421 1362 1422 #if 01423 sounddata->sels = sels_invert (sounddata->sels, sounddata->nr_frames);1424 1425 #else1426 1427 1363 if (!sounddata->sels) { 1428 1364 sounddata_set_selection_1 (sounddata, 0, sounddata->nr_frames); … … 1453 1389 1454 1390 out: 1455 #endif1456 1391 1457 1392 g_mutex_unlock (sounddata->sels_mutex); sweep/trunk/src/sweep_selection.c
r460 r688 246 246 register_operation (sample, inst); 247 247 } 248 249 #if 0250 sample_set_edit_state (sample, SWEEP_EDIT_STATE_DONE);251 #endif252 248 } 253 249 sweep/trunk/src/sweep_sounddata.c
r682 r688 26 26 #include <string.h> 27 27 #include <glib.h> 28 29 #if 030 #include <unistd.h>31 #include <sys/mman.h>32 #endif33 28 34 29 #include <sweep/sweep_types.h> … … 62 57 len = frames_to_bytes (s->format, sample_length); 63 58 64 #if 165 59 s->data = g_malloc0 ((size_t)len); 66 #else67 s->data = sweep_large_alloc_zero (len, PROT_READ|PROT_WRITE);68 #endif69 70 60 71 61 if (!(s->data)) { 72 #if 073 #if (SIZEOF_OFF_T == 8)74 fprintf(stderr, "Unable to allocate %lld bytes for sample data.\n", len);75 #else76 62 fprintf(stderr, "Unable to allocate %d bytes for sample data.\n", len); 77 #endif78 #else79 fprintf(stderr, "Unable to allocate %d bytes for sample data.\n", len);80 #endif81 63 g_free(s); 82 64 return NULL; … … 121 103 122 104 if (sounddata->refcount <= 0) { 123 #if 1124 105 g_free (sounddata->data); 125 #else126 len = frames_to_bytes (sounddata->format, sounddata->nr_frames);127 munmap (sounddata->data, len);128 #endif129 106 g_mutex_free(sounddata->data_mutex); 130 107 sounddata_clear_selection (sounddata); sweep/trunk/src/sweep_undo.c
r557 r688 106 106 inst->op->_do_ ((sw_sample *)inst, (void *)inst); 107 107 108 #if 0 /* XXX: need to tell main thread to start playback; freezes from here */109 if (inst->op->edit_mode == SWEEP_EDIT_MODE_ALLOC && was_going) {110 #if 0111 g_mutex_lock (sample->play_mutex);112 head_set_going (sample->play_head, TRUE);113 g_mutex_unlock (sample->play_mutex);114 #else115 sample_play (sample);116 #endif117 }118 #endif119 108 g_mutex_lock (sample->edit_mutex); 120 109 … … 696 685 /* Standard undo/redo functions */ 697 686 698 #if 0699 replace_data *700 replace_data_new (sw_sample * old_sample, sw_sample * new_sample)701 {702 replace_data * r;703 704 r = g_malloc (sizeof(replace_data));705 706 r->old_sample = old_sample;707 r->new_sample = new_sample;708 709 return r;710 };711 712 void713 undo_by_replace (replace_data * r)714 {715 sample_replace_throughout (r->new_sample, r->old_sample);716 717 sample_refresh_views (r->new_sample);718 }719 720 void721 redo_by_replace (replace_data * r)722 {723 sample_replace_throughout (r->old_sample, r->new_sample);724 725 sample_refresh_views (r->new_sample);726 }727 #endif728 729 687 sounddata_replace_data * 730 688 sounddata_replace_data_new (sw_sample * sample, sweep/trunk/src/time_ruler.c
r359 r688 296 296 if (i == 0) 297 297 { 298 #if 1299 298 snprint_time (unit_str, UNIT_STR_LEN, (sw_time_t)cur); 300 #else301 snprint_time_smpte (unit_str, UNIT_STR_LEN, (sw_time_t)cur, 10.0);302 #endif303 299 pango_layout_set_text (layout, unit_str, -1); 304 300 pango_layout_get_extents (layout, NULL, &logical_rect); sweep/trunk/src/undo_dialog.c
r557 r688 57 57 undo_dialog = NULL; 58 58 } 59 60 #if 061 static void62 undo_dialog_ok_cb (GtkWidget * widget, gpointer data)63 {64 GtkWidget * dialog;65 66 dialog = gtk_widget_get_toplevel (widget);67 gtk_widget_hide (dialog);68 }69 #endif70 59 71 60 static void … … 247 236 248 237 for (gl = g_list_last (ud_sample->registered_ops); gl; gl = gl->prev) { 249 #if 0250 inst = (sw_op_instance *)gl->data;251 252 if (gl == ud_sample->current_undo) {253 need_undo = TRUE;254 }255 #endif256 257 238 if (i == s) { 258 239 sel_gl = gl; … … 264 245 265 246 g_mutex_unlock (ud_sample->ops_mutex); 266 267 #if 0268 if (need_undo) {269 while (ud_sample->current_undo != sel_gl)270 undo_current (ud_sample);271 } else {272 while (ud_sample->current_undo != sel_gl)273 redo_current (ud_sample);274 }275 #endif276 247 277 248 revert_op (ud_sample, sel_gl); … … 434 405 revert_button = button; 435 406 436 #if 0437 438 /* OK */439 440 ok_button = gtk_button_new_with_label (_("OK"));441 GTK_WIDGET_SET_FLAGS (GTK_WIDGET (ok_button), GTK_CAN_DEFAULT);442 gtk_box_pack_start (GTK_BOX (GTK_DIALOG(undo_dialog)->action_area),443 ok_button, TRUE, TRUE, 0);444 gtk_widget_show (ok_button);445 g_signal_connect (G_OBJECT(ok_button), "clicked",446 G_CALLBACK (undo_dialog_ok_cb),447 NULL);448 #endif449 450 407 /* Cancel */ 451 408 … … 460 417 461 418 gtk_widget_grab_default (button); 462 463 #if 0464 gtk_widget_grab_default (ok_button);465 #endif466 467 468 419 } 469 420 sweep/trunk/src/view.c
r557 r688 78 78 */ 79 79 #define VIEW_MIN_WIDTH 197 80 #if 081 #define VIEW_MAX_WIDTH 51782 #define VIEW_DEFAULT_HEIGHT 32083 #else84 80 #define VIEW_MAX_WIDTH 1034 85 81 #define VIEW_DEFAULT_HEIGHT_PER_CHANNEL 320 86 #endif87 82 88 83 #define DEFAULT_MIN_ZOOM 8 … … 208 203 submenu = menu; 209 204 210 #if 0211 first_name[4] = '\0';212 last_name[4] = '\0';213 #endif214 215 205 if (plugins) 216 206 /*strncpy (first_name, ((sw_procedure *)plugins->data)->name, 4);*/ … … 292 282 for (gl = view->channelops_widgets; gl; gl = gl->next) { 293 283 view->nomodify_widgets = g_list_remove (view->nomodify_widgets, gl->data); 294 #if 0295 view->noready_widgets = g_list_remove (view->noready_widgets, gl->data);296 view->noalloc_widgets = g_list_remove (view->noalloc_widgets, gl->data);297 #endif298 284 } 299 285 g_list_free (view->channelops_widgets); … … 438 424 accel_group = gtk_accel_group_new(); 439 425 g_object_set_data(G_OBJECT(view->window), "accel_group", accel_group); 440 #if 0441 if (GTK_IS_MENU(m))442 gtk_window_add_accel_group (GTK_WINDOW(view->window), accel_group);443 #endif444 426 445 427 /* File */ … … 703 685 704 686 705 #if 0706 create_view_menu_item (submenu, _("Left"), "<Sweep-View>/View/Left", view,707 zoom_left_cb, FALSE,708 GDK_Left, GDK_BUTTON1_MASK, s);709 710 create_view_menu_item (submenu, _("Right"), "<Sweep-View>/View/Right", view,711 zoom_right_cb, FALSE,712 GDK_Right, GDK_BUTTON1_MASK, s);713 #endif714 715 687 create_view_menu_item (submenu, _("Zoom normal"), "<Sweep-View>/View/Zoom normal", view, 716 688 zoom_norm_cb, FALSE, … … 1240 1212 gtk_widget_show(menuitem); 1241 1213 1242 #if 01243 menuitem = gtk_menu_item_new(); /* Separator */1244 gtk_menu_append(GTK_MENU(menu), menuitem);1245 gtk_widget_show(menuitem);1246 1247 /* Properties */1248 1249 menuitem = gtk_menu_item_new_with_label(_("File properties ..."));1250 gtk_menu_append(GTK_MENU(menu), menuitem);1251 g_signal_connect (G_OBJECT(menuitem), "activate",1252 G_CALLBACK(show_info_dialog_cb), view);1253 gtk_widget_show(menuitem);1254 #endif1255 1256 1214 return menu; 1257 1215 } … … 1325 1283 G_CALLBACK(view_new_cb), s); 1326 1284 gtk_widget_show(menuitem); 1327 1328 #if 01329 menuitem = gtk_menu_item_new(); /* Separator */1330 gtk_menu_append(GTK_MENU(menu), menuitem);1331 gtk_widget_show(menuitem);1332 1333 /* Properties */1334 1335 menuitem = gtk_menu_item_new_with_label(_("File properties ..."));1336 gtk_menu_append(GTK_MENU(menu), menuitem);1337 g_signal_connect (G_OBJECT(menuitem), "activate",1338 G_CALLBACK(show_info_dialog_cb), view);1339 gtk_widget_show(menuitem);1340 #endif1341 1285 1342 1286 return menu; … … 1496 1440 #define VIEW_TOOLBAR_TOGGLE_BUTTON SW_TOOLBAR_TOGGLE_BUTTON 1497 1441 #define VIEW_TOOLBAR_RADIO_BUTTON SW_TOOLBAR_RADIO_BUTTON 1498 1499 #if 01500 typedef enum {1501 VIEW_TOOLBAR_BUTTON,1502 VIEW_TOOLBAR_TOGGLE_BUTTON,1503 VIEW_TOOLBAR_RADIO_BUTTON,1504 } view_toolbar_button_type;1505 1506 static GtkWidget *1507 create_pixmap_button (GtkWidget * widget, gchar ** xpm_data,1508 const gchar * tip_text, const gchar * custom_name,1509 view_toolbar_button_type button_type,1510 GCallback clicked,1511 GCallback pressed, GCallback released,1512 gpointer data)1513 {1514 GtkWidget * pixmap;1515 GtkWidget * button;1516 GtkTooltips * tooltips;1517 1518 switch (button_type) {1519 case VIEW_TOOLBAR_TOGGLE_BUTTON:1520 button = gtk_toggle_button_new ();1521 break;1522 case VIEW_TOOLBAR_RADIO_BUTTON:1523 button = gtk_radio_button_new (NULL);1524 break;1525 case VIEW_TOOLBAR_BUTTON:1526 default:1527 button = gtk_button_new ();1528 break;1529 }1530 1531 if (xpm_data != NULL) {1532 pixmap = create_widget_from_xpm (widget, xpm_data);1533 gtk_widget_show (pixmap);1534 gtk_container_add (GTK_CONTAINER (button), pixmap);1535 }1536 1537 if (tip_text != NULL) {1538 tooltips = gtk_tooltips_new ();1539 gtk_tooltips_set_tip (tooltips, button, tip_text, NULL);1540 }1541 1542 if (style != NULL) {1543 gtk_widget_set_style (button, style);1544 }1545 1546 if (clicked != NULL) {1547 g_signal_connect (G_OBJECT (button), "clicked",1548 G_CALLBACK(clicked), data);1549 }1550 1551 if (pressed != NULL) {1552 g_signal_connect (G_OBJECT(button), "pressed",1553 G_CALLBACK(pressed), data);1554 }1555 1556 if (released != NULL) {1557 g_signal_connect (G_OBJECT(button), "released",1558 G_CALLBACK(released), data);1559 }1560 1561 return button;1562 }1563 #endif1564 1442 1565 1443 static void … … 1653 1531 GtkWidget * frame; 1654 1532 GtkWidget * label; 1655 #if 01656 GtkWidget * entry;1657 #endif1658 1659 #if 01660 GtkWidget * toolbar;1661 #endif1662 1533 1663 1534 #ifdef DEVEL_CODE … … 1698 1569 view->channelops_widgets = NULL; 1699 1570 1700 #if 01701 win_width = CLAMP (sample->sounddata->nr_frames / 150,1702 VIEW_MIN_WIDTH, VIEW_MAX_WIDTH);1703 win_height =1704 VIEW_DEFAULT_HEIGHT_PER_CHANNEL *1705 MIN (2, sample->sounddata->format->channels);1706 #else1707 1571 screen_width = gdk_screen_width (); 1708 1572 screen_height = gdk_screen_height (); … … 1716 1580 1717 1581 win_height *= MIN (2, sample->sounddata->format->channels); 1718 #endif1719 1582 1720 1583 window = gtk_window_new(GTK_WINDOW_TOPLEVEL); … … 1982 1845 1983 1846 gtk_widget_set_style (tool_hbox, style_dark_grey); 1984 1985 #if 01986 /* Zoom all */1987 button = create_pixmap_button (window, zoom_all_xpm, _("Zoom all"),1988 NULL, VIEW_TOOLBAR_BUTTON, G_CALLBACK (zoom_all_cb),1989 NULL, NULL, view);1990 gtk_button_set_relief (GTK_BUTTON(button), GTK_RELIEF_NONE);1991 gtk_box_pack_start (GTK_BOX (tool_hbox), button, FALSE, TRUE, 0);1992 gtk_widget_show (button);1993 #endif1994 1847 1995 1848 /* Zoom in */ … … 2209 2062 gtk_widget_show (label); 2210 2063 2211 #if 02212 rate_adj = gtk_adjustment_new (50.0, /* value */2213 0.0, /* lower */2214 100.0, /* upper */2215 0.001, /* step incr */2216 0.001, /* page incr */2217 0.001 /* page size */2218 );2219 #else2220 2064 rate_adj = gtk_adjustment_new (0.0, /* value */ 2221 2065 -100.0, /* lower */ … … 2225 2069 0.0 /* page size */ 2226 2070 ); 2227 #endif2228 2071 2229 2072 /* view->rate = 1.0;*/ … … 2597 2440 2598 2441 hbox = gtk_hbox_new (FALSE, 0); 2599 #if 0 2600 gtk_table_attach (GTK_TABLE(table), hbox, 2601 0, 3, 3, 4, 2602 GTK_FILL|GTK_SHRINK, GTK_FILL, 2603 0, 0); 2604 #endif 2442 2605 2443 gtk_box_pack_start (GTK_BOX(main_vbox), hbox, FALSE, FALSE, 0); 2606 2444 gtk_widget_show (hbox); … … 2705 2543 view->display); 2706 2544 2707 #if 02708 g_signal_connect_swapped (G_OBJECT(view->display),2709 "motion_notify_event",2710 G_CALLBACK(view_set_pos_indicator_cb),2711 G_OBJECT(view->display));2712 #endif2713 2714 2545 if (sample->sounddata->sels) 2715 2546 sample_display_start_marching_ants (SAMPLE_DISPLAY(view->display)); … … 3347 3178 view->sample->play_head->scrubbing ? _("Scrub!") : _("Ready")); 3348 3179 3349 #if 03350 if (view->sample->play_head->scrubbing) {3351 snprintf (buf, BUF_LEN, "Sweep %s - %s", VERSION, _("Scrub!"));3352 } else {3353 snprintf (buf, BUF_LEN, "Sweep %s - %s", VERSION, _("Ready"));3354 }3355 #endif3356 3357 3180 gtk_progress_set_format_string (GTK_PROGRESS(view->progress), buf); 3358 3181 gtk_progress_set_percentage (GTK_PROGRESS(view->progress), 0.0); … … 3440 3263 if (s->sounddata->nr_frames > 0) { 3441 3264 snprintf(buf, BUF_LEN, 3442 #if 03443 "%s (%dHz %s) %0d%% - Sweep " VERSION,3444 s->filename ? s->filename : _("Untitled"),3445 s->sounddata->format->rate,3446 s->sounddata->format->channels == 1 ? _("Mono") : _("Stereo"),3447 #else3448 3265 "%s%s %0d%% - Sweep " VERSION, 3449 3266 s->modified ? _("*") : "", 3450 3267 s->pathname ? g_basename (s->pathname) : _("Untitled"), 3451 #endif 3268 3452 3269 s->progress_percent); 3453 3270 } else { 3454 3271 snprintf(buf, BUF_LEN, 3455 #if 03456 "%s (%dHz %s) %s - Sweep " VERSION,3457 s->filename ? s->filename : _("Untitled"),3458 s->sounddata->format->rate,3459 s->sounddata->format->channels == 1 ? _("Mono") : _("Stereo"),3460 #else3461 3272 "%s%s %s - Sweep " VERSION, 3462 3273 s->modified ? _("*") : "", 3463 3274 s->pathname ? g_basename (s->pathname) : _("Untitled"), 3464 #endif3465 3275 _("Empty")); 3466 3276 } … … 3573 3383 } 3574 3384 3575 #if 03576 if (adj->page_size > adj->upper - adj->value)3577 adj->page_size = adj->upper - adj->value;3578 #endif3579 3580 #if 03581 if (v->end > v->sample->sounddata->nr_frames)3582 v->end = v->sample->sounddata->nr_frames;3583 #endif3584 3385 3585 3386 if (adj->page_increment == 0) {
