Parent window for buffer plot

Hi,

Is there a convenient way to specify a parent window for a buffer plot? This code does not work:

~my_buffer=Buffer.read(s, Platform.resourceDir +/+ "sounds/a11wlk01.wav");
w=Window.new.front;
~my_buffer.plot(parent:w)

It’s a bit annoying if you want to use the .plot API, but you can access the actual View of the plot via the .interactionView method - you can stick this into a normal layout and then just destroy the old Window (.parent).

~plot = Array.geom(500, 1, 1.02).plot;
~v = View(bounds:200@300).layout_(
	VLayout(
		StaticText().string_("Good Sounds").maxHeight_(20).align_(\center),
		~plot.interactionView
	)
).front;
~plot.parent.close();
4 Likes

Thank you.

FWIW, I landed on this:

~my_buffer=Buffer.read(s, Platform.resourceDir +/+ "sounds/a11wlk01.wav");
w=Window.new.front;

~plot=Plotter(bounds: Rect(10,10,300,200), parent:w);


~my_buffer.loadToFloatArray(action: {arg array, tmp; tmp=array; {~plot.value=tmp}.defer});
1 Like