HISE Logo Forum
    • Categories
    • Register
    • Login

    Horizontal Filmstrip VU meter

    Scheduled Pinned Locked Moved General Questions
    16 Posts 3 Posters 508 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.
    • LindonL
      Lindon @A Former User
      last edited by

      @Steve-Mohican - then yo should make a horizontal png...

      HISE Development for hire.
      www.channelrobot.com

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

        Hmmm something's not clear, do you want the filmstrip to extend horizontally or the VUmeter to be horizontal? not the same thing...

        Can't help pressing F5 in the forum...

        1 Reply Last reply Reply Quote 0
        • ?
          A Former User
          last edited by A Former User

          Sorry for lack of info.

          My filmstrip image is stitched horizontally. Actually I can't stitch it vertically because the height of the stitched image will be soo huge. It is better to stitch a vertical VU filmstrip image horizontally. You can see the image in the project file.

          So the VU meter will be vertical but filmstrip image is horizontally stsitched.

          I think this code is for vertically stitched filmstrips. When I swap x & y it didn't work. The solution must be so simple but I can't see it guys.

          ustkU LindonL 2 Replies Last reply Reply Quote 0
          • ustkU
            ustk @A Former User
            last edited by

            @Steve-Mohican So swapping x and y should work, have you adapted all other properties (index nb, width, height...)?

            Can't help pressing F5 in the forum...

            1 Reply Last reply Reply Quote 0
            • LindonL
              Lindon @A Former User
              last edited by Lindon

              @Steve-Mohican so you want this sort of thing no?

              2a3644fb-d71e-4c19-91ed-027ee48580d4-image.png

              heres the png I use:

              78788f80-4558-4978-9024-dbfc6d8a04b7-image.png

              not really so big...uses 106 images stacked vertically.. to cover the dB range -100dB to +6dB

              HISE Development for hire.
              www.channelrobot.com

              ? 1 Reply Last reply Reply Quote 0
              • ustkU
                ustk
                last edited by ustk

                Apparently, there seems to be a bug when using Xoffset making horizontal filmstrip unusable...

                Can't help pressing F5 in the forum...

                ? 1 Reply Last reply Reply Quote 0
                • ?
                  A Former User @Lindon
                  last edited by A Former User

                  @Lindon said in Horizontal Filmstrip VU meter:

                  @Steve-Mohican so you want this sort of thing no?

                  2a3644fb-d71e-4c19-91ed-027ee48580d4-image.png

                  heres the png I use:

                  No, my VU Meter will be like this (vertical):

                  alt text

                  And my image strip is this (stitched horizontally):
                  alt text

                  LindonL 1 Reply Last reply Reply Quote 0
                  • ?
                    A Former User @ustk
                    last edited by

                    @ustk said in Horizontal Filmstrip VU meter:

                    Apparently, there seems to be a bug when using Xoffset making horizontal filmstrip unusable...

                    I think so too mate.

                    ustkU 1 Reply Last reply Reply Quote 0
                    • ustkU
                      ustk @A Former User
                      last edited by

                      @Steve-Mohican So I corrected the bug, but it works using a hack for the Xoffset (it can't be 0, minimum 1). This is because the way the API is made gives a priority to check X before Y.

                      The way I would do it is

                      setImage(String imageName, bool isHorizontal, int offset)
                      

                      Might not break compatibility, knowing that no one could have used a horizontal filmstrip before.
                      A bool isHorizontal would be 0 in older projects anyway. @Christoph-Hart ?
                      Working on it...

                      Can't help pressing F5 in the forum...

                      1 Reply Last reply Reply Quote 0
                      • LindonL
                        Lindon @A Former User
                        last edited by

                        @Steve-Mohican said in Horizontal Filmstrip VU meter:

                        @Lindon said in Horizontal Filmstrip VU meter:

                        @Steve-Mohican so you want this sort of thing no?

                        2a3644fb-d71e-4c19-91ed-027ee48580d4-image.png

                        heres the png I use:

                        No, my VU Meter will be like this (vertical):

                        alt text

                        And my image strip is this (stitched horizontally):
                        alt text

                        then I've already sent you a snippet with it working...

                        HISE Development for hire.
                        www.channelrobot.com

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

                          @Christoph-Hart Here's a fix that is retro compatible (as long as no one as tried to use xOffset but this shouldn't be the case, otherwise it shouldn't have been broken)
                          Although before making a pull request, I don't know how to properly initialize the auto img variable, I'm sure I did it dirty...

                          void ScriptingApi::Content::ScriptPanel::setImage(String imageName, bool isHorizontal, int offset)
                          {
                          	jassert_locked_script_thread(getScriptProcessor()->getMainController_());
                          
                          	paintRoutine = var();
                          	usesClippedFixedImage = true;
                          
                          	Image toUse = getLoadedImage(imageName);
                          
                          	auto b = getPosition().withPosition(0, 0);
                          	auto img = toUse;
                          
                          	int w = 0;
                          	int h = 0;
                          
                          	if (isHorizontal)
                          	{
                          		double ratio = (double)b.getWidth() / (double)b.getHeight();
                          		h = toUse.getHeight();
                          		w = (int)((double)h * ratio);
                          		offset = jmin<int>(offset, toUse.getWidth() - w);
                          
                          		img = toUse.getClippedImage(Rectangle<int>(offset, 0, w, h));
                          	}
                          	else
                          	{
                          		double ratio = (double)b.getHeight() / (double)b.getWidth();
                          		w = toUse.getWidth();
                          		h = (int)((double)w * ratio);
                          		offset = jmin<int>(offset, toUse.getHeight() - h);
                          
                          		img = toUse.getClippedImage(Rectangle<int>(0, offset, w, h));
                          	}
                          
                          
                          	if (auto drawHandler = getDrawActionHandler())
                          	{
                          		drawHandler->beginDrawing();
                          		drawHandler->addDrawAction(new ScriptedDrawActions::drawImageWithin(img, b.toFloat()));
                          		drawHandler->flush();
                          	}
                          }
                          

                          Can't help pressing F5 in the forum...

                          1 Reply Last reply Reply Quote 1
                          • ?
                            A Former User
                            last edited by

                            @Lindon @ustk Thank you so much guys. That really really helped me a lot. You saved my day.

                            Thank you again!

                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post

                            17

                            Online

                            1.7k

                            Users

                            11.8k

                            Topics

                            102.6k

                            Posts