graphic gui elements in effect plugins

Discussion in 'Effects and the DSP' started by stylus02, Dec 2, 2009.

  1. stylus02

    stylus02 New Member

    Joined:
    Jan 11, 2008
    Messages:
    283
    Likes Received:
    2
    Trophy Points:
    0
    hello,

    the kx diver provides some graphic gui elements to skin plugins.
    the sdk folder contains code examples: /efx_tube, /efx_reverb, /fx_dynamica, /fx_skin.

    1.
    i tried changing the background image/ window buttons by manipulate the files in /fx_skin, pack to myplugin.rar, rename to myplugin.kxs and bring it together with
    "copy /b myplugin.kxl + myplugin.kxs myplugin_skinned.kxl" - works.
    http://freenet-homepage.de/stylish-stylus/myplugin_skinned.jpg

    2.
    then i tried to give a slider a different look with the lines (/fx_skin/readme.txt):
    myslider.SetBitmaps(
    mf.load_image("path-to-your-slider-image"),
    mf.load_image("path-to-your-slider-thumb-image"),
    mf.load_image("path-to-your-slider-thumb-image"),
    mf.load_image("path-to-your-slider-thumb-image"));
    btw. "SetBitmaps" should be "setbitmaps" otherwise compiler error.
    after compiling without error i had no changes (no pics) in myplugin. why?

    3.
    next i tried the the eknob from "dynamica". linked eknob.cpp & eknob.h with fx_demo and some code changes brought a grey point in myplugin, i think it was the knob, but it showed no reaction on mouse movement.

    4.
    last i tried implement tiger m.`s bitmap gui elements.
    while linking e.g. CMKnob.cpp & CMKnob.h with fx_demo the compiler outputs some errors:
    warning C4273: .. inconsistent dll linkage. dllexport assumed.
    error C2491: .. definition of dllimport static data member not allowed

    5.
    there are some undocumented gui elements in /h/gui/.. like kKnob.h (klogo.h, kindicator.h..) was that ever used?

    primarily i need a good looking knob on a bitmap background. therefore tiger m.`s CMKnob with bitmap loading loop is the most flexible choice, but also the trickiest one.

    I would be grateful for some suggestions

    stylus
     
    Last edited: Dec 2, 2009
  2. Lex Nahumury

    Lex Nahumury DH Senior Member

    Joined:
    Jan 5, 2003
    Messages:
    1,944
    Likes Received:
    6
    Trophy Points:
    0
    I don't use kX GUI and it has been ages since I did but IIRC;
    2. You have to call CKXPluginGUI::init() in your plugDlg::init() prior to using SetBitmaps/mf.load_image stuff.

    5. kKnob is just an abstract class. Not implemented.
    I have never tried klogo or kindicator.

    As for the rest of your questions;
    If your new to C++/VS/MFC, why don't you try to use the efx_tube project as a "template" for your own plugin?
     
  3. Russ

    Russ Well-Known Member

    Joined:
    Jan 17, 2005
    Messages:
    5,722
    Likes Received:
    13
    Trophy Points:
    48
  4. stylus02

    stylus02 New Member

    Joined:
    Jan 11, 2008
    Messages:
    283
    Likes Received:
    2
    Trophy Points:
    0
    thanks guys. lex, hopefully tiger´s sources work properly with 3545 sdk. i`ll go more into it to get it run. russ, thanks for the tread. i was searching for such treads but this forum really big.
     
  5. stylus02

    stylus02 New Member

    Joined:
    Jan 11, 2008
    Messages:
    283
    Likes Received:
    2
    Trophy Points:
    0
    have packed together my workspace. it contains tiger´s tube- files placed in demo workspace. the linker can`t resolve some externals:
    tube.cpp
    Linking...
    Creating library Release/tube.lib and object Release/tube.exp
    tube.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall CMKnob::~CMKnob(void)" (__imp_??1CMKnob@@UAE@XZ)

    .. and so on and sofore..

    Release/tube.dll : fatal error LNK1120: 9 unresolved externals
    Error executing link.exe.

    tube.dll - 10 error(s), 0 warning(s)

    http://freenet-homepage.de/stylish-stylus/demo_tube.zip

    have made a demo skin backdrop for kx modular (including knob- animation, "k1.bmp..k64.bmp"). design is based on emu`s first analog modular synth from 1973.
    here is a preview rendering:
    http://freenet-homepage.de/stylish-stylus/kxm_demoskin.jpg
    a perspective view:
    http://freenet-homepage.de/stylish-stylus/kxm_demoskin_perspective_07.jpg
    gui elements:
    http://freenet-homepage.de/stylish-stylus/kxm_demoskin_bmp.zip

    maybe someone of you get run a knob on the backdrop, it plays no role which. if i had a working example, i could skin the kxm modules. kxm uses sliders only, for now knobs would be enough. (further i can imagine control lamps (on/off) for e.g. lfo- speed or switches for octaveswitch.)

    what do you think?
     
    Last edited: Dec 4, 2009
  6. Tyrsonswood

    Tyrsonswood HH's curmudgeon

    Joined:
    Mar 7, 2008
    Messages:
    13,807
    Likes Received:
    1,613
    Trophy Points:
    138
    The demo skin jpg looks great.
     
  7. Max M.

    Max M. h/h member-shmember

    Joined:
    Dec 7, 2002
    Messages:
    2,690
    Likes Received:
    9
    Trophy Points:
    63
    Îòâåò: graphic gui elements in effect plugins

    if i'm not mistaken this is because the CMKnob is declared with kCLASS_TYPE macro which expands to __declspec(dllimport) (so the linker expects CMKnob functions to be implemented elsewhere but not in your dll (where they actually are)). I.e. just remove kCLASS_TYPE from CMKnob.h.

    P.S. Ah, and (sure) add the CMKnob.cpp to your project (as i see it's not there)
     
    Last edited: Dec 4, 2009
  8. Max M.

    Max M. h/h member-shmember

    Joined:
    Dec 7, 2002
    Messages:
    2,690
    Likes Received:
    9
    Trophy Points:
    63
    Îòâåò: graphic gui elements in effect plugins

    (p.p.s)
    In other words:
    In the SDK, the "efx" widgets are compiled as a separate dll (kxefx.dll), so the "efx" plugins do not include these (CMKnob.cpp etc.) files directly. Your plugin could also use the kxefx.dll, but the SDK does not include corresponding import library (i.e. kxefx.lib).
    You need to either re-build the kxefx.dll (to get kxefx.lib) or (less complicated) put its code (i.e. those cpp files) right into your plugin dll.
     
    Last edited: Dec 4, 2009
  9. stylus02

    stylus02 New Member

    Joined:
    Jan 11, 2008
    Messages:
    283
    Likes Received:
    2
    Trophy Points:
    0
    Re: Îòâåò: graphic gui elements in effect plugins

    yes, now it compiles, great. removed all "kCLASS_TYPE" declarations in header files from h/gui/efx.. and added .cpp files from /fx_efx to project sources. and i have something running! :)
     
  10. stylus02

    stylus02 New Member

    Joined:
    Jan 11, 2008
    Messages:
    283
    Likes Received:
    2
    Trophy Points:
    0
    can`t get my knob pics in kxl. instead of these are tubedrive original knob pics in it. the bitmap loading code:

    //valid filenames k1.bmp, k2.bmp, k3.bmp etc.
    for(i=0;i<FRAMES;i++){
    sprintf(filename, "k%d.bmp", i+1);
    bitmaps = mf.load_image(filename);
    }

    sprintf(filename, "k%d.bmp", i+1); writes incrementing filenames to filename char array k1.bmp, k2.bmp, k3.bmp etc. isn`t it? where the comiler is looking for the pics? the pics are in my working dir.
     
  11. Russ

    Russ Well-Known Member

    Joined:
    Jan 17, 2005
    Messages:
    5,722
    Likes Received:
    13
    Trophy Points:
    48
    The pics should be part of your skin (i.e. zipped up with the rest of the skin components (kxskin.ini, etc)).

    i.e.
    Your .KXS file should contain:
    kxskini.ini
    k1.bmp
    k2.bmp
    ...
     
  12. Russ

    Russ Well-Known Member

    Joined:
    Jan 17, 2005
    Messages:
    5,722
    Likes Received:
    13
    Trophy Points:
    48
    BTW: EFX_TUBEDRIVE uses a separate (i.e. it is not merged with the .KXL) skin (kxefx.kxs) which is placed in the kX program directory (in older versions of kX, it was placed in the system32 directory (IIRC)). If you are going to use that method, then make sure you put your skin file there.

    Personally I use the other method.

    i.e.
    Delete the following:
    Code:
    TCHAR tmp_str[MAX_PATH];
    efx_skin.get_full_skin_path(_T("kxefx.kxs"),tmp_str);
    efx_skin.set_skin(tmp_str);
    mf.attach_skin(&efx_skin);
    efx_skin.attach_skin(kxmixer_skin);
    efx_skin.set_attach_priority(1);
    
    ...and just merge your skin with your .KXL after compiling.

    e.g.
    copy /b MyPlugin.kxl + Myskin.kxs
     
  13. stylus02

    stylus02 New Member

    Joined:
    Jan 11, 2008
    Messages:
    283
    Likes Received:
    2
    Trophy Points:
    0
    packed the knob bmp`s together in myskin.kxs. used the copy command. works. i left in the skin attach in my code and only changed the skin name.
    (by cutting it out the knob wasn´t showed anymore)
    btw there is still a frame over my background. it seems it is from standard skin.
    http://freenet-homepage.de/stylish-stylus/kxm_demoskin_nastyframe.jpg

    edit: i had set- as- comment following line: grpbox.hide();//hide useless GUI elements
    now the frame is hide.
     
    Last edited: Dec 4, 2009
  14. Russ

    Russ Well-Known Member

    Joined:
    Jan 17, 2005
    Messages:
    5,722
    Likes Received:
    13
    Trophy Points:
    48
    You have to either hide those elements, or skin them.

    i.e. (to hide (see kxpluginui.h for the names of the default items, etc))
    grpbox.hide();
    b_mute.hide();
    b_reset.hide();
    b_bypass.hide();
    etc.
     
  15. Russ

    Russ Well-Known Member

    Joined:
    Jan 17, 2005
    Messages:
    5,722
    Likes Received:
    13
    Trophy Points:
    48
    BTW: kX resizes the dialog to fit the card info stuff... You probably do not want that behavior.

    To disable that, change the following:
    create_dialog(plugin_name(fuzz), 250, 120);
    to:
    create_dialog(plugin_name(fuzz), 250, 120, -1, KXFX_NO_RESIZE);
     
  16. stylus02

    stylus02 New Member

    Joined:
    Jan 11, 2008
    Messages:
    283
    Likes Received:
    2
    Trophy Points:
    0
    last thing for today.. when i minimize myplugin and bring it up again the knob is hided until i do click and move the mouse in the knob area. (when i start the plugin first time the knob is there).

    edit: this effect occures when the knob position is 0 (full left). also the first 2 ticks from mousemovement are not recognized from position 0, knob is not changing.

    the first 2 knob pics where missing in myskin.kxs. fixed
     
    Last edited: Dec 4, 2009
  17. stylus02

    stylus02 New Member

    Joined:
    Jan 11, 2008
    Messages:
    283
    Likes Received:
    2
    Trophy Points:
    0
    this is what i have. the kxm demo- plugin is just a simple amplitude modulation with triangle lfo. go in with any audiosignal. following controls are active.

    knob 01: mix
    knob 02: lfo rate
    lamp 01: input on/off
    switch : lfo on/off

    everything else is inactive. its just painting on the backdrop image.

    plugin: (3545)
    http://freenet-homepage.de/stylish-stylus/kxmdemoskin_v1.0.jpg
    http://freenet-homepage.de/stylish-stylus/kxmdemoskin.kxl
    complete workspace: (3545)
    http://freenet-homepage.de/stylish-stylus/kxmdemoskin_v0.1.rar

    what i want to do next is:
    - skin the window controls: reset, bypass, mute. how are the filenames?
    - make a lfo lamp wich rises up and down with a lfo register. maybe the
    cmknob class (without mouse controls) can do that? i fear therefore i need your help again guys.
     
    Last edited: Dec 9, 2009
  18. Lex Nahumury

    Lex Nahumury DH Senior Member

    Joined:
    Jan 5, 2003
    Messages:
    1,944
    Likes Received:
    6
    Trophy Points:
    0
    nice skin!
     
  19. stylus02

    stylus02 New Member

    Joined:
    Jan 11, 2008
    Messages:
    283
    Likes Received:
    2
    Trophy Points:
    0
    thanks lex. rendering was done with 3d studio max 3.1.
     
  20. Lex Nahumury

    Lex Nahumury DH Senior Member

    Joined:
    Jan 5, 2003
    Messages:
    1,944
    Likes Received:
    6
    Trophy Points:
    0
    - skin the window controls: reset, bypass, mute. how are the filenames?
    IIRC, you need to provide a custom 'kxskin.ini' with your skin.
    See kxskin.ini for details.

    - make a lfo lamp wich rises up and down with a lfo register. maybe the
    cmknob class (without mouse controls) can do that?

    Well, many ways to go but yep, you could try to modify that code.
    If there's no user input to the control you can simply remove all that stuff.
    Then you'll need a timer and treat it the same way we do with the peak meters.
     

Share This Page

visited