HISE Logo Forum
    • Categories
    • Register
    • Login

    UI Zoom Factor

    Scheduled Pinned Locked Moved Bug Reports
    26 Posts 6 Posters 1.5k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ulrikU
      ulrik @Christoph Hart
      last edited by

      @Christoph-Hart Ok I understand, could we in some way script the UI Zoom setting?

      Hise Develop branch
      MacOs 15.3.1, Xcode 16.2
      http://musikboden.se

      1 Reply Last reply Reply Quote 0
      • Christoph HartC
        Christoph Hart
        last edited by Christoph Hart

        Yes, that's a reasonable request. It's actually pretty easy to do, so maybe someone else can implement it:

        1. fetch a reference to the main controller and dynamic_cast it to AudioProcessorDriver
        2. call driver->setGlobalScaleFactor(scaleFactor, sendNotification); (the last parameter is important to that it sends a message to the UI to resize).
        3. Add a API call Engine.setZoomLevel(double scaleFactor) (it's a bit inconsistent to the C++ naming, but it matches the Engine.getZoomLevel() call).

        EDIT: Oh and if you want to disable the 85% scaling, just remove the condition here:

        Link Preview Image
        HISE/hi_frontend/frontend/FrontendProcessorEditor.cpp at 8ef678ec2fcae0973cc269163404b1f9df967733 · christophhart/HISE

        The open source framework for sample based instruments - HISE/hi_frontend/frontend/FrontendProcessorEditor.cpp at 8ef678ec2fcae0973cc269163404b1f9df967733 · christophhart/HISE

        favicon

        GitHub (github.com)

        ustkU ulrikU 3 Replies Last reply Reply Quote 4
        • ustkU
          ustk @Christoph Hart
          last edited by

          @Christoph-Hart gorgeous, I’ll give it a go sometimes tomorrow 😉

          ulrikU 1 Reply Last reply Reply Quote 3
          • ulrikU
            ulrik @Christoph Hart
            last edited by

            @Christoph-Hart Beautiful, thank you! 🍻

            Hise Develop branch
            MacOs 15.3.1, Xcode 16.2
            http://musikboden.se

            1 Reply Last reply Reply Quote 0
            • ulrikU
              ulrik @ustk
              last edited by ulrik

              @ustk Yezzz...great! You'll get a bear as well 🍻

              Hise Develop branch
              MacOs 15.3.1, Xcode 16.2
              http://musikboden.se

              Dan KorneffD 1 Reply Last reply Reply Quote 0
              • Dan KorneffD
                Dan Korneff @ulrik
                last edited by

                tenor.gif

                Dan Korneff - Producer / Mixer / Audio Nerd

                1 Reply Last reply Reply Quote 3
                • NatanN
                  Natan
                  last edited by

                  @Christoph-Hart said in UI Zoom Factor:

                  message to the UI to resize).

                  Oh Wow, Thank You
                  Any Examples is much appreciated

                  1 Reply Last reply Reply Quote 0
                  • ustkU
                    ustk @Christoph Hart
                    last edited by

                    @Christoph-Hart So I've made the API, but it is of course non-dynamic, as the plugin has to be closed and reopened like for the norm zoom factor setting.
                    So the question is, is it easily doable to have it resized in real-time using the same API, or is it a totally different approach?

                    1 Reply Last reply Reply Quote 1
                    • Christoph HartC
                      Christoph Hart
                      last edited by

                      Did you use sendNotification? It's basically the same thing that the combobox of the settings dialogue does.

                      ustkU 2 Replies Last reply Reply Quote 0
                      • ustkU
                        ustk @Christoph Hart
                        last edited by ustk

                        @Christoph-Hart Yes

                        void ScriptingApi::Engine::setZoomLevel(double scaleFactor)
                        {
                        	auto mc = getScriptProcessor()->getMainController_();
                        	AudioProcessorDriver* driver = dynamic_cast<AudioProcessorDriver*>(mc);
                        
                        	driver->setGlobalScaleFactor(scaleFactor, sendNotification);
                        }
                        

                        or

                        void ScriptingApi::Engine::setZoomLevel(double scaleFactor)
                        {
                        	auto mc = getScriptProcessor()->getMainController_();
                        	dynamic_cast<AudioProcessorDriver*>(mc)->setGlobalScaleFactor(scaleFactor, sendNotification);
                        }
                        

                        which is the same thing

                        1 Reply Last reply Reply Quote 0
                        • ustkU
                          ustk @Christoph Hart
                          last edited by ustk

                          @Christoph-Hart I think we need this

                          #if USE_FRONTEND
                          
                          	auto fpe = mc->findParentComponentOfClass<FrontendProcessorEditor>();
                          
                          	if (fpe != nullptr)
                          	{
                          		fpe->setGlobalScaleFactor((float)scaleFactor);
                          	}
                          #endif
                          

                          then findParentComponentOfClass must be adapted but I don't know how...

                          What's the difference between getScriptProcessor()->getMainController_(); and getProcessor()->getMainController();?
                          Both are working...

                          1 Reply Last reply Reply Quote 0
                          • Christoph HartC
                            Christoph Hart
                            last edited by

                            They are both the same (and one just calls the other method with a dynamic cast).

                            Ah I see the problem (not sure how I could have missed that when I wrote my last answer). The editor window is not registered to the ScaleFactorListener system (which is weird because the system is made exactly for this purpose). I think I have to take it from here and clean up my own mess :)

                            ustkU 1 Reply Last reply Reply Quote 3
                            • ustkU
                              ustk @Christoph Hart
                              last edited by ustk

                              @Christoph-Hart Nice, I've just seen you implemented it yourself ;)

                              You also corrected the macOS compilation, but I still have the same issue when compiling:

                              Untitled.png

                              1 Reply Last reply Reply Quote 0
                              • Christoph HartC
                                Christoph Hart
                                last edited by

                                Yeah, I accidentally committed this to the SNEX branch, it was meant to go to the Scriptnode branch, but I'll transfer it real quick.

                                ustkU 1 Reply Last reply Reply Quote 3
                                • ustkU
                                  ustk @Christoph Hart
                                  last edited by

                                  This post is deleted!
                                  1 Reply Last reply Reply Quote 0
                                  • d.healeyD
                                    d.healey
                                    last edited by

                                    @ustk Think it's possible to add the same kind of function for the Streaming Mode?

                                    Libre Wave - Freedom respecting instruments and effects
                                    My Patreon - HISE tutorials
                                    YouTube Channel - Public HISE tutorials

                                    ustkU 2 Replies Last reply Reply Quote 0
                                    • ustkU
                                      ustk @d.healey
                                      last edited by

                                      @d-healey I can't tell but I can have a look…

                                      1 Reply Last reply Reply Quote 1
                                      • ustkU
                                        ustk @d.healey
                                        last edited by ustk

                                        @d-healey @Christoph-Hart I've done it and it seems to work... But I'm not against an input from Christoph before pushing :)

                                        void ScriptingApi::Engine::setDiskMode(int mode)
                                        {
                                        	auto mc = dynamic_cast<MainController*>(getScriptProcessor()->getMainController_());
                                        
                                        	AudioProcessorDriver* driver = dynamic_cast<AudioProcessorDriver*>(mc);
                                        
                                        	driver->diskMode = mode;
                                        	
                                        	mc->getSampleManager().setDiskMode((MainController::SampleManager::DiskMode)mode);
                                        }
                                        

                                        So mode should be 1 for fast and 2 for slow due to the original combobox offset.
                                        Do you prefer a 0 based value? (0-fast 1-slow)

                                        d.healeyD 1 Reply Last reply Reply Quote 0
                                        • d.healeyD
                                          d.healey @ustk
                                          last edited by d.healey

                                          @ustk

                                          Do you prefer a 0 based value? (0-fast 1-slow)

                                          Thanks @ustk! Yes I prefer 0 based. HISE combo box values mess with the system :p

                                          Libre Wave - Freedom respecting instruments and effects
                                          My Patreon - HISE tutorials
                                          YouTube Channel - Public HISE tutorials

                                          1 Reply Last reply Reply Quote 1
                                          • Christoph HartC
                                            Christoph Hart
                                            last edited by

                                            Yes zero is better, this represents the actual number in the XML file:

                                            <?xml version="1.0" encoding="UTF-8"?>
                                            
                                            <GLOBAL_SETTINGS DISK_MODE="0" SCALE_FACTOR="1.0" VOICE_AMOUNT_MULTIPLIER="2"
                                                             GLOBAL_BPM="-1.0" MIDI_CHANNELS="1" SAMPLES_FOUND="1" OPEN_GL="0"/>
                                            
                                            ustkU 1 Reply Last reply Reply Quote 2
                                            • First post
                                              Last post

                                            12

                                            Online

                                            1.8k

                                            Users

                                            12.1k

                                            Topics

                                            105.5k

                                            Posts