Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resizable and layoutable guis #83

Merged
merged 5 commits into from
Apr 20, 2022
Merged

Conversation

elgiano
Copy link
Contributor

@elgiano elgiano commented Mar 21, 2022

Before this PR FluidWaveform and FluidPlotter can instantiate Views as "standalone" windows, or by directly placing them in an external window with parent and bounds and in none of these cases plots resize when their parent window is resized. This PR makes the "standalone" mode resizable, and introduces a third mode, which creates a view without parent nor bounds, so that it can be used with SC's Layout Management. This new mode is activated by setting the standalone argument to false.

There shouldn't be any breaking change, but GUIs have now three modes:

  1. parent=nil, standalone=true (default): create a new (resizable) window
  2. parent.notNil, bounds: a Rect: create a view and place it in parent at bounds
  3. parent=nil, standalone = false: create a View without parent or Bounds

Example usage with Layout Management:

var win, fW, fpL, fpR;
win = Window("waveform and two plotters");
fW = FluidWaveform(...);
fpL = FluidPlotter(...);
fpR = FluidPlotter(...);
win.layout = VLayout(fW.parent, HLayout(fpL.win, fpR.win);
win.front;

TODO:
[] add Layout Management example?

Notes:

  1. I've been replacing ^super.new.init(...args) with super.newCopyArgs(...args).init everywhere I could in these two files. It saves a lot of unnecessary code duplication, and some init functions were even removed altogether as they were only there to copy those args.
  2. I tried to simplify some of the nested forking in FluidWaveform. Layers don't return anymore something that needs to by synced, as all asynchronous server operation and GUI drawing are now done in the same forkIfNeeded. If a Function needs to wait for the gui to be ready (such as refresh, which needs to wait for layers to refresh the view), it will run all layer.draw calls as part of its own thread (like processBlocking). Draw is called only internally (and I think it's meant to be private, right?). External functions will need to defer { fluidWaveform.refresh } , but not front, which forks automatically.
  3. I perceive as an inconsistency the fact that FluidWaveform returns its parent with .win, while FluidPlotter does is with .parent. Is there any good reason they shouldn't both do it with the same method name (I prefer parent)?

@tedmoore
Copy link
Member

Hi @elgiano,

Sorry, just seeing this now! (in the future, feel free to request or @ me) Thank you for this! I'm looking forward to checking it all out. The resizing is definitely something that these objects need. I'm heading off tomorrow for another trip of workshops, so it may be a couple weeks, but I assure you I'll get to it.

3. I perceive as an inconsistency the fact that FluidWaveform returns its parent with .win, while FluidPlotter does is with .parent. Is there any good reason they shouldn't both do it with the same method name (I prefer parent)?

There is no good reason, I also prefer parent! (and yet it was I who called it win...)

Cheers. T

@elgiano
Copy link
Contributor Author

elgiano commented Mar 30, 2022

Hi @tedmoore, thanks!!!
Glad you like the idea, I'm already using it and I find it kind of fundamental for my flow!

Now main branch was updated, and there are conflicts... you have workshops, I have a piece coming... so let's definitely take it easy, I'll solve the conflicts after the piece, in a couple of weeks, as I don't feel like updating flucoma right now :)

Looking forward for what's coming!

EDIT: I see, you made FluidPlotter zoomable <3 I'll definitely look into it in a couple of weeks then :D, but for sure resizing and zooming have to be compatible.

@elgiano elgiano changed the base branch from main to dev March 31, 2022 10:58
@jamesb93
Copy link
Member

This looks great. I wish we had the composability of views in Max. I think that to complete the PR some additional documentation would be really good @elgiano. Then it would have my approval for sure. I think that we could also aim to merge this for the next major release!

@jamesb93 jamesb93 requested review from tedmoore and jamesb93 March 31, 2022 11:38
Copy link
Member

@jamesb93 jamesb93 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With documentation that shows how to use the three modes, this is good to go (from my non-SC specialist perspective). I'm sure @tedmoore will have more concise and important feedback.

@elgiano
Copy link
Contributor Author

elgiano commented Mar 31, 2022

Thanks @jamesb93 I'll do the docs in a couple of weeks!
I updated my local branch, I'll test it these days but it looks fine so far. Just one note for later:

FluidPlotter's mouseMoveAction gets the FluidPlotter as first argument, not the UserView. I totally support it (you can always get plotter.userView), but I haven't noticed it before and since it's written view everywhere, I'm not sure this is intended.

EDIT: let's make it clearly intended :)

@elgiano
Copy link
Contributor Author

elgiano commented Apr 15, 2022

@tedmoore
Hey Ted! I've updated the help files and made some final changes (and resolved some conflicts). It's ready for review now, whenever you have the time!

elgiano added 4 commits April 15, 2022 14:38
This way views are immediately available upon creation,
for example to be added to layouts.
Views are still correctly updated with data from within the fork,
whenever they are ready.
@tedmoore
Copy link
Member

Thanks @elgiano, I'll take a look this week!

@tedmoore
Copy link
Member

Thanks @elgiano! I love this. Thanks for doing the implementing and thanks for your patience while we were busy for a couple weeks there.

@tedmoore tedmoore merged commit d776b25 into flucoma:dev Apr 20, 2022
@elgiano elgiano deleted the topic/resizeGUI branch April 24, 2022 20:27
jamesb93 pushed a commit that referenced this pull request Jun 14, 2022
* ignore more varieties of build folder

* deal with some warnings

* FluidWaveform 'lineWidth' argument now also affects feature lines

* add back the nmf-jit-classifier example

* novelty interface change in example

* resizable and layoutable guis (#83)

* resizable and layoutable guis

* FluidWaveform: rename 'win' to 'parent'

* FluidWaveform/FluidPlotter: update help

* FluidWaveform/Plotter: make views before forking

This way views are immediately available upon creation,
for example to be added to layouts.
Views are still correctly updated with data from within the fork,
whenever they are ready.

* Thanks @elgiano! + a few small edits

Co-authored-by: Ted Moore <[email protected]>

* slicers: add enums for algorithms (#86)

* typo

* FluidBufNMF class: add resynthMode argument

* add PCA whitening parameter (#65)

* add PCA whitening parameter

* FluidPCA: Ensure whiten parameter is sent to kr query UGen

Co-authored-by: Gerard <[email protected]>
Co-authored-by: weefuzzy <[email protected]>

* Enhance/optional message args (#77)

* optional args: sc wrapper updates

* optional args: KDTree try out

* Enhance/choices param (#78)

* NRTWrapper: Add choices param (long <-> bitset)

* Update `FluidBufStats` with `select` control

* BufStats class: Fix bitfield for `select` and warn on duplicate items

* Update SpectralShape classes for new param

* `PCA.sc`: add batch `inverseTranform` method

* Wrapper: integer sign warnings

* Enhance/max params (#93)

* CMake: Centralise C++ version and set to 17

* Wrapper: handle new LongRuntimeMax param type

* POC for new LongRuntimeMax param with MFCC numCoeffs

* Wrapper: Make MSVC happy about constexpr lambda capture

* All scalers: replace 'invert' parameter with `inverseTransform` messages

* Wrapper: Work around 32 char limit for plugin commands

If too long, remove vowels. 
Sorry. 
Better ideas welcome

* fix #96

* typo

* Update SC classes for new style `max<X>` parameters

* SpectralShape SC class: maxFFT

* RealTime wrapper: play it safer with output channel count

This really relies on the SC class being correct, but then everything 
ultimately does...

* RT FFT Object SC Classes: Provide maxFFTSize default

* BufSTFT SC class: Add maxFFT (now needed due to core type change)

* Add select param to Loudness and Pitch SC clases (#101)

* Wrapper: workaround scsynth 32 char cmd length limit with extra dispatch layer 

also avoids need for formerly truncated plugin names in some cases

* removed invert from scalers class definitions (#102)

* Enhance/generate stubs (#104)

* CMake: generate .cpp stubs

* Remove old cpp stubs

* Ensure correct MSVC runtime by default

* CMake: invoke docs properly

* CMake: Tidy up

* CMake: Tidy up

* CMake: typo

* CI: Update nightly

* CI: remove lingering references to docs job

* CMake: belatedly add branch selection for flucoma deps upon which CI relies

* CMake: Actually commit important code for best collaborative results

* CMake: This file is now redundant, in fact

* cmake: missing slash in install

* bufnmf: added the maxFFTsize parameter in the server call

* FluidStats: Change where output Array reshape happens to keep SynthDescLib happy

* FluidBufNNDSVD: maxfftsize now needed in server call, or booooom

fixes #161

* BufNMFCross: Needs MaxFFTSize

* BufNNDSVD: Ensure activations buffer is queried at finish

* FluidBufToKr ensure that numFrames is an int (not a float)

* Added *(Buf)Feature objects to guide (and deleted old guide)

NNDSVD --> NMFSeed in Guide

fixed bad links in Guide

* change interface and file name (#113)

* hidden --> hiddenLayers in class definition (#114)

* reordered some max<X> arguments

* change interp to interpolation in nmfmorph class (#115)

* Feature/skmeans (#66)

* add PCA whitening parameter

* add FluidSKMeans

* SKMeans correction

* added RT query

* <fit>transform<point> -> <fit>encode<point>

* added to overview

Co-authored-by: Gerard <[email protected]>
Co-authored-by: tremblap <[email protected]>

* [CI] Update Release Workflow (#118)

* cleanup nightly.yaml

* use new release style

* refactor release

* remove workflow dispatch variables
@jamesb93 jamesb93 mentioned this pull request Jun 30, 2022
jamesb93 pushed a commit that referenced this pull request Jun 30, 2022
* ignore more varieties of build folder

* deal with some warnings

* FluidWaveform 'lineWidth' argument now also affects feature lines

* add back the nmf-jit-classifier example

* novelty interface change in example

* resizable and layoutable guis (#83)

* resizable and layoutable guis

* FluidWaveform: rename 'win' to 'parent'

* FluidWaveform/FluidPlotter: update help

* FluidWaveform/Plotter: make views before forking

This way views are immediately available upon creation,
for example to be added to layouts.
Views are still correctly updated with data from within the fork,
whenever they are ready.

* Thanks @elgiano! + a few small edits

Co-authored-by: Ted Moore <[email protected]>

* slicers: add enums for algorithms (#86)

* typo

* FluidBufNMF class: add resynthMode argument

* add PCA whitening parameter (#65)

* add PCA whitening parameter

* FluidPCA: Ensure whiten parameter is sent to kr query UGen

Co-authored-by: Gerard <[email protected]>
Co-authored-by: weefuzzy <[email protected]>

* Enhance/optional message args (#77)

* optional args: sc wrapper updates

* optional args: KDTree try out

* Enhance/choices param (#78)

* NRTWrapper: Add choices param (long <-> bitset)

* Update `FluidBufStats` with `select` control

* BufStats class: Fix bitfield for `select` and warn on duplicate items

* Update SpectralShape classes for new param

* `PCA.sc`: add batch `inverseTranform` method

* Wrapper: integer sign warnings

* Enhance/max params (#93)

* CMake: Centralise C++ version and set to 17

* Wrapper: handle new LongRuntimeMax param type

* POC for new LongRuntimeMax param with MFCC numCoeffs

* Wrapper: Make MSVC happy about constexpr lambda capture

* All scalers: replace 'invert' parameter with `inverseTransform` messages

* Wrapper: Work around 32 char limit for plugin commands

If too long, remove vowels. 
Sorry. 
Better ideas welcome

* fix #96

* typo

* Update SC classes for new style `max<X>` parameters

* SpectralShape SC class: maxFFT

* RealTime wrapper: play it safer with output channel count

This really relies on the SC class being correct, but then everything 
ultimately does...

* RT FFT Object SC Classes: Provide maxFFTSize default

* BufSTFT SC class: Add maxFFT (now needed due to core type change)

* Add select param to Loudness and Pitch SC clases (#101)

* Wrapper: workaround scsynth 32 char cmd length limit with extra dispatch layer 

also avoids need for formerly truncated plugin names in some cases

* removed invert from scalers class definitions (#102)

* Enhance/generate stubs (#104)

* CMake: generate .cpp stubs

* Remove old cpp stubs

* Ensure correct MSVC runtime by default

* CMake: invoke docs properly

* CMake: Tidy up

* CMake: Tidy up

* CMake: typo

* CI: Update nightly

* CI: remove lingering references to docs job

* CMake: belatedly add branch selection for flucoma deps upon which CI relies

* CMake: Actually commit important code for best collaborative results

* CMake: This file is now redundant, in fact

* cmake: missing slash in install

* bufnmf: added the maxFFTsize parameter in the server call

* FluidStats: Change where output Array reshape happens to keep SynthDescLib happy

* FluidBufNNDSVD: maxfftsize now needed in server call, or booooom

fixes #161

* BufNMFCross: Needs MaxFFTSize

* BufNNDSVD: Ensure activations buffer is queried at finish

* FluidBufToKr ensure that numFrames is an int (not a float)

* Added *(Buf)Feature objects to guide (and deleted old guide)

NNDSVD --> NMFSeed in Guide

fixed bad links in Guide

* change interface and file name (#113)

* hidden --> hiddenLayers in class definition (#114)

* reordered some max<X> arguments

* change interp to interpolation in nmfmorph class (#115)

* Feature/skmeans (#66)

* add PCA whitening parameter

* add FluidSKMeans

* SKMeans correction

* added RT query

* <fit>transform<point> -> <fit>encode<point>

* added to overview

Co-authored-by: Gerard <[email protected]>
Co-authored-by: tremblap <[email protected]>

* [CI] Update Release Workflow (#118)

* cleanup nightly.yaml

* use new release style

* refactor release

* remove workflow dispatch variables

* interface changes in 8c

* knearest interface change in 10a

* waveform help nmf interface change

* capitalise beatRemember

* two more changes of interface

* typo

* sign binaries

* add -nightly affix

* sign releases too

* enforce concurrency of jobs

* UMAP kr method should not allow user to pass numDimensions

* slicers: change algo/metric select to symbols (#103)

* slicers: change algo/metric selection to symbols

* slicers: algo/metric accept UGen

* FluidDataSetWr example code (#124)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants