Browse Source

More work on DISTRHO, update to latest zynaddsubfx code

tags/1.9.4
falkTX 11 years ago
parent
commit
f1514311cf
30 changed files with 1383 additions and 4597 deletions
  1. +1
    -1
      source/backend/engine/Makefile
  2. +4
    -5
      source/backend/native/3bandeq/DistrhoUI3BandEQ.cpp
  3. +2
    -0
      source/backend/native/3bandeq/DistrhoUI3BandEQ.hpp
  4. +58
    -0
      source/backend/native/distrho-stereoenhancer.cpp
  5. +1
    -1
      source/backend/native/distrho/DistrhoPluginCarla.cpp
  6. +8
    -1
      source/backend/native/zynaddsubfx/CMakeLists.txt
  7. +1
    -1
      source/backend/native/zynaddsubfx/Effects/DynamicFilter.cpp
  8. +7
    -0
      source/backend/native/zynaddsubfx/Misc/Config.cpp
  9. +1
    -0
      source/backend/native/zynaddsubfx/Misc/Config.h
  10. +3
    -0
      source/backend/native/zynaddsubfx/Misc/Master.cpp
  11. +119
    -0
      source/backend/native/zynaddsubfx/Tests/PluginTest.h
  12. +1022
    -1023
      source/backend/native/zynaddsubfx/Tests/guitar-adnote.xmz
  13. +26
    -18
      source/backend/native/zynaddsubfx/UI/ConfigUI.fl
  14. +1
    -1
      source/backend/native/zynaddsubfx/UI/NioUI.cpp
  15. +1
    -4
      source/backend/native/zynaddsubfx/UI/PresetsUI.fl
  16. +0
    -286
      source/backend/native/zynaddsubfx/zynaddsubfx_icon.svg
  17. +6
    -3
      source/libs/distrho/dgl/Image.hpp
  18. +4
    -1
      source/libs/distrho/dgl/ImageAboutWindow.hpp
  19. +13
    -0
      source/libs/distrho/dgl/StandaloneWindow.hpp
  20. +1
    -1
      source/libs/distrho/dgl/Window.hpp
  21. +6
    -0
      source/libs/distrho/dgl/src/App.cpp
  22. +3
    -0
      source/libs/distrho/dgl/src/AppPrivate.hpp
  23. +18
    -3
      source/libs/distrho/dgl/src/Image.cpp
  24. +17
    -2
      source/libs/distrho/dgl/src/ImageAboutWindow.cpp
  25. +1
    -1
      source/libs/distrho/dgl/src/Widget.cpp
  26. +50
    -36
      source/libs/distrho/dgl/src/Window.cpp
  27. +0
    -61
      source/tests/DGL.cpp
  28. +0
    -3128
      source/tests/DGL_Artwork.cpp
  29. +0
    -15
      source/tests/DGL_Artwork.hpp
  30. +9
    -5
      source/tests/Makefile

+ 1
- 1
source/backend/engine/Makefile View File

@@ -84,7 +84,7 @@ TARGETp = ../libcarla_engine_plugin.a
all: $(TARGET) $(TARGETp)

clean:
rm -f $(OBJS) $(TARGET)
rm -f $(OBJS) $(OBJSp) $(TARGET) $(TARGETp)

debug:
$(MAKE) DEBUG=true


+ 4
- 5
source/backend/native/3bandeq/DistrhoUI3BandEQ.cpp View File

@@ -16,14 +16,13 @@

#include "DistrhoUI3BandEQ.hpp"

#include "dgl/ImageAboutWindow.hpp"

START_NAMESPACE_DISTRHO

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

DistrhoUI3BandEQ::DistrhoUI3BandEQ()
: OpenGLUI()
: OpenGLUI(),
fAboutWindow(this)
{
Window* win = getParent();

@@ -151,8 +150,8 @@ void DistrhoUI3BandEQ::imageButtonClicked(ImageButton* button, int)
return;

Image imageAbout(DistrhoArtwork3BandEQ::aboutData, DistrhoArtwork3BandEQ::aboutWidth, DistrhoArtwork3BandEQ::aboutHeight, GL_BGR);
ImageAboutWindow aboutWindow(getApp(), getParent(), imageAbout);
aboutWindow.exec();
fAboutWindow.setImage(imageAbout);
fAboutWindow.exec();
}

void DistrhoUI3BandEQ::imageKnobDragStarted(ImageKnob* knob)


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

@@ -18,6 +18,7 @@
#define __DISTRHO_UI_3BANDEQ_HPP__

#include "DistrhoUIOpenGL.hpp"
#include "dgl/ImageAboutWindow.hpp"
#include "dgl/ImageButton.hpp"
#include "dgl/ImageKnob.hpp"
#include "dgl/ImageSlider.hpp"
@@ -73,6 +74,7 @@ protected:

private:
Image fImgBackground;
ImageAboutWindow fAboutWindow;

ImageSlider* fSliderLow;
ImageSlider* fSliderMid;


+ 58
- 0
source/backend/native/distrho-stereoenhancer.cpp View File

@@ -0,0 +1,58 @@
/*
* Carla Native Plugins
* Copyright (C) 2012-2013 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
* published by the Free Software Foundation; either version 2 of
* the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For a full copy of the GNU General Public License see the GPL.txt file
*/

#include "CarlaNative.hpp"

// Plugin Code
#include "stereoenhancer/DistrhoArtworkStereoEnhancer.cpp"
#include "stereoenhancer/DistrhoPluginStereoEnhancer.cpp"
#include "stereoenhancer/DistrhoUIStereoEnhancer.cpp"

// Carla DISTRHO Plugin
#include "distrho/DistrhoPluginCarla.cpp"

START_NAMESPACE_DISTRHO

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

static const PluginDescriptor stereoenhancerDesc = {
/* category */ PLUGIN_CATEGORY_EQ,
/* hints */ static_cast<PluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_HAS_GUI),
/* audioIns */ DISTRHO_PLUGIN_NUM_INPUTS,
/* audioOuts */ DISTRHO_PLUGIN_NUM_OUTPUTS,
/* midiIns */ 0,
/* midiOuts */ 0,
/* paramIns */ DistrhoPluginStereoEnhancer::paramCount,
/* paramOuts */ 0,
/* name */ DISTRHO_PLUGIN_NAME,
/* label */ "StereoEnhancer",
/* maker */ "falkTX",
/* copyright */ "LGPL",
PluginDescriptorFILL(PluginCarla)
};

END_NAMESPACE_DISTRHO

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

void carla_register_native_plugin_StereoEnhancer()
{
USE_NAMESPACE_DISTRHO
carla_register_native_plugin(&stereoenhancerDesc);
}

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

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

@@ -430,7 +430,7 @@ protected:
{
CARLA_ASSERT(fUiPtr != nullptr);

uint32_t realProgram = bank * 128 + program;
const uint32_t realProgram(bank * 128 + program);

if (realProgram >= fPlugin.programCount())
return;


+ 8
- 1
source/backend/native/zynaddsubfx/CMakeLists.txt View File

@@ -29,6 +29,10 @@ mark_as_advanced(DSSI_LIBRARIES)
pkg_search_module(LIBLO liblo>=0.26)
mark_as_advanced(LIBLO_LIBRARIES)

execute_process(COMMAND echo fistpl 0
COMMAND as -
ERROR_VARIABLE AVOID_ASM)

######### Settings ###########
# NOTE: These cache variables should normally not be changed in this
# file, but either in in CMakeCache.txt before compile, or by passing
@@ -180,11 +184,14 @@ endif()
include_directories(${ZLIB_INCLUDE_DIRS} ${MXML_INCLUDE_DIRS})

add_definitions(
-DASM_F2I_YES
-g #TODO #todo put in a better location
-Wall
-Wextra
)
if(NOT AVOID_ASM)
message(STATUS "Compiling with x86 opcode support")
add_definitions(-DASM_F2I_YES)
endif()

if (BuildForDebug)
set (CMAKE_BUILD_TYPE "Debug")


+ 1
- 1
source/backend/native/zynaddsubfx/Effects/DynamicFilter.cpp View File

@@ -65,7 +65,7 @@ void DynamicFilter::out(const Stereo<float *> &smp)
efxoutl[i] = smp.l[i];
efxoutr[i] = smp.r[i];

const float x = (fabsf(smp.l[i]) + fabsf(smp.l[i])) * 0.5f;
const float x = (fabsf(smp.l[i]) + fabsf(smp.r[i])) * 0.5f;
ms1 = ms1 * (1.0f - ampsmooth) + x * ampsmooth + 1e-10;
}



+ 7
- 0
source/backend/native/zynaddsubfx/Misc/Config.cpp View File

@@ -59,6 +59,7 @@ void Config::init()

cfg.Interpolation = 0;
cfg.CheckPADsynth = 1;
cfg.IgnoreProgramChange = 0;

cfg.UserInterfaceMode = 0;
cfg.VirKeybLayout = 1;
@@ -185,6 +186,11 @@ void Config::readConfig(const char *filename)
0,
1);

cfg.IgnoreProgramChange = xmlcfg.getpar("ignore_program_change",
cfg.IgnoreProgramChange,
0,
1);


cfg.UserInterfaceMode = xmlcfg.getpar("user_interface_mode",
cfg.UserInterfaceMode,
@@ -252,6 +258,7 @@ void Config::saveConfig(const char *filename)
xmlcfg->addpar("gzip_compression", cfg.GzipCompression);

xmlcfg->addpar("check_pad_synth", cfg.CheckPADsynth);
xmlcfg->addpar("ignore_program_change", cfg.IgnoreProgramChange);

xmlcfg->addparstr("bank_current", cfg.currentBankDir);



+ 1
- 0
source/backend/native/zynaddsubfx/Misc/Config.h View File

@@ -47,6 +47,7 @@ class Config
std::string bankRootDirList[MAX_BANK_ROOT_DIRS], currentBankDir;
std::string presetsDirList[MAX_BANK_ROOT_DIRS];
int CheckPADsynth;
int IgnoreProgramChange;
int UserInterfaceMode;
int VirKeybLayout;
std::string LinuxALSAaudioDev;


+ 3
- 0
source/backend/native/zynaddsubfx/Misc/Master.cpp View File

@@ -235,6 +235,9 @@ void Master::setController(char chan, int type, int par)

void Master::setProgram(char chan, unsigned int pgm)
{
if(config.cfg.IgnoreProgramChange)
return;

for(int npart = 0; npart < NUM_MIDI_PARTS; ++npart)
if(chan == part[npart]->Prcvchn) {
bank.loadfromslot(pgm, part[npart]);


+ 119
- 0
source/backend/native/zynaddsubfx/Tests/PluginTest.h View File

@@ -0,0 +1,119 @@
/*
ZynAddSubFX - a software synthesizer

PluginTest.h - CxxTest for embedding zyn
Copyright (C) 2013-2013 Mark McCurry
Authors: Mark McCurry

This program is free software; you can redistribute it and/or modify
it under the terms of version 2 of the GNU General Public License
as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License (version 2 or later) for more details.

You should have received a copy of the GNU General Public License (version 2)
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

*/
#include <cxxtest/TestSuite.h>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <string>
#include "../Misc/Master.h"
#include "../Misc/Util.h"
#include "../globals.h"
SYNTH_T *synth;

using namespace std;

char *instance_name=(char*)"";

class PluginTest:public CxxTest::TestSuite
{
public:
void setUp() {
synth = new SYNTH_T;
synth->buffersize = 256;
synth->samplerate = 48000;
synth->alias();

outL = new float[1024];
for(int i = 0; i < synth->buffersize; ++i)
outL[i] = 0.0f;
outR = new float[1024];
for(int i = 0; i < synth->buffersize; ++i)
outR[i] = 0.0f;

//next the bad global variables that for some reason have not been properly placed in some
//initialization routine, but rather exist as cryptic oneliners in main.cpp:
denormalkillbuf = new float[synth->buffersize];
for(int i = 0; i < synth->buffersize; ++i)
denormalkillbuf[i] = 0;

for(int i = 0; i < 16; ++i)
master[i] = new Master();
}

void tearDown() {
for(int i = 0; i < 16; ++i)
delete master[i];

delete[] outL;
delete[] outR;
delete synth;
}


void testInit() {

for(int x=0; x<100; ++x)
for(int i=0; i<16; ++i)
master[i]->GetAudioOutSamples(rand()%1025,
synth->samplerate, outL, outR);
}

void testPanic()
{
master[0]->setController(0, 0x64, 0);
master[0]->noteOn(0,64,64);
master[0]->AudioOut(outL, outR);

float sum = 0.0f;
for(int i = 0; i < synth->buffersize; ++i)
sum += fabs(outL[i]);

TS_ASSERT_LESS_THAN(0.1f, sum);
}

string loadfile(string fname) const
{
std::ifstream t(fname.c_str());
std::string str((std::istreambuf_iterator<char>(t)),
std::istreambuf_iterator<char>());
return str;
}


void testLoadSave(void)
{
const string fname = string(SOURCE_DIR) + "/guitar-adnote.xmz";
const string fdata = string("\n") + loadfile(fname);
char *result = NULL;
master[0]->putalldata((char*)fdata.c_str(), fdata.length());
int res = master[0]->getalldata(&result);

TS_ASSERT_EQUALS(fdata.length()+1, res);
TS_ASSERT(fdata == result);
}


private:
float *outR, *outL;
Master *master[16];
};

+ 1022
- 1023
source/backend/native/zynaddsubfx/Tests/guitar-adnote.xmz
File diff suppressed because it is too large
View File


+ 26
- 18
source/backend/native/zynaddsubfx/UI/ConfigUI.fl View File

@@ -1,33 +1,35 @@
# data file for the Fltk User Interface Designer (fluid)
version 1.0107
version 1.0300
header_name {.h}
code_name {.cc}
decl {//Copyright (c) 2002-2005 Nasca Octavian Paul} {}
decl {//Copyright (c) 2002-2005 Nasca Octavian Paul} {private local
}

decl {//License: GNU GPL version 2 or later} {}
decl {//License: GNU GPL version 2 or later} {private local
}

decl {\#include <stdio.h>} {public
decl {\#include <stdio.h>} {public local
}

decl {\#include <math.h>} {public
decl {\#include <math.h>} {public local
}

decl {\#include <stdlib.h>} {public
decl {\#include <stdlib.h>} {public local
}

decl {\#include <FL/Fl_File_Chooser.H>} {public
decl {\#include <FL/Fl_File_Chooser.H>} {public local
}

decl {\#include "../globals.h"} {public
decl {\#include "../globals.h"} {public local
}

decl {\#include "../Misc/Util.h"} {public
decl {\#include "../Misc/Util.h"} {public local
}

decl {\#include "../Misc/Dump.h"} {public
decl {\#include "../Misc/Dump.h"} {public local
}

decl {extern Dump dump;} {public
decl {extern Dump dump;} {public local
}

class ConfigUI {} {
@@ -36,14 +38,14 @@ class ConfigUI {} {
label {ZynAddSubFX Settings}
callback {writebankcfg();
o->hide();}
xywh {88 313 510 340} type Double hide
xywh {554 443 510 370} type Double visible
} {
Fl_Tabs {} {
xywh {5 5 500 305}
xywh {5 5 500 330}
} {
Fl_Group {} {
label {Main settings}
xywh {5 25 500 285}
xywh {5 25 500 310}
} {
Fl_Group {} {
label {Sample Rate}
@@ -157,18 +159,18 @@ config.cfg.SoundBufferSize=strtoul(o->value(),&tmp,10);}
}
Fl_Box {} {
label {Most settings has effect only after ZynAddSubFX is restarted.}
xywh {15 275 235 30} labelfont 1 labelsize 11 align 128
xywh {10 300 235 30} labelfont 1 labelsize 11 align 128
}
Fl_Box {} {
label {Read the Readme.txt for other settings}
xywh {10 255 240 20} labelfont 1 labelsize 11 align 128
xywh {10 280 240 15} labelfont 1 labelsize 11 align 128
}
Fl_Group {} {
xywh {15 125 230 85} box ENGRAVED_BOX
} {
Fl_File_Input {} {
label {Dump File}
callback {config.cfg.DumpFile = o->value();} selected
callback {config.cfg.DumpFile = o->value();}
xywh {20 170 220 35} align 5
code0 {o->insert(config.cfg.DumpFile.c_str());}
}
@@ -277,6 +279,12 @@ midiinputnamebox->label(config.winmididevices[config.cfg.WindowsMidiInId].name);
xywh {45 45 100 20} labelfont 1 labelsize 11
}
}
Fl_Check_Button {} {
label {Ignore MIDI Program Change}
callback {config.cfg.IgnoreProgramChange=(int) o->value();}
xywh {10 255 230 20} down_box DOWN_BOX
code0 {o->value(config.cfg.IgnoreProgramChange);}
}
}
Fl_Group {} {
label {Bank root dirs}
@@ -364,7 +372,7 @@ activatebutton_presetdir(true);}
callback {configwindow->hide();
writebankcfg();
writepresetcfg();}
xywh {200 315 105 20} box THIN_UP_BOX
xywh {200 345 105 20} box THIN_UP_BOX
}
}
}


+ 1
- 1
source/backend/native/zynaddsubfx/UI/NioUI.cpp View File

@@ -14,7 +14,7 @@
using namespace std;

NioUI::NioUI()
:Fl_Window(400, 400, "New IO Controls")
:Fl_Window(200, 100, 400, 400, "New IO Controls")
{
//hm, I appear to be leaking memory
Fl_Group *settings = new Fl_Group(0, 20, 400, 400 - 35, "Settings");


+ 1
- 4
source/backend/native/zynaddsubfx/UI/PresetsUI.fl View File

@@ -207,8 +207,5 @@ for (unsigned int i=0;i<presetsstore.presets.size();i++){
}
}

decl {extern __thread PresetsUI *presetsui;} {public
}

decl {__thread PresetsUI *presetsui;} {private
decl {PresetsUI *presetsui;} {public
}

+ 0
- 286
source/backend/native/zynaddsubfx/zynaddsubfx_icon.svg View File

@@ -1,286 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
id="svg1"
sodipodi:version="0.32"
inkscape:version="0.39"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://web.resource.org/cc/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
width="210mm"
height="297mm"
sodipodi:docbase="/home/nop"
sodipodi:docname="zynaddsubfx.svg">
<defs
id="defs3">
<linearGradient
id="linearGradient4809">
<stop
style="stop-color:#d5d8db;stop-opacity:1.0000000;"
offset="0.0000000"
id="stop4810" />
<stop
style="stop-color:#6d8ec2;stop-opacity:1.0000000;"
offset="1.0000000"
id="stop4811" />
</linearGradient>
<linearGradient
id="linearGradient4179">
<stop
style="stop-color:#bec8c6;stop-opacity:1.0000000;"
offset="0.0000000"
id="stop4180" />
<stop
style="stop-color:#bbcac9;stop-opacity:1.0000000;"
offset="0.59527779"
id="stop4182" />
<stop
style="stop-color:#879797;stop-opacity:1.0000000;"
offset="1.0000000"
id="stop4181" />
</linearGradient>
<linearGradient
id="linearGradient4038">
<stop
style="stop-color:#4a8a61;stop-opacity:1.0000000;"
offset="0.0000000"
id="stop4039" />
<stop
style="stop-color:#557c7d;stop-opacity:1.0000000;"
offset="1.0000000"
id="stop4040" />
</linearGradient>
<linearGradient
id="linearGradient2162">
<stop
style="stop-color:#549c6d;stop-opacity:1.0000000;"
offset="0.0000000"
id="stop2163" />
<stop
style="stop-color:#679697;stop-opacity:1.0000000;"
offset="1.0000000"
id="stop2164" />
</linearGradient>
<linearGradient
id="linearGradient2158">
<stop
style="stop-color:#dbdbdb;stop-opacity:1.0000000;"
offset="0.0000000"
id="stop2159" />
<stop
style="stop-color:#a1aec2;stop-opacity:1.0000000;"
offset="1.0000000"
id="stop2160" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient2158"
id="radialGradient2165"
cx="0.15540540"
cy="0.21093750"
r="0.97186714"
fx="0.14189187"
fy="0.20312500" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4038"
id="linearGradient4043"
x1="-0.042253520"
y1="0.50000000"
x2="0.92957747"
y2="0.25781250" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4809"
id="radialGradient4184"
cx="0.25423729"
cy="0.34375000"
r="0.69531035"
fx="0.26271194"
fy="0.33593792"
spreadMethod="pad"
gradientUnits="objectBoundingBox" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.15349816"
inkscape:cx="305.25996"
inkscape:cy="588.90466"
inkscape:window-width="812"
inkscape:window-height="582"
inkscape:window-x="100"
inkscape:window-y="50"
showguides="true"
inkscape:guide-bbox="true" />
<metadata
id="metadata4">
<rdf:RDF
id="RDF5">
<cc:Work
rdf:about=""
id="Work6">
<dc:format
id="format7">image/svg+xml</dc:format>
<dc:type
id="type9"
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<rect
style="fill:#000000;fill-opacity:1.0000000;fill-rule:evenodd;stroke:#000000;stroke-width:2.1387453pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;"
id="rect2793"
width="497.32657"
height="497.92426"
x="135.99535"
y="56.972706"
rx="10.000000"
ry="10.000001" />
<rect
style="fill:url(#radialGradient2165);fill-opacity:0.75000000;fill-rule:evenodd;stroke:#c7ffc7;stroke-width:2.6750000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000;"
id="rect1532"
width="497.32657"
height="497.92426"
x="128.79752"
y="48.335308"
rx="10.000000"
ry="10.000001" />
<g
id="g4871"
transform="matrix(1.000000,0.000000,0.000000,0.721530,4.071710,-76.99862)">
<rect
style="fill:url(#linearGradient4043);fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.5086593pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;"
id="rect2794"
width="374.55670"
height="328.96643"
x="144.30453"
y="199.03429"
rx="10.000001"
ry="13.859430" />
<path
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#fafafa;stroke-width:20.000000;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000;"
d="M 153.53968,361.37008 C 224.07845,562.90944 263.89796,571.59568 330.99807,367.47765 C 397.67095,164.65924 435.24317,161.86656 507.22152,367.72463"
id="path4175"
sodipodi:nodetypes="czc" />
<path
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:7.3750000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000;"
d="M 145.99255,362.80964 C 515.96124,362.80964 515.36495,364.24921 515.36495,364.24921"
id="path4176"
sodipodi:nodetypes="cc" />
</g>
<g
id="g4852"
transform="matrix(-1.360555,0.352222,-0.352222,-1.360555,324.1433,630.0333)">
<path
sodipodi:type="arc"
style="fill:url(#radialGradient4184);fill-opacity:0.75000000;fill-rule:evenodd;stroke:none;stroke-width:1.2507370;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000;"
id="path4853"
sodipodi:cx="16.555019"
sodipodi:cy="147.59439"
sodipodi:rx="46.785923"
sodipodi:ry="43.906792"
d="M 63.340942 147.59439 A 46.785923 43.906792 0 1 0 -30.230904,147.59439 A 46.785923 43.906792 0 1 0 63.340942 147.59439 z"
transform="matrix(1.045432,0.000000,0.000000,1.113986,-125.3003,-37.14836)" />
<path
sodipodi:type="arc"
style="fill:none;fill-opacity:0.087719269;fill-rule:evenodd;stroke:#000000;stroke-width:11.857302;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-dasharray:11.857302 23.714604 ;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;"
id="path4854"
sodipodi:cx="16.555019"
sodipodi:cy="147.59439"
sodipodi:rx="46.785923"
sodipodi:ry="43.906792"
d="M 63.340942 147.59439 A 46.785923 43.906792 0 1 0 -30.230904,147.59439 A 46.785923 43.906792 0 1 0 63.340942 147.59439 z"
transform="matrix(1.162718,0.507361,-0.579194,1.268918,-39.94742,-66.78193)" />
<path
style="fill:#000000;fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;"
d="M -108.49675,123.27211 C -71.611637,112.47038 -68.592698,110.81196 -68.592698,110.81196 L -102.05452,134.07127 L -108.49675,123.27211 z "
id="path4855"
sodipodi:nodetypes="cccc" />
</g>
<g
id="g4864"
transform="matrix(0.687211,0.000000,0.000000,0.854478,627.1311,-28.81607)">
<rect
style="fill:#000000;fill-opacity:0.75000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;"
id="rect4856"
width="110.64801"
height="545.60913"
x="-136.40228"
y="109.76131" />
<rect
style="fill:#00bc1a;fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;"
id="rect4857"
width="39.393082"
height="442.41235"
x="-128.61479"
y="205.44652" />
<rect
style="fill:#00bc1a;fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;"
id="rect4858"
width="37.357227"
height="525.88245"
x="-74.664627"
y="120.64261" />
<rect
style="fill:#000000;fill-opacity:0.17543860;fill-rule:evenodd;stroke:none;stroke-width:0.91707621pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;"
id="rect4860"
width="95.883904"
height="12.215130"
x="-128.35823"
y="221.73334" />
<rect
style="fill:#000000;fill-opacity:0.17543860;fill-rule:evenodd;stroke:none;stroke-width:0.91707621pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;"
id="rect4862"
width="95.883904"
height="12.215130"
x="-129.37616"
y="563.75702" />
<rect
style="fill:#000000;fill-opacity:0.17543860;fill-rule:evenodd;stroke:none;stroke-width:0.91707621pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;"
id="rect4863"
width="95.883904"
height="12.215130"
x="-127.34029"
y="386.63760" />
</g>
<g
id="g4875"
transform="matrix(-1.360555,0.352222,-0.352222,-1.360555,130.9140,634.1877)">
<path
sodipodi:type="arc"
style="fill:url(#radialGradient4184);fill-opacity:0.75000000;fill-rule:evenodd;stroke:none;stroke-width:1.2507370;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000;"
id="path4876"
sodipodi:cx="16.555019"
sodipodi:cy="147.59439"
sodipodi:rx="46.785923"
sodipodi:ry="43.906792"
d="M 63.340942 147.59439 A 46.785923 43.906792 0 1 0 -30.230904,147.59439 A 46.785923 43.906792 0 1 0 63.340942 147.59439 z"
transform="matrix(1.045432,0.000000,0.000000,1.113986,-125.3003,-37.14836)" />
<path
sodipodi:type="arc"
style="fill:none;fill-opacity:0.087719269;fill-rule:evenodd;stroke:#000000;stroke-width:11.857302;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-dasharray:11.857302 23.714604 ;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;"
id="path4877"
sodipodi:cx="16.555019"
sodipodi:cy="147.59439"
sodipodi:rx="46.785923"
sodipodi:ry="43.906792"
d="M 63.340942 147.59439 A 46.785923 43.906792 0 1 0 -30.230904,147.59439 A 46.785923 43.906792 0 1 0 63.340942 147.59439 z"
transform="matrix(1.162718,0.507361,-0.579194,1.268918,-39.94742,-66.78193)" />
<path
style="fill:#000000;fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;"
d="M -108.49675,123.27211 C -71.611637,112.47038 -68.592698,110.81196 -68.592698,110.81196 L -102.05452,134.07127 L -108.49675,123.27211 z "
id="path4878"
sodipodi:nodetypes="cccc" />
</g>
</svg>

+ 6
- 3
source/libs/distrho/dgl/Image.hpp View File

@@ -31,6 +31,7 @@ public:
Image(const char* rawData, const Size<int>& size, GLenum format = GL_BGRA, GLenum type = GL_UNSIGNED_BYTE);
Image(const Image& image);

void loadFromMemory(const char* rawData, int width, int height, GLenum format = GL_BGRA, GLenum type = GL_UNSIGNED_BYTE);
void loadFromMemory(const char* rawData, const Size<int>& size, GLenum format = GL_BGRA, GLenum type = GL_UNSIGNED_BYTE);

bool isValid() const;
@@ -43,11 +44,13 @@ public:
GLenum getFormat() const;
GLenum getType() const;

void draw();
void draw(int x, int y);
void draw(const Point<int>& pos);
void draw() const;
void draw(int x, int y) const;
void draw(const Point<int>& pos) const;

Image& operator=(const Image& image);
bool operator==(const Image& image) const;
bool operator!=(const Image& image) const;

private:
const char* fRawData;


+ 4
- 1
source/libs/distrho/dgl/ImageAboutWindow.hpp View File

@@ -35,7 +35,10 @@ class ImageAboutWindow : public Window,
public Widget
{
public:
ImageAboutWindow(App* app, Window* parent, const Image& image);
ImageAboutWindow(App* app, Window* parent, const Image& image = Image());
ImageAboutWindow(Widget* widget, const Image& image = Image());

void setImage(const Image& image);

protected:
void onDisplay();


+ 13
- 0
source/libs/distrho/dgl/StandaloneWindow.hpp View File

@@ -50,6 +50,19 @@ public:
fApp.exec();
}

// ----------------------------------------------------
// helpers

void setSize(unsigned int width, unsigned int height)
{
fWindow.setSize(width, height);
}

void setWindowTitle(const char* title)
{
fWindow.setWindowTitle(title);
}

private:
App fApp;
Window fWindow;


+ 1
- 1
source/libs/distrho/dgl/Window.hpp View File

@@ -33,7 +33,7 @@ public:
Window(App* app, intptr_t parentId);
virtual ~Window();

void exec();
void exec(bool lock = false);
void focus();
void idle();
void repaint();


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

@@ -53,6 +53,12 @@ void App::exec()
void App::quit()
{
kPrivate->fDoLoop = false;

for (std::list<Window*>::iterator it = kPrivate->fWindows.begin(); it != kPrivate->fWindows.end(); ++it)
{
Window* const window(*it);
window->close();
}
}

bool App::isQuiting() const


+ 3
- 0
source/libs/distrho/dgl/src/AppPrivate.hpp View File

@@ -56,6 +56,9 @@ public:
void oneShown()
{
++fVisibleWindows;

if (fVisibleWindows == 1)
fDoLoop = true;
}

void oneHidden()


+ 18
- 3
source/libs/distrho/dgl/src/Image.cpp View File

@@ -52,6 +52,11 @@ Image::Image(const Image& image)
{
}

void Image::loadFromMemory(const char* rawData, int width, int height, GLenum format, GLenum type)
{
loadFromMemory(rawData, Size<int>(width, height), format, type);
}

void Image::loadFromMemory(const char* rawData, const Size<int>& size, GLenum format, GLenum type)
{
fRawData = rawData;
@@ -95,12 +100,12 @@ GLenum Image::getType() const
return fType;
}

void Image::draw()
void Image::draw() const
{
draw(0, 0);
}

void Image::draw(int x, int y)
void Image::draw(int x, int y) const
{
if (! isValid())
return;
@@ -111,7 +116,7 @@ void Image::draw(int x, int y)
glDrawPixels(fSize.getWidth(), fSize.getHeight(), fFormat, fType, fRawData);
}

void Image::draw(const Point<int>& pos)
void Image::draw(const Point<int>& pos) const
{
draw(pos.getX(), pos.getY());
}
@@ -125,6 +130,16 @@ Image& Image::operator=(const Image& image)
return *this;
}

bool Image::operator==(const Image& image) const
{
return (fRawData == image.fRawData);
}

bool Image::operator!=(const Image& image) const
{
return (fRawData != image.fRawData);
}

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

END_NAMESPACE_DGL

+ 17
- 2
source/libs/distrho/dgl/src/ImageAboutWindow.cpp View File

@@ -29,6 +29,21 @@ ImageAboutWindow::ImageAboutWindow(App* app, Window* parent, const Image& image)
Window::setWindowTitle("About");
}

ImageAboutWindow::ImageAboutWindow(Widget* widget, const Image& image)
: Window(widget->getApp(), widget->getParent()),
Widget(this),
fImgBackground(image)
{
Window::setSize(image.getWidth(), image.getHeight());
Window::setWindowTitle("About");
}

void ImageAboutWindow::setImage(const Image& image)
{
fImgBackground = image;
Window::setSize(image.getWidth(), image.getHeight());
}

void ImageAboutWindow::onDisplay()
{
fImgBackground.draw();
@@ -38,7 +53,7 @@ bool ImageAboutWindow::onMouse(int, bool press, int, int)
{
if (press)
{
Window::hide();
Window::close();
return true;
}

@@ -49,7 +64,7 @@ bool ImageAboutWindow::onKeyboard(bool press, uint32_t key)
{
if (press && key == DGL_CHAR_ESCAPE)
{
Window::hide();
Window::close();
return true;
}



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

@@ -46,7 +46,7 @@ bool Widget::isVisible()

void Widget::setVisible(bool yesNo)
{
if (yesNo == fVisible)
if (fVisible == yesNo)
return;

fVisible = yesNo;


+ 50
- 36
source/libs/distrho/dgl/src/Window.cpp View File

@@ -58,12 +58,8 @@ public:
kView(puglCreate(parentId, "Window", 600, 500, false, (parentId != 0))),
fParent(parent),
fChildFocus(nullptr),
#if DGL_OS_MAC
fVisible(true),
#else
fVisible((parentId != 0)),
#endif
fClosed(false),
fOnModal(false),
fResizable(false),
#if DGL_OS_WINDOWS
hwnd(0)
@@ -111,15 +107,11 @@ public:
#endif

kAppPriv->addWindow(kSelf);

#if DGL_OS_MAC
// TODO
kAppPriv->oneShown();
#endif
}

~Private()
{
fOnModal = false;
fWidgets.clear();

if (kView != nullptr)
@@ -129,9 +121,10 @@ public:
}
}

void exec()
void exec_init()
{
fClosed = false;
fOnModal = true;
assert(fParent != nullptr);

if (fParent != nullptr)
{
@@ -157,21 +150,39 @@ public:
}

show();
}

while (isVisible() && ! fClosed)
{
idle();
void exec_fini()
{
fOnModal = false;

if (fParent != nullptr)
fParent->fChildFocus = nullptr;
}

if (fParent != nullptr)
fParent->idle();
void exec(bool block)
{
exec_init();

dgl_msleep(10);
}
if (block)
{
while (fVisible && fOnModal)
{
// idle()
puglProcessEvents(kView);

fClosed = true;
if (fParent != nullptr)
fParent->idle();

if (fParent != nullptr)
fParent->fChildFocus = nullptr;
dgl_msleep(10);
}

exec_fini();
}
else
{
idle();
}
}

void focus()
@@ -190,6 +201,9 @@ public:
void idle()
{
puglProcessEvents(kView);

if (fVisible && fOnModal && fParent != nullptr)
fParent->idle();
}

void repaint()
@@ -229,14 +243,6 @@ public:

void setVisible(bool yesNo, bool closed = false)
{
#if DGL_OS_MAC
// TODO
if (closed && ! yesNo)
kAppPriv->oneHidden();

return;
#endif

if (fVisible == yesNo)
return;

@@ -265,9 +271,17 @@ public:
#endif

if (yesNo)
{
kAppPriv->oneShown();
else if (closed)
kAppPriv->oneHidden();
}
else
{
if (fOnModal)
exec_fini();

if (closed)
kAppPriv->oneHidden();
}
}

void setSize(unsigned int width, unsigned int height)
@@ -439,7 +453,7 @@ protected:

void onClose()
{
fClosed = true;
fOnModal = false;

if (fChildFocus != nullptr)
fChildFocus->onClose();
@@ -462,7 +476,7 @@ private:
Private* fParent;
Private* fChildFocus;
bool fVisible;
bool fClosed;
bool fOnModal;
bool fResizable;

std::list<Widget*> fWidgets;
@@ -542,9 +556,9 @@ Window::~Window()
delete kPrivate;
}

void Window::exec()
void Window::exec(bool lock)
{
kPrivate->exec();
kPrivate->exec(lock);
}

void Window::focus()


+ 0
- 61
source/tests/DGL.cpp View File

@@ -1,61 +0,0 @@
/*
* Carla Tests
* Copyright (C) 2013 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
* published by the Free Software Foundation; either version 2 of
* the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For a full copy of the GNU General Public License see the GPL.txt file
*/

#include "dgl/Image.hpp"
#include "dgl/StandaloneWindow.hpp"

#include "DGL_Artwork.hpp"

USE_NAMESPACE_DGL;

class MyWidget : public Widget
{
public:
MyWidget(StandaloneWindow* win)
: Widget(win->getWindow()),
fWindow(win->getWindow())
{
{
using namespace DGL_Artwork;
fImage.loadFromMemory(start_here_kxstudioData,
Size<int>(start_here_kxstudioWidth, start_here_kxstudioHeight),
GL_BGRA, GL_UNSIGNED_BYTE);
}

fWindow->setSize(fImage.getWidth(), fImage.getHeight());
fWindow->setWindowTitle("DGL Test");
}

protected:
void onDisplay() override
{
fImage.draw();
}

private:
Window* const fWindow;

Image fImage;
};

int main()
{
StandaloneWindow win;
MyWidget widget(&win);
win.exec();
return 0;
}

+ 0
- 3128
source/tests/DGL_Artwork.cpp
File diff suppressed because it is too large
View File


+ 0
- 15
source/tests/DGL_Artwork.hpp View File

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

#ifndef BINARY_DGL_ARTWORK_HPP
#define BINARY_DGL_ARTWORK_HPP

namespace DGL_Artwork
{
extern const char* start_here_kxstudioData;
const unsigned int start_here_kxstudioDataSize = 262144;
const unsigned int start_here_kxstudioWidth = 256;
const unsigned int start_here_kxstudioHeight = 256;
}

#endif // BINARY_DGL_ARTWORK_HPP


+ 9
- 5
source/tests/Makefile View File

@@ -11,7 +11,7 @@ include ../Makefile.mk
BUILD_CXX_FLAGS += -I../backend -I../includes -I../libs -I../theme -I../utils -Wall -Wextra
# BUILD_CXX_FLAGS += -isystem ../libs/juce
# BUILD_CXX_FLAGS += -DWANT_JACK -DWANT_LADSPA -DWANT_DSSI
# BUILD_CXX_FLAGS += -isystem /usr/include/qt4
BUILD_CXX_FLAGS += -isystem /usr/include/qt4
# BUILD_CXX_FLAGS += -isystem ../backend/engine/rtaudio-4.0.11
# BUILD_CXX_FLAGS += -I/opt/mingw32/include

@@ -23,13 +23,14 @@ ANSI_CXX_FLAGS += -DBUILD_ANSI_TEST -DVESTIGE_HEADER -fPIC
ifeq ($(MACOS),true)
DGL_LIBS = -framework OpenGL -framework Cocoa
else
DGL_LIBS = -lGL -lX11
# DGL_LIBS = -lQtCore -lopengl32 -lgdi32 -lole32 -luuid -lws2_32
DGL_LIBS = -lQtCore -lGL -lX11
endif

ifeq ($(MACOS),true)
TARGETS = CarlaString DGL Print
TARGETS = CarlaString DGL1 DGL2 Print
else
TARGETS = ANSI CarlaString DGL Print RtList Utils
TARGETS = ANSI CarlaString DGL1 DGL2 Print RtList Utils
endif

all: $(TARGETS) RUN
@@ -42,9 +43,12 @@ ANSI: ANSI.cpp
CarlaString: CarlaString.cpp
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) -o $@

DGL: DGL.cpp DGL_Artwork.cpp ../libs/dgl.a
DGL1: DGL1.cpp DGL1_Artwork.cpp ../libs/dgl.a
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) -o $@

DGL2: DGL2.cpp NekoArtwork.cpp ../libs/dgl.a
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) -o $@ && $(STRIP) $@

MacTest: MacTest.cpp
$(CXX) MacTest.cpp -o $@



Loading…
Cancel
Save