Browse Source

Update dpf based plugins

Signed-off-by: falkTX <falktx@falktx.com>
develop
falkTX 6 months ago
parent
commit
04544c5446
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
30 changed files with 226 additions and 5660 deletions
  1. +4
    -4
      distrho-3bandeq.cpp
  2. +0
    -5
      distrho-3bandeq/DistrhoPlugin3BandEQ.cpp
  3. +12
    -10
      distrho-3bandeq/DistrhoUI3BandEQ.cpp
  4. +4
    -4
      distrho-3bandsplitter.cpp
  5. +0
    -5
      distrho-3bandsplitter/DistrhoPlugin3BandSplitter.cpp
  6. +1
    -1
      distrho-3bandsplitter/DistrhoPlugin3BandSplitter.hpp
  7. +12
    -10
      distrho-3bandsplitter/DistrhoUI3BandSplitter.cpp
  8. +0
    -21
      distrho-kars.cpp
  9. +0
    -5264
      distrho-kars/DistrhoArtworkKars.cpp
  10. +0
    -20
      distrho-kars/DistrhoArtworkKars.hpp
  11. +1
    -2
      distrho-kars/DistrhoPluginInfo.h
  12. +69
    -43
      distrho-kars/DistrhoPluginKars.cpp
  13. +13
    -9
      distrho-kars/DistrhoPluginKars.hpp
  14. +0
    -77
      distrho-kars/DistrhoUIKars.cpp
  15. +0
    -60
      distrho-kars/DistrhoUIKars.hpp
  16. +4
    -4
      distrho-nekobi.cpp
  17. +0
    -1
      distrho-nekobi/DistrhoPluginInfo.h
  18. +8
    -18
      distrho-nekobi/DistrhoPluginNekobi.cpp
  19. +0
    -2
      distrho-nekobi/DistrhoPluginNekobi.hpp
  20. +30
    -23
      distrho-nekobi/DistrhoUINekobi.cpp
  21. +9
    -7
      distrho-nekobi/DistrhoUINekobi.hpp
  22. +4
    -16
      distrho-nekobi/NekoWidget.hpp
  23. +4
    -4
      distrho-pingpongpan.cpp
  24. +0
    -1
      distrho-pingpongpan/DistrhoPluginInfo.h
  25. +11
    -9
      distrho-pingpongpan/DistrhoUIPingPongPan.cpp
  26. +3
    -3
      distrho-vectorjuice.cpp
  27. +22
    -22
      distrho-vectorjuice/VectorJuiceUI.cpp
  28. +1
    -1
      distrho-vectorjuice/VectorJuiceUI.hpp
  29. +4
    -4
      distrho-wobblejuice.cpp
  30. +10
    -10
      distrho-wobblejuice/WobbleJuiceUI.cpp

+ 4
- 4
distrho-3bandeq.cpp View File

@@ -27,16 +27,16 @@
#include "CarlaJuceUtils.hpp"

// Plugin Code
#include "distrho-3bandeq/DistrhoArtwork3BandEQ.cpp"
#include "distrho-3bandeq/DistrhoPlugin3BandEQ.cpp"
#ifdef HAVE_DGL
#if DISTRHO_PLUGIN_HAS_UI
#include "distrho-3bandeq/DistrhoArtwork3BandEQ.cpp"
#include "distrho-3bandeq/DistrhoUI3BandEQ.cpp"
#endif

// DISTRHO Code
#define DISTRHO_PLUGIN_TARGET_CARLA
#include "DistrhoPluginMain.cpp"
#ifdef HAVE_DGL
#if DISTRHO_PLUGIN_HAS_UI
#include "DistrhoUIMain.cpp"
#endif

@@ -46,7 +46,7 @@ START_NAMESPACE_DISTRHO

static const NativePluginDescriptor _3bandeqDesc = {
/* category */ NATIVE_PLUGIN_CATEGORY_EQ,
#ifdef HAVE_DGL
#if DISTRHO_PLUGIN_HAS_UI
/* hints */ static_cast<NativePluginHints>(NATIVE_PLUGIN_IS_RTSAFE
|NATIVE_PLUGIN_HAS_UI
|NATIVE_PLUGIN_NEEDS_UI_MAIN_THREAD


+ 0
- 5
distrho-3bandeq/DistrhoPlugin3BandEQ.cpp View File

@@ -209,11 +209,6 @@ void DistrhoPlugin3BandEQ::activate()
xLP = std::exp(-2.0f * kPI * freqLP / sr);
#ifdef DISTRHO_OS_WINDOWS
// don't ask me why, but this fixes a crash/exception below on windows...
printf("%f\n", -xLP);
#endif
a0LP = 1.0f - xLP;
b1LP = -xLP;


+ 12
- 10
distrho-3bandeq/DistrhoUI3BandEQ.cpp View File

@@ -1,6 +1,6 @@
/*
* DISTRHO 3BandEQ Plugin, based on 3BandEQ by Michael Gruhn
* Copyright (C) 2012-2015 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2012-2021 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -24,16 +24,16 @@ namespace Art = DistrhoArtwork3BandEQ;
// -----------------------------------------------------------------------

DistrhoUI3BandEQ::DistrhoUI3BandEQ()
: UI(Art::backgroundWidth, Art::backgroundHeight),
fImgBackground(Art::backgroundData, Art::backgroundWidth, Art::backgroundHeight, GL_BGR),
: UI(Art::backgroundWidth, Art::backgroundHeight, true),
fImgBackground(Art::backgroundData, Art::backgroundWidth, Art::backgroundHeight, kImageFormatBGR),
fAboutWindow(this)
{
// about
Image aboutImage(Art::aboutData, Art::aboutWidth, Art::aboutHeight, GL_BGR);
Image aboutImage(Art::aboutData, Art::aboutWidth, Art::aboutHeight, kImageFormatBGR);
fAboutWindow.setImage(aboutImage);

// sliders
Image sliderImage(Art::sliderData, Art::sliderWidth, Art::sliderHeight);
Image sliderImage(Art::sliderData, Art::sliderWidth, Art::sliderHeight, kImageFormatBGRA);
Point<int> sliderPosStart(57, 43);
Point<int> sliderPosEnd(57, 43 + 160);

@@ -80,7 +80,7 @@ DistrhoUI3BandEQ::DistrhoUI3BandEQ()
fSliderMaster->setCallback(this);

// knobs
Image knobImage(Art::knobData, Art::knobWidth, Art::knobHeight);
Image knobImage(Art::knobData, Art::knobWidth, Art::knobHeight, kImageFormatBGRA);

// knob Low-Mid
fKnobLowMid = new ImageKnob(this, knobImage, ImageKnob::Vertical);
@@ -101,8 +101,8 @@ DistrhoUI3BandEQ::DistrhoUI3BandEQ()
fKnobMidHigh->setCallback(this);

// about button
Image aboutImageNormal(Art::aboutButtonNormalData, Art::aboutButtonNormalWidth, Art::aboutButtonNormalHeight);
Image aboutImageHover(Art::aboutButtonHoverData, Art::aboutButtonHoverWidth, Art::aboutButtonHoverHeight);
Image aboutImageNormal(Art::aboutButtonNormalData, Art::aboutButtonNormalWidth, Art::aboutButtonNormalHeight, kImageFormatBGRA);
Image aboutImageHover(Art::aboutButtonHoverData, Art::aboutButtonHoverWidth, Art::aboutButtonHoverHeight, kImageFormatBGRA);
fButtonAbout = new ImageButton(this, aboutImageNormal, aboutImageHover, aboutImageHover);
fButtonAbout->setAbsolutePos(264, 300);
fButtonAbout->setCallback(this);
@@ -161,7 +161,7 @@ void DistrhoUI3BandEQ::imageButtonClicked(ImageButton* button, int)
if (button != fButtonAbout)
return;

fAboutWindow.exec();
fAboutWindow.runAsModal();
}

void DistrhoUI3BandEQ::imageKnobDragStarted(ImageKnob* knob)
@@ -196,7 +196,9 @@ void DistrhoUI3BandEQ::imageSliderValueChanged(ImageSlider* slider, float value)

void DistrhoUI3BandEQ::onDisplay()
{
fImgBackground.draw();
const GraphicsContext& context(getGraphicsContext());

fImgBackground.draw(context);
}

// -----------------------------------------------------------------------


+ 4
- 4
distrho-3bandsplitter.cpp View File

@@ -27,16 +27,16 @@
#include "CarlaJuceUtils.hpp"

// Plugin Code
#include "distrho-3bandsplitter/DistrhoArtwork3BandSplitter.cpp"
#include "distrho-3bandsplitter/DistrhoPlugin3BandSplitter.cpp"
#ifdef HAVE_DGL
#if DISTRHO_PLUGIN_HAS_UI
#include "distrho-3bandsplitter/DistrhoArtwork3BandSplitter.cpp"
#include "distrho-3bandsplitter/DistrhoUI3BandSplitter.cpp"
#endif

// DISTRHO Code
#define DISTRHO_PLUGIN_TARGET_CARLA
#include "DistrhoPluginMain.cpp"
#ifdef HAVE_DGL
#if DISTRHO_PLUGIN_HAS_UI
#include "DistrhoUIMain.cpp"
#endif

@@ -46,7 +46,7 @@ START_NAMESPACE_DISTRHO

static const NativePluginDescriptor _3bandsplitterDesc = {
/* category */ NATIVE_PLUGIN_CATEGORY_EQ,
#ifdef HAVE_DGL
#if DISTRHO_PLUGIN_HAS_UI
/* hints */ static_cast<NativePluginHints>(NATIVE_PLUGIN_IS_RTSAFE
|NATIVE_PLUGIN_HAS_UI
|NATIVE_PLUGIN_NEEDS_UI_MAIN_THREAD


+ 0
- 5
distrho-3bandsplitter/DistrhoPlugin3BandSplitter.cpp View File

@@ -209,11 +209,6 @@ void DistrhoPlugin3BandSplitter::activate()
xLP = std::exp(-2.0f * kPI * freqLP / sr);
#ifdef DISTRHO_OS_WINDOWS
// don't ask me why, but this fixes a crash/exception below on windows...
printf("%f\n", -xLP);
#endif
a0LP = 1.0f - xLP;
b1LP = -xLP;


+ 1
- 1
distrho-3bandsplitter/DistrhoPlugin3BandSplitter.hpp View File

@@ -51,7 +51,7 @@ protected:
const char* getDescription() const override
{
return "3 Band Equalizer, splitted output version.";
return "3 Band Equalizer, split output version.";
}
const char* getMaker() const noexcept override


+ 12
- 10
distrho-3bandsplitter/DistrhoUI3BandSplitter.cpp View File

@@ -1,6 +1,6 @@
/*
* DISTRHO 3BandSplitter Plugin, based on 3BandSplitter by Michael Gruhn
* Copyright (C) 2012-2015 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2012-2021 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -24,16 +24,16 @@ namespace Art = DistrhoArtwork3BandSplitter;
// -----------------------------------------------------------------------

DistrhoUI3BandSplitter::DistrhoUI3BandSplitter()
: UI(Art::backgroundWidth, Art::backgroundHeight),
fImgBackground(Art::backgroundData, Art::backgroundWidth, Art::backgroundHeight, GL_BGR),
: UI(Art::backgroundWidth, Art::backgroundHeight, true),
fImgBackground(Art::backgroundData, Art::backgroundWidth, Art::backgroundHeight, kImageFormatBGR),
fAboutWindow(this)
{
// about
Image aboutImage(Art::aboutData, Art::aboutWidth, Art::aboutHeight, GL_BGR);
Image aboutImage(Art::aboutData, Art::aboutWidth, Art::aboutHeight, kImageFormatBGR);
fAboutWindow.setImage(aboutImage);

// sliders
Image sliderImage(Art::sliderData, Art::sliderWidth, Art::sliderHeight);
Image sliderImage(Art::sliderData, Art::sliderWidth, Art::sliderHeight, kImageFormatBGRA);
Point<int> sliderPosStart(57, 43);
Point<int> sliderPosEnd(57, 43 + 160);

@@ -80,7 +80,7 @@ DistrhoUI3BandSplitter::DistrhoUI3BandSplitter()
fSliderMaster->setCallback(this);

// knobs
Image knobImage(Art::knobData, Art::knobWidth, Art::knobHeight);
Image knobImage(Art::knobData, Art::knobWidth, Art::knobHeight, kImageFormatBGRA);

// knob Low-Mid
fKnobLowMid = new ImageKnob(this, knobImage, ImageKnob::Vertical);
@@ -101,8 +101,8 @@ DistrhoUI3BandSplitter::DistrhoUI3BandSplitter()
fKnobMidHigh->setCallback(this);

// about button
Image aboutImageNormal(Art::aboutButtonNormalData, Art::aboutButtonNormalWidth, Art::aboutButtonNormalHeight);
Image aboutImageHover(Art::aboutButtonHoverData, Art::aboutButtonHoverWidth, Art::aboutButtonHoverHeight);
Image aboutImageNormal(Art::aboutButtonNormalData, Art::aboutButtonNormalWidth, Art::aboutButtonNormalHeight, kImageFormatBGRA);
Image aboutImageHover(Art::aboutButtonHoverData, Art::aboutButtonHoverWidth, Art::aboutButtonHoverHeight, kImageFormatBGRA);
fButtonAbout = new ImageButton(this, aboutImageNormal, aboutImageHover, aboutImageHover);
fButtonAbout->setAbsolutePos(264, 300);
fButtonAbout->setCallback(this);
@@ -161,7 +161,7 @@ void DistrhoUI3BandSplitter::imageButtonClicked(ImageButton* button, int)
if (button != fButtonAbout)
return;

fAboutWindow.exec();
fAboutWindow.runAsModal();
}

void DistrhoUI3BandSplitter::imageKnobDragStarted(ImageKnob* knob)
@@ -196,7 +196,9 @@ void DistrhoUI3BandSplitter::imageSliderValueChanged(ImageSlider* slider, float

void DistrhoUI3BandSplitter::onDisplay()
{
fImgBackground.draw();
const GraphicsContext& context(getGraphicsContext());

fImgBackground.draw(context);
}

// -----------------------------------------------------------------------


+ 0
- 21
distrho-kars.cpp View File

@@ -17,27 +17,14 @@

// config fix
#include "distrho-kars/DistrhoPluginInfo.h"

#if DISTRHO_PLUGIN_HAS_UI && ! defined(HAVE_DGL)
# undef DISTRHO_PLUGIN_HAS_UI
# define DISTRHO_PLUGIN_HAS_UI 0
#endif

#include "CarlaJuceUtils.hpp"

// Plugin Code
#include "distrho-kars/DistrhoArtworkKars.cpp"
#include "distrho-kars/DistrhoPluginKars.cpp"
#ifdef HAVE_DGL
#include "distrho-kars/DistrhoUIKars.cpp"
#endif

// DISTRHO Code
#define DISTRHO_PLUGIN_TARGET_CARLA
#include "DistrhoPluginMain.cpp"
#ifdef HAVE_DGL
#include "DistrhoUIMain.cpp"
#endif

START_NAMESPACE_DISTRHO

@@ -45,16 +32,8 @@ START_NAMESPACE_DISTRHO

static const NativePluginDescriptor karsDesc = {
/* category */ NATIVE_PLUGIN_CATEGORY_SYNTH,
#ifdef HAVE_DGL
/* hints */ static_cast<NativePluginHints>(NATIVE_PLUGIN_IS_RTSAFE
|NATIVE_PLUGIN_IS_SYNTH
|NATIVE_PLUGIN_HAS_UI
|NATIVE_PLUGIN_NEEDS_UI_MAIN_THREAD
|NATIVE_PLUGIN_USES_PARENT_ID),
#else
/* hints */ static_cast<NativePluginHints>(NATIVE_PLUGIN_IS_RTSAFE
|NATIVE_PLUGIN_IS_SYNTH),
#endif
/* supports */ NATIVE_PLUGIN_SUPPORTS_NOTHING,
/* audioIns */ DISTRHO_PLUGIN_NUM_INPUTS,
/* audioOuts */ DISTRHO_PLUGIN_NUM_OUTPUTS,


+ 0
- 5264
distrho-kars/DistrhoArtworkKars.cpp
File diff suppressed because it is too large
View File


+ 0
- 20
distrho-kars/DistrhoArtworkKars.hpp View File

@@ -1,20 +0,0 @@
/* (Auto-generated binary data file). */

#ifndef BINARY_DISTRHOARTWORKKARS_HPP
#define BINARY_DISTRHOARTWORKKARS_HPP

namespace DistrhoArtworkKars
{
extern const char* backgroundData;
const unsigned int backgroundDataSize = 379260;
const unsigned int backgroundWidth = 301;
const unsigned int backgroundHeight = 315;

extern const char* switchData;
const unsigned int switchDataSize = 61952;
const unsigned int switchWidth = 88;
const unsigned int switchHeight = 176;
}

#endif // BINARY_DISTRHOARTWORKKARS_HPP


+ 1
- 2
distrho-kars/DistrhoPluginInfo.h View File

@@ -21,11 +21,10 @@
#define DISTRHO_PLUGIN_NAME "Kars"
#define DISTRHO_PLUGIN_URI "http://distrho.sf.net/plugins/Kars"

#define DISTRHO_PLUGIN_HAS_UI 1
#define DISTRHO_PLUGIN_HAS_UI 0
#define DISTRHO_PLUGIN_IS_RT_SAFE 1
#define DISTRHO_PLUGIN_IS_SYNTH 1
#define DISTRHO_PLUGIN_NUM_INPUTS 0
#define DISTRHO_PLUGIN_NUM_OUTPUTS 1
#define DISTRHO_PLUGIN_USES_MODGUI 1

#endif // DISTRHO_PLUGIN_INFO_H_INCLUDED

+ 69
- 43
distrho-kars/DistrhoPluginKars.cpp View File

@@ -1,6 +1,6 @@
/*
* DISTRHO Kars Plugin, based on karplong by Chris Cannam.
* Copyright (C) 2015 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2015-2019 Filipe Coelho <falktx@falktx.com>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
@@ -15,6 +15,7 @@
*/
#include "DistrhoPluginKars.hpp"
#include "DistrhoPluginUtils.hpp"
START_NAMESPACE_DISTRHO
@@ -23,12 +24,14 @@ START_NAMESPACE_DISTRHO
DistrhoPluginKars::DistrhoPluginKars()
: Plugin(paramCount, 0, 0), // 0 programs, 0 states
fSustain(false),
fRelease(0.01),
fVolume(75.0f),
fSampleRate(getSampleRate()),
fBlockStart(0)
{
for (int i=kMaxNotes; --i >= 0;)
{
fNotes[i].index = i;
fNotes[i].voice = i;
fNotes[i].setSampleRate(fSampleRate);
}
}
@@ -38,15 +41,35 @@ DistrhoPluginKars::DistrhoPluginKars()
void DistrhoPluginKars::initParameter(uint32_t index, Parameter& parameter)
{
if (index != 0)
return;
parameter.hints = kParameterIsAutomatable|kParameterIsBoolean;
parameter.name = "Sustain";
parameter.symbol = "sustain";
parameter.ranges.def = 0.0f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 1.0f;
switch (index)
{
case paramSustain:
parameter.hints = kParameterIsAutomatable|kParameterIsBoolean;
parameter.name = "Sustain";
parameter.symbol = "sustain";
parameter.ranges.def = 0.0f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 1.0f;
break;
case paramRelease:
parameter.hints = kParameterIsAutomatable;
parameter.name = "Release";
parameter.symbol = "release";
parameter.unit = "s";
parameter.ranges.def = 0.01f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 5.0f;
break;
case paramVolume:
parameter.hints = kParameterIsAutomatable;
parameter.name = "Volume";
parameter.symbol = "volume";
parameter.unit = "%";
parameter.ranges.def = 75.0f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 100.0f;
break;
}
}
// -----------------------------------------------------------------------
@@ -54,18 +77,30 @@ void DistrhoPluginKars::initParameter(uint32_t index, Parameter& parameter)
float DistrhoPluginKars::getParameterValue(uint32_t index) const
{
if (index != 0)
return 0.0f;
switch (index)
{
case paramSustain: return fSustain ? 1.0f : 0.0f;
case paramRelease: return fRelease;
case paramVolume: return fVolume;
}
return fSustain ? 1.0f : 0.0f;
return 0.0f;
}
void DistrhoPluginKars::setParameterValue(uint32_t index, float value)
{
if (index != 0)
return;
fSustain = value > 0.5f;
switch (index)
{
case paramSustain:
fSustain = value > 0.5f;
break;
case paramRelease:
fRelease = value;
break;
case paramVolume:
fVolume = value;
break;
}
}
// -----------------------------------------------------------------------
@@ -86,16 +121,16 @@ void DistrhoPluginKars::activate()
void DistrhoPluginKars::run(const float* const*, float** outputs, uint32_t frames, const MidiEvent* midiEvents, uint32_t midiEventCount)
{
uint8_t note, velo;
float* out = outputs[0];
std::memset(outputs[0], 0, sizeof(float)*frames);
for (uint32_t count, pos=0, curEventIndex=0; pos<frames;)
for (AudioMidiSyncHelper amsh(outputs, frames, midiEvents, midiEventCount); amsh.nextEvent();)
{
for (;curEventIndex < midiEventCount && pos >= midiEvents[curEventIndex].frame; ++curEventIndex)
for (uint32_t i=0; i<amsh.midiEventCount; ++i)
{
if (midiEvents[curEventIndex].size > MidiEvent::kDataSize)
if (amsh.midiEvents[i].size > MidiEvent::kDataSize)
continue;
const uint8_t* data = midiEvents[curEventIndex].data;
const uint8_t* data = amsh.midiEvents[i].data;
const uint8_t status = data[0] & 0xF0;
switch (status)
@@ -106,7 +141,7 @@ void DistrhoPluginKars::run(const float* const*, float** outputs, uint32_t frame
DISTRHO_SAFE_ASSERT_BREAK(note < 128); // kMaxNotes
if (velo > 0)
{
fNotes[note].on = fBlockStart + midiEvents[curEventIndex].frame;
fNotes[note].on = fBlockStart;
fNotes[note].off = kNoteNull;
fNotes[note].velocity = velo;
break;
@@ -115,35 +150,26 @@ void DistrhoPluginKars::run(const float* const*, float** outputs, uint32_t frame
case 0x80:
note = data[1];
DISTRHO_SAFE_ASSERT_BREAK(note < 128); // kMaxNotes
fNotes[note].off = fBlockStart + midiEvents[curEventIndex].frame;
fNotes[note].off = fBlockStart;
break;
}
}
if (curEventIndex < midiEventCount && midiEvents[curEventIndex].frame < frames)
count = midiEvents[curEventIndex].frame - pos;
else
count = frames - pos;
std::memset(out+pos, 0, sizeof(float)*count);
//for (uint32_t i=0; i<count; ++i)
// out[pos + i] = 0.0f;
float* const out = amsh.outputs[0];
for (int i=kMaxNotes; --i >= 0;)
{
if (fNotes[i].on != kNoteNull)
addSamples(out, i, pos, count);
addSamples(out, i, amsh.frames);
}
pos += count;
fBlockStart += amsh.frames;
}
fBlockStart += frames;
}
void DistrhoPluginKars::addSamples(float* out, int voice, uint32_t offset, uint32_t count)
void DistrhoPluginKars::addSamples(float* out, int voice, uint32_t frames)
{
const uint32_t start = fBlockStart + offset;
const uint32_t start = fBlockStart;
Note& note(fNotes[voice]);
@@ -162,7 +188,7 @@ void DistrhoPluginKars::addSamples(float* out, int voice, uint32_t offset, uint3
float gain, sample;
uint32_t index, size;
for (uint32_t i=0, s=start-note.on; i<count; ++i, ++s)
for (uint32_t i=0, s=start-note.on; i<frames; ++i, ++s)
{
gain = vgain;
@@ -170,8 +196,8 @@ void DistrhoPluginKars::addSamples(float* out, int voice, uint32_t offset, uint3
{
// reuse index and size to save some performance.
// actual values are release and dist
index = 1 + uint32_t(0.01 * fSampleRate); // release, not index
size = i + start - note.off; // dist, not size
index = 1 + uint32_t(fRelease * fSampleRate); // release, not index
size = i + start - note.off; // dist, not size
if (size > index)
{
@@ -198,7 +224,7 @@ void DistrhoPluginKars::addSamples(float* out, int voice, uint32_t offset, uint3
note.wavetable[index] = sample/2;
}
out[offset+i] += gain * sample;
out[i] += gain * sample * (fVolume / 100.0f);
}
}


+ 13
- 9
distrho-kars/DistrhoPluginKars.hpp View File

@@ -1,6 +1,6 @@
/*
* DISTRHO Kars Plugin, based on karplong by Chris Cannam.
* Copyright (C) 2015 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2015-2019 Filipe Coelho <falktx@falktx.com>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
@@ -32,6 +32,8 @@ public:
enum Parameters
{
paramSustain = 0,
paramRelease,
paramVolume,
paramCount
};
@@ -68,7 +70,7 @@ protected:
uint32_t getVersion() const noexcept override
{
return d_version(1, 0, 0);
return d_version(1, 1, 0);
}
int64_t getUniqueId() const noexcept override
@@ -97,6 +99,8 @@ protected:
private:
bool fSustain;
float fRelease;
float fVolume;
double fSampleRate;
uint32_t fBlockStart;
@@ -104,16 +108,16 @@ private:
uint32_t on;
uint32_t off;
uint8_t velocity;
float index;
float size;
int sizei;
float* wavetable;
float voice;
float size;
int sizei;
float* wavetable;
Note() noexcept
: on(kNoteNull),
off(kNoteNull),
velocity(0),
index(0.0f),
voice(0.0f),
size(0.0f),
wavetable(nullptr) {}
@@ -131,7 +135,7 @@ private:
if (wavetable != nullptr)
delete[] wavetable;
const float frequency = 440.0f * std::pow(2.0f, (index - 69.0f) / 12.0f);
const float frequency = 440.0f * std::pow(2.0f, (voice - 69.0f) / 12.0f);
size = sampleRate / frequency;
sizei = int(size)+1;
wavetable = new float[sizei];
@@ -140,7 +144,7 @@ private:
} fNotes[kMaxNotes];
void addSamples(float* out, int voice, uint32_t offset, uint32_t count);
void addSamples(float* out, int voice, uint32_t frames);
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(DistrhoPluginKars)
};


+ 0
- 77
distrho-kars/DistrhoUIKars.cpp View File

@@ -1,77 +0,0 @@
/*
* DISTRHO Kars Plugin, based on karplong by Chris Cannam.
* Copyright (C) 2015 Filipe Coelho <falktx@falktx.com>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
* permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
* TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/

#include "DistrhoPluginKars.hpp"
#include "DistrhoUIKars.hpp"

START_NAMESPACE_DISTRHO

namespace Art = DistrhoArtworkKars;

// -----------------------------------------------------------------------

DistrhoUIKars::DistrhoUIKars()
: UI(Art::backgroundWidth, Art::backgroundHeight),
fImgBackground(Art::backgroundData, Art::backgroundWidth, Art::backgroundHeight)
{
// sustain switch
Image switchImageNormal(Art::switchData, Art::switchWidth, Art::switchHeight/2);
Image switchImageDown(Art::switchData+(Art::switchWidth*Art::switchHeight/2*4), Art::switchWidth, Art::switchHeight/2);
fSwitchSustain = new ImageSwitch(this, switchImageNormal, switchImageDown);
fSwitchSustain->setAbsolutePos(Art::backgroundWidth/2-Art::switchWidth/2, Art::backgroundHeight/2-Art::switchHeight/4);
fSwitchSustain->setId(DistrhoPluginKars::paramSustain);
fSwitchSustain->setCallback(this);
}

// -----------------------------------------------------------------------
// DSP Callbacks

void DistrhoUIKars::parameterChanged(uint32_t index, float value)
{
if (index != 0)
return;

fSwitchSustain->setDown(value > 0.5f);
}

// -----------------------------------------------------------------------
// Widget Callbacks

void DistrhoUIKars::imageSwitchClicked(ImageSwitch* imageSwitch, bool down)
{
if (imageSwitch != fSwitchSustain)
return;

editParameter(DistrhoPluginKars::paramSustain, true);
setParameterValue(DistrhoPluginKars::paramSustain, down ? 1.0f : 0.0f);
editParameter(DistrhoPluginKars::paramSustain, false);
}

void DistrhoUIKars::onDisplay()
{
fImgBackground.draw();
}

// -----------------------------------------------------------------------

UI* createUI()
{
return new DistrhoUIKars();
}

// -----------------------------------------------------------------------

END_NAMESPACE_DISTRHO

+ 0
- 60
distrho-kars/DistrhoUIKars.hpp View File

@@ -1,60 +0,0 @@
/*
* DISTRHO Kars Plugin, based on karplong by Chris Cannam.
* Copyright (C) 2015 Filipe Coelho <falktx@falktx.com>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
* permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
* TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/

#ifndef DISTRHO_UI_KARS_HPP_INCLUDED
#define DISTRHO_UI_KARS_HPP_INCLUDED

#include "DistrhoUI.hpp"

#include "ImageWidgets.hpp"

#include "DistrhoArtworkKars.hpp"

START_NAMESPACE_DISTRHO

// -----------------------------------------------------------------------

class DistrhoUIKars : public UI,
public ImageSwitch::Callback
{
public:
DistrhoUIKars();

protected:
// -------------------------------------------------------------------
// DSP Callbacks

void parameterChanged(uint32_t index, float value) override;

// -------------------------------------------------------------------
// Widget Callbacks

void imageSwitchClicked(ImageSwitch* imageSwitch, bool down) override;

void onDisplay() override;

private:
Image fImgBackground;
ScopedPointer<ImageSwitch> fSwitchSustain;

DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(DistrhoUIKars)
};

// -----------------------------------------------------------------------

END_NAMESPACE_DISTRHO

#endif // DISTRHO_UI_KARS_HPP_INCLUDED

+ 4
- 4
distrho-nekobi.cpp View File

@@ -26,16 +26,16 @@
#include "CarlaJuceUtils.hpp"

// Plugin Code
#include "distrho-nekobi/DistrhoArtworkNekobi.cpp"
#include "distrho-nekobi/DistrhoPluginNekobi.cpp"
#ifdef HAVE_DGL
#if DISTRHO_PLUGIN_HAS_UI
#include "distrho-nekobi/DistrhoArtworkNekobi.cpp"
#include "distrho-nekobi/DistrhoUINekobi.cpp"
#endif

// DISTRHO Code
#define DISTRHO_PLUGIN_TARGET_CARLA
#include "DistrhoPluginMain.cpp"
#ifdef HAVE_DGL
#if DISTRHO_PLUGIN_HAS_UI
#include "DistrhoUIMain.cpp"
#endif

@@ -45,7 +45,7 @@ START_NAMESPACE_DISTRHO

static const NativePluginDescriptor nekobiDesc = {
/* category */ NATIVE_PLUGIN_CATEGORY_SYNTH,
#ifdef HAVE_DGL
#if DISTRHO_PLUGIN_HAS_UI
/* hints */ static_cast<NativePluginHints>(NATIVE_PLUGIN_IS_RTSAFE
|NATIVE_PLUGIN_IS_SYNTH
|NATIVE_PLUGIN_HAS_UI


+ 0
- 1
distrho-nekobi/DistrhoPluginInfo.h View File

@@ -27,6 +27,5 @@
#define DISTRHO_PLUGIN_IS_SYNTH 1
#define DISTRHO_PLUGIN_NUM_INPUTS 0
#define DISTRHO_PLUGIN_NUM_OUTPUTS 1
#define DISTRHO_PLUGIN_USES_MODGUI 1

#endif // DISTRHO_PLUGIN_INFO_H_INCLUDED

+ 8
- 18
distrho-nekobi/DistrhoPluginNekobi.cpp View File

@@ -135,7 +135,6 @@ DistrhoPluginNekobi::DistrhoPluginNekobi()
fParams.decay = 75.0f;
fParams.accent = 25.0f;
fParams.volume = 75.0f;
fParams.bypass = false;
// Internal stuff
fSynth.waveform = 0.0f;
@@ -172,6 +171,7 @@ void DistrhoPluginNekobi::initParameter(uint32_t index, Parameter& parameter)
parameter.ranges.max = 1.0f;
parameter.enumValues.count = 2;
parameter.enumValues.restrictedMode = true;
parameter.midiCC = 70; //Sound Variation
{
ParameterEnumerationValue* const enumValues = new ParameterEnumerationValue[2];
enumValues[0].value = 0.0f;
@@ -188,6 +188,7 @@ void DistrhoPluginNekobi::initParameter(uint32_t index, Parameter& parameter)
parameter.ranges.def = 0.0f;
parameter.ranges.min = -12.0f;
parameter.ranges.max = 12.0f;
parameter.midiCC = 75;
break;
case paramCutoff:
parameter.hints = kParameterIsAutomatable; // modified x2.5
@@ -197,6 +198,7 @@ void DistrhoPluginNekobi::initParameter(uint32_t index, Parameter& parameter)
parameter.ranges.def = 25.0f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 100.0f;
parameter.midiCC = 74;
break;
case paramResonance:
parameter.hints = kParameterIsAutomatable; // modified x100
@@ -206,6 +208,7 @@ void DistrhoPluginNekobi::initParameter(uint32_t index, Parameter& parameter)
parameter.ranges.def = 25.0f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 95.0f;
parameter.midiCC = 71;
break;
case paramEnvMod:
parameter.hints = kParameterIsAutomatable; // modified x100
@@ -215,6 +218,7 @@ void DistrhoPluginNekobi::initParameter(uint32_t index, Parameter& parameter)
parameter.ranges.def = 50.0f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 100.0f;
parameter.midiCC = 1; //Mod Wheel
break;
case paramDecay:
parameter.hints = kParameterIsAutomatable; // was 0.000009 <-> 0.0005, log
@@ -224,6 +228,7 @@ void DistrhoPluginNekobi::initParameter(uint32_t index, Parameter& parameter)
parameter.ranges.def = 75.0f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 100.0f;
parameter.midiCC = 72;
break;
case paramAccent:
parameter.hints = kParameterIsAutomatable; // modified x100
@@ -233,6 +238,7 @@ void DistrhoPluginNekobi::initParameter(uint32_t index, Parameter& parameter)
parameter.ranges.def = 25.0f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 100.0f;
parameter.midiCC = 76;
break;
case paramVolume:
parameter.hints = kParameterIsAutomatable; // modified x100
@@ -242,9 +248,7 @@ void DistrhoPluginNekobi::initParameter(uint32_t index, Parameter& parameter)
parameter.ranges.def = 75.0f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 100.0f;
break;
case paramBypass:
parameter.initDesignation(kParameterDesignationBypass);
parameter.midiCC = 7; //Volume
break;
}
}
@@ -272,8 +276,6 @@ float DistrhoPluginNekobi::getParameterValue(uint32_t index) const
return fParams.accent;
case paramVolume:
return fParams.volume;
case paramBypass:
return fParams.bypass ? 1.0f : 0.0f;
}
return 0.0f;
@@ -323,14 +325,6 @@ void DistrhoPluginNekobi::setParameterValue(uint32_t index, float value)
fSynth.volume = value/100.0f;
DISTRHO_SAFE_ASSERT(fSynth.volume >= 0.0f && fSynth.volume <= 1.0f);
break;
case paramBypass: {
const bool bypass = (value > 0.5f);
if (fParams.bypass != bypass)
{
fParams.bypass = bypass;
nekobee_synth_all_voices_off(&fSynth);
}
} break;
}
}
@@ -366,10 +360,6 @@ void DistrhoPluginNekobi::run(const float* const*, float** outputs, uint32_t fra
return;
}
// ignore midi input if bypassed
if (fParams.bypass)
midiEventCount = 0;
while (framesDone < frames)
{
if (fSynth.nugget_remains == 0)


+ 0
- 2
distrho-nekobi/DistrhoPluginNekobi.hpp View File

@@ -42,7 +42,6 @@ public:
paramDecay,
paramAccent,
paramVolume,
paramBypass,
paramCount
};
@@ -118,7 +117,6 @@ private:
float decay;
float accent;
float volume;
bool bypass;
} fParams;
nekobee_synth_t fSynth;


+ 30
- 23
distrho-nekobi/DistrhoUINekobi.cpp View File

@@ -1,6 +1,6 @@
/*
* DISTRHO Nekobi Plugin, based on Nekobee by Sean Bolton and others.
* Copyright (C) 2013-2015 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2013-2021 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -25,19 +25,16 @@ namespace Art = DistrhoArtworkNekobi;
// -----------------------------------------------------------------------

DistrhoUINekobi::DistrhoUINekobi()
: UI(Art::backgroundWidth, Art::backgroundHeight),
fImgBackground(Art::backgroundData, Art::backgroundWidth, Art::backgroundHeight, GL_BGR),
: UI(Art::backgroundWidth, Art::backgroundHeight, true),
fImgBackground(Art::backgroundData, Art::backgroundWidth, Art::backgroundHeight, kImageFormatBGR),
fAboutWindow(this)
{
// FIXME
fNeko.setTimerSpeed(5);

// about
Image aboutImage(Art::aboutData, Art::aboutWidth, Art::aboutHeight, GL_BGR);
Image aboutImage(Art::aboutData, Art::aboutWidth, Art::aboutHeight, kImageFormatBGR);
fAboutWindow.setImage(aboutImage);

// slider
Image sliderImage(Art::sliderData, Art::sliderWidth, Art::sliderHeight);
Image sliderImage(Art::sliderData, Art::sliderWidth, Art::sliderHeight, kImageFormatBGRA);

fSliderWaveform = new ImageSlider(this, sliderImage);
fSliderWaveform->setId(DistrhoPluginNekobi::paramWaveform);
@@ -49,7 +46,7 @@ DistrhoUINekobi::DistrhoUINekobi()
fSliderWaveform->setCallback(this);

// knobs
Image knobImage(Art::knobData, Art::knobWidth, Art::knobHeight);
Image knobImage(Art::knobData, Art::knobWidth, Art::knobHeight, kImageFormatBGRA);

// knob Tuning
fKnobTuning = new ImageKnob(this, knobImage, ImageKnob::Vertical);
@@ -122,11 +119,19 @@ DistrhoUINekobi::DistrhoUINekobi()
fKnobVolume->setCallback(this);

// about button
Image aboutImageNormal(Art::aboutButtonNormalData, Art::aboutButtonNormalWidth, Art::aboutButtonNormalHeight);
Image aboutImageHover(Art::aboutButtonHoverData, Art::aboutButtonHoverWidth, Art::aboutButtonHoverHeight);
Image aboutImageNormal(Art::aboutButtonNormalData, Art::aboutButtonNormalWidth, Art::aboutButtonNormalHeight, kImageFormatBGRA);
Image aboutImageHover(Art::aboutButtonHoverData, Art::aboutButtonHoverWidth, Art::aboutButtonHoverHeight, kImageFormatBGRA);
fButtonAbout = new ImageButton(this, aboutImageNormal, aboutImageHover, aboutImageHover);
fButtonAbout->setAbsolutePos(505, 5);
fButtonAbout->setCallback(this);

// neko animation
addIdleCallback(this, 120);
}

DistrhoUINekobi::~DistrhoUINekobi()
{
removeIdleCallback(this);
}

// -----------------------------------------------------------------------
@@ -163,15 +168,6 @@ void DistrhoUINekobi::parameterChanged(uint32_t index, float value)
}
}

// -----------------------------------------------------------------------
// UI Callbacks

void DistrhoUINekobi::uiIdle()
{
if (fNeko.idle())
repaint();
}

// -----------------------------------------------------------------------
// Widget Callbacks

@@ -180,7 +176,7 @@ void DistrhoUINekobi::imageButtonClicked(ImageButton* button, int)
if (button != fButtonAbout)
return;

fAboutWindow.exec();
fAboutWindow.runAsModal();
}

void DistrhoUINekobi::imageKnobDragStarted(ImageKnob* knob)
@@ -215,8 +211,19 @@ void DistrhoUINekobi::imageSliderValueChanged(ImageSlider* slider, float value)

void DistrhoUINekobi::onDisplay()
{
fImgBackground.draw();
fNeko.draw();
const GraphicsContext& context(getGraphicsContext());

fImgBackground.draw(context);
fNeko.draw(context);
}

// -----------------------------------------------------------------------
// Other Callbacks

void DistrhoUINekobi::idleCallback()
{
if (fNeko.idle())
repaint();
}

// -----------------------------------------------------------------------


+ 9
- 7
distrho-nekobi/DistrhoUINekobi.hpp View File

@@ -1,6 +1,6 @@
/*
* DISTRHO Nekobi Plugin, based on Nekobee by Sean Bolton and others.
* Copyright (C) 2013-2015 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2013-2021 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -37,10 +37,12 @@ START_NAMESPACE_DISTRHO
class DistrhoUINekobi : public UI,
public ImageButton::Callback,
public ImageKnob::Callback,
public ImageSlider::Callback
public ImageSlider::Callback,
public IdleCallback
{
public:
DistrhoUINekobi();
~DistrhoUINekobi() override;

protected:
// -------------------------------------------------------------------
@@ -48,11 +50,6 @@ protected:

void parameterChanged(uint32_t index, float value) override;

// -------------------------------------------------------------------
// UI Callbacks

void uiIdle() override;

// -------------------------------------------------------------------
// Widget Callbacks

@@ -66,6 +63,11 @@ protected:

void onDisplay() override;

// -------------------------------------------------------------------
// Other Callbacks

void idleCallback() override;

private:
Image fImgBackground;
ImageAboutWindow fAboutWindow;


+ 4
- 16
distrho-nekobi/NekoWidget.hpp View File

@@ -1,6 +1,6 @@
/*
* Neko widget animation
* Copyright (C) 2013-2015 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2013-2021 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -21,7 +21,6 @@
#include "DistrhoArtworkNekobi.hpp"

#include "Image.hpp"
#include "Widget.hpp"

#include <cstdlib> // rand

@@ -35,7 +34,6 @@ public:
NekoWidget()
: fPos(0),
fTimer(0),
fTimerSpeed(20),
fCurAction(kActionNone),
fCurImage(&fImages.sit)
{
@@ -62,7 +60,7 @@ public:
}
}

void draw()
void draw(const GraphicsContext& context)
{
int x = fPos+108;
int y = -2;
@@ -73,16 +71,13 @@ public:
y += 12;
}

fCurImage->drawAt(x, y);
fCurImage->drawAt(context, x, y);
}

// returns true if needs repaint
bool idle()
{
if (++fTimer % fTimerSpeed != 0) // target is 20ms
return false;

if (fTimer == fTimerSpeed*9)
if (++fTimer == 10)
{
if (fCurAction == kActionNone)
fCurAction = static_cast<Action>(std::rand() % kActionCount);
@@ -158,12 +153,6 @@ public:
return true;
}

void setTimerSpeed(int speed)
{
fTimer = 0;
fTimerSpeed = speed;
}

// -------------------------------------------------------------------

private:
@@ -191,7 +180,6 @@ private:

int fPos;
int fTimer;
int fTimerSpeed;

Action fCurAction;
Image* fCurImage;


+ 4
- 4
distrho-pingpongpan.cpp View File

@@ -27,16 +27,16 @@
#include "CarlaJuceUtils.hpp"

// Plugin Code
#include "distrho-pingpongpan/DistrhoArtworkPingPongPan.cpp"
#include "distrho-pingpongpan/DistrhoPluginPingPongPan.cpp"
#ifdef HAVE_DGL
#if DISTRHO_PLUGIN_HAS_UI
#include "distrho-pingpongpan/DistrhoArtworkPingPongPan.cpp"
#include "distrho-pingpongpan/DistrhoUIPingPongPan.cpp"
#endif

// DISTRHO Code
#define DISTRHO_PLUGIN_TARGET_CARLA
#include "DistrhoPluginMain.cpp"
#ifdef HAVE_DGL
#if DISTRHO_PLUGIN_HAS_UI
#include "DistrhoUIMain.cpp"
#endif

@@ -46,7 +46,7 @@ START_NAMESPACE_DISTRHO

static const NativePluginDescriptor pingpongpanDesc = {
/* category */ NATIVE_PLUGIN_CATEGORY_UTILITY,
#ifdef HAVE_DGL
#if DISTRHO_PLUGIN_HAS_UI
/* hints */ static_cast<NativePluginHints>(NATIVE_PLUGIN_IS_RTSAFE
|NATIVE_PLUGIN_HAS_UI
|NATIVE_PLUGIN_NEEDS_UI_MAIN_THREAD


+ 0
- 1
distrho-pingpongpan/DistrhoPluginInfo.h View File

@@ -26,7 +26,6 @@
#define DISTRHO_PLUGIN_NUM_INPUTS 2
#define DISTRHO_PLUGIN_NUM_OUTPUTS 2
#define DISTRHO_PLUGIN_WANT_PROGRAMS 1
#define DISTRHO_PLUGIN_USES_MODGUI 1

#define DISTRHO_PLUGIN_LV2_CATEGORY "lv2:SpatialPlugin"



+ 11
- 9
distrho-pingpongpan/DistrhoUIPingPongPan.cpp View File

@@ -1,6 +1,6 @@
/*
* DISTRHO PingPongPan Plugin, based on PingPongPan by Michael Gruhn
* Copyright (C) 2012-2015 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2012-2021 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -24,16 +24,16 @@ namespace Art = DistrhoArtworkPingPongPan;
// -----------------------------------------------------------------------

DistrhoUIPingPongPan::DistrhoUIPingPongPan()
: UI(Art::backgroundWidth, Art::backgroundHeight),
fImgBackground(Art::backgroundData, Art::backgroundWidth, Art::backgroundHeight, GL_BGR),
: UI(Art::backgroundWidth, Art::backgroundHeight, true),
fImgBackground(Art::backgroundData, Art::backgroundWidth, Art::backgroundHeight, kImageFormatBGR),
fAboutWindow(this)
{
// about
Image imageAbout(Art::aboutData, Art::aboutWidth, Art::aboutHeight, GL_BGR);
Image imageAbout(Art::aboutData, Art::aboutWidth, Art::aboutHeight, kImageFormatBGR);
fAboutWindow.setImage(imageAbout);

// knobs
Image knobImage(Art::knobData, Art::knobWidth, Art::knobHeight);
Image knobImage(Art::knobData, Art::knobWidth, Art::knobHeight, kImageFormatBGRA);

// knob Low-Mid
fKnobFreq = new ImageKnob(this, knobImage, ImageKnob::Vertical);
@@ -54,8 +54,8 @@ DistrhoUIPingPongPan::DistrhoUIPingPongPan()
fKnobWidth->setCallback(this);

// about button
Image aboutImageNormal(Art::aboutButtonNormalData, Art::aboutButtonNormalWidth, Art::aboutButtonNormalHeight);
Image aboutImageHover(Art::aboutButtonHoverData, Art::aboutButtonHoverWidth, Art::aboutButtonHoverHeight);
Image aboutImageNormal(Art::aboutButtonNormalData, Art::aboutButtonNormalWidth, Art::aboutButtonNormalHeight, kImageFormatBGRA);
Image aboutImageHover(Art::aboutButtonHoverData, Art::aboutButtonHoverWidth, Art::aboutButtonHoverHeight, kImageFormatBGRA);
fButtonAbout = new ImageButton(this, aboutImageNormal, aboutImageHover, aboutImageHover);
fButtonAbout->setAbsolutePos(183, 8);
fButtonAbout->setCallback(this);
@@ -98,7 +98,7 @@ void DistrhoUIPingPongPan::imageButtonClicked(ImageButton* button, int)
if (button != fButtonAbout)
return;

fAboutWindow.exec();
fAboutWindow.runAsModal();
}

void DistrhoUIPingPongPan::imageKnobDragStarted(ImageKnob* knob)
@@ -118,7 +118,9 @@ void DistrhoUIPingPongPan::imageKnobValueChanged(ImageKnob* knob, float value)

void DistrhoUIPingPongPan::onDisplay()
{
fImgBackground.draw();
const GraphicsContext& context(getGraphicsContext());

fImgBackground.draw(context);
}

// -----------------------------------------------------------------------


+ 3
- 3
distrho-vectorjuice.cpp View File

@@ -28,7 +28,7 @@

// Plugin Code
#include "distrho-vectorjuice/VectorJuicePlugin.cpp"
#ifdef HAVE_DGL
#if DISTRHO_PLUGIN_HAS_UI
#include "distrho-vectorjuice/VectorJuiceArtwork.cpp"
#include "distrho-vectorjuice/VectorJuiceUI.cpp"
#endif
@@ -36,7 +36,7 @@
// DISTRHO Code
#define DISTRHO_PLUGIN_TARGET_CARLA
#include "DistrhoPluginMain.cpp"
#ifdef HAVE_DGL
#if DISTRHO_PLUGIN_HAS_UI
#include "DistrhoUIMain.cpp"
#endif

@@ -46,7 +46,7 @@ START_NAMESPACE_DISTRHO

static const NativePluginDescriptor vectorjuiceDesc = {
/* category */ NATIVE_PLUGIN_CATEGORY_UTILITY,
#ifdef HAVE_DGL
#if DISTRHO_PLUGIN_HAS_UI
/* hints */ static_cast<NativePluginHints>(NATIVE_PLUGIN_IS_RTSAFE
|NATIVE_PLUGIN_HAS_UI
|NATIVE_PLUGIN_NEEDS_UI_MAIN_THREAD


+ 22
- 22
distrho-vectorjuice/VectorJuiceUI.cpp View File

@@ -25,11 +25,9 @@ START_NAMESPACE_DISTRHO
// -----------------------------------------------------------------------

VectorJuiceUI::VectorJuiceUI()
: UI(),
: UI(VectorJuiceArtwork::backgroundWidth, VectorJuiceArtwork::backgroundHeight, true),
fAboutWindow(this)
{
setSize(VectorJuiceArtwork::backgroundWidth, VectorJuiceArtwork::backgroundHeight);

// xy params
paramX = paramY = 0.5f;

@@ -44,7 +42,7 @@ VectorJuiceUI::VectorJuiceUI()
fCanvasArea.setSize(368-24, 368-24);

// background
fImgBackground = Image(VectorJuiceArtwork::backgroundData, VectorJuiceArtwork::backgroundWidth, VectorJuiceArtwork::backgroundHeight, GL_BGR);
fImgBackground = Image(VectorJuiceArtwork::backgroundData, VectorJuiceArtwork::backgroundWidth, VectorJuiceArtwork::backgroundHeight, kImageFormatBGR);

//roundlet
fImgRoundlet = Image(VectorJuiceArtwork::roundletData, VectorJuiceArtwork::roundletWidth, VectorJuiceArtwork::roundletHeight);
@@ -56,7 +54,7 @@ VectorJuiceUI::VectorJuiceUI()
fImgSubOrbit = Image(VectorJuiceArtwork::subOrbitData, VectorJuiceArtwork::subOrbitWidth, VectorJuiceArtwork::subOrbitHeight);

// about
Image aboutImage(VectorJuiceArtwork::aboutData, VectorJuiceArtwork::aboutWidth, VectorJuiceArtwork::aboutHeight, GL_BGR);
Image aboutImage(VectorJuiceArtwork::aboutData, VectorJuiceArtwork::aboutWidth, VectorJuiceArtwork::aboutHeight, kImageFormatBGR);
fAboutWindow.setImage(aboutImage);

// about button
@@ -303,7 +301,7 @@ void VectorJuiceUI::imageButtonClicked(ImageButton* button, int)
if (button != fButtonAbout)
return;

fAboutWindow.exec();
fAboutWindow.runAsModal();
}

void VectorJuiceUI::imageKnobDragStarted(ImageKnob* knob)
@@ -338,15 +336,17 @@ void VectorJuiceUI::imageSliderValueChanged(ImageSlider* slider, float value)

void VectorJuiceUI::onDisplay()
{
fImgBackground.draw();
const GraphicsContext& context(getGraphicsContext());

fImgBackground.draw(context);

// get x, y mapped to XY area
int x = fCanvasArea.getX() + paramX*fCanvasArea.getWidth() - fImgRoundlet.getWidth()/2;
int y = fCanvasArea.getY() + paramY*fCanvasArea.getHeight() - fImgRoundlet.getHeight()/2;
int nOrbitX = fCanvasArea.getX()+((orbitX)*fCanvasArea.getWidth())-15;
int nOrbitY = fCanvasArea.getY()+((orbitY)*fCanvasArea.getWidth())-15;
int nSubOrbitX = fCanvasArea.getX()+(subOrbitX*fCanvasArea.getWidth())-15;
int nSubOrbitY = fCanvasArea.getY()+(subOrbitY*fCanvasArea.getWidth())-14;
const int x = fCanvasArea.getX() + paramX*fCanvasArea.getWidth() - fImgRoundlet.getWidth()/2;
const int y = fCanvasArea.getY() + paramY*fCanvasArea.getHeight() - fImgRoundlet.getHeight()/2;
const int nOrbitX = fCanvasArea.getX()+((orbitX)*fCanvasArea.getWidth())-15;
const int nOrbitY = fCanvasArea.getY()+((orbitY)*fCanvasArea.getWidth())-15;
const int nSubOrbitX = fCanvasArea.getX()+(subOrbitX*fCanvasArea.getWidth())-15;
const int nSubOrbitY = fCanvasArea.getY()+(subOrbitY*fCanvasArea.getWidth())-14;

//draw lines, just for fun
glEnable(GL_BLEND);
@@ -362,13 +362,10 @@ void VectorJuiceUI::onDisplay()
glVertex2i(nSubOrbitX+15, nSubOrbitY+14);
glEnd();

// reset color
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);

// draw roundlet and orbits
fImgRoundlet.drawAt(x, y);
fImgOrbit.drawAt(nOrbitX, nOrbitY);
fImgSubOrbit.drawAt(nSubOrbitX, nSubOrbitY);
fImgRoundlet.drawAt(context, x, y);
fImgOrbit.drawAt(context, nOrbitX, nOrbitY);
fImgSubOrbit.drawAt(context, nSubOrbitX, nSubOrbitY);
}

bool VectorJuiceUI::onMouse(const MouseEvent& ev)
@@ -378,7 +375,9 @@ bool VectorJuiceUI::onMouse(const MouseEvent& ev)

if (ev.press)
{
if (! fCanvasArea.contains(ev.pos))
const double scaling = getWidth() / static_cast<double>(VectorJuiceArtwork::backgroundWidth);

if (! fCanvasArea.containsAfterScaling(ev.pos, scaling))
return false;

fDragging = true;
@@ -401,6 +400,7 @@ bool VectorJuiceUI::onMotion(const MotionEvent& ev)
if (! fDragging)
return false;

const double scaling = getWidth() / static_cast<double>(VectorJuiceArtwork::backgroundWidth);
const int x = ev.pos.getX();
const int y = ev.pos.getY();

@@ -419,8 +419,8 @@ bool VectorJuiceUI::onMotion(const MotionEvent& ev)
float newX = paramX;
float newY = paramY;

newX -= float(movedX)/fCanvasArea.getWidth();
newY -= float(movedY)/fCanvasArea.getHeight();
newX -= float(movedX)/fCanvasArea.getWidth()/scaling;
newY -= float(movedY)/fCanvasArea.getHeight()/scaling;

if (newX < 0.0f)
newX = 0.0f;


+ 1
- 1
distrho-vectorjuice/VectorJuiceUI.hpp View File

@@ -88,7 +88,7 @@ private:
bool fDragValid;
int fLastX;
int fLastY;
DGL_NAMESPACE::Rectangle<int> fCanvasArea;
DGL_NAMESPACE::Rectangle<double> fCanvasArea;
float orbitX, orbitY, subOrbitX, subOrbitY;
};



+ 4
- 4
distrho-wobblejuice.cpp View File

@@ -27,16 +27,16 @@
#include "CarlaJuceUtils.hpp"

// Plugin Code
#include "distrho-wobblejuice/WobbleJuiceArtwork.cpp"
#include "distrho-wobblejuice/WobbleJuicePlugin.cpp"
#ifdef HAVE_DGL
#if DISTRHO_PLUGIN_HAS_UI
#include "distrho-wobblejuice/WobbleJuiceArtwork.cpp"
#include "distrho-wobblejuice/WobbleJuiceUI.cpp"
#endif

// DISTRHO Code
#define DISTRHO_PLUGIN_TARGET_CARLA
#include "DistrhoPluginMain.cpp"
#ifdef HAVE_DGL
#if DISTRHO_PLUGIN_HAS_UI
#include "DistrhoUIMain.cpp"
#endif

@@ -46,7 +46,7 @@ START_NAMESPACE_DISTRHO

static const NativePluginDescriptor wobblejuiceDesc = {
/* category */ NATIVE_PLUGIN_CATEGORY_DYNAMICS,
#ifdef HAVE_DGL
#if DISTRHO_PLUGIN_HAS_UI
/* hints */ static_cast<NativePluginHints>(NATIVE_PLUGIN_IS_RTSAFE
|NATIVE_PLUGIN_HAS_UI
|NATIVE_PLUGIN_NEEDS_UI_MAIN_THREAD


+ 10
- 10
distrho-wobblejuice/WobbleJuiceUI.cpp View File

@@ -23,20 +23,18 @@ START_NAMESPACE_DISTRHO
// -----------------------------------------------------------------------

WobbleJuiceUI::WobbleJuiceUI()
: UI(),
: UI(WobbleJuiceArtwork::backgroundWidth, WobbleJuiceArtwork::backgroundHeight, true),
fAboutWindow(this)
{
setSize(WobbleJuiceArtwork::backgroundWidth, WobbleJuiceArtwork::backgroundHeight);

// background
fImgBackground = Image(WobbleJuiceArtwork::backgroundData, WobbleJuiceArtwork::backgroundWidth, WobbleJuiceArtwork::backgroundHeight, GL_BGR);
fImgBackground = Image(WobbleJuiceArtwork::backgroundData, WobbleJuiceArtwork::backgroundWidth, WobbleJuiceArtwork::backgroundHeight, kImageFormatBGR);

// about
Image aboutImage(WobbleJuiceArtwork::aboutData, WobbleJuiceArtwork::aboutWidth, WobbleJuiceArtwork::aboutHeight, GL_BGR);
Image aboutImage(WobbleJuiceArtwork::aboutData, WobbleJuiceArtwork::aboutWidth, WobbleJuiceArtwork::aboutHeight, kImageFormatBGR);
fAboutWindow.setImage(aboutImage);

// knobs
Image knobImage(WobbleJuiceArtwork::knobData, WobbleJuiceArtwork::knobWidth, WobbleJuiceArtwork::knobHeight);
Image knobImage(WobbleJuiceArtwork::knobData, WobbleJuiceArtwork::knobWidth, WobbleJuiceArtwork::knobHeight, kImageFormatBGRA);

// knob Division
fKnobDivision = new ImageKnob(this, knobImage, ImageKnob::Vertical);
@@ -94,8 +92,8 @@ WobbleJuiceUI::WobbleJuiceUI()
fKnobDrive->setCallback(this);

// about button
Image aboutImageNormal(WobbleJuiceArtwork::aboutButtonNormalData, WobbleJuiceArtwork::aboutButtonNormalWidth, WobbleJuiceArtwork::aboutButtonNormalHeight);
Image aboutImageHover(WobbleJuiceArtwork::aboutButtonHoverData, WobbleJuiceArtwork::aboutButtonHoverWidth, WobbleJuiceArtwork::aboutButtonHoverHeight);
Image aboutImageNormal(WobbleJuiceArtwork::aboutButtonNormalData, WobbleJuiceArtwork::aboutButtonNormalWidth, WobbleJuiceArtwork::aboutButtonNormalHeight, kImageFormatBGRA);
Image aboutImageHover(WobbleJuiceArtwork::aboutButtonHoverData, WobbleJuiceArtwork::aboutButtonHoverWidth, WobbleJuiceArtwork::aboutButtonHoverHeight, kImageFormatBGRA);
fButtonAbout = new ImageButton(this, aboutImageNormal, aboutImageHover, aboutImageHover);
fButtonAbout->setAbsolutePos(390, 20);
fButtonAbout->setCallback(this);
@@ -154,7 +152,7 @@ void WobbleJuiceUI::imageButtonClicked(ImageButton* button, int)
if (button != fButtonAbout)
return;

fAboutWindow.exec();
fAboutWindow.runAsModal();
}

void WobbleJuiceUI::imageKnobDragStarted(ImageKnob* knob)
@@ -174,7 +172,9 @@ void WobbleJuiceUI::imageKnobValueChanged(ImageKnob* knob, float value)

void WobbleJuiceUI::onDisplay()
{
fImgBackground.draw();
const GraphicsContext& context(getGraphicsContext());

fImgBackground.draw(context);
}

// -----------------------------------------------------------------------


Loading…
Cancel
Save