Browse Source

Really fix build; misc fixes to native and 3bandeq ui

tags/1.9.4
falkTX 12 years ago
parent
commit
0d2bc187e2
12 changed files with 140 additions and 68 deletions
  1. +9
    -1
      source/backend/native/3bandeq/DistrhoUI3BandEQ.cpp
  2. +2
    -0
      source/backend/native/3bandeq/DistrhoUI3BandEQ.hpp
  3. +4
    -4
      source/backend/native/Makefile
  4. +5
    -6
      source/backend/native/distrho/DistrhoPluginCarla.cpp
  5. +76
    -0
      source/backend/plugin/NativePlugin.cpp
  6. +1
    -1
      source/libs/Makefile
  7. +0
    -1
      source/libs/distrho/dgl/src/App.cpp
  8. +6
    -6
      source/libs/distrho/dgl/src/ImageSlider.cpp
  9. +5
    -0
      source/libs/distrho/dgl/src/Widget.cpp
  10. +6
    -2
      source/libs/distrho/dgl/src/Window.cpp
  11. +18
    -40
      source/libs/distrho/src/DistrhoUIInternal.hpp
  12. +8
    -7
      source/libs/distrho/src/DistrhoUIOpenGL.cpp

+ 9
- 1
source/backend/native/3bandeq/DistrhoUI3BandEQ.cpp View File

@@ -73,8 +73,11 @@ DistrhoUI3BandEQ::DistrhoUI3BandEQ()
fKnobLowMid->setCallback(this);

// knob Mid-High
fKnobMidHigh = new ImageKnob(*fKnobLowMid);
fKnobMidHigh = new ImageKnob(win, knobImage);
fKnobMidHigh->setPos(160, 270);
fKnobMidHigh->setRange(1000.0f, 20000.0f);
fKnobMidHigh->setValue(2000.0f);
fKnobMidHigh->setCallback(this);

// about button
Image aboutImageNormal(DistrhoArtwork3BandEQ::aboutButtonNormalData, DistrhoArtwork3BandEQ::aboutButtonNormalWidth, DistrhoArtwork3BandEQ::aboutButtonNormalHeight);
@@ -210,6 +213,11 @@ void DistrhoUI3BandEQ::imageSliderValueChanged(ImageSlider* slider, float value)
d_setParameterValue(DistrhoPlugin3BandEQ::paramMaster, value);
}

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

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

UI* createUI()


+ 2
- 0
source/backend/native/3bandeq/DistrhoUI3BandEQ.hpp View File

@@ -70,6 +70,8 @@ protected:
void imageSliderDragFinished(ImageSlider* slider);
void imageSliderValueChanged(ImageSlider* slider, float value);

void onDisplay();

private:
Image fImgBackground;



+ 4
- 4
source/backend/native/Makefile View File

@@ -83,16 +83,16 @@ $(STATIC): $(OBJS)

# --------------------------------------------------------------

distrho-3bandeq.cpp.o: distrho-3bandeq.cpp
distrho-3bandeq.cpp.o: distrho-3bandeq.cpp 3bandeq/DistrhoArtwork3BandEQ.cpp 3bandeq/DistrhoPlugin3BandEQ.cpp 3bandeq/DistrhoUI3BandEQ.cpp distrho/DistrhoPluginCarla.cpp
$(CXX) $< $(BUILD_CXX_FLAGS) -I3bandeq -DDISTRHO_NAMESPACE=DISTRHO_3BandEQ -c -o $@

distrho-3bandsplitter.cpp.o: distrho-3bandsplitter.cpp
distrho-3bandsplitter.cpp.o: distrho-3bandsplitter.cpp distrho/DistrhoPluginCarla.cpp
$(CXX) $< $(BUILD_CXX_FLAGS) -I3bandsplitter -DDISTRHO_NAMESPACE=DISTRHO_3BandSplitter -c -o $@

distrho-pingpongpan.cpp.o: distrho-pingpongpan.cpp
distrho-pingpongpan.cpp.o: distrho-pingpongpan.cpp distrho/DistrhoPluginCarla.cpp
$(CXX) $< $(BUILD_CXX_FLAGS) -Ipingpongpan -DDISTRHO_NAMESPACE=DISTRHO_PingPongPan -c -o $@

distrho-notes.cpp.o: distrho-notes.cpp moc_DistrhoUINotes.cpp moc_ParamProgressBar.cpp
distrho-notes.cpp.o: distrho-notes.cpp distrho/DistrhoPluginCarla.cpp moc_DistrhoUINotes.cpp moc_ParamProgressBar.cpp
$(CXX) $< $(BUILD_CXX_FLAGS) -Inotes -DDISTRHO_NAMESPACE=DISTRHO_Notes -c -o $@

zynaddsubfx.cpp.o: zynaddsubfx.cpp


+ 5
- 6
source/backend/native/distrho/DistrhoPluginCarla.cpp View File

@@ -19,9 +19,6 @@

#include "DistrhoPluginMain.cpp"

// TODO
//#undef DISTRHO_PLUGIN_HAS_UI

#if DISTRHO_PLUGIN_HAS_UI
#include <QtGui/QMainWindow>
#include "DistrhoUIMain.cpp"
@@ -46,8 +43,9 @@ public:
fUi(this, (intptr_t)fWidget.winId(), editParameterCallback, setParameterCallback, setStateCallback, sendNoteCallback, uiResizeCallback)
{
setCentralWidget(&fWidget);
setFixedSize(fUi.width(), fUi.height());
setWindowTitle(fUi.name());
setWindowTitle(QString("%1 (GUI)").arg(fUi.name()));

uiResize(fUi.width(), fUi.height());
}

~UICarla()
@@ -119,6 +117,7 @@ protected:

void uiResize(unsigned int width, unsigned int height)
{
fWidget.setFixedSize(width, height);
setFixedSize(width, height);
}

@@ -223,7 +222,7 @@ protected:
param.scalePoints = nullptr;

{
int nativeParamHints = 0;
int nativeParamHints = ::PARAMETER_IS_ENABLED;
const uint32_t paramHints = fPlugin.parameterHints(index);

if (paramHints & PARAMETER_IS_AUTOMABLE)


+ 76
- 0
source/backend/plugin/NativePlugin.cpp View File

@@ -1526,6 +1526,82 @@ public:
}
}

// -------------------------------------------------------------------
// Post-poned events

void uiParameterChange(const uint32_t index, const float value)
{
CARLA_ASSERT(fDescriptor != nullptr);
CARLA_ASSERT(fHandle != nullptr);
CARLA_ASSERT(index < kData->param.count);

if (! fIsUiVisible)
return;
if (fDescriptor == nullptr || fHandle == nullptr)
return;
if (index >= kData->param.count)
return;

fDescriptor->ui_set_parameter_value(fHandle, index, value);
}

void uiMidiProgramChange(const uint32_t index)
{
CARLA_ASSERT(fDescriptor != nullptr);
CARLA_ASSERT(fHandle != nullptr);
CARLA_ASSERT(index < kData->midiprog.count);

if (! fIsUiVisible)
return;
if (fDescriptor == nullptr || fHandle == nullptr)
return;
if (index >= kData->midiprog.count)
return;

fDescriptor->ui_set_parameter_value(fHandle, kData->midiprog.data[index].bank, kData->midiprog.data[index].program);
}

void uiNoteOn(const uint8_t channel, const uint8_t note, const uint8_t velo)
{
CARLA_ASSERT(fDescriptor != nullptr);
CARLA_ASSERT(fHandle != nullptr);
CARLA_ASSERT(channel < MAX_MIDI_CHANNELS);
CARLA_ASSERT(note < MAX_MIDI_NOTE);
CARLA_ASSERT(velo > 0 && velo < MAX_MIDI_VALUE);

if (! fIsUiVisible)
return;
if (fDescriptor == nullptr || fHandle == nullptr)
return;
if (channel >= MAX_MIDI_CHANNELS)
return;
if (note >= MAX_MIDI_NOTE)
return;
if (velo >= MAX_MIDI_VALUE)
return;

// TODO
}

void uiNoteOff(const uint8_t channel, const uint8_t note)
{
CARLA_ASSERT(fDescriptor != nullptr);
CARLA_ASSERT(fHandle != nullptr);
CARLA_ASSERT(channel < MAX_MIDI_CHANNELS);
CARLA_ASSERT(note < MAX_MIDI_NOTE);

if (! fIsUiVisible)
return;
if (fDescriptor == nullptr || fHandle == nullptr)
return;
if (channel >= MAX_MIDI_CHANNELS)
return;
if (note >= MAX_MIDI_NOTE)
return;

// TODO
}

// -------------------------------------------------------------------
// Cleanup



+ 1
- 1
source/libs/Makefile View File

@@ -45,6 +45,6 @@ rtmempool_%.a:

clean:
rm -f *.a *.def *.dll *.so
$(MAKE) clean -C dgl
$(MAKE) clean -C distrho/dgl
$(MAKE) clean -C lilv
$(MAKE) clean -C rtmempool

+ 0
- 1
source/libs/distrho/dgl/src/App.cpp View File

@@ -17,7 +17,6 @@
#include "AppPrivate.hpp"

#include "../Window.hpp"
#include "../../DistrhoUtils.hpp"

START_NAMESPACE_DGL



+ 6
- 6
source/libs/distrho/dgl/src/ImageSlider.cpp View File

@@ -122,11 +122,11 @@ void ImageSlider::onDisplay()
if (fStartPos.getX() == fEndPos.getX())
{
x = fStartPos.getX();
y = fStartPos.getY() + normValue*(fEndPos.getY()-fStartPos.getY());
y = fEndPos.getY() - normValue*(fEndPos.getY()-fStartPos.getY());
}
else if (fStartPos.getY() == fEndPos.getY())
{
x = fStartPos.getX() + normValue*(fEndPos.getX()-fStartPos.getX());
x = fEndPos.getX() - normValue*(fEndPos.getX()-fStartPos.getX());
y = fStartPos.getY();
}
else
@@ -160,7 +160,7 @@ bool ImageSlider::onMouse(int button, bool press, int x, int y)
else
return false;

float value = vper * (fMaximum - fMinimum) + fMinimum;
float value = fMaximum - vper * (fMaximum - fMinimum);

if (value < fMinimum)
value = fMinimum;
@@ -212,7 +212,7 @@ bool ImageSlider::onMotion(int x, int y)
vper = float(y - fSliderArea.getY()) / float(fSliderArea.getHeight());
}

float value = vper * (fMaximum - fMinimum) + fMinimum;
float value = fMaximum - vper * (fMaximum - fMinimum);

if (value < fMinimum)
value = fMinimum;
@@ -223,11 +223,11 @@ bool ImageSlider::onMotion(int x, int y)
}
else if (y < fSliderArea.getY())
{
setValue(horizontal ? fMaximum : fMinimum, true);
setValue(fMaximum, true);
}
else
{
setValue(horizontal ? fMinimum : fMaximum, true);
setValue(fMinimum, true);
}

return true;


+ 5
- 0
source/libs/distrho/dgl/src/Widget.cpp View File

@@ -18,6 +18,7 @@
#include "../Widget.hpp"
#include "../Window.hpp"

#include <cassert>
#include <cstdio>

START_NAMESPACE_DGL
@@ -29,11 +30,14 @@ Widget::Widget(Window* parent)
: fParent(parent),
fVisible(true)
{
assert(parent != nullptr);

parent->addWidget(this);
}

Widget::~Widget()
{
fParent->removeWidget(this);
}

bool Widget::isVisible()
@@ -212,6 +216,7 @@ bool Widget::onSpecial(bool, Key)

void Widget::onReshape(int width, int height)
{
printf("Reshape(%i, %i)\n", width, height);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glMatrixMode(GL_PROJECTION);


+ 6
- 2
source/libs/distrho/dgl/src/Window.cpp View File

@@ -39,6 +39,8 @@

START_NAMESPACE_DGL

Window* dgl_lastUiParent = nullptr;

// -------------------------------------------------
// Window Private

@@ -49,10 +51,10 @@ public:
: kApp(app),
kAppPriv(appPriv),
kSelf(self),
kView(puglCreate(parentId, "Window", 600, 500, false, false)),
kView(puglCreate(parentId, "Window", 600, 500, (parentId != 0), (parentId != 0))),
fParent(parent),
fChildFocus(nullptr),
fVisible(false),
fVisible((parentId != 0)),
fClosed(false),
fResizable(false),
#if DGL_OS_WINDOWS
@@ -491,11 +493,13 @@ private:
Window::Window(App* app, Window* parent)
: kPrivate(new Private(this, app, app->kPrivate, (parent != nullptr) ? parent->kPrivate : nullptr))
{
dgl_lastUiParent = this;
}

Window::Window(App* app, intptr_t parentId)
: kPrivate(new Private(this, app, app->kPrivate, nullptr, parentId))
{
dgl_lastUiParent = this;
}

Window::~Window()


+ 18
- 40
source/libs/distrho/src/DistrhoUIInternal.hpp View File

@@ -34,6 +34,8 @@
# endif
#endif

#include <cassert>

START_NAMESPACE_DISTRHO

// -------------------------------------------------
@@ -44,10 +46,7 @@ typedef void (*setStateFunc) (void* ptr, const char* key, const char* value);
typedef void (*sendNoteFunc) (void* ptr, bool onOff, uint8_t channel, uint8_t note, uint8_t velo);
typedef void (*uiResizeFunc) (void* ptr, unsigned int width, unsigned int height);

extern double d_lastUiSampleRate;
#ifdef DISTRHO_UI_OPENGL
extern Window* d_lastUiParent;
#endif
extern double d_lastUiSampleRate;

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

@@ -144,7 +143,8 @@ public:
: qtGrip(nullptr),
qtWidget(nullptr),
#else
: glWindow(createWindow(winId)),
: glApp(),
glWindow(&glApp, winId),
#endif
kUi(createUI()),
kData((kUi != nullptr) ? kUi->pData : nullptr)
@@ -171,7 +171,9 @@ public:
{
if (kUi != nullptr)
{
#ifdef DISTRHO_UI_QT4
destroyWindow();
#endif
delete kUi;
}
}
@@ -240,10 +242,11 @@ public:

void idle()
{
assert(kUi != nullptr);

if (kUi != nullptr)
kUi->d_uiIdle();
#ifdef DISTRHO_UI_QT4
kUi->d_uiIdle();
#else
glApp.idle();
#endif
}

intptr_t getWinId()
@@ -252,8 +255,7 @@ public:
assert(qtWidget != nullptr);
return (qtWidget != nullptr) ? qtWidget->winId() : 0;
#else
assert(glWindow != nullptr);
return (glWindow != nullptr) ? glWindow->getWindowId() : 0;
return glWindow.getWindowId();
#endif
}

@@ -264,7 +266,6 @@ public:
{
assert(kUi != nullptr);
assert(kData != nullptr);
assert(kData->widget != nullptr);
assert(qtGrip == nullptr);
assert(qtWidget == nullptr);

@@ -284,7 +285,7 @@ public:

// set layout
qtWidget->setLayout(new QVBoxLayout(qtWidget));
qtWidget->layout()->addWidget(kData->widget);
qtWidget->layout()->addWidget(qt4Ui);
qtWidget->layout()->setContentsMargins(0, 0, 0, 0);
qtWidget->setFixedSize(kUi->d_width(), kUi->d_height());

@@ -310,20 +311,10 @@ public:
// show it
qtWidget->show();
}
#else
Window* createWindow(intptr_t parent)
{
Window* window = new Window(&glApp, parent);
d_lastUiParent = window;
return window;
}
#endif

void destroyWindow()
{
#ifdef DISTRHO_UI_QT4
assert(kData != nullptr);
assert(kData->widget != nullptr);
assert(qtWidget != nullptr);

if (kData == nullptr)
@@ -351,20 +342,8 @@ public:

delete qtWidget;
qtWidget = nullptr;
#else
assert(kData != nullptr);
assert(glWindow != nullptr);

if (kData == nullptr)
return;
if (glWindow == nullptr)
return;

glWindow->hide();
delete glWindow;
glWindow = nullptr;
#endif
}
#endif

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

@@ -373,8 +352,8 @@ private:
QSizeGrip* qtGrip;
QEmbedWidget* qtWidget;
#else
App glApp;
Window* glWindow;
App glApp;
Window glWindow;
#endif

protected:
@@ -386,8 +365,7 @@ protected:
{
assert(kUi != nullptr);
assert(kData != nullptr);
assert(kData->widget != nullptr);
assert(qtGrip != nullptr);
//assert(qtGrip != nullptr);
assert(qtWidget != nullptr);

if (kUi == nullptr)


+ 8
- 7
source/libs/distrho/src/DistrhoUIOpenGL.cpp View File

@@ -16,21 +16,22 @@

#include "DistrhoUIInternal.hpp"

START_NAMESPACE_DISTRHO

// -------------------------------------------------
// Static data
START_NAMESPACE_DGL
extern Window* dgl_lastUiParent;
END_NAMESPACE_DGL

Window* d_lastParent = nullptr;
START_NAMESPACE_DISTRHO

// -------------------------------------------------
// OpenGLUI

OpenGLUI::OpenGLUI()
: UI(),
Widget(d_lastParent)
Widget(dgl_lastUiParent)
{
d_lastParent = nullptr;
assert(dgl_lastUiParent != nullptr);

dgl_lastUiParent = nullptr;
}

OpenGLUI::~OpenGLUI()


Loading…
Cancel
Save