Browse Source

More dpf module changes; Fix build

tags/1.9.6
falkTX 9 years ago
parent
commit
6779d1d796
15 changed files with 66 additions and 37 deletions
  1. +2
    -2
      source/modules/dgl/ImageKnob.hpp
  2. +2
    -2
      source/modules/dgl/ImageSwitch.hpp
  3. +2
    -0
      source/modules/dgl/Widget.hpp
  4. +6
    -6
      source/modules/dgl/src/Color.cpp
  5. +2
    -2
      source/modules/dgl/src/Geometry.cpp
  6. +4
    -2
      source/modules/dgl/src/Image.cpp
  7. +0
    -1
      source/modules/dgl/src/ImageKnob.cpp
  8. +2
    -2
      source/modules/dgl/src/NanoVG.cpp
  9. +4
    -4
      source/modules/dgl/src/nanovg/fontstash.h
  10. +11
    -0
      source/modules/distrho/DistrhoUtils.hpp
  11. +4
    -2
      source/native-plugins/distrho-3bandeq/DistrhoUI3BandEQ.cpp
  12. +4
    -2
      source/native-plugins/distrho-3bandsplitter/DistrhoUI3BandSplitter.cpp
  13. +18
    -9
      source/native-plugins/distrho-mverb/DistrhoUIMVerb.cpp
  14. +4
    -2
      source/native-plugins/distrho-pingpongpan/DistrhoUIPingPongPan.cpp
  15. +1
    -1
      source/utils/CarlaVstUtils.hpp

+ 2
- 2
source/modules/dgl/ImageKnob.hpp View File

@@ -41,8 +41,8 @@ public:
virtual void imageKnobValueChanged(ImageKnob* imageKnob, float value) = 0;
};

explicit ImageKnob(Window& parent, const Image& image, Orientation orientation = Vertical, int id = 0) noexcept;
explicit ImageKnob(Widget* widget, const Image& image, Orientation orientation = Vertical, int id = 0) noexcept;
explicit ImageKnob(Window& parent, const Image& image, Orientation orientation = Vertical) noexcept;
explicit ImageKnob(Widget* widget, const Image& image, Orientation orientation = Vertical) noexcept;
explicit ImageKnob(const ImageKnob& imageKnob);
ImageKnob& operator=(const ImageKnob& imageKnob);
~ImageKnob() override;


+ 2
- 2
source/modules/dgl/ImageSwitch.hpp View File

@@ -34,8 +34,8 @@ public:
virtual void imageSwitchClicked(ImageSwitch* imageButton, bool down) = 0;
};

explicit ImageSwitch(Window& parent, const Image& imageNormal, const Image& imageDown, int id = 0) noexcept;
explicit ImageSwitch(Widget* widget, const Image& imageNormal, const Image& imageDown, int id = 0) noexcept;
explicit ImageSwitch(Window& parent, const Image& imageNormal, const Image& imageDown) noexcept;
explicit ImageSwitch(Widget* widget, const Image& imageNormal, const Image& imageDown) noexcept;
explicit ImageSwitch(const ImageSwitch& imageSwitch) noexcept;
ImageSwitch& operator=(const ImageSwitch& imageSwitch) noexcept;



+ 2
- 0
source/modules/dgl/Widget.hpp View File

@@ -59,6 +59,8 @@ public:
struct BaseEvent {
Modifier mod;
uint32_t time;
// make -Weffc++ happy
virtual ~BaseEvent() {}
};

/**


+ 6
- 6
source/modules/dgl/src/Color.cpp View File

@@ -125,27 +125,27 @@ Color Color::fromHTML(const char* rgb, float alpha)
if (rgblen == 3)
{
rgbtmp[0] = rgb[0];
r = std::strtol(rgbtmp, nullptr, 16);
r = static_cast<int>(std::strtol(rgbtmp, nullptr, 16));

rgbtmp[0] = rgb[1];
g = std::strtol(rgbtmp, nullptr, 16);
g = static_cast<int>(std::strtol(rgbtmp, nullptr, 16));

rgbtmp[0] = rgb[2];
b = std::strtol(rgbtmp, nullptr, 16);
b = static_cast<int>(std::strtol(rgbtmp, nullptr, 16));
}
else
{
rgbtmp[0] = rgb[0];
rgbtmp[1] = rgb[1];
r = std::strtol(rgbtmp, nullptr, 16);
r = static_cast<int>(std::strtol(rgbtmp, nullptr, 16));

rgbtmp[0] = rgb[2];
rgbtmp[1] = rgb[3];
g = std::strtol(rgbtmp, nullptr, 16);
g = static_cast<int>(std::strtol(rgbtmp, nullptr, 16));

rgbtmp[0] = rgb[4];
rgbtmp[1] = rgb[5];
b = std::strtol(rgbtmp, nullptr, 16);
b = static_cast<int>(std::strtol(rgbtmp, nullptr, 16));
}

return Color(r, g, b, static_cast<int>(getFixedRange(alpha)*255.0f));


+ 2
- 2
source/modules/dgl/src/Geometry.cpp View File

@@ -641,13 +641,13 @@ Circle<T>& Circle<T>::operator=(const Circle<T>& cir) noexcept
template<typename T>
bool Circle<T>::operator==(const Circle<T>& cir) const noexcept
{
return (fPos == cir.fPos && fSize == cir.fSize && fNumSegments == cir.fNumSegments);
return (fPos == cir.fPos && d_isEqual(fSize, cir.fSize) && fNumSegments == cir.fNumSegments);
}

template<typename T>
bool Circle<T>::operator!=(const Circle<T>& cir) const noexcept
{
return (fPos != cir.fPos || fSize != cir.fSize || fNumSegments != cir.fNumSegments);
return (fPos != cir.fPos || d_isNotEqual(fSize, cir.fSize) || fNumSegments != cir.fNumSegments);
}

template<typename T>


+ 4
- 2
source/modules/dgl/src/Image.cpp View File

@@ -152,12 +152,14 @@ void Image::drawAt(const Point<int>& pos)

glPixelStorei(GL_PACK_ALIGNMENT, 1);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, fSize.getWidth(), fSize.getHeight(), 0, fFormat, fType, fRawData);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
static_cast<GLsizei>(fSize.getWidth()), static_cast<GLsizei>(fSize.getHeight()), 0,
fFormat, fType, fRawData);

fIsReady = true;
}

Rectangle<int>(pos, fSize.getWidth(), fSize.getHeight()).draw();
Rectangle<int>(pos, static_cast<int>(fSize.getWidth()), static_cast<int>(fSize.getHeight())).draw();

glBindTexture(GL_TEXTURE_2D, 0);
glDisable(GL_TEXTURE_2D);


+ 0
- 1
source/modules/dgl/src/ImageKnob.cpp View File

@@ -25,7 +25,6 @@ START_NAMESPACE_DGL
ImageKnob::ImageKnob(Window& parent, const Image& image, Orientation orientation) noexcept
: Widget(parent),
fImage(image),
fId(id),
fMinimum(0.0f),
fMaximum(1.0f),
fStep(0.0f),


+ 2
- 2
source/modules/dgl/src/NanoVG.cpp View File

@@ -576,13 +576,13 @@ NanoVG::FontId NanoVG::createFont(const char* name, const char* filename)
return nvgCreateFont(fContext, name, filename);
}

NanoVG::FontId NanoVG::createFontMem(const char* name, uchar* data, int ndata, bool freeData)
NanoVG::FontId NanoVG::createFontMem(const char* name, const uchar* data, int ndata, bool freeData)
{
if (fContext == nullptr) return -1;
DISTRHO_SAFE_ASSERT_RETURN(name != nullptr && name[0] != '\0', -1);
DISTRHO_SAFE_ASSERT_RETURN(data != nullptr, -1);

return nvgCreateFontMem(fContext, name, data, ndata, freeData);
return nvgCreateFontMem(fContext, name, const_cast<uchar*>(data), ndata, freeData);
}

NanoVG::FontId NanoVG::findFont(const char* name)


+ 4
- 4
source/modules/dgl/src/nanovg/fontstash.h View File

@@ -41,7 +41,7 @@ enum FONSalign {
enum FONSerrorCode {
// Font atlas is full.
FONS_ATLAS_FULL = 1,
// Scratch memory used to render glyphs is full, requested size reported in 'val', you may need to bump up FONS_SCRATCH_BUF_SIZE.
// Scratch memory used to render glyphs is full, requested size reported in 'val', you may need to bump up FONS_SCRATCH_BUF_SIZE.
FONS_SCRATCH_FULL = 2,
// Calls to fonsPushState has craeted too large stack, if you need deep state stack bump up FONS_MAX_STATES.
FONS_STATES_OVERFLOW = 3,
@@ -85,7 +85,7 @@ void fonsDeleteInternal(struct FONScontext* s);
void fonsSetErrorCallback(struct FONScontext* s, void (*callback)(void* uptr, int error, int val), void* uptr);
// Returns current atlas size.
void fonsGetAtlasSize(struct FONScontext* s, int* width, int* height);
// Expands the atlas size.
// Expands the atlas size.
int fonsExpandAtlas(struct FONScontext* s, int width, int height);
// Reseta the whole stash.
int fonsResetAtlas(struct FONScontext* stash, int width, int height);
@@ -1388,7 +1388,7 @@ void fonsDrawDebug(struct FONScontext* stash, float x, float y)
}

float fonsTextBounds(struct FONScontext* stash,
float x, float y,
float x, float y,
const char* str, const char* end,
float* bounds)
{
@@ -1576,7 +1576,7 @@ int fonsExpandAtlas(struct FONScontext* stash, int width, int height)
height = fons__maxi(height, stash->params.height);

if (width == stash->params.width && height == stash->params.height)
return 1;
return 1;

// Flush pending glyphs.
fons__flush(stash);


+ 11
- 0
source/modules/distrho/DistrhoUtils.hpp View File

@@ -166,6 +166,17 @@ bool d_isEqual(const T& v1, const T& v2)
return std::abs(v1-v2) < std::numeric_limits<T>::epsilon();
}

/*
* Safely compare two floating point numbers.
* Returns true if they don't match.
*/
template<typename T>
static inline
bool d_isNotEqual(const T& v1, const T& v2)
{
return std::abs(v1-v2) >= std::numeric_limits<T>::epsilon();
}

/*
* Safely check if a floating point number is zero.
*/


+ 4
- 2
source/native-plugins/distrho-3bandeq/DistrhoUI3BandEQ.cpp View File

@@ -79,7 +79,8 @@ DistrhoUI3BandEQ::DistrhoUI3BandEQ()
Image knobImage(DistrhoArtwork3BandEQ::knobData, DistrhoArtwork3BandEQ::knobWidth, DistrhoArtwork3BandEQ::knobHeight);

// knob Low-Mid
fKnobLowMid = new ImageKnob(this, knobImage, ImageKnob::Vertical, DistrhoPlugin3BandEQ::paramLowMidFreq);
fKnobLowMid = new ImageKnob(this, knobImage, ImageKnob::Vertical);
fKnobLowMid->setId(DistrhoPlugin3BandEQ::paramLowMidFreq);
fKnobLowMid->setAbsolutePos(65, 269);
fKnobLowMid->setRange(0.0f, 1000.0f);
fKnobLowMid->setDefault(440.0f);
@@ -87,7 +88,8 @@ DistrhoUI3BandEQ::DistrhoUI3BandEQ()
fKnobLowMid->setCallback(this);

// knob Mid-High
fKnobMidHigh = new ImageKnob(this, knobImage, ImageKnob::Vertical, DistrhoPlugin3BandEQ::paramMidHighFreq);
fKnobMidHigh = new ImageKnob(this, knobImage, ImageKnob::Vertical);
fKnobMidHigh->setId(DistrhoPlugin3BandEQ::paramMidHighFreq);
fKnobMidHigh->setAbsolutePos(159, 269);
fKnobMidHigh->setRange(1000.0f, 20000.0f);
fKnobMidHigh->setDefault(1000.0f);


+ 4
- 2
source/native-plugins/distrho-3bandsplitter/DistrhoUI3BandSplitter.cpp View File

@@ -79,7 +79,8 @@ DistrhoUI3BandSplitter::DistrhoUI3BandSplitter()
Image knobImage(DistrhoArtwork3BandSplitter::knobData, DistrhoArtwork3BandSplitter::knobWidth, DistrhoArtwork3BandSplitter::knobHeight);

// knob Low-Mid
fKnobLowMid = new ImageKnob(this, knobImage, ImageKnob::Vertical, DistrhoPlugin3BandSplitter::paramLowMidFreq);
fKnobLowMid = new ImageKnob(this, knobImage, ImageKnob::Vertical);
fKnobLowMid->setId(DistrhoPlugin3BandSplitter::paramLowMidFreq);
fKnobLowMid->setAbsolutePos(65, 269);
fKnobLowMid->setRange(0.0f, 1000.0f);
fKnobLowMid->setDefault(440.0f);
@@ -87,7 +88,8 @@ DistrhoUI3BandSplitter::DistrhoUI3BandSplitter()
fKnobLowMid->setCallback(this);

// knob Mid-High
fKnobMidHigh = new ImageKnob(this, knobImage, ImageKnob::Vertical, DistrhoPlugin3BandSplitter::paramMidHighFreq);
fKnobMidHigh = new ImageKnob(this, knobImage, ImageKnob::Vertical);
fKnobMidHigh->setId(DistrhoPlugin3BandSplitter::paramMidHighFreq);
fKnobMidHigh->setAbsolutePos(159, 269);
fKnobMidHigh->setRange(1000.0f, 20000.0f);
fKnobMidHigh->setDefault(1000.0f);


+ 18
- 9
source/native-plugins/distrho-mverb/DistrhoUIMVerb.cpp View File

@@ -43,7 +43,8 @@ DistrhoUIMVerb::DistrhoUIMVerb()
Image knobImage(DistrhoArtworkMVerb::knobData, DistrhoArtworkMVerb::knobWidth, DistrhoArtworkMVerb::knobHeight);

{
ImageKnob* const knob(new ImageKnob(this, knobImage, ImageKnob::Vertical, MVerb<float>::DAMPINGFREQ));
ImageKnob* const knob(new ImageKnob(this, knobImage, ImageKnob::Vertical));
knob->setId(MVerb<float>::DAMPINGFREQ);
knob->setAbsolutePos(56 + 7*40, 40);
knob->setRange(0.0f, 100.0f);
knob->setDefault(50.0f);
@@ -51,7 +52,8 @@ DistrhoUIMVerb::DistrhoUIMVerb()
fKnobs.push_back(knob);
}
{
ImageKnob* const knob(new ImageKnob(this, knobImage, ImageKnob::Vertical, MVerb<float>::DENSITY));
ImageKnob* const knob(new ImageKnob(this, knobImage, ImageKnob::Vertical));
knob->setId(MVerb<float>::DENSITY);
knob->setAbsolutePos(56 + 4*40, 40);
knob->setRange(0.0f, 100.0f);
knob->setDefault(50.0f);
@@ -59,7 +61,8 @@ DistrhoUIMVerb::DistrhoUIMVerb()
fKnobs.push_back(knob);
}
{
ImageKnob* const knob(new ImageKnob(this, knobImage, ImageKnob::Vertical, MVerb<float>::BANDWIDTHFREQ));
ImageKnob* const knob(new ImageKnob(this, knobImage, ImageKnob::Vertical));
knob->setId(MVerb<float>::BANDWIDTHFREQ);
knob->setAbsolutePos(56 + 5*40, 40);
knob->setRange(0.0f, 100.0f);
knob->setDefault(50.0f);
@@ -67,7 +70,8 @@ DistrhoUIMVerb::DistrhoUIMVerb()
fKnobs.push_back(knob);
}
{
ImageKnob* const knob(new ImageKnob(this, knobImage, ImageKnob::Vertical, MVerb<float>::DECAY));
ImageKnob* const knob(new ImageKnob(this, knobImage, ImageKnob::Vertical));
knob->setId(MVerb<float>::DECAY);
knob->setAbsolutePos(56 + 6*40, 40);
knob->setRange(0.0f, 100.0f);
knob->setDefault(50.0f);
@@ -75,7 +79,8 @@ DistrhoUIMVerb::DistrhoUIMVerb()
fKnobs.push_back(knob);
}
{
ImageKnob* const knob(new ImageKnob(this, knobImage, ImageKnob::Vertical, MVerb<float>::PREDELAY));
ImageKnob* const knob(new ImageKnob(this, knobImage, ImageKnob::Vertical));
knob->setId(MVerb<float>::PREDELAY);
knob->setAbsolutePos(56 + 1*40, 40);
knob->setRange(0.0f, 100.0f);
knob->setDefault(50.0f);
@@ -83,7 +88,8 @@ DistrhoUIMVerb::DistrhoUIMVerb()
fKnobs.push_back(knob);
}
{
ImageKnob* const knob(new ImageKnob(this, knobImage, ImageKnob::Vertical, MVerb<float>::SIZE));
ImageKnob* const knob(new ImageKnob(this, knobImage, ImageKnob::Vertical));
knob->setId(MVerb<float>::SIZE);
knob->setAbsolutePos(56 + 3*40, 40);
knob->setRange(5.0f, 100.0f);
knob->setDefault(100.0f);
@@ -91,7 +97,8 @@ DistrhoUIMVerb::DistrhoUIMVerb()
fKnobs.push_back(knob);
}
{
ImageKnob* const knob(new ImageKnob(this, knobImage, ImageKnob::Vertical, MVerb<float>::GAIN));
ImageKnob* const knob(new ImageKnob(this, knobImage, ImageKnob::Vertical));
knob->setId(MVerb<float>::GAIN);
knob->setAbsolutePos(56 + 8*40, 40);
knob->setRange(0.0f, 100.0f);
knob->setDefault(75.0f);
@@ -99,7 +106,8 @@ DistrhoUIMVerb::DistrhoUIMVerb()
fKnobs.push_back(knob);
}
{
ImageKnob* const knob(new ImageKnob(this, knobImage, ImageKnob::Vertical, MVerb<float>::MIX));
ImageKnob* const knob(new ImageKnob(this, knobImage, ImageKnob::Vertical));
knob->setId(MVerb<float>::MIX);
knob->setAbsolutePos(56 + 0*40, 40);
knob->setRange(0.0f, 100.0f);
knob->setDefault(50.0f);
@@ -107,7 +115,8 @@ DistrhoUIMVerb::DistrhoUIMVerb()
fKnobs.push_back(knob);
}
{
ImageKnob* const knob(new ImageKnob(this, knobImage, ImageKnob::Vertical, MVerb<float>::EARLYMIX));
ImageKnob* const knob(new ImageKnob(this, knobImage, ImageKnob::Vertical));
knob->setId(MVerb<float>::EARLYMIX);
knob->setAbsolutePos(56 + 2*40, 40);
knob->setRange(0.0f, 100.0f);
knob->setDefault(50.0f);


+ 4
- 2
source/native-plugins/distrho-pingpongpan/DistrhoUIPingPongPan.cpp View File

@@ -38,7 +38,8 @@ DistrhoUIPingPongPan::DistrhoUIPingPongPan()
Image knobImage(DistrhoArtworkPingPongPan::knobData, DistrhoArtworkPingPongPan::knobWidth, DistrhoArtworkPingPongPan::knobHeight);

// knob Low-Mid
fKnobFreq = new ImageKnob(this, knobImage, ImageKnob::Vertical, DistrhoPluginPingPongPan::paramFreq);
fKnobFreq = new ImageKnob(this, knobImage, ImageKnob::Vertical);
fKnobFreq->setId(DistrhoPluginPingPongPan::paramFreq);
fKnobFreq->setAbsolutePos(60, 58);
fKnobFreq->setRange(0.0f, 100.0f);
fKnobFreq->setDefault(50.0f);
@@ -46,7 +47,8 @@ DistrhoUIPingPongPan::DistrhoUIPingPongPan()
fKnobFreq->setCallback(this);

// knob Mid-High
fKnobWidth = new ImageKnob(this, knobImage, ImageKnob::Vertical, DistrhoPluginPingPongPan::paramWidth);
fKnobWidth = new ImageKnob(this, knobImage, ImageKnob::Vertical);
fKnobWidth->setId(DistrhoPluginPingPongPan::paramWidth);
fKnobWidth->setAbsolutePos(182, 58);
fKnobWidth->setRange(0.0f, 100.0f);
fKnobWidth->setDefault(75.0f);


+ 1
- 1
source/utils/CarlaVstUtils.hpp View File

@@ -127,7 +127,7 @@ struct ERect {
#endif
#undef VST_64BIT_PLATFORM
#define VST_64BIT_PLATFORM (defined(_WIN64) || defined(__LP64__) || defined (_LP64))
#include "vst/pluginterfaces/vst2.x/aeffectx.h"
#include "vst2/pluginterfaces/vst2.x/aeffectx.h"
#endif

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


Loading…
Cancel
Save