PDA

View Full Version : IPlug C++ code framework for VST and AU audio plugins and GUIs


schwa
05-16-2007, 12:23 PM
Here is a code framework for developing audio plugins and GUIs, which includes:

- A platform independent IPlug class that handles all communication with the audio host.

- A platform independent IGraphics class that handles managing the controls on the GUI.

- A set of platform independent IControl classes that handle moving and rotating images, vector graphics, mouse input, etc. Classes like "static bitmap", "switch", "fader", "rotating knob", etc. These classes can be easily extended.

- Windows and OSX graphics implementation classes, which handle window management, and use LICE (Cockos graphics lib) to draw GUIs.

- VST and AU implementation classes, which handle communication between the audio host and the plugin.

The idea is that you can derive a new plugin class from IPlug, and with a small number of readable lines of code, you can assemble the plugin and GUI without caring what the OS, plugin format, or graphics implementation is.

The framework and the code for the sample plugin can be found in the latest WDL package (http://cockos.com/wdl/). This code should compile into a Windows VST, an OSX Audio Unit, or an OSX VST with no changes.

Here (http://stashbox.org/682638/iplug_ctor.txt) is an example of the source code (from the package) for the constructor of the example plugin.

To compile VSTs, you will need the VST SDK (http://ygrabit.steinberg.de/~ygrabit/public_html/index.html) from Steinberg. You only need two files out of the SDK: aeffect.h and aeffectx.h. To compile AUs, you will need the Core Audio SDK (http://developer.apple.com/sdk/) from Apple (this comes with XCode).

The IPlug example project in WDL links in the Cockos LICE graphics library statically, but if you are making one-off plugins you may find it easier to simply add the necessary LICE source files to your plugin project.


.
http://stash.reaper.fm/oldsb/32305/108227141357-Master-track-VST-IPlug-Example-Schwa.png

.

Caveats.
This is code I use, so it's designed for users who are comfortable using C++. It doesn't offer any sort of GUI assembling graphical interface, everything is done in the user's code. Although it supports all the plugin/GUI functionality I happen to use, it may not support the functionality you want, for example it doesn't support common Windows controls like dropdowns and checkboxes. However, it should be straightforward to extend the framework to add features.

esorcc
05-16-2007, 01:30 PM
I've been wanting to dive in to writing VST's. I'd not seen much C++ development for VST's. Having a base class to inherit from will significantly cut my development time.

Is this base class efficient?

schwa
05-16-2007, 01:37 PM
It's efficient.

caleb
05-18-2007, 10:15 AM
Talk to me Schwa.

Is this the cross-platform VST/GUI development platform that we've been waiting for that doesn't have large license costs for commercial endeavors like Juce does?

For example - can we take this and develop Linux VST plug-ins?

I'm actually interested (finally) in developing an audio plug-in and know shit really - I promise that what I want to make is quite simple in comparison to what others do. It's a flexible tone generator more than anything else.

I would also be interested in developing midi plugins.

Please help me. :)

Regards
Caleb

schwa
05-18-2007, 10:44 AM
Well, it's technically cross platform -- it's designed that way. But ATM it will only work on windows. There are 3 main pieces:

- Framework code -- talking to audio host, managing params and controls, and all the specific code you would write for a given plugin, that's all cross platform and should work more or less out of the box anywhere. But without a GUI.

- Opening and managing the GUI window. This is designed to be able to drop in managers for different platforms but ATM there's only a windows implementation there. The existing windows impl is bare bones simple, it just throws a window up and routes messages back to the framework code. Somebody could write a window manager class to talk to whatever linux window manager pretty easily.

- Drawing the graphics. The two implementation classes in there are gdi+ which is windows-only and cockos LICE which is windows-only for now but planned to be cross-platform.

So for now, just Windows, but the important part is you could write your plugin code and when there are other windows manager and graphics implementation classes, your code will not need to change.

The audio and midi processing end, and what and how communication happens with the audio host, is all straight VST, so whatever a VST can do, IPlug can do.

caleb
05-19-2007, 04:34 AM
If LICE is planning to be cross-platform, maybe that's a better choice for me at the moment.

I might struggle to start with this without pretty good examples and such. I've never even made a VST plug-in full stop.

Plus there's the small issue that I'm not really a C++ programmer.

Yeah - the obstacles just keep getting bigger. :)

Regards
Caleb

schwa
05-19-2007, 06:10 AM
It looks like you at least have a computer, which is an important first step :)

There is an example plug in the zip but it's not a very exciting one. I'd be happy to help out at any stage, from getting it compiling to usage, etc, anyone who does try it out feel free to pm or whatever if any questions.

schwa
05-19-2007, 08:29 PM
Update mutex lock fixes, alpha blending, user settable gui fps, bitmap overlay control (for "about" screens etc).

Also added GetTimeInfo for finding out the current tempo and quarter-note position, which would be handy for say midi groove quantizing...

schwa
05-23-2007, 09:24 PM
<insert clever self deprecating joke about continuing to reply to myself here>

Added full midi support, internal state saving/reloading, a file selector control, text controls, other stuff.

IPlug is now a static library ... create a plugin dll by implementing a couple of functions, link against IPlug, and include VSTMain.h.

HotDogWater
05-23-2007, 10:51 PM
Well, Schwa, I have to say this looks very cool. I've been looking for something like this (an easy framework to get off and running with VSTs) for a long time. I downloaded today, and tried to compile the example in VS2005, which resulted in about 250 errors. I doubt there's anything wrong with your code; more the fact that it's been years since I've done any C++ coding, it was mostly in UN*X, I and don't know what I'm doing anymore. (smile)

Would you expect this to compile out of the box in VS2005? It did do some conversion when I opened it. Most of the compile errors seemed to be around very simple things (like trouble finding strcpy and other basic functions). I did D/L the Steinberg SDK as well as WDL and put them in the compiler's path. I'm hoping it's just some global library I haven't stuck in the compiler path yet or maybe I need some more include statements.

Any advice? I would love to play around with this but I'm kinda stuck :) Feel free to ignore me if this is a more basic question than you wanted to take on ;-)

schwa
05-24-2007, 03:59 AM
Actually I know what your problem is: it's WDL's string.h conflicting with the standard library string.h. You need to do one of these things:

- rename WDL/string.h to something else, like WDL/wdlstring.h.

or

- don't put WDL in your include path at all, and whenever you need a WDL include, explicitly qualify it as #include "../WDL/whatever.h".

IPlug doesn't use WDL's string.h, so so the first fix will work without changing IPlug and the second fix will require (slightly) changing IPlug's references to WDL includes.

With that fix, you will still get a few errors about not finding resource.h or the IDR_PNGX style constants that reside in it, you'll need to add your own PNG image resources to the project.

Please do attach a file with any remaining errors or warnings you get and I'll try to help out.

stodge
05-24-2007, 06:17 AM
Cool! I'm curious about writing VSTs, so I might just give this a try.

HotDogWater
05-24-2007, 06:22 AM
That went a long way! I decided to try your fix of renaming WDL's string.h since that seems easiest to deal with in the long run.

IPlug compiled with no errors. IPlugGUI generated a 3 errors with respect to the PNG files (I can't find where the variables that reference them are defined) and 2 warnings.

The compiler log is here:
Plug GUI (http://jlf.no-ip.com/plugGUI5-24.htm)


Again, thanks for taking the time. Any help appreciated :)

schwa
05-24-2007, 06:43 AM
OK.

If you're unfamiliar with using resources in C++ projects, it might be worth a web browse to read up on it. The example plugin refers to constants like IDR_PNG1 etc, which are references to compiled-in image resources that aren't included in the download. What you'll need to do is:

- Right click project -> add resource.
- Import -> browse to whatever image files you want to use for your background, faders, knobs, meters, whatever.
- If your version of VS doesn't recognize PNGs and you try to import a PNG, it will ask what type of resource it is, type "PNG".

When you do that VS will compile the image resources into the binary, and create a resource.h file that contains tags like IDR_PNG1 etc that refer to those images. You can then use those tags to construct IBitmaps in the IPlug code.

Now, if you're using the free VC++ 2005 express, microsoft has cruelly disabled the resource compiler and "add resource" will be grayed out. You'll need to browse for how to compile resources from the command line, which isn't hard, but is an arbitrary pain in the ass that Microsoft has decided to drop on you because you didn't pay them any money.

I think all the rest is warnings from the Stenberg VST header which has the char-width-unsafe strncat, strncpy, etc in it. Your options are: ignore the warnings, or edit the header to use _strncat etc instead (I think, might require some fiddling), or define _CRT_SECURE_NO_DEPRECATE at the top of the header.

stodge
05-24-2007, 06:49 AM
Actually I know what your problem is: it's WDL's string.h conflicting with the standard library string.h. You need to do one of these things:

- rename WDL/string.h to something else, like WDL/wdlstring.h.

or

- don't put WDL in your include path at all, and whenever you need a WDL include, explicitly qualify it as #include "../WDL/whatever.h".

IPlug doesn't use WDL's string.h, so so the first fix will work without changing IPlug and the second fix will require (slightly) changing IPlug's references to WDL includes.

With that fix, you will still get a few errors about not finding resource.h or the IDR_PNGX style constants that reside in it, you'll need to add your own PNG image resources to the project.

Please do attach a file with any remaining errors or warnings you get and I'll try to help out.

How about a WDL/wdl namespace?

schwa
05-24-2007, 06:55 AM
How about a WDL/wdl namespace?

I don't think that would fix the include problem unfortunately ... the issue is that the compiler knows it needs a string.h, grabs the first one it finds and carries on, and then complains that it never saw the functions defined in the other string.h.

HotDogWater
05-24-2007, 09:07 AM
Good stuff. I am still struggling. I'm running VS05 Pro, so it lets me import resources. I browse to a PNG file I created, give it type PNG, and it opens up a hex file with an RC extension. Any suggestions? Sorry for all the basic questions that I should probably already know when attempting this.

Also, though there were no graphics files included in the archive, they appear in my resource list. (e.g. fader-cap.png)

schwa
05-24-2007, 09:24 AM
I guess I should just stick some pngs in the download. I sort of wanted a handsomer looking example plugin before doing that (the graphics in the example are fairly random). You might need to delete the references to nonexistent pngs, I'm not sure.

Anyway. Add your own image resource at described above. VS will then display the raw data (because it doesn't understand what a PNG is, if you added a BMP resource it would display the actual bitmap), with a label like "IDR_PNGX" in the tab over the data. Save the raw data file and close it to get it out of your way. In your plugin, that IDR_PNGX label can now be used to initialize an IBitmap.

Specifically what happens is when you compile, VS compiles the resources first, and creates a resource.h file that lists all the resource tags. If you #include "resource.h", then you can use the tag as a reference to the image.

This is all generic resource stuff, not specifically to do with IPlug (I'm happy to help with it, just being clear that these are generic issues and not IPlug specific issues).

Here is some MSDN stuff on using resources. (http://msdn2.microsoft.com/en-us/library/zabda143(vs.80).aspx)

stodge
05-24-2007, 09:46 AM
I don't think that would fix the include problem unfortunately ... the issue is that the compiler knows it needs a string.h, grabs the first one it finds and carries on, and then complains that it never saw the functions defined in the other string.h.

Fair enough. Maybe rename your string header in the download?

HotDogWater
05-24-2007, 11:24 AM
Yep, I agree that this is generic resource stuff and you are very generous to help out, not to mention posting your code wihch looks like it will be very useful! Thanks for the instructions and the link.

So, now I've downloaded your most recent ZIP file (Iplug as a static library). The resource PNG files seem to (I hope) be the last hurdle. But now when I right click and try to add a new PNG resource, I'm getting "Operation cannot be completed - unspecified error". (which is oh so helpful a message :)) The PlugGUIExample.rc list is empty and says "load failed." Everything I do around resources seems to generate that unspecified error. And I can't seem to remove the PlugGUIExample.rc file and start from scracth.

So I'm Googling around and trying to find out why that would happen (maybe a VS 2005 bug?), but so far no luck.

schwa
05-24-2007, 11:32 AM
I'm in the middle of putting together a real example plugin which I will zip up with images & all. I should be able to get it out within the next hour or so.

HotDogWater
05-24-2007, 11:39 AM
Schwa, you're a gentlman and a scholar!

WHATEVER kind of images you include are going to be better than what I was throwing together (plain circles and squares, probably way off in size) just trying to get this to compile :)

schwa
05-24-2007, 11:51 AM
OK, there is a real example plugin there including images, that should compile out of the box. It's a boring panner / channel switcher, with randomly placed graphic elements that White Tie ("Shiny Knobs for the Distinguished Gentleman") was kind enough to sweep off the desk in my direction.

I think I scooped everything for the example into the zip, let me know if anything is missing.

HotDogWater
05-24-2007, 12:28 PM
It doesn't look boring to me. Perhaps from an end user perspective it is but from a learning perspective, it looks perfect.

Still having PNG troubles.

Compiler's output is here (http://jlf.no-ip.com/BuildLog.htm). The compiler did not seem to generate a resource.h file (at least that I can find) when it went, so I'm guessing the errors are linked to that.

schwa
05-24-2007, 12:47 PM
Well let's see. There must be a resource.h file somewhere or else the compiler would complain about not finding it. I would say, first clean the project. Then, there should be an .rc file in the project, try right-click compile only the resources and see if you get a new resource.h file.

HotDogWater
05-24-2007, 01:25 PM
I made it past the PNGs. YAY! There were a few problems. I had a path to WDL\lice\test in my preferences and there was a resource.h file there that it was using. It wouldn't build me a resource.h file until I manually added a new resource and then deleted it. Finally, the existing resource IDs all got imported inside double quotes, and it didn't like those. So anyway, I think there is progress :)

Now I'm down to one (new) error:

Linking...
LINK : fatal error LNK1104: cannot open file 'lice.lib'


I can't find the file "lice.lib" on my HDD either. Is this part of the WDL?

schwa
05-24-2007, 01:29 PM
Endgame!

If you want to use the Cockos LICE graphics lib as your GUI engine, you need to compile LICE. It's part of WDL, there should be a project file in WDL/LICE which will compile a lib to Debug or Release underneath that dir. Then you may need to adjust a path to the LICE lib in the PlugExample project settings (there will be a relative path for it there already but if you put things in different places from me, you'll need to change it).

HotDogWater
05-24-2007, 02:08 PM
That's it! AWESOME! It compiled, and loaded up in Reaper! Thank you SO MUCH for helping me get this going! Now to start tinkering and hopefully my next question(s) will be more relevant to iPlug itself rather than how to compile :)

Just an FYI, when I loaded the compiled DLL into Reaper, two things weren't as I expected.

1. The pan control isn't where I thought it would be (see my screenshot)

2. The pan knob functions (affects audio pan), but the knob doesn't rotate

http://jlf.no-ip.com/iplugexample.jpg

So, first iplug question. There are function calls to SetDisplayText e.g.
GetParam(kChannelSw).SetDisplayText(kDefault, "default");
but I don't ever see that text displayed. Would you expect to see it somewhere?

schwa
05-24-2007, 02:14 PM
Hmm, that's weird the knob is in a different place. Are you using the gdi+ engine or the lice one? If the lice one, it's possible we have different versions or something. Whichever one you are using, try the other one and see if anything changes.

The display text is what shows by default in the GUI-less interface (press the UI button). But it's available via GetParam(idx).GetDisplayTextForHost() if you want to send it to a text control on the GUI or something.

I'm gone until late tonight, hope that helps for now.

HotDogWater
05-24-2007, 04:17 PM
I was using gdi+ but after switching to Lice, same thing. Pan knob is still behind left meter.

After digging in a little further into the code and opening up the PNG files in GIMP, I realize the things I thought were a/b swiches are in fact faders. They do not move, in addition to the pan knob not moving. Though the graphics don't move, going through the motions of moving them does control the sound (i.e. I can click on a fader and drag down and that channel's gain goes down but the fader graphic stays stationary).

The meters are animated as expected, and the 5-pole switch moves when I click it. Can't say I've quite figured out how that works yet. They are esentially graphics for all possible positions stacked atop one another. But I'm not sure how the code tells it to move to position Y within the PNG file. I'll have to play with that, I guess.

I wonder if you sent the DLL that you compiled on your system if it would behave as expected on my system or do the same thing it's doing now.

Again, thanks for this. It is well documented code, so I'm starting to get a feel for what's going on, and could see where this could really make for rapid VST development! PlugGUIExample.cpp is really very few lines of code for what it does, and is pretty straightforward to read.

schwa
05-24-2007, 07:16 PM
HDW, make sure all the IPlug code is current, maybe that's the trouble.

I'll put a version file or something in the package for clarity, I guess.

HotDogWater
05-25-2007, 10:29 AM
I know we've gone back and forth with PMs, but just for the record - all fixed when I updated to the most recent version.

schwa
05-26-2007, 06:34 PM
Updated IPlug: simplified drawing logic, more text drawing options, proper drawing cleanup after modal windows.

schwa
06-07-2007, 06:17 AM
Updated with project files for VC++ 2005. I had to rebuild a PC anyway so I thought I'd try out the free VC++ 2005 Express, which works just fine, I recommend it for anyone who wants to do C++ work without the installing whole Visual Studio universe.

Earlier I said that the free VC++ didn't have a resource compiler, but that's wrong, all it's missing is a resource editor, which for this application you would never use anyway. You need to hand-write a resource.h and <projectname>.rc file, but it's very straightforward (faster than adding resources using the resource editor), and the compiler will embed the images properly for you (you can look at the example project to see how it's done).

Andrew Cockburn
06-07-2007, 07:41 AM
Hey Schwa,

This looks cool - I tried VST programming a few months ago but gave up when I ran out of steam with all the boring GUI programing - I'll definately have a look at this and have a play - thanks!

schwa
06-28-2007, 10:20 PM
I removed the gdi+ graphics implementation class from IPlug. Cockos' Lice graphic library now supports vector drawing (as well as lots of other cool stuff, check it out) (http://cockos.com/wdl/). So Lice can now do most of what gdi+ can do, but way faster.

aquila
06-29-2007, 01:26 PM
Hi,
I try to compile the Iplug with the latest version of WDL (2070627) and I have the following error : LICE_Line identifier not found.
I open the lice.h and there is :
/*
Stuff planned:


...
void LICE_Line(LICE_IBitmap *dest, float x1, float y1, float x2, float y2, LICE_pixel color, float alpha=1.0, bool aa=true);
void LICE_Rectangle(LICE_IBitmap *dest, float x1, float y1, float x2, float y2, LICE_pixel color, float alpha=1.0, bool aa=true);
....
*/
SO the method is not implemented in my version of WDL. When do plan to update the WDL to compile Iplug or do I have the right version ?

regards
Philippe

schwa
06-29-2007, 05:18 PM
Oops! That's coming to WDL soon I think. For the moment you can comment out the single call to LICE_Line at (or near) IGraphicsLice.cpp line 142 and everything else should work fine (except vector drawing, of course), until a new WDL comes out.

aquila
06-30-2007, 12:46 AM
There is another problem. The file IGraphicsGL.cpp and .h is not present. But there is IGraphicsGdip.cpp and .h
Does the new files replace the old one.
If I try to replace, I have a lot of error in like IGraphicsGdip.h:
Error 1 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\nomad\dev\juce\wdl\iplug\igraphicsgl.h 27
or
Error 2 error C2143: syntax error : missing ',' before '&' c:\nomad\dev\juce\wdl\iplug\igraphicsgl.h 27

Have you an idea ?

regards
Philippe

schwa
06-30-2007, 05:24 AM
Sorry about that, I left the old vcproj file in the zip after I removed the stale files, so it's looking for stuff it can't find. I updated the zips, it should work without complaining now.

aquila
07-01-2007, 02:08 AM
Hi,
I test. Iplug compile now. But for the IplugExample the project need lice.lib and the lice project doesn't compile because the main.ico is missing in the test folder. I add a dummy icone and everything is ok.

regards
Philippe

schwa
07-04-2007, 05:34 AM
Justin dropped by in the dark of night to fix a windows-level problem that occurred when multiple instances of the same plugin were loaded and unloaded. Thanks Justin.

... also there were a couple of changes in this update that will require tweaking existing projects: OnParamChange now supplies the index of the param that changed, the vector drawing controls now take a channel blending object, the relative library paths got flatted by one level, and possibly other minor things I can't recall at the moment.

spaz
08-30-2007, 07:49 AM
Should work on:

1. OSX?
2. Any VST Host?

schwa
08-30-2007, 10:52 AM
Should work on:

1. OSX?
2. Any VST Host?

I just updated the code with a month's worth of changes, at the top of the thread. IPlug has been pretty well battle tested in many configurations in many VST hosts, including Cubase SX3 & C4, Samplitude, FL Studio, Sonar, Live, etc.

IPlug will not work on OSX out of the box. But it's designed to be portable. Right now, to work on OSX, two new classes would need to be written: a window handler class and a graphics drawing class. (Both of these needs may eventually be met by WDL's LICE and SWELL.) With those two new classes, plugins written in IPlug will be compilable for either Windows or OSX.

I'm pretty sure the OSX classes will exist someday, but it's not something I'm working on right now.

* By the way, I want to say an huge "thank you" to Tallisman, who has done a tremendous amount of the aforementioned battle-testing. Thanks T!

spaz
08-30-2007, 05:38 PM
I just updated the code with a month's worth of changes, at the top of the thread. IPlug has been pretty well battle tested in many configurations in many VST hosts, including Cubase SX3 & C4, Samplitude, FL Studio, Sonar, Live, etc.

IPlug will not work on OSX out of the box. But it's designed to be portable. Right now, to work on OSX, two new classes would need to be written: a window handler class and a graphics drawing class. (Both of these needs may eventually be met by WDL's LICE and SWELL.) With those two new classes, plugins written in IPlug will be compilable for either Windows or OSX.

I'm pretty sure the OSX classes will exist someday, but it's not something I'm working on right now.

* By the way, I want to say an huge "thank you" to Tallisman, who has done a tremendous amount of the aforementioned battle-testing. Thanks T!

Why would LICE and SWELL not do the job today?

schwa
10-09-2007, 01:04 PM
A major update (in the first post) that includes tons of updates including vastly more efficient drawing logic, presets, battle tested host compatibility, and a million other things. Also I replaced STL with Cockos WDL, which makes for much smaller and somewhat faster code.

Removing STL caused a lot of interface changes, so this update is NOT compatible with previous IPlugs. And what's more, I'll be away for a few days and unable to respond to any problems! So if you are an actual current IPlug user, please copy your current build to a safe place instead of just clobbering it with this one.

Also, I'm using VC++ 9 Express which is newish, so I didn't bother posting project files because I know they are not backwards compatible.

Also if you are an actual current IPlug user, please say hello to the unicorns and leprechauns and other mythical creatures you must live among...

wct
10-19-2007, 07:00 AM
Hi there! I checked out the last release of IPlug and was impressed with what I saw, but haven't had time to do much with it recently. For what it's worth I was able to build the last release on Visual Studio 2005 by editing the project file and changing the version "9.00" to "8.00". But I'm on a new computer now and just installed Visual Studio Express 2008, so time to give it another whirl.

The main issue I had last time was that I had to guess the include and library paths for VST and LICE. Has this been standardised somehow (maybe an env variable?)

I also tweaked the iplug creation to allow use as a generator module. I'd be happy to contribute back code but I need to get up to speed with this release first.

Thanks for your great work!

wct
11-08-2007, 08:46 AM
I want to add a control that maps to two parameters (in this case an X/Y pad control). When I looked controls appeared to be limited to 1 param. If I change this would I be better off subclassing in my own library, or modifying IPlug and submitting the changes back?

schwa
11-08-2007, 09:48 AM
I want to add a control that maps to two parameters (in this case an X/Y pad control). When I looked controls appeared to be limited to 1 param. If I change this would I be better off subclassing in my own library, or modifying IPlug and submitting the changes back?

When I've done this, I've subclassed IControl and overridden SetDirty to send both parameters back to the host, which is a painless way to do something like an X/Y pad.

Often though if you have a complex control, some parameters may be constrained by others, for example if you have controls to move 2 points along a line but the points may not pass one another. In this case it's not really safe to allow the control values to be VST parameters at all, because with the GUI closed (or using automation) the user could set the parameters to illegal combinations. In cases like this, I've subclassed IControl and had the new control hold a pointer to the plugin instance class. That way, the graphics handler still knows how to pass mouse actions to the control, but the control and the plugin can communicate directly without having to go back through the parameter handling code.

(BTW I just updated the IPlug src in the first post.)

wct
11-09-2007, 04:39 AM
Cool, I'll try that and see how I go.

COCPORN
01-15-2008, 08:17 PM
Thanks for this library! It was simple to get working, and I'm working on a VST plugin (receiving and processing both MIDI and audio) as we speak, complete with GUI and all. I'm very happy having gotten this far working less than 24h.

A quick question: I'm using the IKnobMultiControl to display a nice little knob I made with KnobMan, and it works very well. But for simple 2 bitmap thingies like a "MIDI activity"-indicator not connected to a parameter, what would you use?

Thanks again!

COCPORN
01-15-2008, 08:23 PM
...snip question which has the answer in the example code...

*blush*

Sorry about that, I see you're using the IBitmapControl in the example. Thanks again.

schwa
01-15-2008, 08:36 PM
I'm glad somebody's getting use out of this.

BTW, there's a major iplug update coming with OSX and AU support. I'd guess a couple of weeks away, after I clear some other work out.

COCPORN
01-15-2008, 08:59 PM
I'm glad somebody's getting use out of this.

BTW, there's a major iplug update coming with OSX and AU support. I'd guess a couple of weeks away, after I clear some other work out.

Excellent. I've already managed to add the MIDI-activity button since my last post. This is a very nice library indeed. Looking forward to OSX support too! That'll be great.

COCPORN
01-16-2008, 11:41 AM
I tried moving my plugin to my computer designated for audio work, but Live 7 doesn't even find the plugin on a rescan. That is, I'm sure it rescans the directory, but for some reason it doesn't list my baby.

Anyone familiar with troubleshooting this kind of situation? Are there any specialized hosts suitable for debugging this (and other) kinds of problems?

(I've MD5 checked files on both computers, it works perfectly on my development machine. I've also installed the vcredist 2008 on the second computer, as I'm using Visual Studio 2008 for development. I've also tried making an installation project to detect dependencies, but this doesn't seem to do any good either; it just adds comdlg32.dll to the install directory.)

Any help greatly appreciated.

schwa
01-16-2008, 12:13 PM
I tried moving my plugin to my computer designated for audio work, but Live 7 doesn't even find the plugin on a rescan.

Is this a machine problem, or a host problem? You have computer A and computer B, and you have Reaper and Live (say). Which of the 4 combinations work and which don't?

I know for sure that my current local IPlug works in Live 6 and Live 7, fwiw, so if you discover it's a host problem, I can push the current source code up (it's been a while since I updated the code here). If it's a machine problem, it may be that the compiler settings on the dev PC don't generate code that audio PC can read (SSE2 code won't run on an Athlon XP, for example).

COCPORN
01-16-2008, 12:39 PM
The configurations are similar, but not identical. The laptop is a Core2 Duo, the desktop is a Quad, both from Intel. Both are running Vista Home Premium. Both are Live 7.0.1.

I'll try to compile the plugin with VS2005, I'm pretty sure this has something to do with runtime libraries and stuff like that. Trying that now.

Do you have a debug-host to recommend? I did a search but found mostly dead links.

schwa
01-16-2008, 12:48 PM
The configurations are similar, but not identical. The laptop is a Core2 Duo, the desktop is a Quad, both from Intel. Both are running Vista Home Premium. Both are Live 7.0.1.

I'll try to compile the plugin with VS2005, I'm pretty sure this has something to do with runtime libraries and stuff like that. Trying that now.

Do you have a debug-host to recommend? I did a search but found mostly dead links.

If the same version of Live loads the plugin on one PC and not the other, I think it has to be something in your compiler settings. Did you change anything in the stock compiler settings that came with the project?

I don't think this will help in your case, but one debugging option is to define TRACER_BUILD in the project settings for IPlug and your plugin. Then the plugin will log all activity to C:/VSTLog.txt (don't run it too long if you get it to load, or you'll wear a groove in the disk). But like I said, it sounds like the one PC isn't even recognizing the dll.

I use a bunch of hosts for debugging, these all have free or eval versions available:
- MiniHost
- EnergyXT
- Live
- Samplitude
- Tracktion
- Sonar (time limited trial)

COCPORN
01-16-2008, 01:11 PM
Did the source come with a project? Not sure if I found it.

WDL came with a project, which I've converted to 2005 and 2008-projects, it compiles nicely on both platforms after handling a problem with redefinition of UINT8 and UINT16.

IPlugExample.zip and IPlug.zip don't really come with project files, as far as I can see. Am I missing something?

I've just done a "Create project from existing sourcefiles" and chose them to be lib for IPlug and dll for IPlugExample.

Any idea what settings in the project would make this not work? Do you have a sample project file for 2005 or 2008?

I've now compiled my source with 2005 and 2008, both work on the dev-PC, none work on the separate machine. I've also tested the VST Plugin Analyser from here: http://www.savioursofsoul.de/Christian/?page_id=5, which loads the plugin correctly on the dev-machine, but not on the separate machine. I've also compiled the source with the TRACER_BUILD-define, but nothing shows up in any file, even on the machine where the plugin loads correctly.

Thanks again! :)

schwa
01-16-2008, 01:18 PM
Here's a VC++ 2008 project file for the example project. If you post yours I can take a look at it, too.
http://stash.reaper.fm/oldsb/18548/IPlugExample.vcproj

The TRACER_BUILD needs both the lib and the dll compiled with it on (I use a separate build config for this). But it's clear this won't help you, because you need to get the one PC to read the dll at all.

COCPORN
01-16-2008, 01:42 PM
I went through and made some changes. The ones I remember off the top of my head were "Character set" from "Not set" to "Multibyte charset", "Multithreaded DLL" (/MD)to "Multithreaded" (/MT), also I only had link includes to only lice.lib and iplug.lib, I added the ones you had in your project.

I'm pretty sure the perp was the "Multithreaded DLL", tho, in C++ Code Generation.

Thanks a bunch for your help! :)

COCPORN
01-18-2008, 01:52 AM
I've come a long way in a short time writing my first VST plugin. Doing the last polishing I decided to implement a bypass button. As this will not be linked to a VST parameter, I decided on just subclassing the IBitmapControl with a new class; BypassButton. In BypassButton I override OnMouseDown, and toggle a bool and some UI elements in the plugin surface.

Problem is, the click-message is trapped only 70% of the time. I kind of remember this behavior in the cyclebitmaps in the IPlugExample-project too. (The one with the led and the lever.)

Anyone else experienced this, and/or have a workaround?

(EDIT: It seems to trigger ~100% of the time if I move the mouse in and out of the bitmap boundaries with every click. This could be a timing thing, tho. RE-EDIT: It seems like it approaches ~100% if I wait a period of time between clicks. Which is kind of odd. Is there a need to lock on some kind of mutex to trap these 100%? Tried locking on the IPlug mMutex in OnMouseDown, but no behavior changed.)

schwa
01-18-2008, 05:19 AM
Could it just be that overly soon re-clicks are interpreted as double clicks? Try overridding OnMouseDblClick too.

COCPORN
01-18-2008, 08:29 AM
Thanks again, now everything works excellently. :)

COCPORN
01-20-2008, 03:21 AM
BTW, ISwitchControl is affected by the same problem (with the double clicks not being trapped). It's really easy to fix, but should probably make it into your source base. I just added;

IControl.h:

(To ISwitchControl declaration.)

void OnMouseDblClick(int x, int y, IMouseMod *pMod);


IControl.cpp:

void ISwitchControl::OnMouseDblClick(int x, int y, IMouseMod *pMod)
{
OnMouseDown(x, y, pMod);
}

Then the lever doesn't jump around as strangely anymore.

COCPORN
01-20-2008, 05:37 AM
There seems to be a problem with the way the audioMasterCallback is stored in the current implementation. This sometimes causes the plugin to hang the host under certain circumstances.

To reproduce:

(works with IPluginExample):

Set the ProcessDoubleReplacing-implementation to ask for host information, for example sample position:

void PlugExample::ProcessDoubleReplacing (double** inputs, double** outputs, int sampleFrames)
{
WDL_MutexLock lock(&mMutex);

int samplePos = GetSamplePos();
}

Create two instances of the plugin. Deleting the first works fine. Trying to deleting the second hangs my host (Live 7). Note: Both instances of the plugin will happily coexist until you delete one of them.

(I'm not intimately familiar with how DLL handles static resources, but I think this might be the problem. I tried heap-allocating some memory to hold the callback, but I was unable to get it to work.)

Workaround:

It's not difficult to work around this problem by passing the audioMasterCallback to the IPlug-instance (I'm currently doing this for my own plugin). This makes the IPlug-interface VST specific, tho. I'll leave it up to you to figure out a smart way to fix this in a platform agnostic way. :)

schwa
01-20-2008, 06:40 AM
Boy, you're going at this, aren't you?

For AU support I've added an "instance data" struct that holds the host callback and HINSTANCE pointer for Windows VSTs, and mac and AU specific stuff when relevant. Each plugin instance then holds its own instance data, so nothing is kept global. This will probably clear up whatever you're seeing.

Also, fwiw, the default double-click implementation resets the control to its original (default) setting.

COCPORN
01-20-2008, 07:40 AM
I had a dream as a boy to code sound-stuff, and now it seems so accessible (mainly because of the excellent support in this thread) I'm going to spend some time with it.

I'm very happy with the results so far, I've been able to code this in under a week with no prior exposure to VST or MIDI:

http://www.intranq.com/Screenshots/PurpleGate/PurpleGate_Beta1.png

(The knobs actually do something.Send me a private message if you need a MIDI controlled "trance gate", and I'll give you the download URL.)

I'm looking forward to trying to compile this stuff on my friend's OSX-laptop, it sounds like the problem I was experiencing has been solved nicely. Regarding the double click thingie, I noticed on the rotary knobs that double click reset them, but I didn't have the mental capacity to transfer this behavior to the switchknobs. From a user point of view it was still kind of confusing even knowing why it was bahaving like that, so I'll leave the reset function disabled.

schwa
03-27-2008, 11:35 AM
Updated ... now you can compile the same code into a Windows VST and an OSX Audio Unit.

NAS
03-29-2008, 08:43 PM
Hohohohohoho very cool update :)

NAS

schwa
05-06-2008, 11:44 AM
Updated the source code (link in first post). VST and now AU support have been battle-tested in many hosts. Added OSX VST support.

schwa
05-13-2008, 12:14 PM
I do compile lice with VC08 ... you are compiling the lice library, not the test executable, right? That error sounds like it's not able to build the resources but the library shouldn't need any resources.

This might help, it's the VC08 vcproj file I use to build lice:

kierenj
06-15-2008, 05:23 AM
Hi, wondering the best way of doing a visualisation-style plugin (or, one that redraws the whole window at a frequency). I saw some FPS / OnIdle things in the interfaces, but can't seem to wrangle it to work the way I'm thinking of.

At the moment I'm creating a graphics object, with no controls, and then infrequently (every 20k samples for this example) in ProcessDoubleReplacing calling some DrawLine(), then DrawScreen() with the whole screen rect.

It redraws if you force a window redraw - drag it on/off screen, overlay something else on top and move it away etc - but no matter what I do it wont refresh by itself - invalidate I mean.

Is there a correct way to do this? Create a new IControl-derived class for this kinda stuff?

schwa
06-15-2008, 06:57 AM
Proper usage would have the control only redrawing itself when it is marked dirty. For controls that have only a single value (like a knob, or a meter), you can call GetGUI()->SetParameterFromPlug from within ProcessDoubleReplacing, which will cause the control to set itself dirty and redraw.

If the control has more than one value (like a graph), here's what I do:

- Create a new control class, and store a pointer to it in your plugin class.
- Write a control method Draw() (to override IControl:: Draw) that pulls the stored data from the plugin and draws whatever it needs to.
- From within the sample processing code, store whatever data the control needs, and whenever you want the control to redraw itself, call mycontrol->SetDirty(), which will cause mycontrol->Draw() to be called.

garyn
06-15-2008, 10:39 PM
I managed, after much mucking around, (why, not release something that'll build first time? ) to get the vst and au
to compile a universal binary in xcode, tried to load the vst in Live6 and it crashed:

/IPlug/IGraphicsLice.cpp:104: failed assertion `imgResourceFound'

the png files are there in the Resource folder though so, no
idea why it cant find them.

The au loads but draws the gui upside down! (see attahed)

any ideas?

schwa
06-15-2008, 10:58 PM
I managed, after much mucking around, (why, not release something that'll build first time? ) to get the vst and au
to compile a universal binary in xcode, tried to load the vst in Live6 and it crashed:

/IPlug/IGraphicsLice.cpp:104: failed assertion `imgResourceFound'

the png files are there in the Resource folder though so, no
idea why it cant find them.

The au loads but draws the gui upside down! (see attahed)

any ideas?

The failed assert is probably because you didn't add the image resource to the vst target.

The upside downness is because (I forgot about this) iplug and lice developed along different paths for OSX drawing. You'll need to edit wdl/lice/lice.h LICE_SysBitmap::isFlipped() to simply return false always, and that should fix it.

garyn
06-23-2008, 06:12 PM
Hi schwa


The failed assert is probably because you didn't add the image resource to the vst target.

The upside downness is because (I forgot about this) iplug and lice developed along different paths for OSX drawing. You'll need to edit wdl/lice/lice.h LICE_SysBitmap::isFlipped() to simply return false always, and that should fix it.

The bitmaps are added to the VST target, i didnt change it
it, thats how your project was setup.

--

isFlipped currently always returns false, again its set that way in your code:

virtual bool isFlipped()=0;
bool isFlipped() { return false; }
bool isFlipped()
{
#ifndef _WIN32
return true;
#else
return false;
#endif
}

schwa
06-23-2008, 06:23 PM
#ifndef _WIN32
return true;
#else
return false;
#endif
}

It's currently returning true on OSX (you are probably reading that as "ifdef" not "ifndef"). If you change that function to return false always, the plugin guis should turn themselves around properly.

angixstudios
06-29-2008, 11:51 PM
This framework is fantastic!
I'd be happy to make a donation for this great release.
Email me if there is a way to do so.

angixstudios
07-12-2008, 05:38 AM
Am I correct in saying that the text controls are not implemented yet?

They do not display at all. Followed the code and DrawIText is declared but not defined.

If I'm wrong could someone let me know what I may be doing wrong?

schwa
07-12-2008, 05:45 AM
Am I correct in saying that the text controls are not implemented yet?

They do not display at all. Followed the code and DrawIText is declared but not defined.

If I'm wrong could someone let me know what I may be doing wrong?

They are implemented ... should be separate implementations in IGraphicsWindows and IGraphicsMac. If a control doesnt display the problem is often either that the rect is poorly defined or offscreen, or that the control wasn't set dirty after updating the text.

angixstudios
07-12-2008, 08:17 PM
Sorry to paste code, but I'm not sure how else to ask for help.
Any assistance would be very appreciated.

bitmap = pGraphics->LoadIBitmap(BIGKNOB1_ID, BIGKNOB1_FN, kKnob_N);
pGraphics->AttachControl(new IKnobMultiControl(this, kDepth_X, kDepth_Y, kDepth, &bitmap, kVertical));

IRECT kDepthCap_Rect(57,148,92,161);
IColor white(255,255,255,255);
IText kDepthCapText(12, &white, "Arial");

ICaptionControl *cap = new ICaptionControl(this, &kDepthCap_Rect, kDepth, &kDepthCapText,true);
cap->SetDirty();

pGraphics->AttachControl(cap);

IRECT is definately within bounds.

If I right-click on the Caption Text I see the correct text in the popup but nothing appears normally.

schwa
07-12-2008, 08:38 PM
Ah! ICaptionControl is artifact code, I will delete it. Please try ITextControl (its parent).

angixstudios
07-12-2008, 08:54 PM
ITextControl doesn't display anything either. CODE BELOW.
Am I doing something wrong?

ITextControl doesn't link to a control as well. I was hoping captionControl was a textbox that displayed the value of a knob below the knob.

IRECT kDepthCap_Rect(57,148,92,161);
IColor white(255,255,255,255);
IText kDepthCapText(12, &white, "Arial");

ITextControl *cap = new ITextControl(this, &kDepthCap_Rect, &kDepthCapText,"hello");

cap->SetDirty();

pGraphics->AttachControl(cap);

schwa
07-12-2008, 09:17 PM
Fuck me, a bug. Thanks/sorry.

I updated IPlug at http://downloads.stillwellaudio.com/schwa/misc/IPlug.zip, and there's a test plugin with text captions (I restored ICaptionControl) at http://downloads.stillwellaudio.com/schwa/misc/VSTTest.zip.

angixstudios
07-12-2008, 10:08 PM
AWESOME! Thanks Mate!

angixstudios
07-13-2008, 12:13 AM
Another question.
After editing a captionText, the corresponding(connected) control(knob) does not change. I have tried to edit the code placing SetDirties and Redraws for the control but does not work.

My guess is the PromptUserInput in running on a seperate thread and redraws are executed before the input in entered.

I tried onKeyDown handlers on the captionText but no good.

Is there a way you can think of to get this to work??

Ernst Hot
09-19-2008, 02:59 AM
First, let me say that this framework is just awesome... I had a basic filter vst up and running about an hour after downloading it, despite not having dealt with C++ in years. Great stuff :)

I have a question though; It seems there is some artificial limit on how often the gui updates? It seems a tad bit too slow for metering for instance. Is there a way to remedy this?

I've been looking through the Lice and IPlug source, but haven't found anything so far.

schwa
09-19-2008, 05:08 AM
I have a question though; It seems there is some artificial limit on how often the gui updates? It seems a tad bit too slow for metering for instance. Is there a way to remedy this?

Hi, thanks!

The last argument to MakeGraphics() is the frame rate, which I think is set to 24 by default. If this looks slow to you, it may be because whatever you're drawing is overly CPU intensive and the redraws are not actually happening at 24 -- if everything is actually updating at 24 fps it should look fine.

snebenan
10-15-2008, 01:52 AM
Hi,
Since I ran into the limitation of max 16 sliders in JS I'm looking towards other solutions for creating a good vst controller for my evolver and blofeld.

wdl looks like it could solve my graphics needs but I could not find anything about midi. am I just blind or is it solved in some other way?

//Peter

Xenakios
11-17-2008, 08:31 PM
Hi,
Since I ran into the limitation of max 16 sliders in JS I'm looking towards other solutions for creating a good vst controller for my evolver and blofeld.

wdl looks like it could solve my graphics needs but I could not find anything about midi. am I just blind or is it solved in some other way?

//Peter

Since you mention JS, I am assuming you want to make something that works integrated inside Reaper? Then the Reaper Extension plugins are probably what you want to look into...From them you can have access to the MIDI ports as well as the plugins loaded on Reaper's tracks.

red
11-21-2008, 08:58 AM
Hi there,

I'm trying to build IPlug in Xcode 3.
I have tons of compiler errors.

- IPlug_Prefix.pch is missing.
- some includes must be edited (../wdl/swell/*.h -> ../swell/*.h)
- Xcode build error: swell-gdi-int.h file not found, not included in the package
- IGraphicsMac.mm - GDP_CTX not declared

Can someone please point me the right direction, how to compile this great framework. I really want to give it a try.


Thanks for help and best regards.
./Klaus

debian
11-30-2008, 04:27 AM
This seems to be nice. :)

I want to compile IPlug using xcode on a mac. but I'm seem to be missing the file swell/swell-gdi-int.h

EDIT:
found it in an older WDL,
I have some other errors now... I'll be back :)

debian
11-30-2008, 03:08 PM
How do I compile the Lice Library to get the file liblice.a on an intel macintosh?

schwa
11-30-2008, 03:18 PM
Hi Debian,

To use my IPlug.xcodeproj, you'll need to build LICE (once only) as a separate static library (as its own project). Alternatively you could drag all the LICE source files that IPlug uses into the IPlug project and remove the dependency on liblice.

debian
11-30-2008, 04:34 PM
Thanks for the assistanse. :)
I manage to compile the IPlug library,
but when trying to compile your IPlugExample.component I get a lot of (38) linker error.

I'll give it another try tomorrow...

debian
12-01-2008, 01:01 PM
hi schwa,
I can't get rid of these linkerror... do you mind have a look at the buld result in my attachment and se if you know of a solution?

l0calh05t
12-28-2008, 05:27 AM
Another question.
After editing a captionText, the corresponding(connected) control(knob) does not change. I have tried to edit the code placing SetDirties and Redraws for the control but does not work.

My guess is the PromptUserInput in running on a seperate thread and redraws are executed before the input in entered.

I tried onKeyDown handlers on the captionText but no good.

Is there a way you can think of to get this to work??

Did anyone manage to get this to work?

l0calh05t
12-28-2008, 08:37 AM
also, the img folder is missing in the IPlug example included with WDL

schwa
12-29-2008, 06:15 AM
I just put the image folder for the iplug example in the WDL dist, thanks for letting us know it was left out. It's in the build that's linked in the first post of this thread.

Regarding the manual editing of controls -- the control does need a redraw call, but this should be handled already in IControl::SetValueFromUserInput. It does seem to wok properly here, are you on Win or OSX?

l0calh05t
12-29-2008, 09:22 AM
I just put the image folder for the iplug example in the WDL dist, thanks for letting us know it was left out. It's in the build that's linked in the first post of this thread.

Yeah, I found those as well.

Regarding the manual editing of controls -- the control does need a redraw call, but this should be handled already in IControl::SetValueFromUserInput. It does seem to wok properly here, are you on Win or OSX?

Windows, but are we talking about the same thing? I don't mean the right-click edit field but having a normal control and a caption field associated to the same parameter, when one changes one via right-click the other isn't redrawn/updated.

stixsmith
12-30-2008, 07:04 AM
schwa

Firstly, congratulations on an excellent framework!

I've aleady built the libraries, and a fairly complex VST on Windows (Visual Studio 2008) and so far very impressed...

I'm attempting to "port" the Windows VST to VST/AU on Mac. I have to admit at this point that whilst an experienced developer, I'm an XCode noob! I'm running into the same issues as Debain in an earlier post, and tried your suggestion:


To use my IPlug.xcodeproj, you'll need to build LICE (once only) as a separate static library (as its own project). Alternatively you could drag all the LICE source files that IPlug uses into the IPlug project and remove the dependency on liblice.

I removed liblice from the IPlug.xcodeproj, and added the entire contents of the lice folder (cpp and h files), and was able to successfully build IPlug that way (or at least it built without any errors - which might not be quite the same thing?!?!?!)

I am now getting linker errors just like Debian when I try to build your IPlugExample :(

Could you provide/post your LICE.xcodeproj? Then I can try building that, then your original IPlug, and then your original IPlugExample - to more closely match your setup?

Thanks in advance

stixsmith

schwa
12-30-2008, 07:25 AM
I'll post some xcodeproj files next time I'm at a Mac. One piece of possibly useful information is that the way to set up a library dependency in xcode is to simply drag the library's xcodeproj into the target's project (as opposed to the devstudio way of typing the .lib into the link settings window and then adding it as on the target dependency list).

stixsmith
12-30-2008, 08:18 AM
Thanks very much

Those project files will be VERY useful in getting started, I'm sure (for me, and a lot of other noobs too!)

I managed to figure that out that you can drag and drop pretty much anything from one project to another in XCode - which is rather handy

Since I used your IPlugExample it already had the IPlug project in it - so I still suspect my attempt to build IPlug (or LICE) is the problem - once I have your three project files, then the answer will most likely be obvious!

Hope that at some point I'll be able to start contributing a little something back to the project...

Thanks again
stixsmith

bvesco
01-05-2009, 03:40 AM
Using VC2k5.

Debug build of the example is working fine.

Release build is giving lots of linker errors on msvcrt.lib and LIBCMT.lib

Sound familiar to anyone?

More google-ing for this:
http://cboard.cprogramming.com/showthread.php?t=97754
showed:

Reusable Library Switch Library Macro(s) Defined
----------------------------------------------------------------
Single Threaded /ML LIBC (none)
Static MultiThread /MT LIBCMT _MT
Dynamic Link (DLL) /MD MSVCRT _MT and _DLL
Debug Single Threaded /MLd LIBCD _DEBUG
Debug Static MultiThread /MTd LIBCMTD _DEBUG and _MT
Debug Dynamic Link (DLL) /MDd MSVCRTD _DEBUG, _MT, and _DLL


The IPlug, IPlug Example and plush2 projects are using /MT while lice and test use /MD. I changed lice and test to /MT and things compiled just fine. So the remaining question is if it is ok to have lice compiled with /MT instead of /MD.

schwa
01-05-2009, 06:47 AM
Sounds like you need to do a static lib release build of LICE on your system.

bvesco
01-05-2009, 01:03 PM
Yes, that is what I thought. That's what the /MT flag does but it is set up to be /MD (dynamic). I just wanted to make sure that switching to static is ok.

bvesco
01-06-2009, 12:44 AM
Next mundane technical question:

The "Reaper Special" configuration seems to be copied from the "No SSE2" configuration. Like the latter, the Reaper config has NO_SSE2 defined and EnableEnhancedInstructionSet="0"

Is this also intentional, is there something about the reaper mode that makes SSE2 undesirable? It seems like a copy/paste casualty.

bvesco
01-07-2009, 02:19 AM
Next bit of feedback on IPlug.

The functions for setting sample rate and IO configuration from the host are not virtual in the base class and provide no callbacks. This means there is no direct way to respond to these events without directly modifying the base class to suit your own nefarious purposes.

Use case 1:
Implementing an IIR filter where the coefficients have to be recalculated when the sample rate changes. In the straight VST SDK my effect would override the virtual setSamplerate call, call to parent, then do some of its own triggering of events before returning.

In the world of IPlug it seems necessary to look for a samplerate change on each call to the process replacing functions and recalculate if your samplerate is different than last time. Or calculate the coefficients on every call to process. Neither of these seem desirable. Or was IPlug designed to force this calculation on every call to process? Have I missed something?

schwa
01-07-2009, 05:39 AM
Both VST and AU will call the plugin's Reset() when the sample rate or buffer size changes. So the typical way to handle something like this would be something like this in Reset():

int sr = GetSampleRate();
if (sr != m_sr)
{
m_sr = sr;
// do recalculation
}

bvesco
01-07-2009, 10:35 AM
Oh, very sweet then. So reset() is sort of like the "catch all" for needing to start/stop/open/close/change anything. Dig.

bvesco
01-08-2009, 12:16 AM
Bah, leftovers from doing too much of my own VST wrapper coding...
So if you use IRECT as (x, y, w, h) things will get fubar with ITextControl and ICaptionControl. It is of course supposed to be (x1, y1, x2, y2) which made everything work like normal. This note left here for anyone else who might stumble across this human error..

Now I have ICaptionControl element that is linked to a knob control via param. Turning the knob control does not update the ICaptionControl in realtime. Actually, it does update it in realtime but the control does not redraw so the caption remains showing the old value. Forcing a redraw (close/open gui or move off/on screen) will show the correct value.

This only happens with live updating of the knob (moving it with mouse). If I select saved presets then the knob and caption both are updated and rendered in realtime.

Updating the param via right-click, then type, does not update the knob though.

Additionally, setting the IText::kStyleBold in the IText passed to ITextControl does not result in bold text.

Still work to be done in this area?

P.S. The reset() thing worked out really slick. I am liking IPlug more every day.

stixsmith
01-10-2009, 04:27 AM
Seems newbies are running into many of the same "gotchas"
Congrats for posting them here so that others might avoid

This really is a great framework already - and building up a friendly community of users can only help it get even better... and save Schwa from having to answer so many "dumb" questions?

Congrats again to Schwa for releasing this.


Seems that once setting the font type/size the first time, you cannot change them? Digging a little deeper into the framework code this seems deliberate - perhaps there is a good reason for this? I have not yet had the need to investigate further - but just a mental note/heads up...


I had similar problems with controls/captions (when right clicking and keying values, controls/captions were not updating) which I fixed (bodged?) like this:

void PlugExample::OnParamChange(int paramIdx) {

...

if (GetGUI()) {
// force redraw of a control - any one - does not seem to matter which?
GetGUI()->GetControl(hdl[kSomeControl])->Redraw();

GetGUI()->SetAllControlsDirty();
}
}

Which works - though I am not entirely "happy" this is really the "solution"


An example plug that covers even more of the controls/functions in the framework would serve as good documentation (and a test of the framework)

e.g. I've not yet been able to get box/line drawing - or any similar "graphics" functions to work (on Windows platform) - can anyone post a snippet of example code? (to show correct usage?)


Still cannot get the IPlug or IPlugExample to build on Mac OSX/xCode - Schwa if you could post the most recent code and projects (liblice, IPlug, IPlugExample) that would be very very helpful. Much appreciated!

Cheers
stixsmith

bvesco
01-11-2009, 02:51 PM
Seems newbies are running into many of the same "gotchas"
Congrats for posting them here so that others might avoid

Seems that once setting the font type/size the first time, you cannot change them?


I'm not sure if this reply is targeted at my post or not, but seems related so I feel the need to clarify in case there's an answer for me in there. Are you suggesting that an IText can not have its mStyle property changed after construction? Perhaps my question was not clear enough...


IText textProps(FONT_SIZE_NORMAL, &COLOR_BLACK, "Arial", IText::kStyleBold);
pGraphics->AttachControl(new ITextControl(this, &tmpRect, &textProps, "bold me"));


The ITextControl in the example above is not bold text when displayed.

Furthermore I should expect this example to work (as a continuation of the previous snippet, though I'm not using it in this way):


textProps.mStyle = IText::kStyleNormal;
pGraphics->AttachControl(new ITextControl(this, &tmpRect, &textProps, "don't bold me"));


This text should display unbolded even though it uses the IText that was previously constructed as bold. I should expect this to work because the ITextControl invokes the default copy constructor of IText to make a shallow copy. It does not keep a pointer to the original pass by reference IText.

I'm not trying to do anything funny like attempting to get at the mText member of ITextControl and change it from normal to bold on the fly. I am telling an ITextControl to be bold from "day 1" of its render.

Thanks for the tip on forcing redraw of controls. I will try that soon. I agree that does not seem like the "real" solution, but if it gets it working then I'll live with it for a while.

I'll also echo the congrats on releasing this framework. I've tried JUCE and Infinity and neither one cut the mustard for me. I had started rolling my own which was in its infancy. I was just about to implement my own version of what is called IParam here when I stumbled upon WDL and the IPlug. I was also planning to move my own library toward being AU/VST abstracted but was only VST so far. IPlug had taken care of that layer already too. IPlug didn't just already do these things, but did them in a more feature complete way than I had even imagined I would do in my own version. So kudos on the IPlug framework. It has been a dream.

stixsmith
01-12-2009, 12:19 PM
I'm not sure if this reply is targeted at my post or not, but seems related so I feel the need to clarify in case there's an answer for me in there. Are you suggesting that an IText can not have its mStyle property changed after construction? Perhaps my question was not clear enough...

Yes, mostly targetted at your post Bvesco - but others too in earlier posts - I am a newcomer.

Having similar but slightly different problems with fonts...

You might expect the following two examples to produce the same output - try them - you will see that they do not!


Example 1:

IText lFont1(14, &COLOR_WHITE, "Arial");
pGraphics->AttachControl(new ITextControl(this, &IRECT(10, 200, 10 + 128, 200 + 32), &lFont1, "14 White Arial"));

IText lFont2(28, &COLOR_BLUE, "Courier");
pGraphics->AttachControl(new ITextControl(this, &IRECT(10, 400, 10 + 128, 400 + 32), &lFont2, "28 Blue Courier"));


and...


Example 2:

IText lFont2(28, &COLOR_BLUE, "Courier");
pGraphics->AttachControl(new ITextControl(this, &IRECT(10, 400, 10 + 128, 400 + 32), &lFont2, "28 Blue Courier"));

IText lFont1(14, &COLOR_WHITE, "Arial");
pGraphics->AttachControl(new ITextControl(this, &IRECT(10, 200, 10 + 128, 200 + 32), &lFont1, "14 White Arial"));


(i.e. I just reversed the order of creating the text and text controls)

You will see that once the typeface and size have been set once - for ANY IText in the Plug, they are effectively "locked in"

bvesco
01-12-2009, 04:01 PM
You will see that once the typeface and size have been set once - for ANY IText in the Plug, they are effectively "locked in"

1. If that is true, then it is a ridiculous limitation that I do not accept after having used several other libs that enforce no such restriction.

2. That's all well and good, but I'm not changing typeface and size on the fly. I'm just trying to put some bold text on the plug while there is no other text on it at all.

I guess I might be slapping VSTGUI on top of IPlug after all...

stixsmith
01-13-2009, 02:41 AM
I guess I might be slapping VSTGUI on top of IPlug after all...

No - please don't do it!!! ;)

Just wanted to point out there is still some development required on the framework to have text functionality working as might be expected.

The more eyes we have looking at it (and the more hands tinkering with it) the quicker these little things can be identified and resolved...

bvesco
01-13-2009, 11:29 PM
I have been playing with this stuff and here's where we are at.

IGraphicsWin.cpp has the function body for


bool IGraphicsWin::DrawIText(IText* pText, char* str, IRECT* pR)


where around line 654 we see the conditional


if (!mFontActive) {
int h = pText->mSize;
int esc = 10 * pText->mOrientation;
int wt = (pText->mStyle == IText::kStyleBold ? FW_BOLD : 0);
int it = (pText->mStyle == IText::kStyleItalic ? 1 : 0);
HFONT font = CreateFont(h, 0, esc, esc, wt, it, 0, 0, 0, 0, 0, 0, 0, pText->mFont);
SelectObject(pDC, font); // leak?
SetBkMode(pDC, TRANSPARENT);
mFontActive = true;
setColor = true;
}


which is what restricts the size and weight from being set more than once (among other things). Perhaps this is done because the font is created every time the function is called. This is assuming CreateFont does not cache the font, I don't know much GDI so I am not sure of that one. For giggles I removed the (!mFontActive) check. I was now able to change font size any time I want, but not font weight. This puzzled me and led to playing around with line 657 until I ended up with


int wt = (pText->mStyle == IText::kStyleBold ? FW_EXTRABOLD: FW_EXTRABOLD);


which you would *think* means that all your text would always be extra bold no matter what you told it. Alas, such is not the case. I am unable to get any font weight other than the default. I'm going to dig into GDI and see if I can turn anything up. In the meantime, any other ideas? I'd really like to be able to bold some text ;)

l0calh05t
01-13-2009, 11:52 PM
Creating new fonts all the time will cause a memory leak. The solution would probably be to store the font with the IText it belongs to (and delete the font when the IText is destroyed), BUT there is a slight problem: currently the IText is copied for every widget using text, so we'd still have a copy of the font for every caption etc.

l0calh05t
01-13-2009, 11:54 PM
int wt = (pText->mStyle == IText::kStyleBold ? FW_EXTRABOLD: FW_EXTRABOLD);


which you would *think* means that all your text would always be extra bold no matter what you told it. Alas, such is not the case. I am unable to get any font weight other than the default. I'm going to dig into GDI and see if I can turn anything up. In the meantime, any other ideas? I'd really like to be able to bold some text ;)

try the following:

int wt = (pText->mStyle == IText::kStyleBold) ? FW_BOLD : 0;

bvesco
01-14-2009, 01:23 AM
Yeah, that's what the code started as. I deliberately screwbarred the code I posted to show that it wasn't bolding even if you told it to bold no matter what. As it turns out it is a font size issue. GDI/LICE doesn't seem to be able to provide bold fonts below a certain size. Again, this is a case where I've been used to using VSTGUI for so long that I take certain things for granted, like the ability to get a bold font when I want it.

Storing the font on the IText for every text element is still preferrable to only being able to use a single font size/style on the entire plugin. I might be leaning that way since it is still better than not doing it, and better than leaking a logical font handle on every draw.

l0calh05t
01-14-2009, 04:13 AM
No, the code started out as:


int wt = (pText->mStyle == IText::kStyleBold ? FW_BOLD : 0);


my suggestion was:



int wt = (pText->mStyle == IText::kStyleBold) ? FW_BOLD : 0;


small but important difference ;-)

bvesco
01-14-2009, 10:18 AM
Small difference yes, important? No. At least not on my compiler (visual studio). Looking at those two statements I fully expect them to be 100% equivalent. Try this test:


int testTernary1()
{
int FW_BOLD = 700;
enum { kStyleNormal, kStyleBold };
int mStyle = kStyleBold;
int wt = (mStyle == kStyleBold ? FW_BOLD : 0);
return wt;
}

int testTernary2()
{
int FW_BOLD = 700;
enum { kStyleNormal, kStyleBold };
int mStyle = kStyleBold;
int wt = (mStyle == kStyleBold) ? FW_BOLD : 0;
return wt;
}


Only difference between those two functions is the form of the ternary operator or rather the placement of parentheses. As expected, both statements evaluate to the exact same value.

Can you tell me if I'm missing something in your suggestion?

l0calh05t
01-14-2009, 10:26 AM
Sorry, faulty memory. I was sure == had a lower precedence than ?: but apparently it hasn't, so never mind.

bvesco
01-18-2009, 03:39 AM
void PlugExample::OnParamChange(int paramIdx) {

...

if (GetGUI()) {
// force redraw of a control - any one - does not seem to matter which?
GetGUI()->GetControl(hdl[kSomeControl])->Redraw();

GetGUI()->SetAllControlsDirty();
}
}


Almost did the trick for me but in the end it still had a few shortcomings. I ended up doing:

void PlugExample::OnParamChange(int paramIdx)
{
...
RedrawParamControls();
...
}


So far this seems to have solved all the main problems with various controls not updating and it seems a lot more "intended" than the other suggestion.

bvesco
01-18-2009, 05:51 PM
I wanted my user edit boxes to have text highlighted by default (which is not how it behaves "out of the box"). I primarily wanted this to work with my ICaptionControl objects but this solution makes it work for any "PromptUserInput" style text edit boxes.


void IGraphicsWin::PromptUserInput(IControl* pControl, IParam* pParam)
{
...
if (! n)
{
SetFocus(mParamEditWnd);
SendMessage(mParamEditWnd, EM_SETSEL, 0, -1);
}
}


There appears to be a font handle leak in this function. I think this and the other font problems could be solved by associating a font handle pointer with each IControl object where they cache their own handle to be deleted with themselves. Not sure where to hang this extra font handle for edit boxes, maybe on the IGraphicsWin object itself since there can only ever be one at a time.

Before I tackle that though, there is still a problem with this code and the "PromptUserInput" edit box. When you activate the edit box (with text highlighted by default) and hit enter (without typing in the box) you will get a min value as return input. The text edit box itself contains the highlighted text of the current setting, but entering that still is treated as an empty entry until you make some form of input to the edit box. This could be in the form of even just a mouse click in the edit area. Anyone have any idea about this behavior?

bvesco
01-19-2009, 01:13 AM
This thread is getting too long.

I would love some code review and opinions on how I "fixed" the font rendering in IPlug. I started a new thread for this:

http://forum.cockos.com/showthread.php?p=275230

This allows us to render as many fonts in as many styles, sizes and weights as we'd like. All without leaking font handles like a sieve. Please continue any font discussions of this nature in the other thread.

Jeffos
11-02-2009, 06:38 AM
Is IURLControl working ? I've tried to attach this control... nothing appears (Win).

Also, given some posts of this thread, I'm not sure where's the latest IPlug version: is it the one embedded in WDL (the one I use) or the zip attached in the 1st post of this thread ?
For example: it's said that ICaptionControl should work, an example has been attached but it leads to "URL not found" and ICaptionControl does not work here (Win).

Thanks for any help!

Tale
11-02-2009, 08:04 AM
Is IURLControl working ? I've tried to attach this control... nothing appears (Win).
I hadn't found that control yet, so thanks for pointing it out to me.

Yes, it works here (Win32). I've just added this one line to a plug I'm working on:

pGraphics->AttachControl(new IURLControl(this, &IRECT(33, 267, 49, 283), "http://www.martinic.com/combov/"));

Now I can click in the 16x16 ractangle starting at (33, 267) of my plug's GUI to open my my website. Cool!

Also, given some posts of this thread, I'm not sure where's the latest IPlug version: is it the one embedded in WDL (the one I use) or the zip attached in the 1st post of this thread ?
For example: it's said that ICaptionControl should work, an example has been attached but it leads to "URL not found" and ICaptionControl does not work here (Win).
I assume the version on the WDL download page (http://www.cockos.com/wdl/) is the latest version, especially because it was updated only a couple of weeks ago (10 October).

Jeffos
11-02-2009, 08:19 AM
Thanks A LOT, Tale! With your code example, I've found my -big noob- error, I was using new IRECT(x,y,width,height) !! Same goes for ICaptionControl, both work fine now...
About the latest IPlug version: yep, quite sure, that's why I use this one.. May be an edit of the initial post could clarify this ([edit] done, thanks schwa!).
Thanks again, Tale.

whatsup
11-07-2009, 02:37 PM
is there a complete easy to install working demo (vc express /vc6) project ?
also a one post with full detailed instructions for newbies, is strongly needed.

whatsup
11-08-2009, 02:30 PM
i downloaded VST SDK and extracted the affect/x.h files
also downloaded WDL package
but a full working VC6/VC express demo project is still strongly needed.

onqel
11-08-2009, 03:54 PM
I really like this framework for doing vst :D but how do I proceed if I would like Mac compatibility? Do I need to compile it on a Mac?

Jeffos
11-08-2009, 04:31 PM
@whatsup
not sure I understand but there's a "full working VC6/VC express demo project" delivered : ..\wdl\IPlug\Example\IPlugExample.vcproj

@onqel
i guess yes, using: ..\YourIPlug\YourPlug.xcodeproj\project.pbxproj but i never did so, _cc would better reply..

whatsup
11-08-2009, 04:43 PM
thank you, now found it.

RRokkenAudio
11-09-2009, 01:03 PM
Yeah, I must say, I'm really having FUN with this framework!!!

~Rob.

matt42
12-15-2009, 08:22 PM
Hi there,

I'm having trouble getting the example to compile on windows. I'm getting the following linking errors:

1>MSVCRT.lib(MSVCR80.dll) : error LNK2005: _malloc already defined in LIBCMT.lib(malloc.obj)
1>MSVCRT.lib(MSVCR80.dll) : error LNK2005: _free already defined in LIBCMT.lib(free.obj)
1>MSVCRT.lib(MSVCR80.dll) : error LNK2005: _fclose already defined in LIBCMT.lib(fclose.obj)
1>MSVCRT.lib(MSVCR80.dll) : error LNK2005: _fopen already defined in LIBCMT.lib(fopen.obj)
1>MSVCRT.lib(MSVCR80.dll) : error LNK2005: _realloc already defined in LIBCMT.lib(realloc.obj)
1>MSVCRT.lib(MSVCR80.dll) : error LNK2005: _sprintf already defined in LIBCMT.lib(sprintf.obj)
1>MSVCRT.lib(MSVCR80.dll) : error LNK2005: _abort already defined in LIBCMT.lib(abort.obj)
1>MSVCRT.lib(MSVCR80.dll) : error LNK2005: _sscanf already defined in LIBCMT.lib(sscanf.obj)
1>MSVCRT.lib(MSVCR80.dll) : error LNK2005: _getenv already defined in LIBCMT.lib(getenv.obj)
1>MSVCRT.lib(MSVCR80.dll) : error LNK2005: _fprintf already defined in LIBCMT.lib(fprintf.obj)
1>MSVCRT.lib(MSVCR80.dll) : error LNK2005: ___iob_func already defined in LIBCMT.lib(_file.obj)
1>MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj)
1>MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: class type_info & __thiscall type_info:: operator=(class type_info const &)" (??4type_info@@AAEAAV0@ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj)
1>MSVCRT.lib(MSVCR80.dll) : error LNK2005: __stricmp already defined in LIBCMT.lib(stricmp.obj)
1> Creating library Release/test.lib and object Release/test.exp
1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>Release/IPlugExample.dll : fatal error LNK1169: one or more multiply defined symbols found

Can anyone help me out?

Thanks in advance,

Matt

bvesco
12-15-2009, 08:59 PM
LIBCMT errors: http://www.plugindeveloper.com/tag/linker

dub3000
12-15-2009, 09:33 PM
Yeah, I must say, I'm really having FUN with this framework!!!

me too... busy porting my JS effects to C++, plus extra bits...

fwiw - floaty as a C++ plugin runs about 4-5x faster.

junioreq
12-15-2009, 09:43 PM
See, i know NOTHING about DSP :( so i have to try to learn that too. And you know, theres nothing that I can find that says:

To make a signal louder multiply or add or etc...

There is no tutorial!!

Like, I want to add rms to a compressor i'm modding, Man, taking forever to find a code snippet that I understand etc....

Iplug is amazing so far!

~Rob.

junioreq
12-15-2009, 10:06 PM
One thing though, that would be nice is some sample code on LICE. Like, how to draw a display like reaEQ has etc. Don't even know where to start with lice.

~Rob.

dub3000
12-15-2009, 10:44 PM
huge list of resources: http://www.kvraudio.com/forum/viewtopic.php?t=30071

best one is http://www.musicdsp.org/ - has cookbooks for pretty much everything.

Jeffos
12-16-2009, 01:10 AM
a floaty VST, cool dub3000 (we use it often here..) !
excatly the same here, I started to port all my JSs since I met IPlug.. but JS remains super-cool for fast tuning (mostly with midi when the guitarist says "now I want my gt-6 to make some coffee" during a rehearsal!).

rob, in order to use lice primitives you have to subclass your own control and override the draw() method. an very cool lice project example can be found on the WDL download page (jetpack, bottom of the page: mainly bitmap usage tho, few primitives) and we can at least see some justin's code ;-)

junioreq
12-16-2009, 01:31 AM
yeah, been waiting to see some justin code :) "warning, need gas" lol

BTW: If you guys get that brute force ir going thats in there, let me know :)

~Rob.

matt42
12-16-2009, 04:59 AM
LIBCMT errors: http://www.plugindeveloper.com/tag/linkerThanks for that - my google-fu is clearly weak. That also look like a great site so thanks again.

Cheers,

Matt

Astralp
01-20-2010, 07:12 PM
Could someone please upload an xcode project for building lice, I have been attempting to compile it all day without success. Failing that if someone can upload a compiled lice, that would at least allow me to struggle on. I'm new to OSX and xcode but would love to get this working. An xcode project for IPlug would be nice too, although I am not using the lib on my windows setup.

Sorry for the double post, I have made a thread on the forum for this issue yesterday, but I figured I might have more success with users subscribed to this thread!

many thanks
Andy

Astralp
01-20-2010, 08:31 PM
Ok, worked it out finally... I'll post my experience on my original thread

Astralp
01-21-2010, 10:57 AM
Well, it compiled but doesn't work as VST or AU unfortunately. Garageband crashes on detecting the AU plug and says:

"GarageBand unexpectedly quit while trying to use the Audio Unit “IPlug Example” by “Schwa”.
This plug-in may require an update."

Reaper does actually load the AU plug, but it crackles when using the sliders. Reaper crashes when scanning the VST version.

I am assuming that I am either doing something wrong or there is a problem with the compiler settings, I will try and describe what I have tried and hope that somebody will offer some help, I'm completely stumped.

First I am on OS X 10.5.8 using the latest version of X-code for 10.5 which is 3.1.4.

After extracting wdl, I then extract the image zip, make the change to line 82 of AEffect which stops the deprecated errors.

Next I open the example xcode project, scroll down to Linked frameworks, double click on IPlug.xcodeproj which then opens in a new window. I then build this and it compiles, but produces 198 warnings which are mostly:

'warning: taking address of temporary'

other errors are:

'warning: "MIN" redefined'
'warning: "MAX" redefined'
/VST/wdl/IPlug/IGraphicsMac.mm:165: warning: instance variable 'mGraphics' is @protected; this will be a hard error in the future
/VST/wdl/IPlug/IPlugAU.cpp:769: warning: enumeral mismatch in conditional expression: '<anonymous enum>' vs '<anonymous enum>'

/VST/wdl/IPlug/IGraphicsCarbon.cpp:8: warning: 'GetRegionBounds' is deprecated (declared at /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/ApplicationServices.framework/Frameworks/QD.framework/Headers/Quickdraw.h:7119)

plus a whole other bunch of deprecated graphics like the above

/VST/wdl/IPlug/../lice/lice_text.cpp:1287: warning: comparison is always false due to limited range of data type

Those are the main errors alongside a few unused variables.


For the settings, I presume that 386 should be selected, I have tried both 10.4 and 10.5 which doesn't make any difference.

So, after that I compile the main project using the same setting I used for the IPlug compile. This builds successfully too, but has the following errors:

Checking Dependencies
Warning: The Compile Sources build phase contains this target's exported symbols file 'IPlugExample.exp'.
warning: no rule to process file '$(PROJECT_DIR)/IPlugExample.exp' of type sourcecode.exports for architecture i386
Warning: The Compile Sources build phase contains this target's exported symbols file 'IPlugExample.exp'.
warning: no rule to process file '$(PROJECT_DIR)/IPlugExample.exp' of type sourcecode.exports for architecture i386

Plus a few more:

/VST/wdl/IPlug/Example/../IControl.h:102: warning: taking address of temporary

and MIN/MAX redefined.

Regardless of build type debug/release the plugins don't work.

I've run out of ideas, I'm hoping someone can see something obvious here and I can get on with some coding! Not sure what else to try, and after loving IPlug in windows so far, the main attraction being the single code base idea, I'm starting to feel despondent that it won't work... Any suggestions appreciated! I'm wondering whether I should install an earlier Xcode.

thanks
Andy

schwa
01-21-2010, 11:03 AM
I don't think the xcode version would make a difference. Do you have the latest WDL from here http://www.cockos.com/wdl/ ?

Frustrating I know, but you could try running the plugin under the xcode debugger, to see where it crashes on the initial scan.

Astralp
01-21-2010, 11:11 AM
Thanks for answering schwa. Yes I have the latest wdl from that page.

I just added the complete logs as attachments, do you get these same warnings when you compile?

I will investigate the debugger, though again it is an unknown realm...

thanks again, I'd love to get this working, it is such a fantastic framework..

Astralp
01-21-2010, 12:27 PM
Been trying to use the debugger, I presume that the way to do it is you attach to a process such as garageband, but when i try it says no executable in path. I've never debugged a plug before, only an exe a long time ago. I usually do my debugging with log files, I guess I'll try that.

I've also just made an AU project from the templates in xcode and that worked flawlessly, so I don't think there is anything wrong with my xcode setup at least...

Astralp
01-22-2010, 10:46 AM
Well I'm still plodding along with this, seems like the only problem with AU is in garageband which crashes on starting up detecting the example plug. Works in other hosts I've tried. Can anyone else confirm this with the example plug or is it just me? My garageband is up to date from the iLife 09.

I'm getting tantalizingly close to having one of my projects compile, but now have discovered that the text structure appears to be missing in the library. If I put this in the example project:

IText textStyle(16, &list_text_colour, "Arial", IText::EStyle::kStyleNormal,IText::EAlign::kAlignN ear);

It complains that there is no class/namespace etc...

I can't understand why as other structs seem to be ok from the Istructures.h

Is text supported on OSX?

Astralp
01-22-2010, 11:13 AM
Oh, forgot the color:

IColor list_text_colour(10,240,240,240);

which goes above the IText, this is accepted which is baffling as the structs are defined in the same place.. the headache continues. Does anyone actually use IPlug to produce AU's regularly?

Astralp
01-22-2010, 02:41 PM
Oh well, I give up, aside from the text issue I am also getting crashes in all AU hosts now when loading my custom plugin. I don't know whether I am missing something, but I feel that there are problems with the OS X support that I just don't have the ability to understand. I will continue to use IPlug for windows probably, but I am going to work on native AU plugs for the MAC, trying to get this working has zapped an enormous amount of energy. It's a real shame as the single base idea is truly brilliant... The AU examples with xcode compile and work flawlessly, so I'm going to direct my energy there.

Andy

olilarkin
02-01-2010, 05:18 AM
did you change the various IDs in the resource.h? I have had a lot of problems, with aus crashing logic (although they passed the auval) when i did this (although i tried to stick to the advice in the comments). Eventually i seem to have it working

Astralp
02-01-2010, 05:25 AM
Hi Oli

Can you clarify what you mean by change the ids? I have VST working flawlessly now on Mac, but haven't tried again with AU. This is promising that you have them working though, at least I know someone has for certain now :)

nice to see you on here btw!
take care
Andy

olilarkin
02-01-2010, 10:47 AM
I just tried it and i get the

"Logic Pro unexpectedly quit while trying... This plug-in may require an update."

when i set PLUG_MFR and PLUG_MFR_ID in resource.h to the same four char string. If they are different it works.

oli

Astralp
02-02-2010, 10:23 AM
Hi oli

Thanks so much, your advice has AU working for me although strangely it was the opposite of what you said, when I made the above 2 the same it worked for me.

The only problem I have now is that the controls with no parameters associated aren't working, but I am over the moon to get a loadable AU plug. Thanks so much!

Andy

olilarkin
02-03-2010, 03:25 AM
what exactly did you set them to? I'd like to work out exactly what the problem is

Astralp
02-04-2010, 06:22 PM
I'm away at the moment, I'll have a look when I get back but from memory I think it was just hgso for both. It is a bit annoying because the plugs are categorized by this in some hosts.

cerberus
07-24-2010, 05:55 PM
i'm trying to change the font style, size and specify an r,g,b or hex color...

my result is not successful so far:
http://gyazo.com/1e573bae76fd0054ba92df8ac3bea6ff.png

here is the relevant code :

////attatch text control
//IText lFont2(28, &COLOR_YELLOW, "Arial");
//ITextControl *pTextControl=new ITextControl(this, &IRECT(10, 100, 10 + 128, 100 + 32), &lFont2,"55");

IText lFont2(28, &COLOR_YELLOW, "Arial", IText::kStyleItalic);

ITextControl *pTextControl=new ITextControl(this, &IRECT(10, 100, 10 + 128, 100 + 32), &lFont2,"55");

pGraphics->AttachControl(pTextControl);

// Convert result to string and assign to restoString variable
double dbResult = 50.0; //fixed test number..

char restoString[5];
sprintf(restoString, "%f", dbResult);

char *updCaption = restoString;
pTextControl->SetTextFromPlug(updCaption);




AttachGraphics(pGraphics);

cerberus
07-25-2010, 08:54 AM
would it be possible to work around this using LICEtext? i see : "class LICE_IFont"
etc. which appears to have a different set of formatting options than the IText library.

cerberus
07-26-2010, 07:31 AM
http://gyazo.com/d1f48f4e0f15435f01b1f2edc4fd4b37.png

is this meant to work, the text field is not accessible to copy from, that
issue is discussed here http://forum.cockos.com/showthread.php?p=551759#post551759

is there a different method to control IText fonts and font styles for osx?

i can't read that tiny font easily... can anyone?

Tale
07-26-2010, 07:52 AM
I'm not sure what exactly you are trying to accomplish, but I use pGraphics->DrawIText() in customized controls to display text in my ComboV plug (screenshot (http://www.martinic.com/combov/screenshots/settings.jpg)). I do this by implementing my own Draw() method, e.g.:

char mText[100];

...

bool MyControl::Draw(IGraphics* pGraphics)
sprintf(mText, "%0.2f", mValue);
return pGraphics->DrawIText(&IText(17, &IColor(255, 160, 160, 160), NULL, IText::kStyleNormal, IText::kAlignFar), mText, &IRECT(400, 300, 500, 330));

Note that the current Windows implementation allows only one font and size per plug-in instance(?), I am unsure if this also goes for Mac. I believe there is a mod floating around here somewhere that overcomes this limitation.

Another thing is that I don't understand Mac font sizes, as they seem to come out smaller than on Windows. A Mac font size of 17 is about the same size as a font size of 15 on Windows.

bvesco
07-26-2010, 10:57 PM
The mod is located here:

http://www.plugindeveloper.com/02/improved-font-rendering

Of special note on Windows fonts below a certain size for certain font faces get replaced with a default font face. So you might get your Times New Roman at 15 pts but it becomes Arial when you get down to about 8 or so.

cc_
07-27-2010, 12:43 AM
Another thing is that I don't understand Mac font sizes, as they seem to come out smaller than on Windows. A Mac font size of 17 is about the same size as a font size of 15 on Windows.

I don't understand them either! But I messed about a bit to try and get them to come out the same - it's in my mods. It's not easy getting the positioning the same either. I didn't check many font sizes though...

The changes are to IDrawText in IGraphicsMac.mm

Tale
07-27-2010, 01:18 AM
I don't understand them either! But I messed about a bit to try and get them to come out the same - it's in my mods. It's not easy getting the positioning the same either. I didn't check many font sizes though...

The changes are to IDrawText in IGraphicsMac.mm
Thanks, I'll check them out.

olilarkin
07-27-2010, 02:31 AM
I have been working on a couple of solutions to the font problem–the first one involves making a bitmap (in gimp or photo shop etc) which holds each character of the font at the desired size (mono space fonts only). The second solution involves linking to the freetype library (but I didn't get that far yet). The second solution should be a lot more flexible.

cc_
07-27-2010, 07:27 AM
Did you consider the text facilities in lice? I seem to remember schwa saying something about this. I have been meaning to look at it, but haven't had time. lice_textnew.cpp looks interesting, I guess combined with the swell to make the HFONT stuff work on OSX.

Then again I noticed that swell-gdi-lice.cpp has this line in it:


#define FONTSCALE 0.9


so maybe the results are not going to be pixel identical :D

cerberus
07-27-2010, 08:41 AM
The mod is located here:

http://www.plugindeveloper.com/02/improved-font-rendering

Of special note on Windows fonts below a certain size for certain font faces get replaced with a default font face. So you might get your Times New Roman at 15 pts but it becomes Arial when you get down to about 8 or so.
that method seems to be for windows only. i assume tale's code will work in osx?

Tale
07-27-2010, 10:24 AM
that method seems to be for windows only. i assume tale's code will work in osx?
Yes, my code will work in both Windows and OS X.

Jeffos
07-27-2010, 03:16 PM
I've drawn some text using LICE_IFont (well LICE_CachedFont) in IPlug, -theorically- this should also work on OSX (?). However, I did some mods in IPlug: I moved DrawIText() in IGraphicsLice (+ related clean-up in inherited classes) + see below + I defined a new attribute mFontIdx in IText (updated contructors too).
Well, quick/brutal job (be cool about "MAX_NB_FONTS").. could be of course be improved. You also need SWELL's LOGFONT + "../lice/lice_text.h" + "../ptrlist.h"

HTH! I'd like to know how/if it works on OSX!

Added in IGraphicsLice.h:

bool IGraphicsLice::DrawIText(IText* pText, char* str, IRECT* pR);
WDL_PtrList<LICE_CachedFont> m_fonts;


Added/moded IGraphicsLice.cpp:

IGraphicsLice::IGraphicsLice(IPlugBase* pPlug, int w, int h, int refreshFPS)
: IGraphics(pPlug, w, h, refreshFPS), mDrawBitmap(0), mTmpBitmap(0)
{
for (int i=0; i < MAX_NB_FONTS; i++)
m_fonts.Add(new LICE_CachedFont);
}

IGraphicsLice::~IGraphicsLice()
{
DELETE_NULL(mDrawBitmap);
DELETE_NULL(mTmpBitmap);
m_fonts.Empty(true);
}

bool IGraphicsLice::DrawIText(IText* pText, char* str, IRECT* pR)
{
if (!str || str == '\0') {
return true;
}
if (pText->mFontIdx >= MAX_NB_FONTS)
return false;
RECT R = { pR->L, pR->T, pR->R, pR->B };
if (!m_fonts.Get(pText->mFontIdx)->GetHFont())
{
LOGFONT lf = {
pText->mSize,0,0,0,FW_NORMAL,FALSE,FALSE,FALSE,DEFAULT_CH ARSET,
OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUA LITY,DEFAULT_PITCH,
(CHAR)pText->mFont
};
m_fonts.Get(pText->mFontIdx)->SetFromHFont(CreateFontIndirect(&lf),LICE_FONT_FLAG_OWNS_HFONT);
m_fonts.Get(pText->mFontIdx)->SetBkMode(TRANSPARENT);
m_fonts.Get(pText->mFontIdx)->SetTextColor(
LICE_RGBA(pText->mColor.R,pText->mColor.G,pText->mColor.B,pText->mColor.A));
}
m_fonts.Get(pText->mFontIdx)->DrawText(mDrawBitmap, str, -1, &R, DT_LEFT | DT_VCENTER);
return true;
}


[edit] I forgot! the idea is of course to support multiple fonts in a same plug

Tale
07-28-2010, 01:37 AM
I can't even get it work on Windows. I get an error from the linker saying it can't resolve LICE_CachedFont.

BTW, I know you have just copied it from the original, but this can't be right:

if (!str || str == '\0') {
return true;
}

Surely this was meant (right?):

if (!str || *str == '\0') {
return true;
}

Jeffos
07-28-2010, 03:03 AM
Thanks for giving it a try, Tale!

For your linking issue, I can't check that from where I am but, as said above, I'd say you need something like this in IGraphicsLice.h:

#define MAX_NB_FONTS 8
#include "../lice/lice_text.h"
#include "../ptrlist.h"


For the *str == '\0', LOL, of course! But please, keep the credits to schwa :D (copy/paste from IGraphicsWin indeed)

Disclaimer: although I'm deeply into WDL/LICE now, I really am an OSX noob! Carbon, coca-cola and stuff are still chineese to me. Fortunately, I'll borow a MAC for a couple of weeks soon.. Also, this should be considered as a POC, I did that following schwa's remark about bvesco's mod.. to see..

Jeffos
07-28-2010, 07:35 AM
Just posted in another thread (I quote it here as this thread is IPlug's entry point):
Similarly, the text display features are limited on Windows and extremely limited on Mac. LICE's text display features are pretty good now (they didn't exist when iplug was written), so the "right" thing to do is to implement text drawing in iplug using LICE_CachedFont. This isn't a quick job, though.

I understand this as LICE_CachedFont is indeed the way to go, but what I posted above is insufficient/incorrect for OSX (I just know it's ok on Win).

Adam Fulara
02-23-2011, 08:07 AM
Is that library working with Gnu C++ compiler too?

Edit: nevermind, I downloaded free Visual C++ Express and it's working fine. Looks great! :D

olilarkin
02-27-2011, 06:35 AM
Is that library working with Gnu C++ compiler too?

if you're still interested i have some codeblocks/mingw projects in my git repository. it seems ok so far, except for finding resources. The binary obviously includes them but i still get an error that they can't be found

oli

olilarkin
03-23-2011, 11:47 AM
Jeffos - i got your mod working on OSX.

it's here if anyone wants to try https://github.com/olilarkin/wdl-ce/tree/igraphicsmod

work in progress (see screenshot)! Hopefully can get the fonts to look really similar. Actually some of those fonts are probably not installed on my windows vm, so didn't show up properly

olilarkin
03-23-2011, 11:49 AM
i also merged IGraphicsLice into IGraphics as shwa was suggesting on another thread. seems to be working ok so far.

gluon
05-15-2011, 12:02 AM
hello experts,
just wanted to figure out if IPlug C++ is still developped and used.
I checked that the first post was from 2007 so I just ask the question.

I'm looking for a framework to begin to design VST for designthemedia.com
synthmaker seems nice, but I'm afraid to be a bit limitated because it seems we cannot tweak the code under the hood.

any infos would be appreciated :)

bvesco
05-15-2011, 12:59 AM
IPlug is alive and kicking. There is the official version here and the community edition maintained at https://github.com/audio-plugins/wdl-ce

gluon
05-15-2011, 01:21 AM
ok bvesco, thanks for your precious feedback !

I'd need a little help to build my toolchain with eclipse etc.
Can I find it here?

izmirlig
09-07-2011, 10:27 AM
@schwa
with regards to IPLUG-- I am a statistician who does music as a very very serious hobby. When I got my fireware audio interface several years ago I decided to play around and learn the RIFF/WAV format. I wrote a small program to read and copy the format block to a second file and then 'speed up' the file by an integer factor, F, supplied by the user (2, 4, etc). Inside the program, the WAV file format block was analyzed for sample rate, bytes per sample etc. The final data block split the bytes per sample into F pieces and averaged them. It works! I am aware that there are plenty of simple ways to do this but it amused me to no end doing it myself in C.

Several years later, I dusted off this old program and decided to play around some more--maybe try filtering using Fourier transform--once again--nothing new or earth shattering here--I have plenty of plugins that probably can do that in my Cubase LE Elements 6. I'm just in it for fun.

What I was wondering is maybe I could use your IPLUG to turn my experiments in to VST plugins. I am not facile with object oriented programming in C++ but I have had experience with classes in Java and in R. So would the learning curve be too steep? In any case, I'll download IPLUG and take a look at the samples. I was interested in starting a dialogue with you. If this gets anywhere--I'll write back with a [shorter] update on my progress.