- fixed font loading

- changed to RMS
- added decibel Scales
- fixed logo loading
- changed blood theme
- added some look and feel
This commit is contained in:
Maurice Grönwoldt 2020-06-29 22:47:45 +02:00
commit 3fda15966c
16 changed files with 396 additions and 146 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

View file

@ -4,6 +4,7 @@
#include <cmath>
#include "VenoBuffer.h"
#include "../Utils.h"
VenoBuffer::VenoBuffer ()
{
@ -54,24 +55,22 @@ void VenoBuffer::addRightSample (float value, int index)
void VenoBuffer::calcPeak ()
{
for (int i = 0; i < buffer.size(); ++i)
if (monoPeak != 0 && rightPeak != 0 && leftPeak != 0)
{
auto l = std::abs(left[i]);
auto r = std::abs(right[i]);
auto m = std::abs(buffer[i]);
if (m > monoPeak)
return;
}
float leftRMS = 0;
float rightRMS = 0;
auto size = buffer.size();
for (int i = 0; i < size; ++i)
{
monoPeak = m;
}
if (l > leftPeak)
{
leftPeak = l;
}
if (r > rightPeak)
{
rightPeak = r;
}
leftRMS += left[i] * left[i];
rightRMS += right[i] * right[i];
}
rightPeak = VeNo::Utils::clamp (Decibels::gainToDecibels (std::sqrt (rightRMS / size), -30.0f), -30.0f, 0.0f);
leftPeak = VeNo::Utils::clamp (Decibels::gainToDecibels (std::sqrt (leftRMS / size), -30.0f), -30.0f, 0.0f);
monoPeak = leftPeak;
//monoPeak = VeNo::Utils::clamp (Decibels::gainToDecibels (monoPeak, -70.0f), -70.0f, 0.0f);
}
const std::vector<float>& VenoBuffer::getBuffer () const

View file

@ -0,0 +1,68 @@
//
// Created by Maurice on 29.06.2020.
//
#include "DecibelScale.h"
#include "../../../Core/Config.h"
#include "../../../Utils.h"
#include "../../../Fonts/Fonts.h"
DecibelScale::DecibelScale (const std::string& process_id) : BaseComponent (process_id)
{
}
void DecibelScale::resized ()
{
m_scale = 0.95 * getHeight();
}
void DecibelScale::paint (Graphics& g)
{
VeNo::Utils::setFontSize(7, g);
auto theme = Config::getInstance ()->getCurrentTheme ();
g.setColour (theme->getColour (ThemeColour::lcd));
g.setFont(*VenoFonts::getLCD());
if (m_mode == 0)
{
drawLabel (g, getScale (0), "0");
drawLabel (g, getScale (-3), "3");
drawLabel (g, getScale (-6), "6");
drawLabel (g, getScale (-9), "9");
drawLabel (g, getScale (-12), "12");
drawLabel (g, getScale (-18), "18");
drawLabel (g, getScale (-27), "27");
}
else
{
g.setOpacity (0);
}
}
int DecibelScale::getScale (float dB)
{
float fDef = (dB+30) / 30;
return int (fDef * m_scale);
}
void DecibelScale::drawLabel (Graphics& g, int y, const std::string& label)
{
auto font = g.getCurrentFont ();
int currentY = getHeight () - y;
int thisWidth = getWidth ();
int iMidHeight = (int) (font.getHeight () * 0.5f);
if (font.getStringWidth (label) < thisWidth - 5)
{
g.drawLine (0, currentY, 2, currentY);
g.drawLine (thisWidth - 3, currentY, thisWidth - 1, currentY);
}
g.drawText (label,
2, currentY - iMidHeight, thisWidth - 3, (int) font.getHeight (),
Justification::centred,
false);
m_lastY = currentY + 1;
}

View file

@ -0,0 +1,28 @@
//
// Created by Maurice on 29.06.2020.
//
#ifndef VENO_DECIBELSCALE_H
#define VENO_DECIBELSCALE_H
#include "JuceHeader.h"
#include "../BaseComponent.h"
class DecibelScale : public BaseComponent
{
private:
public:
explicit DecibelScale (const std::string& process_id);
~DecibelScale () override = default;
void resized () override;
void paint (Graphics& g) override;
int getScale(float dB);
void drawLabel(Graphics& g, int y, const std::string& label);
int m_mode = 0;
protected:
float m_scale = 0;
float m_lastY = 0;
};
#endif //VENO_DECIBELSCALE_H

View file

@ -22,7 +22,8 @@ void SidebarLCD::drawHeadline (Graphics& g)
{
float fontSize = VeNo::Utils::setFontSize(12.0f, g) + 2;
int line = m_innerY + fontSize + 2;
g.drawText(">>> VeNo <<<", 0, m_innerY, getWidth() - m_width, fontSize,
// should draw random stuff? or draw current selected preset :)
g.drawText(">>> INIT <<<", 0, m_innerY, getWidth() - m_width, fontSize,
Justification::centred,
true);
g.drawLine(0, line, getWidth(), line);
@ -33,7 +34,7 @@ void SidebarLCD::drawFooter (Graphics& g)
float fontSize = VeNo::Utils::setFontSize(8.0f, g) + 4;
int space = m_innerY + fontSize;
int line = getHeight() - space;
g.drawText("by VersusTuneZ", 0, line, getWidth() - m_width, fontSize,
g.drawText("by VersusTuneZ for " + SystemStats::getFullUserName(), 0, line, getWidth() - m_width, fontSize,
Justification::horizontallyCentred,
true);
g.drawLine(0, line - 4, getWidth(), line - 4);

View file

@ -21,6 +21,9 @@ Waveforms::Waveforms (const std::string& processId) : BaseComponent(processId)
std::srand (unsigned (time (nullptr)));
pickRandomText = (std::rand () % RANDOM_TEXT_COUNT);
m_ticks = 0;
dBScale = std::make_unique<DecibelScale> (processId);
dBScale->m_mode = -1;
addAndMakeVisible (*dBScale);
}
Waveforms::~Waveforms ()
@ -28,6 +31,7 @@ Waveforms::~Waveforms ()
stopTimer ();
shaderProgram.reset ();
m_context.detach ();
dBScale.reset (nullptr);
}
void Waveforms::newOpenGLContextCreated ()
@ -51,8 +55,8 @@ void Waveforms::renderOpenGL ()
{
return;
}
glViewport(0, 0, getWidth(), getHeight());
OpenGLHelpers::clear (theme->getColour (ThemeColour::lcd_bg));
//glViewport(0, 0, getWidth(), getHeight());
glEnable (GL_BLEND);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
shaderProgram->use ();
@ -102,6 +106,8 @@ void Waveforms::mouseDown (const MouseEvent& e)
{
m_mode = 0;
}
dBScale->m_mode = m_mode;
dBScale->repaint ();
}
void Waveforms::mouseDrag (const MouseEvent& e)
@ -155,26 +161,21 @@ void Waveforms::drawPeakMeter ()
}
auto instance = VenoInstance::getInstance (BaseComponent::m_processId);
instance->audioBuffer->calcPeak ();
repaint();
// draw peak signal
auto leftChannel = getdBForChannel (instance->audioBuffer->leftPeak);
selectColourByPeak (leftChannel);
glBegin (GL_TRIANGLES);
glVertex2f (-0.9f, leftChannel);
glVertex2f (-0.9f, -1.0f);
glVertex2f(-0.01f, -1.0f);
glVertex2f(-0.9f, leftChannel);
glVertex2f(-0.01f, leftChannel);
glVertex2f(-0.01f, -1.0f);
glVertex2f (-0.08f, -1.0f);
glEnd ();
auto rightChannel = getdBForChannel (instance->audioBuffer->rightPeak);
selectColourByPeak (rightChannel);
glBegin (GL_TRIANGLES);
glVertex2f (0.9f, rightChannel);
glVertex2f (0.9f, -1.0f);
glVertex2f(0.01f, -1.0f);
glVertex2f(0.9f, rightChannel);
glVertex2f(0.01f, rightChannel);
glVertex2f(0.01f, -1.0f);
glVertex2f (0.08f, -1.0f);
glEnd ();
}
@ -221,9 +222,28 @@ void Waveforms::paint (Graphics& g)
}
else
{
if (needToClear) {
dBScale->m_mode = m_mode;
dBScale->repaint();
g.resetToDefaultState ();
needToClear = false;
}
g.setFont(*VenoFonts::getLCD());
VeNo::Utils::setFontSize (16.0f, g);
if (m_mode == 0)
{
auto instance = VenoInstance::getInstance (BaseComponent::m_processId);
g.setColour (theme->getColour (ThemeColour::lcd_bg));
float size = VeNo::Utils::setFontSize (7, g);
auto halfWidth = getWidth () / 2;
auto halfHalfWidth = halfWidth / 2;
auto y = getHeight () - size;
g.drawText (std::to_string (instance->audioBuffer->leftPeak), halfWidth - halfHalfWidth - (size * 1.5), y,
(size * 3), size, Justification::centred, false);
g.drawText (std::to_string (instance->audioBuffer->rightPeak), halfWidth + halfHalfWidth - (size * 1.5), y,
(size * 3), size, Justification::centred, false);
}
}
}
void Waveforms::drawChangedParameter (Graphics& g, int w, int h, int x, int y) const
@ -256,11 +276,11 @@ void Waveforms::selectColourByPeak (float value)
return;
}
auto color = theme->getColour (ThemeColour::lcd);
if (value > 0.9)
if (value > 0.87)
{
color = theme->getColour (ThemeColour::clip);
}
else if (value > 0.8)
else if (value > 0.75)
{
color = theme->getColour (ThemeColour::warning);
}
@ -270,14 +290,14 @@ void Waveforms::selectColourByPeak (float value)
float Waveforms::getdBForChannel (float value)
{
float v = VeNo::Utils::clamp(Decibels::gainToDecibels(value, -60.0f), -60.0f, 6.0f);
return jmap(v, -60.0f, 6.0f, -1.0f,
1.0f);
return jmap (value, -30.0f, 0.0f, -1.0f,
0.9f);
}
void Waveforms::setFps ()
{
if(m_currentFps != Config::getInstance()->getFps()) {
if (m_currentFps != Config::getInstance ()->getFps ())
{
m_currentFps = Config::getInstance ()->getFps ();
// is something that
m_time_needed = roundToInt (4000 / (1000 / m_currentFps));
@ -286,3 +306,9 @@ void Waveforms::setFps ()
startTimer (m_currentFps);
}
}
void Waveforms::resized ()
{
auto halfWidth = getWidth () / 2;
auto w = VeNo::Utils::getCalculatedWidth (21);
dBScale->setBounds (halfWidth - (w / 2), 0, w, getHeight ());
}

View file

@ -7,6 +7,7 @@
#include "JuceHeader.h"
#include "../BaseComponent.h"
#include "DecibelScale.h"
#define RANDOM_TEXT_COUNT 5
// opengl context :D
@ -36,6 +37,7 @@ public:
void mouseDown (const MouseEvent& e) override;
void mouseDrag (const MouseEvent& e) override;
void paint (Graphics& g) override;
void resized () override;
bool m_isChangingData = false;
std::string changingParameter = "";
float changedValue = 0;
@ -53,6 +55,7 @@ private:
void setFps();
OpenGLContext m_context;
std::unique_ptr<OpenGLShaderProgram> shaderProgram;
std::unique_ptr<DecibelScale> dBScale;
int m_currentFps = 0;
};
#endif //VENO_WAVEFORMS_H

View file

@ -3,3 +3,8 @@
//
#include "SidebarMixer.h"
SidebarMixer::SidebarMixer (const std::string& processId) : BaseComponent (processId)
{
}

View file

@ -4,8 +4,17 @@
#ifndef VENO_SIDEBARMIXER_H
#define VENO_SIDEBARMIXER_H
class SidebarMixer
{
#include "JuceHeader.h"
#include "../../Components/BaseComponent.h"
class SidebarMixer : public BaseComponent
{
private:
public:
SidebarMixer (const std::string& processId);
~SidebarMixer() = default;
protected:
};
#endif //VENO_SIDEBARMIXER_H

View file

@ -18,11 +18,8 @@ VenoLogo* VenoLogo::getInstance ()
VenoLogo::VenoLogo ()
{
MemoryOutputStream mo;
auto result = Base64::convertFromBase64(mo, base64logo);
if (result)
{
realLogo = juce::PNGImageFormat::loadFrom(mo.getData(), mo.getDataSize());
}
auto result = ImageCache::getFromMemory(BinaryData::LogoVeNo_png, BinaryData::LogoVeNo_pngSize);
realLogo = result;
}
Image VenoLogo::getLogo ()
@ -33,4 +30,5 @@ Image VenoLogo::getLogo ()
void VenoLogo::deleteInstance ()
{
delete instance;
instance = nullptr;
}

File diff suppressed because one or more lines are too long

View file

@ -20,3 +20,75 @@ void FlatLook::drawButtonBackground (Graphics& graphics, Button& button, const C
}
graphics.drawRect (buttonArea);
}
void FlatLook::drawRotarySlider (Graphics& g, int x, int y, int width, int height, float sliderPosProportional,
float rotaryStartAngle, float rotaryEndAngle, Slider& slider)
{
auto theme = Config::getInstance ()->getCurrentTheme ();
float MAX_RADIAN = 2.53073;
auto radius = jmin (width / 2, height / 2) - 4.0f;
auto centreX = x + width * 0.5f;
auto centreY = y + height * 0.5f;
auto angle = rotaryStartAngle + sliderPosProportional * (rotaryEndAngle - rotaryStartAngle);
//---[the real draw]---//
Path outerArc;
outerArc.addCentredArc (0, 0, radius, radius, 0, -MAX_RADIAN,
MAX_RADIAN,
true);
outerArc.applyTransform (AffineTransform ().translated (centreX, centreY));
g.setColour (Colour (65, 65, 65));
g.strokePath (outerArc, PathStrokeType (3.0f));
//prepare pointer for drawing
Path arc;
arc.addCentredArc (0, 0, radius, radius, 0, -MAX_RADIAN, (sliderPosProportional * 2 - 1) * MAX_RADIAN,
true);
arc.applyTransform (AffineTransform ().translated (centreX, centreY));
g.setGradientFill (
ColourGradient::horizontal (theme->getColour (ThemeColour::accent_two), centreX - radius,theme->getColour (ThemeColour::accent),
centreX + radius));
g.strokePath (arc, PathStrokeType (3.0f));
Path pointer;
auto pointerThickness = 3;
pointer.addEllipse (-pointerThickness * 0.25f, -(radius - 5), pointerThickness, pointerThickness);
pointer.applyTransform (AffineTransform::rotation (angle).translated (centreX, centreY));
g.setColour (Colour (125, 125, 125));
g.fillPath (pointer);
}
void FlatLook::drawTextEditorOutline (Graphics& graphics, int width, int height, TextEditor& editor)
{
auto theme = Config::getInstance ()->getCurrentTheme ();
graphics.setGradientFill (
ColourGradient::horizontal (
theme->getColour (ThemeColour::accent_two),
0,
theme->getColour (ThemeColour::accent),
width
)
);
graphics.drawLine (10, height, width - 10, height, 0.9f);
}
void FlatLook::drawToggleButton (Graphics& graphics, ToggleButton& button, bool shouldDrawButtonAsHighlighted,
bool shouldDrawButtonAsDown)
{
LookAndFeel_V4::drawToggleButton (graphics, button, shouldDrawButtonAsHighlighted, shouldDrawButtonAsDown);
}
void FlatLook::drawTabButton (TabBarButton& button, Graphics& graphics, bool isMouseOver, bool isMouseDown)
{
LookAndFeel_V3::drawTabButton (button, graphics, isMouseOver, isMouseDown);
}
void FlatLook::drawComboBox (Graphics& graphics, int width, int height, bool isButtonDown, int buttonX, int buttonY,
int buttonW, int buttonH, ComboBox& box)
{
auto theme = Config::getInstance ()->getCurrentTheme ();
graphics.setColour (theme->getColour (ThemeColour::bg));
graphics.fillRect (0, 0, width, height);
graphics.setColour (theme->getColour (ThemeColour::accent));
graphics.drawRect (0, 0, width, height);
}

View file

@ -13,6 +13,21 @@ private:
public:
void drawButtonBackground (Graphics& graphics, Button& button, const Colour& backgroundColour,
bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown) override;
void drawRotarySlider(Graphics &graphics, int x, int y, int width, int height, float sliderPosProportional,
float rotaryStartAngle, float rotaryEndAngle, Slider &slider) override;
void drawTextEditorOutline(Graphics &graphics, int width, int height, TextEditor &editor) override;
void drawToggleButton(Graphics &graphics, ToggleButton &button, bool shouldDrawButtonAsHighlighted,
bool shouldDrawButtonAsDown) override;
void drawTabButton(TabBarButton &button, Graphics &graphics, bool isMouseOver, bool isMouseDown) override;
void
drawComboBox(Graphics &graphics, int width, int height, bool isButtonDown, int buttonX, int buttonY, int buttonW,
int buttonH, ComboBox &box) override;
protected:
};
#endif //VENO_FLATLOOK_H

View file

@ -31,8 +31,8 @@ void setBloodTheme (Theme* theme)
theme->setColour(ThemeColour::accent_two, new Colour(115, 47, 64));
theme->setColour(ThemeColour::clip, new Colour(255, 23, 68));
theme->setColour(ThemeColour::warning, new Colour(255, 143, 0));
theme->setColour(ThemeColour::lcd_bg, new Colour(0, 0, 0));
theme->setColour(ThemeColour::lcd, new Colour(180, 38, 78));
theme->setColour(ThemeColour::lcd_bg, new Colour(43, 0, 0));
theme->setColour(ThemeColour::lcd, new Colour(255, 0, 0));
}
void setOrangeDreamTheme (Theme* theme)

View file

@ -4,7 +4,8 @@
companyWebsite="https://vstz.dev" companyEmail="info@vstz.dev"
splashScreenColour="Dark" projectType="audioplug" pluginCharacteristicsValue="pluginIsSynth,pluginProducesMidiOut,pluginWantsMidiIn"
pluginManufacturerCode="VSTZ" pluginCode="veno" pluginVST3Category="Generator,Instrument,Synth"
cppLanguageStandard="17" version="1.0.0" companyCopyright="Copyright VersusTuneZ 2019-2020">
cppLanguageStandard="17" version="1.0.0" companyCopyright="Copyright VersusTuneZ 2019-2020"
reportAppUsage="0" displaySplashScreen="0">
<MAINGROUP id="m9l7SJ" name="VeNo">
<GROUP id="{AAF9955A-D1A2-45FF-2C17-02C73D8064D3}" name="Source">
<GROUP id="{12946A85-B629-A60C-6A3F-4FD136126888}" name="Resources">
@ -16,6 +17,7 @@
</GROUP>
<FILE id="gB4Xst" name="arvo.ttf" compile="0" resource="1" file="Source/Resources/arvo.ttf"/>
<FILE id="QG10mY" name="lcd.ttf" compile="0" resource="1" file="Source/Resources/lcd.ttf"/>
<FILE id="yeOELp" name="LogoVeNo.png" compile="0" resource="1" file="Source/Resources/LogoVeNo.png"/>
</GROUP>
<GROUP id="{5791B3F9-67EA-BE3E-0208-47B8AF81F72F}" name="Veno">
<GROUP id="{BD05234A-1BBB-5055-FA22-C66F1E78CC81}" name="Fonts">
@ -109,6 +111,9 @@
file="Source/Veno/GUI/Components/Config/VenoPreColours.h"/>
</GROUP>
<GROUP id="{7C37E6D2-F2F7-6BF7-5D9B-2DDABFFE993F}" name="LCD">
<FILE id="HcApOX" name="DecibelScale.cpp" compile="1" resource="0"
file="Source/Veno/GUI/Components/LCD/DecibelScale.cpp"/>
<FILE id="eSXqPi" name="DecibelScale.h" compile="0" resource="0" file="Source/Veno/GUI/Components/LCD/DecibelScale.h"/>
<FILE id="LpeTfD" name="SidebarLCD.cpp" compile="1" resource="0" file="Source/Veno/GUI/Components/LCD/SidebarLCD.cpp"/>
<FILE id="Y5kUlM" name="SidebarLCD.h" compile="0" resource="0" file="Source/Veno/GUI/Components/LCD/SidebarLCD.h"/>
<FILE id="Ox2oOB" name="Waveforms.cpp" compile="1" resource="0" file="Source/Veno/GUI/Components/LCD/Waveforms.cpp"/>
@ -205,7 +210,7 @@
<MODULEPATH id="juce_dsp" path="../../tools/JUCE/modules"/>
</MODULEPATHS>
</LINUX_MAKE>
<CLION targetFolder="Builds/CLion" clionMakefileEnabled="1">
<CLION targetFolder="Builds/CLion" clionMakefileEnabled="1" clionCodeBlocksEnabled="1">
<MODULEPATHS>
<MODULEPATH id="juce_audio_basics" path="../../Tools/JUCE/modules"/>
<MODULEPATH id="juce_audio_devices" path="../../Tools/JUCE/modules"/>
@ -224,6 +229,29 @@
<MODULEPATH id="juce_dsp" path="../../tools/JUCE/modules"/>
</MODULEPATHS>
</CLION>
<CODEBLOCKS_WINDOWS targetFolder="Builds/CodeBlocksWindows">
<CONFIGURATIONS>
<CONFIGURATION isDebug="1" name="Debug"/>
<CONFIGURATION isDebug="0" name="Release"/>
</CONFIGURATIONS>
<MODULEPATHS>
<MODULEPATH id="juce_opengl"/>
<MODULEPATH id="juce_gui_extra"/>
<MODULEPATH id="juce_gui_basics"/>
<MODULEPATH id="juce_graphics"/>
<MODULEPATH id="juce_events"/>
<MODULEPATH id="juce_dsp"/>
<MODULEPATH id="juce_data_structures"/>
<MODULEPATH id="juce_cryptography"/>
<MODULEPATH id="juce_core"/>
<MODULEPATH id="juce_audio_utils"/>
<MODULEPATH id="juce_audio_processors"/>
<MODULEPATH id="juce_audio_plugin_client"/>
<MODULEPATH id="juce_audio_formats"/>
<MODULEPATH id="juce_audio_devices"/>
<MODULEPATH id="juce_audio_basics"/>
</MODULEPATHS>
</CODEBLOCKS_WINDOWS>
</EXPORTFORMATS>
<MODULES>
<MODULE id="juce_audio_basics" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
@ -245,6 +273,7 @@
</MODULES>
<LIVE_SETTINGS>
<LINUX/>
<WINDOWS/>
</LIVE_SETTINGS>
<JUCEOPTIONS JUCE_VST3_CAN_REPLACE_VST2="0" JUCE_STRICT_REFCOUNTEDPOINTER="1"
JUCE_WEB_BROWSER="0" JUCE_USE_WINRT_WEBVIEW="0"/>