VST compiled for linux / gui message loop

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

VST compiled for linux / gui message loop

jorgen-2
Hi, Im coding a VST host for windows and linux. The linux version will
support VSTs compiled on linux and not using wine or aything. Of course,
there is not alot of native linux VST plugins around but that will
change (I already made one :P )

There is one challange though, event dispatching in X11. Unlike windows,
X11 windows doesnt have an assotiated window proc for dispatching
events. I can overcome this in my own gui toolkit by passing a Display*
pointer to the plugin etc, but it wouldnt work with other gui toolkits.

So how do I make a soution that work with any toolkits on linux?

1) the plugin calls its own event loop in effEditIdle
2) make a new atom "wndproc" for storing wndproc function per window,
the host will send XEvents to the wndproc if found.

I prefer 1) but I dont know if toolkits supports manually calling the
event loop?

cheers
jorgen


Reply | Threaded
Open this post in threaded view
|

Re: VST compiled for linux / gui message loop

torbenh
On Sat, Jan 07, 2006 at 11:58:49AM +0100, jorgen wrote:
> Hi, Im coding a VST host for windows and linux. The linux version will
> support VSTs compiled on linux and not using wine or aything. Of course,
> there is not alot of native linux VST plugins around but that will
> change (I already made one :P )

:) cool welcome abord. so you ported vstGUI ?
how will that work ?
does a vst plugin coder only recompile his plug then ?

>
> There is one challange though, event dispatching in X11. Unlike windows,
> X11 windows doesnt have an assotiated window proc for dispatching
> events. I can overcome this in my own gui toolkit by passing a Display*
> pointer to the plugin etc, but it wouldnt work with other gui toolkits.
>
> So how do I make a soution that work with any toolkits on linux?

we are still searching for a solution with a window generated in the
same process. with different toolkits etc.

to my knowledge
this has not really been solved. believe me, there would be a much nicer
standard than dssi already.

> 1) the plugin calls its own event loop in effEditIdle
> 2) make a new atom "wndproc" for storing wndproc function per window,
> the host will send XEvents to the wndproc if found.
>
> I prefer 1) but I dont know if toolkits supports manually calling the
> event loop?

i am not sure i understand what you want to do but.....

for gtk see:

http://www.gtk.org/api/2.6/gtk/gtk-General.html#gtk-main-iteration-do

for qt start along here:

http://doc.trolltech.com/4.1/qeventloop.html#processEvents


>
> cheers
> jorgen
>
>

--
torben Hohn
http://galan.sourceforge.net -- The graphical Audio language
Reply | Threaded
Open this post in threaded view
|

Re: VST compiled for linux / gui message loop

jorgen-2
[hidden email] wrote:

>On Sat, Jan 07, 2006 at 11:58:49AM +0100, jorgen wrote:
>  
>
>>Hi, Im coding a VST host for windows and linux. The linux version will
>>support VSTs compiled on linux and not using wine or aything. Of course,
>>there is not alot of native linux VST plugins around but that will
>>change (I already made one :P )
>>    
>>
>
>:) cool welcome abord. so you ported vstGUI ?
>how will that work ?
>does a vst plugin coder only recompile his plug then ?
>
>  
>
No, I have made my own toolkit based on xlib calls. The host (energyXT2)
will pass a xlib Window handle that I use as a parent when calling
XCreateWindow:

      case effEditOpen:
            if (!editor)
                editor = new CEditor(app, 0, wsChild | wsNoBorder, "",
100, 100, 200, 200);
#ifdef WIN32  
      SetWindowLong (editor->handle, GWL_STYLE,
                (GetWindowLong (editor->handle, GWL_STYLE) &~ WS_POPUP)
| WS_CHILD);
      SetParent(editor->handle, HWND(ptr));
#endif
#ifdef linux
            XReparentWindow(dp, editor->handle, (Window)ptr, 0, 0);
            editor->parentWnd = (Window)ptr;
#endif
      editor->show();
      result = 1;
    break;



In effEditIdle I then call my message loop:

        case effEditIdle:
#ifdef linux
            XEvent event;
            while (XPending(dp)) {
                XNextEvent(dp, &event);
                handleEvent(event);                        // replace
this with your own event handler for your toolkit
            }
#endif
        break;

>>There is one challange though, event dispatching in X11. Unlike windows,
>>X11 windows doesnt have an assotiated window proc for dispatching
>>events. I can overcome this in my own gui toolkit by passing a Display*
>>pointer to the plugin etc, but it wouldnt work with other gui toolkits.
>>
>>So how do I make a soution that work with any toolkits on linux?
>>    
>>
>
>we are still searching for a solution with a window generated in the
>same process. with different toolkits etc.
>
>to my knowledge
>this has not really been solved. believe me, there would be a much nicer
>standard than dssi already.
>
>  
>
>>1) the plugin calls its own event loop in effEditIdle
>>2) make a new atom "wndproc" for storing wndproc function per window,
>>the host will send XEvents to the wndproc if found.
>>
>>I prefer 1) but I dont know if toolkits supports manually calling the
>>event loop?
>>    
>>
>
>i am not sure i understand what you want to do but.....
>
>for gtk see:
>
>http://www.gtk.org/api/2.6/gtk/gtk-General.html#gtk-main-iteration-do
>
>for qt start along here:
>
>http://doc.trolltech.com/4.1/qeventloop.html#processEvents
>
>
>  
>
>>cheers
>>jorgen
>>
>>
>>    
>>
>
>  
>

Reply | Threaded
Open this post in threaded view
|

Re: VST compiled for linux / gui message loop

torbenh
On Sat, Jan 07, 2006 at 02:43:24PM +0100, jorgen wrote:

> [hidden email] wrote:
>
> >On Sat, Jan 07, 2006 at 11:58:49AM +0100, jorgen wrote:
> >
> >
> >>Hi, Im coding a VST host for windows and linux. The linux version will
> >>support VSTs compiled on linux and not using wine or aything. Of course,
> >>there is not alot of native linux VST plugins around but that will
> >>change (I already made one :P )
> >>  
> >>
> >
> >:) cool welcome abord. so you ported vstGUI ?
> >how will that work ?
> >does a vst plugin coder only recompile his plug then ?
> >
> >
> >
> No, I have made my own toolkit based on xlib calls. The host (energyXT2)
> will pass a xlib Window handle that I use as a parent when calling
> XCreateWindow:
>
>      case effEditOpen:
>            if (!editor)
>                editor = new CEditor(app, 0, wsChild | wsNoBorder, "",
> 100, 100, 200, 200);
> #ifdef WIN32  
>      SetWindowLong (editor->handle, GWL_STYLE,
>                (GetWindowLong (editor->handle, GWL_STYLE) &~ WS_POPUP)
> | WS_CHILD);
>      SetParent(editor->handle, HWND(ptr));
> #endif
> #ifdef linux
>            XReparentWindow(dp, editor->handle, (Window)ptr, 0, 0);
>            editor->parentWnd = (Window)ptr;
> #endif
>      editor->show();
>      result = 1;
>    break;
>

why dont you open a separate display connection for the plugin ?
then you can even move the gui updates to a different thread and there
you go...

look into gtkplug.c and gtksocket.c on how this works.


--
torben Hohn
http://galan.sourceforge.net -- The graphical Audio language
Reply | Threaded
Open this post in threaded view
|

Re: VST compiled for linux / gui message loop

jorgen-2
[hidden email] wrote:

>On Sat, Jan 07, 2006 at 02:43:24PM +0100, jorgen wrote:
>  
>
>>[hidden email] wrote:
>>
>>    
>>
>>>On Sat, Jan 07, 2006 at 11:58:49AM +0100, jorgen wrote:
>>>
>>>
>>>      
>>>
>>>>Hi, Im coding a VST host for windows and linux. The linux version will
>>>>support VSTs compiled on linux and not using wine or aything. Of course,
>>>>there is not alot of native linux VST plugins around but that will
>>>>change (I already made one :P )
>>>>  
>>>>
>>>>        
>>>>
>>>:) cool welcome abord. so you ported vstGUI ?
>>>how will that work ?
>>>does a vst plugin coder only recompile his plug then ?
>>>
>>>
>>>
>>>      
>>>
>>No, I have made my own toolkit based on xlib calls. The host (energyXT2)
>>will pass a xlib Window handle that I use as a parent when calling
>>XCreateWindow:
>>
>>     case effEditOpen:
>>           if (!editor)
>>               editor = new CEditor(app, 0, wsChild | wsNoBorder, "",
>>100, 100, 200, 200);
>>#ifdef WIN32  
>>     SetWindowLong (editor->handle, GWL_STYLE,
>>               (GetWindowLong (editor->handle, GWL_STYLE) &~ WS_POPUP)
>>| WS_CHILD);
>>     SetParent(editor->handle, HWND(ptr));
>>#endif
>>#ifdef linux
>>           XReparentWindow(dp, editor->handle, (Window)ptr, 0, 0);
>>           editor->parentWnd = (Window)ptr;
>>#endif
>>     editor->show();
>>     result = 1;
>>   break;
>>
>>    
>>
>
>why dont you open a separate display connection for the plugin ?
>then you can even move the gui updates to a different thread and there
>you go...
>
>look into gtkplug.c and gtksocket.c on how this works.
>
>
>  
>
I do open a separet connection for display in my toolkit and gui updates
are already working by the dispatcher code in effEditIdle. If gtk can
create a thread for gui updates than it sounds like it will work, but a
gui update thread for each plugin? Whats the performance loss, I mean a
typical song projects has 10-30 plugins.


Reply | Threaded
Open this post in threaded view
|

Re: VST compiled for linux / gui message loop

Fons Adriaensen
In reply to this post by torbenh
On Sat, Jan 07, 2006 at 04:45:21PM +0100, [hidden email] wrote:

> why dont you open a separate display connection for the plugin ?
> then you can even move the gui updates to a different thread and there
> you go...
>
> look into gtkplug.c and gtksocket.c on how this works.

Does X allow multiple clients within the same process space ?

Last time I tried this it failed miserably, but that could
of course just be the result of my own ignorance...

--
FA

Reply | Threaded
Open this post in threaded view
|

Re: VST compiled for linux / gui message loop

jorgen-2
fons adriaensen wrote:

>On Sat, Jan 07, 2006 at 04:45:21PM +0100, [hidden email] wrote:
>
>  
>
>>why dont you open a separate display connection for the plugin ?
>>then you can even move the gui updates to a different thread and there
>>you go...
>>
>>look into gtkplug.c and gtksocket.c on how this works.
>>    
>>
>
>Does X allow multiple clients within the same process space ?
>
>Last time I tried this it failed miserably, but that could
>of course just be the result of my own ignorance...
>
>  
>
It didnt crash for me, but it may depend on the toolkit. I guess the
host could pass a Display pointer as an option.

Reply | Threaded
Open this post in threaded view
|

Re: VST compiled for linux / gui message loop

Tim Hockin-3
In reply to this post by jorgen-2
On Sat, Jan 07, 2006 at 11:58:49AM +0100, jorgen wrote:
> Hi, Im coding a VST host for windows and linux. The linux version will
> support VSTs compiled on linux and not using wine or aything. Of course,
> there is not alot of native linux VST plugins around but that will
> change (I already made one :P )

Jorgen,

I don't have an answer to this, but good to see you here and I am looking
forward to eXT on Linux.  THANK YOU!

Tim