aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-08-14 00:29:22 +0000
committerDavid Robillard <d@drobilla.net>2008-08-14 00:29:22 +0000
commitefa03e862ad75e0a83fcf82a916720a82cdffc0b (patch)
treed2c0e6661576f2dd5cda62bc3b76864aac635429
parent2f7d4f902639750d8c0ca49bb15ed11a3d5cadd9 (diff)
downloadmda.lv2-efa03e862ad75e0a83fcf82a916720a82cdffc0b.tar.gz
mda.lv2-efa03e862ad75e0a83fcf82a916720a82cdffc0b.tar.bz2
mda.lv2-efa03e862ad75e0a83fcf82a916720a82cdffc0b.zip
Fix crash when showing control window for root patch.
git-svn-id: http://svn.drobilla.net/lad/mda-lv2@1362 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--Makefile2
-rw-r--r--lvz/AEffEditor.hpp2
-rw-r--r--lvz/audioeffectx.h14
-rw-r--r--vstgui/vstgui.cpp19
4 files changed, 30 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 5a49bf7..69d9f94 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-#CFLAGS = -O0 -g -ansi -Wall -Wextra -Wno-unused # -pedantic -Woverloaded-virtual
+CFLAGS = -O0 -g -ansi -Wall -Wextra -Wno-unused # -pedantic -Woverloaded-virtual
CFLAGS += -fPIC -DPIC -Ilvz -Ivstgui -I. -DURI_PREFIX=\"http://drobilla.net/ns/dev/mda-lv2/\"
SYSTEMNAME = $(shell uname -s)
diff --git a/lvz/AEffEditor.hpp b/lvz/AEffEditor.hpp
index 239c9d0..f8da52a 100644
--- a/lvz/AEffEditor.hpp
+++ b/lvz/AEffEditor.hpp
@@ -12,8 +12,10 @@ public:
{}
virtual long open(void* ptr) { return true; }
+ virtual void close() {}
virtual void idle() {}
+ virtual void postUpdate() {}
virtual const char* getURI() { return URI; }
virtual void setURI(const char* u) { URI = u; }
diff --git a/lvz/audioeffectx.h b/lvz/audioeffectx.h
index 162d24b..f278d63 100644
--- a/lvz/audioeffectx.h
+++ b/lvz/audioeffectx.h
@@ -22,6 +22,8 @@
#include <stdint.h>
#include <string.h>
+#include "AEffect.h"
+
// Some plugins seem to use these names...
#ifndef VstInt32
# define VstInt32 LvzInt32
@@ -56,6 +58,11 @@ struct LvzPinProperties {
int flags;
};
+enum LvzOpCodes {
+ effEditClose,
+ effEditOpen
+};
+
enum LvzEventTypes {
kLvzMidiType = 0
};
@@ -82,6 +89,7 @@ public:
virtual ~AudioEffect() {}
virtual void setParameter(LvzInt32 index, float value) = 0;
+ virtual void setParameterAutomated(LvzInt32 index, float value) {}
virtual float getParameter(LvzInt32 index) = 0;
void setEditor(AEffEditor* e) { editor = e; }
@@ -103,6 +111,7 @@ public:
, numParams(params)
, numPrograms(progs)
{
+ cEffect.flags = 0;
}
virtual void process (float **inputs, float **outputs, LvzInt32 nframes) = 0;
@@ -138,6 +147,10 @@ public:
virtual bool openFileSelector (VstFileSelect* sel) { return false; }
virtual bool closeFileSelector (VstFileSelect* sel) { return false; }
+ virtual long dispatcher(long opCode, long index, long value, void *ptr, float opt) {
+ return 0;
+ }
+
protected:
const char* URI;
const char* uniqueID;
@@ -147,6 +160,7 @@ protected:
LvzInt32 numOutputs;
LvzInt32 numParams;
LvzInt32 numPrograms;
+ AEffect cEffect;
};
#endif // __LVZ_AUDIOEFFECTX_H
diff --git a/vstgui/vstgui.cpp b/vstgui/vstgui.cpp
index 365c16b..2661738 100644
--- a/vstgui/vstgui.cpp
+++ b/vstgui/vstgui.cpp
@@ -978,13 +978,14 @@ void CDrawContext::forget ()
//-----------------------------------------------------------------------------
long CDrawContext::getIndexColor (CColor color)
{
- XColor xcol;
+ /*XColor xcol;
xcol.red = color.red << 8;
xcol.green = color.green << 8;
xcol.blue = color.blue << 8;
xcol.flags = (DoRed | DoGreen | DoBlue);
- XAllocColor (display, XDefaultColormap (display, 0), &xcol);
- return xcol.pixel;
+ XAllocColor (display, getColormap(), &xcol);
+ return xcol.pixel;*/
+ return (color.red << 16) + (color.green << 8) + color.blue;
}
//-----------------------------------------------------------------------------
@@ -3450,6 +3451,10 @@ CBitmap::CBitmap (long ID)
gNbCBitmap++;
#endif
+ pHandle = 0;
+ pngRead = NULL;
+ pngInfo = NULL;
+
bool found = false;
long i = 0;
@@ -3462,6 +3467,7 @@ CBitmap::CBitmap (long ID)
break;
}
}
+ ++i;
}
if (VSTGUI::bundlePath == NULL) {
@@ -3551,10 +3557,8 @@ bool CBitmap::loadFromResource (long resourceID)
//-----------------------------------------------------------------------------
bool CBitmap::loadFromPath (const void* platformPath)
{
- if (pHandle != NULL) {
+ if (pHandle != NULL)
dispose ();
- closePng ();
- }
bool success = openPng ((char*)platformPath);
if (success)
@@ -3763,6 +3767,7 @@ bool CBitmap::openPng (const char* path)
pngInfo = png_create_info_struct(pngRead);
if (!pngInfo) {
png_destroy_read_struct(&pngRead, NULL, NULL);
+ pngRead = NULL;
return false;
}
@@ -3787,6 +3792,8 @@ bool CBitmap::closePng ()
png_destroy_read_struct(&pngRead, &pngInfo, NULL);
fclose(pngFp);
pngFp = NULL;
+ pngRead = NULL;
+ pngInfo = NULL;
return true;
}