|
05-17-2011, 10:10 AM
|
#1
|
Human being with feelings
Join Date: May 2011
Posts: 4
|
IPlug - error "imgResourceFound" & error "SSE2 instruction set not enabled"
Hi all,
I'm new in VST development.
I heard bout iPlug, about his simplicity, but I have some problems to understand how it works with GUI.
If someone could guide me a bit.
I'm working on Win XP, Code::Blocks 10.05, MinGW, vsthostx86.exe
I've downloaded the WDL_CE repository from Git
I've test two examples IPlugEffect and IPlugExample (and few others from others repositories...)
The IPlugEffect compiles correctly and runs in vsthost.
The IPlugExample does not compile in Code::Blocks. You need "Add files" to the project : IPopMenu.h, IPopMenu.cpp. Then it works.
This example does not run in vsthost.
I have this error :
erreur line 118 : assertion imgResourceFound in IPlug/IGraphicsLice.cpp
The screenshot :
http://abel.jerome.free.fr/cicm/vst/...ourceFound.png
I've tried to import png images into the project, convert them into bmp, modify "resource.h", rename "img" folder into "resource" etc. I'm out.
Also, I've another error when I try another example from
http://www.cubitsdsp.net/blog/archives/18
You need rewrite class name "Cubits_IPlugVST_GUI" instead of "iPlugVST_GUI" and change it in different classes.. Then it's quite ok.
But I have this error :
gcc emmintrin.h #error "SSE2 instruction set not enabled"
Thanks,
Jerome
|
|
|
05-17-2011, 01:11 PM
|
#2
|
Human being with feelings
Join Date: Mar 2011
Posts: 8
|
In mingw you need to add to the command line either of these
-msse2
-mno-sse2
-msse3
-mno-sse3
or -mfpmath=sse
as for "imgResourceFound" make sure you are using png as iplug supports this in your resource you can define them using
resource.h:
#define IDR_PNG1 128
#define IDR_BG "images/back.png"
then inside your gui constructor use
pGraphics->AttachBackground(IDR_PNG1,IDR_BG);
hope this helps
-Cubits
|
|
|
05-17-2011, 01:17 PM
|
#3
|
Human being with feelings
Join Date: Apr 2009
Location: Berlin, Germany
Posts: 1,248
|
i didn't manage to get resources working with codeblocks/mingw. the resources are obviously there (due to the binary size) but they don't get found and you get the assertion imgResourceFound error.
>The IPlugExample does not compile in Code::Blocks. You need "Add files" to the project : IPopMenu.h, IPopMenu.cpp. Then it works.
bit confused by that since the IPopupMenu.cpp stuff isnt in wdl-ce
|
|
|
05-17-2011, 02:55 PM
|
#4
|
Human being with feelings
Join Date: Mar 2009
Posts: 256
|
Quote:
Originally Posted by olilarkin
>The IPlugExample does not compile in Code::Blocks. You need "Add files" to the project : IPopMenu.h, IPopMenu.cpp. Then it works.
bit confused by that since the IPopupMenu.cpp stuff isnt in wdl-ce
|
I had to add IPopupMenu.h and cpp to IPlugExample to get it to compile in XCode.
I also wondered why all the IPlug source files were in the IPlugExample xcode project, isn't it better to just use the IPlug xcode project?
|
|
|
05-17-2011, 03:06 PM
|
#5
|
Human being with feelings
Join Date: Apr 2009
Location: Berlin, Germany
Posts: 1,248
|
can you clarify which repo you're talking about?
my personal repo has/needs IPopupMenu.cpp/h but not wdl-ce,
>I also wondered why all the IPlug source files were in the IPlugExample xcode project, isn't it better to just use the IPlug xcode project?
i find it better not to build iplug as a library. In my experience It makes it easier to manage building for multiple architectures with multiple compilers, makes debugging easier and it makes the IGraphicsCocoa class name problem easier to manage. It takes a while longer to build afresh, but it's not too bad
|
|
|
05-18-2011, 12:34 AM
|
#6
|
Human being with feelings
Join Date: Mar 2009
Posts: 256
|
Ah yes I'm using yours, not wdl-ce.
|
|
|
05-18-2011, 02:13 AM
|
#7
|
Human being with feelings
Join Date: May 2011
Posts: 4
|
Thanks for answers.
I would like to find documentation about iPlug classes, a tutorial. Is there a link ?
And I would like compile and run successfully a VST with GUI builded with iPlug to compare with standard VST SDK examples.
My feedbacks :
1 - Test IPlugVst from
http://www.cubitsdsp.net/blog/archives/18
Quote:
In mingw you need to add to the command line either of these -msse2
|
I did.
-----------------------------------------
IPlugVSTGUI.cbp (codeblocks project file)
-----------------------------------------
<Compiler>
<Add option="-MSSE2" />
<Add option="-DVST_API" />
<Add option="-DWIN32" />
<Add option="-D_WIN32_WINNT=0x0501" />
<Add option="-DWINVER=0x0501" />
<Add option="-D_CRT_SECURE_NO_DEPRECATE" />
<Add option="-D_DEBUG" />
</Compiler>
> Compilation error with __asm (assembler language ?)
See the screenshot:
http://abel.jerome.free.fr/cicm/vst/...Cubits_ASM.png
2 - assert(imgResourceFound)
The syntax seems ok. See those 3 files.
-----------------------
resource.h
-----------------------
// Unique IDs for each image resource.
#define TOGGLE_ID 100
#define KNOB_ID 101
#define FADER_ID 102
#define BG_ID 103
#define METER_ID 104
// Image resource locations for this plug.
#define TOGGLE_FN "img/toggle-switch.png"
#define KNOB_FN "img/knob_sm.png"
#define FADER_FN "img/fader-cap_sm.png"
#define BG_FN "img/BG_400x200.png"
#define METER_FN "img/VU-meter_sm.png"
-----------------------
IPlugExample.rc
-----------------------
#include "resource.h"
TOGGLE_ID PNG TOGGLE_FN
KNOB_ID PNG KNOB_FN
FADER_ID PNG FADER_FN
BG_ID PNG BG_FN
METER_ID PNG METER_FN
-----------------------
IPlugExample.cpp
-----------------------
IGraphics* pGraphics = MakeGraphics(this, kW, kH); // MakeGraphics(this, kW, kH);
pGraphics->AttachBackground(BG_ID, BG_FN);
> The result is the same
http://abel.jerome.free.fr/cicm/vst/...ourceFound.png
Quote:
i didn't manage to get resources working with codeblocks/mingw
|
Seems to be an important problem. May be a problem with windows resource file
Those links could help :
http://msdn.microsoft.com/en-us/library/aa380599.aspx
http://www.cygwin.com/cygwin-ug-net/windres.html
|
|
|
05-18-2011, 09:34 AM
|
#8
|
Human being with feelings
Join Date: Mar 2011
Posts: 8
|
I kept the code in there just above all the asm sse just remove or comment out the sse code and use the code above it should be
attack_s=(x*x)*(sample_rate*8);
i kept asm in there so people can learn from it and also commented it. as for resources this is a wdl-ce issue i feel but in the RC make sure to define them this way
TOGGLE_ID PNG "img\\toggle-switch.png"
then in resource.h
#define IDR_PNG1 128
IDR_TOGGLE PNG "img\\toggle-switch.png"
use of doing them both ways is good practice for cross platform production also define PNG as the type so they go into the right resource section of the data structure.
-Cubits
|
|
|
05-19-2011, 02:22 AM
|
#9
|
Human being with feelings
Join Date: May 2011
Posts: 4
|
1- SSE2
-------
Quote:
I kept the code in there just above all the asm sse just remove or comment out the sse code
|
Ok.
Now I've always the SSE2 error in the line 32 from "codeblocks\MinGW\lib\gcc\mingw32\4.4.1\include\em mintrin.h" file
I've tried your options in the codeblocks project file in those markup :
<Compiler>
<Add option="-MSSE2" />
2- imgResourceFound
-------------------
I tried your path syntax (using "\\")
I tried without path, images were into the project's folder
etc.
The compilation is always Ok, but it's a running problem with the vst host.
May be just a issue about Windows.
I don't know what to do. In the standard VST SDK we can load images without this problem.
|
|
|
05-19-2011, 06:39 AM
|
#10
|
Human being with feelings
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,645
|
I think I have found the cause of the imgResourceFound error with Code::Blocks. In IPlug_include_in_plug_src.h there is a line that reads:
Code:
BOOL WINAPI DllMain(HINSTANCE hDllInst, DWORD fdwReason, LPVOID res)
I have changed it like this, and now I can load image resources just fine:
Code:
extern "C" BOOL WINAPI DllMain(HINSTANCE hDllInst, DWORD fdwReason, LPVOID res)
|
|
|
05-19-2011, 06:52 AM
|
#11
|
Human being with feelings
Join Date: May 2011
Posts: 4
|
Quote:
extern "C" BOOL WINAPI DllMain(HINSTANCE hDllInst, DWORD fdwReason, LPVOID res)
|
That's the trick !
Thanks.
|
|
|
05-19-2011, 10:36 AM
|
#12
|
Human being with feelings
Join Date: Apr 2009
Location: Berlin, Germany
Posts: 1,248
|
nice one tale. does your mod still work with msvc, or does it need to be ifdefd?
|
|
|
05-19-2011, 12:49 PM
|
#13
|
Human being with feelings
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,645
|
It seems to work at my end. That is to say, I can still compile just fine using both Microsoft C/C++ Compiler v15.00 (targeting x86) and v16.00 (targeting x64), and the resulting DLLs are 100% the same. In other words, the extern "C" seems to make no difference whatsoever.
Still, ifdefing it would be safer I guess. I think this should do the trick (although I haven't actually tested it yet):
Code:
#ifdef __MINGW32__
extern "C"
#endif
BOOL WINAPI DllMain(HINSTANCE hDllInst, DWORD fdwReason, LPVOID res)
|
|
|
05-20-2011, 05:44 AM
|
#14
|
Human being with feelings
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,645
|
Microsoft vs GCC
Meanwhile I have compiled ComboV using Code::Blocks, to see how it performs when compared to Microsoft's compiler. I have tried to compile with full speed optimizations, except -ftree-vectorize because this seems to crash IPlug. In each test I played a simple 3-note chord. The tests were performed on an Intel Core2 Duo E6300 1.86 GHz using REAPER 3.76 on WinXP Pro SP3.
Microsoft SSE: 2.9%
Microsoft SSE2: 1.5%
GCC SSE: 5.8%
GCC SSE2: 5.2%
As you can see the Microsoft builds perform way better than the GCC builds, so either Microsoft's compiler is really, really good, or I am doing something wrong. Any insights, anyone?
EDIT: After adding -ffast-math, I now have the GCC builds almost up to speed with the Microsoft builds:
GCC SSE: 3.2%
GCC SSE2: 1.8%
Last edited by Tale; 05-23-2011 at 07:35 AM.
Reason: -ffast-math
|
|
|
05-20-2011, 08:11 AM
|
#15
|
Human being with feelings
Join Date: Mar 2011
Posts: 8
|
GCC vs MSVC
In my opinion the microsoft compiler is faster but i know people who use gcc and with the right mixture of optimisations you can get decent results. But the microsoft debugger/ide/intellisense and compiler combined make it much nicer to program c++ and trace errors quicker.
|
|
|
05-20-2011, 03:21 PM
|
#16
|
Human being with feelings
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,645
|
I have done some googling on GCC to find the "right mixture of optimisations", and now I indeed get decent results. My Code::Blocks build is now only about 30% slower than my Microsoft build. What did the trick was to compile with -ffast-math.
I have also found why -msse2 -O3 crashed my plug-in: stack misalignment. If I add -mstackrealign, then everything works fine. However, I can't detect any increase in performance when compared to -msse2 -O2.
|
|
|
05-23-2011, 06:40 AM
|
#17
|
Human being with feelings
Join Date: Apr 2009
Location: Berlin, Germany
Posts: 1,248
|
could you share your .cbp file so I can have a look at the various settings? I got it compiling and almost loading (i.e. without the imgresource error), but now the dll seems to be somehow write protected or in use by another app (windres?). it won't load properly in vsthost, and i cant seem to copy the file somewhere else to try it in a different host. On the wdl-ce examples that don't have resources, this doesn't happen.
oli
|
|
|
05-23-2011, 07:38 AM
|
#18
|
Human being with feelings
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,645
|
|
|
|
10-23-2011, 03:37 AM
|
#19
|
Human being with feelings
Join Date: Apr 2009
Location: Berlin, Germany
Posts: 1,248
|
so are people happily compiling with CB?
I got to the stage where I don't get the assertion error, but it seems that there is something wrong with the dll whenever I try and include resources. I can't copy and paste it ... access denied and it won't load in a vst host.
If I don't include any resources, just do a plain colored background, the gui loads fine.
It's almost like windres is not releasing the dll file after it's finished linking/whatever
|
|
|
10-25-2011, 04:23 AM
|
#20
|
Human being with feelings
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,645
|
I have just downloaded Code::Blocks again, and I can build the IPlug example without any problems (although I do get the usual GCC warnings). I am running Code::Blocks v10.05 (codeblocks-10.05mingw-setup.exe) on WinXP Pro SP3 32-bit, and I am building for Win32.
Here is the Code::Blocks project file I am using to build the IPlug example:
Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="IPlugExample" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="Debug">
<Option output="bin\Debug\IPlugExample" prefix_auto="1" extension_auto="1" />
<Option object_output="obj\Debug\" />
<Option type="3" />
<Option compiler="gcc" />
<Option createDefFile="1" />
<Option createStaticLib="1" />
<Compiler>
<Add option="-D_DEBUG" />
<Add option="-g" />
</Compiler>
</Target>
<Target title="Release">
<Option output="bin\Release\IPlugExample" prefix_auto="1" extension_auto="1" />
<Option object_output="obj\Release\" />
<Option type="3" />
<Option compiler="gcc" />
<Option createDefFile="1" />
<Option createStaticLib="1" />
<Compiler>
<Add option="-DNDEBUG" />
<Add option="-O2" />
</Compiler>
</Target>
</Build>
<Compiler>
<Add option="-DDLL_BUILD" />
<Add option="-DVST_API" />
<Add option="-DIPLUG_NO_JPEG_SUPPORT" />
<Add option="-msse2" />
<Add option="-ffast-math" />
<Add directory="." />
<Add directory="..\..\zlib" />
</Compiler>
<Linker>
<Add option="-s" />
<Add library="shell32" />
<Add library="user32" />
<Add library="gdi32" />
<Add library="comdlg32" />
<Add library="advapi32" />
<Add library="wininet" />
</Linker>
<Unit filename="IPlugExample.cpp" />
<Unit filename="IPlugExample.h" />
<Unit filename="IPlugExample.rc">
<Option compilerVar="WINDRES" />
</Unit>
<Unit filename="resource.h" />
<Unit filename="..\Containers.h" />
<Unit filename="..\Hosts.cpp" />
<Unit filename="..\Hosts.h" />
<Unit filename="..\IParam.cpp" />
<Unit filename="..\IParam.h" />
<Unit filename="..\IPlugStructs.cpp" />
<Unit filename="..\IPlugStructs.h" />
<Unit filename="..\Log.cpp" />
<Unit filename="..\Log.h" />
<Unit filename="..\IGraphics.cpp" />
<Unit filename="..\IGraphics.h" />
<Unit filename="..\IGraphicsWin.cpp" />
<Unit filename="..\IGraphicsWin.h" />
<Unit filename="..\IControl.cpp" />
<Unit filename="..\IControl.h" />
<Unit filename="..\IPlugBase.cpp" />
<Unit filename="..\IPlugBase.h" />
<Unit filename="..\IPlugVST.cpp" />
<Unit filename="..\IPlugVST.h" />
<Unit filename="..\IPlug_include_in_plug_hdr.h" />
<Unit filename="..\IPlug_include_in_plug_src.h" />
<Unit filename="..\..\zlib\zlib.h" />
<Unit filename="..\..\zlib\zconf.h" />
<Unit filename="..\..\zlib\zconf.in.h" />
<Unit filename="..\..\zlib\adler32.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="..\..\zlib\crc32.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="..\..\zlib\crc32.h" />
<Unit filename="..\..\zlib\infback.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="..\..\zlib\inffast.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="..\..\zlib\inffast.h" />
<Unit filename="..\..\zlib\inffixed.h" />
<Unit filename="..\..\zlib\inflate.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="..\..\zlib\inflate.h" />
<Unit filename="..\..\zlib\inftrees.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="..\..\zlib\inftrees.h" />
<Unit filename="..\..\zlib\trees.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="..\..\zlib\trees.h" />
<Unit filename="..\..\zlib\uncompr.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="..\..\zlib\zutil.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="..\..\zlib\zutil.h" />
<Unit filename="..\..\libpng\png.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="..\..\libpng\png.h" />
<Unit filename="..\..\libpng\pngconf.h" />
<Unit filename="..\..\libpng\pngerror.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="..\..\libpng\pngget.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="..\..\libpng\pngmem.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="..\..\libpng\pngread.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="..\..\libpng\pngrio.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="..\..\libpng\pngrtran.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="..\..\libpng\pngrutil.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="..\..\libpng\pngset.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="..\..\libpng\pngtrans.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="..\..\lice\lice.cpp" />
<Unit filename="..\..\lice\lice.h" />
<Unit filename="..\..\lice\lice_arc.cpp" />
<Unit filename="..\..\lice\lice_bezier.h" />
<Unit filename="..\..\lice\lice_line.cpp" />
<Unit filename="..\..\lice\lice_png.cpp" />
<Unit filename="..\..\lice\lice_textnew.cpp" />
<Unit filename="..\..\lice\lice_text.h" />
<Unit filename="..\..\lice\lice_combine.h" />
<Unit filename="..\..\lice\lice_extended.h" />
<Extensions>
<code_completion />
<debugger />
</Extensions>
</Project>
</CodeBlocks_project_file>
|
|
|
10-25-2011, 05:27 AM
|
#21
|
Human being with feelings
Join Date: Apr 2009
Location: Berlin, Germany
Posts: 1,248
|
thanks, i got it working.
i noticed the -g for debugging symbols, which was missing in my debug build. When I added that the resources started working, but in release it still didn't work. So i thought it's probably to do with symbol visibility. I modified my IPlug_include_in_plugin_hdr.h to define the EXPORT macro differently for Mingw and this seems to have done the trick.
this is probably not an issue with the stock IPlug, but some change I did in the past to my repo meant it was needed
Code:
#ifdef __MINGW32__
#define EXPORT __attribute__ ((visibility("default")))
#else
#define EXPORT __declspec(dllexport)
#endif
...
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 03:55 AM.
|