[CM] snd-nogui - graph->ps in batch file?

Tito Latini tito.01beta at gmail.com
Wed Jun 1 11:00:15 PDT 2016


On Wed, Jun 01, 2016 at 10:45:35AM -0700, bil at ccrma.Stanford.EDU wrote:
> I think in the gtk script case, the gtk event
> queue is not being completely drained, so
> this code at least gets a squished graph:
> 
> (open-sound "oboe.snd")
> (set! (show-full-duration) #t)
> (set! (transform-graph?) #t)
> (set! (time-graph?) #f)
> 
> (do ((i 0 (+ i 1)))
>     ((or (= i 10000)
> 	 (= (gtk_events_pending) 0)))
>   (gtk_main_iteration))
> 
> (set! (transform-graph-type) graph-as-sonogram)
> (set! (fft-log-frequency) #t)
> (update-transform-graph)
> (graph->ps "hi.eps")
> 
> (exit)
> 
> 
> This seems like several different bugs -- hooboy.

Hey Bill, gtk_widget_get_allocated_width() and gtk_widget_get_allocated_height()
return 1 in batch mode and display_channel_data_with_size() is bypassed.

The follow minimal patch is a possible fix.

The values for width and height are copied from a printf in `snd_motif -b ...'.
Largest values, slowest processing.


diff -ur snd-16~/snd-chn.c snd-16/snd-chn.c
--- snd-16~/snd-chn.c	2016-06-01 19:37:39.322878464 +0200
+++ snd-16/snd-chn.c	2016-06-01 19:37:45.044806529 +0200
@@ -4378,6 +4378,15 @@
     {
       width = widget_width(channel_graph(cp));
       height = widget_height(channel_graph(cp));
+
+#if USE_GTK
+      if (ss->batch_mode)
+        {
+          width = 583;
+          height = 374;
+        }
+#endif
       if ((height > 5) && (width > 5))
 	display_channel_data_with_size(cp, width, height, 0, just_fft, just_lisp, just_time, use_incoming_cr);
     }


More information about the Cmdist mailing list