|
12-10-2009, 03:48 PM
|
#1
|
Human being with feelings
Join Date: Aug 2008
Location: Buffalo NY
Posts: 1,091
|
ReaEQ type graph
Anyone have any luck getting graphics to draw with lice? Thinking about making a typical EQ like ReaEQ or a compressor that shows the knee, You know what i'm talking about
Don't really know where to start.
~Rob.
|
|
|
01-17-2010, 10:13 AM
|
#2
|
Human being with feelings
Join Date: Jun 2009
Location: Buffalo, NY
Posts: 777
|
Does anyone have a screenshot of a plug using iplug that has this??
|
|
|
01-22-2010, 09:54 AM
|
#3
|
Human being with feelings
Join Date: Jun 2009
Location: Buffalo, NY
Posts: 777
|
Ok, that was a fail, lets try again:
Does anyone have any idea where I should turn to, some outside library, that I can start making Lines, Curves etc, with documentation, or any info at all on how to start doing dynamic guis?
~Rob.
|
|
|
01-22-2010, 10:48 AM
|
#4
|
Human being with feelings
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
|
Quote:
Originally Posted by RRokkenAudio
Ok, that was a fail, lets try again:
Does anyone have any idea where I should turn to, some outside library, that I can start making Lines, Curves etc, with documentation, or any info at all on how to start doing dynamic guis?
~Rob.
|
Forget external libraries and just use Lice with IPlug. It's very easy to draw some lines but you must figure out the math of lining out a filter's response curve yourself.
Here's a simple class that does custom drawing for an IPlug plugin using Lice :
Code:
// header file
class IDistributionGraph : public IControl
{
public:
IDistributionGraph(IPlugBase* pPlug, int x, int y,int width,int height, int paramIdx);
bool Draw(IGraphics* pGraphics);
bool IsDirty() { return true;}
private:
int m_width;
int m_height;
int m_xpos;
int m_ypos;
IPlugBase *m_pPlug;
};
// cpp file
IDistributionGraph::IDistributionGraph(IPlugBase *pPlug, int x, int y, int width, int height, int paramIdx)
: IControl(pPlug, &IRECT(x,y,width,height ))
{
OutputDebugString("dist graph ctor");
m_height=height;
m_width=width;
m_xpos=x;
m_ypos=y;
m_pPlug=pPlug;
}
bool IDistributionGraph::Draw(IGraphics* pGraphics)
{
//OutputDebugString("dist graph draw()");
IColor color(255,255,255,255);
//SetDirty();
double lowFreq= m_pPlug->GetParam(kLowFreq)->Value();
double hiFreq=m_pPlug->GetParam(kHighFreq)->Value();
double distr=m_pPlug->GetParam(kFilterFreqDistribution)->Value();
int numFilters=m_pPlug->GetParam(kNumFilters)->Int();
for (int i=0;i<numFilters;i++)
{
double filterfreqNorm=1.0/(numFilters-1)*i;
double shapedNormFreq=pow(filterfreqNorm,distr);
double freq=lowFreq+((hiFreq-lowFreq)*shapedNormFreq);
double xscaler=m_width/(20000.0-20.0);
double xcor=8+xscaler*freq;
pGraphics->DrawLine(&color,xcor,m_ypos+1,xcor,m_ypos+ m_height-2,0,true);
}
//xcor=8+xscaler*hiFreq;
//pGraphics->DrawLine(&color,xcor,m_ypos+1,xcor,m_ypos+ m_height-2);
return true;
}
That draws the graph within the red outline :
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
Last edited by Xenakios; 01-22-2010 at 11:04 AM.
|
|
|
01-22-2010, 11:10 AM
|
#5
|
Human being with feelings
Join Date: Jun 2009
Location: Buffalo, NY
Posts: 777
|
Thank you xenakios! Can't thank you enough.
~Rob.
|
|
|
01-22-2010, 11:35 AM
|
#6
|
Human being with feelings
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
|
Quote:
Originally Posted by RRokkenAudio
Thank you xenakios! Can't thank you enough.
~Rob.
|
I know the example isn't what you need but you seemed to be stuck with the "drawing lines" step. That's easy enough, the real difficulty will be coming up with the math for the filter response. (Unless you have some filter code that already provides that data for you. Of course you could also make a crude estimation of the response out of thin air for display purposes but anal retentive people would probably catch you had done that. )
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
|
|
|
01-22-2010, 11:51 AM
|
#7
|
Human being with feelings
Join Date: Jun 2009
Location: Buffalo, NY
Posts: 777
|
Where in LICE did you pull DrawLine from?
|
|
|
01-22-2010, 12:08 PM
|
#8
|
Human being with feelings
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
|
Quote:
Originally Posted by RRokkenAudio
Where in LICE did you pull DrawLine from?
|
Actually it's a bit complicated. You are provided the IGraphics pointer :
Code:
bool IDistributionGraph::Draw(IGraphics* pGraphics)
And you can then use for example the DrawLine() method of IGraphics. That in turn calls the Lice stuff internally. (As there is some initialization and book keeping that must be done when using Lice, so IGraphics abstracts that away. I believe IGraphics also used to have an OS dependent backend that was calling Windows and Mac OS-X native drawing APIs. Later Cockos Lice was added as the preferred backend.)
Using Lice directly with IPlug is a bit involved according to Schwa. (It's certainly possible though.) However you will probably have most of the necessary APIs in IGraphics to do your custom drawing. You can see what the supported drawing functions are in IGraphics.h.
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
Last edited by Xenakios; 01-22-2010 at 12:18 PM.
|
|
|
01-22-2010, 12:20 PM
|
#9
|
Human being with feelings
Join Date: Jun 2009
Location: Buffalo, NY
Posts: 777
|
ahh cool thanks, I won't look too much under the hood. Actually while typing: GetGUI()-> The quick text or whatever showed up,and I seen all the cool stuff you can do with iplug
BTW: For testing, I put:
Code:
bool IDistributionGraph::Draw(IGraphics* pGraphics)
{
IColor color(255,255,255,255);
pGraphics->DrawLine(&color,200,90,200,2+53,0,true);
return true;
}
Nothing showing up, prob because i dont understand all the arguments lol, But it didnt throw errors!
~Rob.
|
|
|
01-22-2010, 12:28 PM
|
#10
|
Human being with feelings
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
|
Quote:
Originally Posted by RRokkenAudio
ahh cool thanks, I won't look too much under the hood. Actually while typing: GetGUI()-> The quick text or whatever showed up,and I seen all the cool stuff you can do with iplug
BTW: For testing, I put:
Code:
bool IDistributionGraph::Draw(IGraphics* pGraphics)
{
IColor color(255,255,255,255);
pGraphics->DrawLine(&color,200,90,200,2+53,0,true);
return true;
}
Nothing showing up, prob because i dont understand all the arguments lol, But it didnt throw errors!
~Rob.
|
IDistributionGraph is a subclass of IControl, so it must be added as a control to the plugin like the usual sliders etc...(You must come up with a dummy plugin parameter if the control doesn't actually control any parameter of the audio processing.) The reason you would probably want your drawing to happen in IControl subclasses is that it's easier that way. Just implement the Draw() in the subclass, you are provided with the IGraphics object automatically and so on. Directly drawing with Lice on the plugin surface would be more involved.
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
|
|
|
02-19-2010, 05:16 PM
|
#11
|
Human being with feelings
Join Date: Jun 2009
Location: Buffalo, NY
Posts: 777
|
BTW: anyone else have a screenie of thier iplug using a graph or line?
One thing with iplug, haven't seen it done yet.
Still can't figure out how to draw a line or any object to the screen, never minding all that class stuff:
Code:
IColor color(255,255,255,255);
pGraphics->DrawLine(&color,200,90,200,2+53,0,true);
Should draw something! right? I mean, theres a bunch of stuff in igraphics that can DRAW. Can't get a single one of them to do anything.
~Rob.
Last edited by RRokkenAudio; 02-19-2010 at 05:30 PM.
|
|
|
02-19-2010, 06:43 PM
|
#12
|
Human being with feelings
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
|
Quote:
Originally Posted by RRokkenAudio
Should draw something! right? I mean, theres a bunch of stuff in igraphics that can DRAW. Can't get a single one of them to do anything.
~Rob.
|
If anything will be drawn will depend on if you've set up all the stuff correctly before.
-Have you made your subclass of IControl?
-Have you instantiated that as an object correctly on the plugin?
-Have you confirmed your subclass's draw() method is actually being called?
-Are you trying to do your test drawing to the correct coordinates and with a color that will be visible?
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
|
|
|
02-20-2010, 08:53 AM
|
#13
|
Human being with feelings
Join Date: Mar 2009
Posts: 256
|
Maybe the thing you're missing is that the Plugin window is not just a blank canvas you can draw on and expect things to stay there. It's really a collection of controls which are being told to redraw themselves all the time (when parameters change, or the window is deiconified etc). Even in areas where there are no real controls there is the background 'control' that is redrawn clobbering everything else.
That's why it's easiest to implement your drawing in the draw method of a fake control you make (derived from IControl), then you can be sure your draw routines will be called to redo your drawing at the correct times, so it appears that the stuff is always there on your plugin window.
|
|
|
02-21-2010, 11:50 AM
|
#14
|
Human being with feelings
Join Date: Aug 2008
Location: Buffalo NY
Posts: 1,091
|
Hmmm yeah, clears things up a little bit, still, I can see putting the code in Icontrol. h or whatever, but that other stuff, not quite too sure about, seeing as though to attach a control usually its just like:
Code:
pGraphics->AttachControl(new IKnobMultiControl(this, 312,48, kmakeup, &bitmap));
Isn't there a way to just do:
Code:
pGraphics->AttachControl(new FreqDrawLine(&color,200,90,200,2+53,0,true);
and be done with it?
hehe, Think i'm just gonna stay with that vintage look afterall ha
Last edited by junioreq; 02-21-2010 at 12:06 PM.
|
|
|
03-19-2010, 08:44 AM
|
#16
|
Human being with feelings
Join Date: Jun 2007
Location: Tromsø, Norway
Posts: 223
|
Yeah I believe it can..
You only need a few points, and interpolate between them.. of course there's some code to be written
Here's what I made in 5 minutes changing 6 lines of code in the DistributionGraph example above..
and a little more "advanced", a scope:
http://dl.dropbox.com/u/1369729/misc/IPlugScope.dll
Last edited by onqel; 03-19-2010 at 09:58 AM.
|
|
|
03-19-2010, 09:00 AM
|
#17
|
Human being with feelings
Join Date: May 2006
Posts: 58
|
In case you develop on a mac you might want to have a look at the Filter Demo AU code example.
It seems to do exactly what you are looking for:
(you would of course have to wrap the supplied code into the IPlug/Lice classes but at least it seems to be a good starting point)
Source code is available from:
http://developer.apple.com/mac/libra...emo/index.html
Andreas
|
|
|
03-19-2010, 10:55 AM
|
#18
|
Human being with feelings
Join Date: Jun 2009
Location: Buffalo, NY
Posts: 777
|
aww man, I gotta try to get this damn thing going!!! 5 mins! wtf lol..
~Rob.
|
|
|
07-25-2010, 03:26 AM
|
#20
|
Human being with feelings
Join Date: Aug 2008
Location: Buffalo NY
Posts: 1,091
|
How did you know what you needed here, to make this line up?
Code:
IDistributionGraph(IPlugBase* pPlug, int x, int y,int width,int height, int paramIdx);
|
|
|
07-31-2010, 12:14 AM
|
#21
|
Human being with feelings
Join Date: Jun 2009
Location: Buffalo, NY
Posts: 777
|
Got it working and drawing last night. Now what will codes like that (musicdsp) put out? Does it output a few numbers that are then (problably not easily) applied to the draw arc? Like, I picture it like one of these for each filters, how would they connect or interact?
Last edited by RRokkenAudio; 07-31-2010 at 01:18 AM.
|
|
|
08-28-2010, 08:46 PM
|
#22
|
Human being with feelings
Join Date: Jun 2009
Location: Buffalo, NY
Posts: 777
|
So, once you get the magnatude, what do you do with that? Use Iplug directly,or try to use lice?
DrawRadialLine, drawarce ?
Edit: perhaps it may be that you just draw pixel per pixel.... hmmm
~Rob.
Last edited by RRokkenAudio; 08-28-2010 at 09:04 PM.
|
|
|
10-29-2010, 02:48 PM
|
#23
|
Human being with feelings
Join Date: Sep 2009
Posts: 623
|
Quote:
Originally Posted by RRokkenAudio
Got it working and drawing last night. Now what will codes like that (musicdsp) put out? Does it output a few numbers that are then (problably not easily) applied to the draw arc? Like, I picture it like one of these for each filters, how would they connect or interact?
|
ok, this is driving me nuts. Can you explain to me how you got it to draw. I've been at it all day and I'm not getting anywhere.
|
|
|
10-29-2010, 03:55 PM
|
#24
|
Human being with feelings
Join Date: Jul 2006
Location: Cowtown
Posts: 1,562
|
Quote:
Originally Posted by onqel
|
One thing to look out for...there's several different ways to state those equations, and some are better than others from a computing standpoint (even though they may be the same mathematically) They can generate extremely small numbers and either inflict you with rounding errors or with denormals.
Can't remember what I did offhand, but I do remember it took me a while with a fair amount of swearing.
Scott
|
|
|
10-29-2010, 03:59 PM
|
#25
|
Human being with feelings
Join Date: Aug 2008
Location: Buffalo NY
Posts: 1,091
|
I smoked my brain even trying to LOOK at the magnitude codes out there hahaa.
~Rob.
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 12:37 AM.
|