Horizontal Filmstrip VU meter
-
@Steve-Mohican - then yo should make a horizontal png...
-
Hmmm something's not clear, do you want the filmstrip to extend horizontally or the VUmeter to be horizontal? not the same thing...
-
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.
-
@Steve-Mohican So swapping x and y should work, have you adapted all other properties (index nb, width, height...)?
-
@Steve-Mohican so you want this sort of thing no?
heres the png I use:
not really so big...uses 106 images stacked vertically.. to cover the dB range -100dB to +6dB
-
Apparently, there seems to be a bug when using Xoffset making horizontal filmstrip unusable...
-
@Lindon said in Horizontal Filmstrip VU meter:
@Steve-Mohican so you want this sort of thing no?
heres the png I use:
No, my VU Meter will be like this (vertical):
And my image strip is this (stitched horizontally):
-
@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.
-
@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.
Abool isHorizontal
would be0
in older projects anyway. @Christoph-Hart ?
Working on it... -
@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?
heres the png I use:
No, my VU Meter will be like this (vertical):
And my image strip is this (stitched horizontally):
then I've already sent you a snippet with it working...
-
@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 theauto 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(); } }
-