- 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:
parent
a27c62f062
commit
3fda15966c
16 changed files with 396 additions and 146 deletions
BIN
Source/Resources/LogoVeNo.png
Normal file
BIN
Source/Resources/LogoVeNo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
Binary file not shown.
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include <cmath>
|
||||
#include "VenoBuffer.h"
|
||||
#include "../Utils.h"
|
||||
|
||||
VenoBuffer::VenoBuffer ()
|
||||
{
|
||||
|
@ -12,18 +13,18 @@ VenoBuffer::VenoBuffer ()
|
|||
|
||||
VenoBuffer::~VenoBuffer ()
|
||||
{
|
||||
buffer.clear();
|
||||
right.clear();
|
||||
left.clear();
|
||||
buffer.clear ();
|
||||
right.clear ();
|
||||
left.clear ();
|
||||
}
|
||||
|
||||
void VenoBuffer::reset (int size)
|
||||
{
|
||||
if (size != buffer.size())
|
||||
if (size != buffer.size ())
|
||||
{
|
||||
buffer.resize(size);
|
||||
right.resize(size);
|
||||
left.resize(size);
|
||||
buffer.resize (size);
|
||||
right.resize (size);
|
||||
left.resize (size);
|
||||
}
|
||||
// reset to 0 dc :D
|
||||
for (int i = 0; i < size; ++i)
|
||||
|
@ -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)
|
||||
{
|
||||
monoPeak = m;
|
||||
}
|
||||
if (l > leftPeak)
|
||||
{
|
||||
leftPeak = l;
|
||||
}
|
||||
if (r > rightPeak)
|
||||
{
|
||||
rightPeak = r;
|
||||
}
|
||||
return;
|
||||
}
|
||||
float leftRMS = 0;
|
||||
float rightRMS = 0;
|
||||
auto size = buffer.size();
|
||||
for (int i = 0; i < size; ++i)
|
||||
{
|
||||
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
|
||||
|
|
68
Source/Veno/GUI/Components/LCD/DecibelScale.cpp
Normal file
68
Source/Veno/GUI/Components/LCD/DecibelScale.cpp
Normal 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;
|
||||
}
|
28
Source/Veno/GUI/Components/LCD/DecibelScale.h
Normal file
28
Source/Veno/GUI/Components/LCD/DecibelScale.h
Normal 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
|
|
@ -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);
|
||||
|
|
|
@ -9,30 +9,34 @@
|
|||
#include "../../../VenoInstance.h"
|
||||
#include "../../../Fonts/Fonts.h"
|
||||
|
||||
Waveforms::Waveforms (const std::string& processId) : BaseComponent(processId)
|
||||
Waveforms::Waveforms (const std::string& processId) : BaseComponent (processId)
|
||||
{
|
||||
setMouseCursor(MouseCursor::PointingHandCursor);
|
||||
m_context.setOpenGLVersionRequired(OpenGLContext::OpenGLVersion::openGL3_2);
|
||||
m_context.setRenderer(this);
|
||||
m_context.setContinuousRepainting(false);
|
||||
m_context.setComponentPaintingEnabled(true);
|
||||
m_context.attachTo(*this);
|
||||
setFps();
|
||||
std::srand(unsigned(time(nullptr)));
|
||||
pickRandomText = (std::rand() % RANDOM_TEXT_COUNT);
|
||||
setMouseCursor (MouseCursor::PointingHandCursor);
|
||||
m_context.setOpenGLVersionRequired (OpenGLContext::OpenGLVersion::openGL3_2);
|
||||
m_context.setRenderer (this);
|
||||
m_context.setContinuousRepainting (false);
|
||||
m_context.setComponentPaintingEnabled (true);
|
||||
m_context.attachTo (*this);
|
||||
setFps ();
|
||||
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 ()
|
||||
{
|
||||
stopTimer();
|
||||
shaderProgram.reset();
|
||||
m_context.detach();
|
||||
stopTimer ();
|
||||
shaderProgram.reset ();
|
||||
m_context.detach ();
|
||||
dBScale.reset (nullptr);
|
||||
}
|
||||
|
||||
void Waveforms::newOpenGLContextCreated ()
|
||||
{
|
||||
compileOpenGLShaderProgram();
|
||||
compileOpenGLShaderProgram ();
|
||||
}
|
||||
|
||||
void Waveforms::openGLContextClosing ()
|
||||
|
@ -42,23 +46,23 @@ void Waveforms::openGLContextClosing ()
|
|||
|
||||
void Waveforms::renderOpenGL ()
|
||||
{
|
||||
if (!isShowing() || shaderProgram == nullptr || !shaderProgram->getLastError().isEmpty())
|
||||
if (!isShowing () || shaderProgram == nullptr || !shaderProgram->getLastError ().isEmpty ())
|
||||
{
|
||||
return;
|
||||
}
|
||||
auto theme = Config::getInstance()->getCurrentTheme();
|
||||
auto theme = Config::getInstance ()->getCurrentTheme ();
|
||||
if (theme == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
glViewport(0, 0, getWidth(), getHeight());
|
||||
OpenGLHelpers::clear(theme->getColour(ThemeColour::lcd_bg));
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
shaderProgram->use();
|
||||
auto color = theme->getColour(ThemeColour::lcd);
|
||||
shaderProgram->setUniform("color", color.getFloatRed(), color.getFloatGreen(), color.getFloatBlue(),
|
||||
color.getFloatAlpha());
|
||||
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 ();
|
||||
auto color = theme->getColour (ThemeColour::lcd);
|
||||
shaderProgram->setUniform ("color", color.getFloatRed (), color.getFloatGreen (), color.getFloatBlue (),
|
||||
color.getFloatAlpha ());
|
||||
if (m_isWelcome || m_isStarting || m_isChangingData)
|
||||
{
|
||||
return;
|
||||
|
@ -66,28 +70,28 @@ void Waveforms::renderOpenGL ()
|
|||
switch (m_mode)
|
||||
{
|
||||
case 1:
|
||||
drawAudioOutput();
|
||||
drawAudioOutput ();
|
||||
break;
|
||||
case 2:
|
||||
drawWaveTable();
|
||||
drawWaveTable ();
|
||||
break;
|
||||
case 3:
|
||||
drawSpectrum();
|
||||
drawSpectrum ();
|
||||
break;
|
||||
default:
|
||||
drawPeakMeter();
|
||||
drawPeakMeter ();
|
||||
}
|
||||
}
|
||||
|
||||
void Waveforms::compileOpenGLShaderProgram ()
|
||||
{
|
||||
std::unique_ptr<OpenGLShaderProgram> shaderProgramAttempt
|
||||
= std::make_unique<OpenGLShaderProgram>(m_context);
|
||||
if (shaderProgramAttempt->addVertexShader({BinaryData::WaveForm_vertex_glsl})
|
||||
&& shaderProgramAttempt->addFragmentShader({BinaryData::WaveForm_fragment_glsl})
|
||||
&& shaderProgramAttempt->link())
|
||||
= std::make_unique<OpenGLShaderProgram> (m_context);
|
||||
if (shaderProgramAttempt->addVertexShader ({BinaryData::WaveForm_vertex_glsl})
|
||||
&& shaderProgramAttempt->addFragmentShader ({BinaryData::WaveForm_fragment_glsl})
|
||||
&& shaderProgramAttempt->link ())
|
||||
{
|
||||
shaderProgram = std::move(shaderProgramAttempt);
|
||||
shaderProgram = std::move (shaderProgramAttempt);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
@ -113,16 +119,16 @@ void Waveforms::timerCallback ()
|
|||
{
|
||||
if (m_isWelcome || m_isStarting || m_isChangingData || needToClear)
|
||||
{
|
||||
repaint();
|
||||
repaint ();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_context.isAttached())
|
||||
if (m_context.isAttached ())
|
||||
{
|
||||
m_context.triggerRepaint();
|
||||
m_context.triggerRepaint ();
|
||||
}
|
||||
}
|
||||
setFps();
|
||||
setFps ();
|
||||
}
|
||||
|
||||
void Waveforms::drawWaveTable ()
|
||||
|
@ -133,61 +139,56 @@ void Waveforms::drawWaveTable ()
|
|||
void Waveforms::drawAudioOutput ()
|
||||
{
|
||||
// draw audio from the oscillators
|
||||
auto instance = VenoInstance::getInstance(BaseComponent::m_processId);
|
||||
auto buffer = instance->audioBuffer->getBuffer();
|
||||
glBegin(GL_LINE_STRIP);
|
||||
auto instance = VenoInstance::getInstance (BaseComponent::m_processId);
|
||||
auto buffer = instance->audioBuffer->getBuffer ();
|
||||
glBegin (GL_LINE_STRIP);
|
||||
float posX = -1;
|
||||
float inc = 2.0f / buffer.size();
|
||||
float inc = 2.0f / buffer.size ();
|
||||
for (float i : buffer)
|
||||
{
|
||||
glVertex2f(posX, i);
|
||||
glVertex2f (posX, i);
|
||||
posX += inc;
|
||||
}
|
||||
glEnd();
|
||||
glEnd ();
|
||||
}
|
||||
|
||||
void Waveforms::drawPeakMeter ()
|
||||
{
|
||||
auto theme = Config::getInstance()->getCurrentTheme();
|
||||
auto theme = Config::getInstance ()->getCurrentTheme ();
|
||||
if (theme == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
auto instance = VenoInstance::getInstance(BaseComponent::m_processId);
|
||||
instance->audioBuffer->calcPeak();
|
||||
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);
|
||||
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);
|
||||
glEnd();
|
||||
auto leftChannel = getdBForChannel (instance->audioBuffer->leftPeak);
|
||||
selectColourByPeak (leftChannel);
|
||||
glBegin (GL_TRIANGLES);
|
||||
glVertex2f (-0.9f, leftChannel);
|
||||
glVertex2f (-0.9f, -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.08f, -1.0f);
|
||||
glEnd ();
|
||||
}
|
||||
|
||||
void Waveforms::paint (Graphics& g)
|
||||
{
|
||||
std::shared_ptr<Theme> theme = Config::getInstance()->getCurrentTheme();
|
||||
auto accent = theme->getColour(ThemeColour::lcd);
|
||||
g.setColour(accent);
|
||||
std::shared_ptr<Theme> theme = Config::getInstance ()->getCurrentTheme ();
|
||||
auto accent = theme->getColour (ThemeColour::lcd);
|
||||
g.setColour (accent);
|
||||
g.setFont(*VenoFonts::getLCD());
|
||||
VeNo::Utils::setFontSize(16.0f, g);
|
||||
VeNo::Utils::setFontSize (16.0f, g);
|
||||
if (m_isWelcome)
|
||||
{
|
||||
drawWelcome(g, getWidth(), getHeight(), 0, 0);
|
||||
drawWelcome (g, getWidth (), getHeight (), 0, 0);
|
||||
m_ticks++;
|
||||
if (m_ticks > m_time_needed_startup)
|
||||
{
|
||||
|
@ -198,8 +199,8 @@ void Waveforms::paint (Graphics& g)
|
|||
}
|
||||
else if (m_isStarting)
|
||||
{
|
||||
g.drawText(m_warmUpText[pickRandomText], 0, 0, getWidth(), getHeight(),
|
||||
Justification::centred, true);
|
||||
g.drawText (m_warmUpText[pickRandomText], 0, 0, getWidth (), getHeight (),
|
||||
Justification::centred, true);
|
||||
m_ticks++;
|
||||
if (m_ticks > m_time_needed_startup)
|
||||
{
|
||||
|
@ -210,7 +211,7 @@ void Waveforms::paint (Graphics& g)
|
|||
}
|
||||
else if (m_isChangingData)
|
||||
{
|
||||
drawChangedParameter(g, getWidth(), getHeight(), 0, 0);
|
||||
drawChangedParameter (g, getWidth (), getHeight (), 0, 0);
|
||||
m_ticks++;
|
||||
if (m_ticks > m_time_needed)
|
||||
{
|
||||
|
@ -221,27 +222,46 @@ void Waveforms::paint (Graphics& g)
|
|||
}
|
||||
else
|
||||
{
|
||||
g.resetToDefaultState();
|
||||
needToClear = false;
|
||||
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
|
||||
{
|
||||
int halfHeight = h / 2;
|
||||
float font = VeNo::Utils::setFontSize(12, g);
|
||||
g.drawText(changingParameter, x, y + halfHeight - font, w, font, Justification::centred, true);
|
||||
g.drawText(std::to_string(changedValue), x, y + halfHeight + 4, w, font, Justification::centred,
|
||||
true);
|
||||
float font = VeNo::Utils::setFontSize (12, g);
|
||||
g.drawText (changingParameter, x, y + halfHeight - font, w, font, Justification::centred, true);
|
||||
g.drawText (std::to_string (changedValue), x, y + halfHeight + 4, w, font, Justification::centred,
|
||||
true);
|
||||
}
|
||||
|
||||
void Waveforms::drawWelcome (Graphics& g, int w, int h, int x, int y)
|
||||
{
|
||||
float font = VeNo::Utils::setFontSize(12, g);
|
||||
float font = VeNo::Utils::setFontSize (12, g);
|
||||
int halfHeight = h / 2;
|
||||
g.drawText(m_readyText, x, y + halfHeight - font, w, font, Justification::centred, true);
|
||||
g.drawText(SystemStats::getLogonName(), x, y + halfHeight + 4, w, font, Justification::centred,
|
||||
true);
|
||||
g.drawText (m_readyText, x, y + halfHeight - font, w, font, Justification::centred, true);
|
||||
g.drawText (SystemStats::getLogonName (), x, y + halfHeight + 4, w, font, Justification::centred,
|
||||
true);
|
||||
}
|
||||
|
||||
void Waveforms::drawSpectrum ()
|
||||
|
@ -250,39 +270,45 @@ void Waveforms::drawSpectrum ()
|
|||
|
||||
void Waveforms::selectColourByPeak (float value)
|
||||
{
|
||||
auto theme = Config::getInstance()->getCurrentTheme();
|
||||
auto theme = Config::getInstance ()->getCurrentTheme ();
|
||||
if (theme == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
auto color = theme->getColour(ThemeColour::lcd);
|
||||
if (value > 0.9)
|
||||
auto color = theme->getColour (ThemeColour::lcd);
|
||||
if (value > 0.87)
|
||||
{
|
||||
color = theme->getColour(ThemeColour::clip);
|
||||
color = theme->getColour (ThemeColour::clip);
|
||||
}
|
||||
else if (value > 0.8)
|
||||
else if (value > 0.75)
|
||||
{
|
||||
color = theme->getColour(ThemeColour::warning);
|
||||
color = theme->getColour (ThemeColour::warning);
|
||||
}
|
||||
shaderProgram->setUniform("color", color.getFloatRed(), color.getFloatGreen(), color.getFloatBlue(),
|
||||
color.getFloatAlpha());
|
||||
shaderProgram->setUniform ("color", color.getFloatRed (), color.getFloatGreen (), color.getFloatBlue (),
|
||||
color.getFloatAlpha ());
|
||||
}
|
||||
|
||||
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()) {
|
||||
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));
|
||||
m_time_needed_startup = roundToInt(1000 / (1000 / m_currentFps));
|
||||
stopTimer();
|
||||
startTimer(m_currentFps);
|
||||
m_time_needed = roundToInt (4000 / (1000 / m_currentFps));
|
||||
m_time_needed_startup = roundToInt (1000 / (1000 / m_currentFps));
|
||||
stopTimer ();
|
||||
startTimer (m_currentFps);
|
||||
}
|
||||
}
|
||||
void Waveforms::resized ()
|
||||
{
|
||||
auto halfWidth = getWidth () / 2;
|
||||
auto w = VeNo::Utils::getCalculatedWidth (21);
|
||||
dBScale->setBounds (halfWidth - (w / 2), 0, w, getHeight ());
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
//
|
||||
// Created by versustune on 11.06.20.
|
||||
//
|
||||
|
||||
|
@ -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
|
||||
|
|
|
@ -3,3 +3,8 @@
|
|||
//
|
||||
|
||||
#include "SidebarMixer.h"
|
||||
|
||||
SidebarMixer::SidebarMixer (const std::string& processId) : BaseComponent (processId)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
@ -8,15 +8,87 @@
|
|||
void FlatLook::drawButtonBackground (Graphics& graphics, Button& button, const Colour& backgroundColour,
|
||||
bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown)
|
||||
{
|
||||
auto theme = Config::getInstance()->getCurrentTheme();
|
||||
auto buttonArea = button.getLocalBounds();
|
||||
auto theme = Config::getInstance ()->getCurrentTheme ();
|
||||
auto buttonArea = button.getLocalBounds ();
|
||||
if (shouldDrawButtonAsHighlighted)
|
||||
{
|
||||
graphics.setColour(theme->getColour(ThemeColour::accent));
|
||||
graphics.setColour (theme->getColour (ThemeColour::accent));
|
||||
}
|
||||
else
|
||||
{
|
||||
graphics.setColour(theme->getColour(ThemeColour::accent_two));
|
||||
graphics.setColour (theme->getColour (ThemeColour::accent_two));
|
||||
}
|
||||
graphics.drawRect(buttonArea);
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
33
Veno.jucer
33
Veno.jucer
|
@ -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"/>
|
||||
|
|
Loading…
Reference in a new issue