Winamp Embedded Window Plug-in Example

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Danya Lukin
    Junior Member
    • Jan 2011
    • 9

    #16
    Yess, the window works now!
    Sorry for bothering so much, but i have another problem. I converted the gen_plugin to a dsp plugin by changing struct types and the function (keeping everything from the original gen plugin), and it all compiled correctly, but if i go to the dps plugins list in the preferences of winamp and either try to close the plugin or switch to a different one, or uninstall, it just makes winamp not respond. I guess i must have some quit procedure taht is special about the DSP plugin as opposed to a GEN?

    Im attaching the file that i actually modified (txt is actually .cpp)
    And in the header embedwnd.h i just changed one line:
    from: extern winampGeneralPurposePlugin plugin;
    to: extern winampDSPModule plugin;

    Whats worse, im looking at the code of the program and i dont see where exactly the window is ACTUALLY created. Where is the createwindowEx function? and the PIXELFORMATDESCRIPTOR? how do I use the window, specifically setting it up for opengl?
    could you explain whats going on?

    thanks a million!

    Danya
    Attached Files

    Comment

    • DrO
      • Sep 2003
      • 27868

      #17
      you cannot use this example for a dsp plug-in, not without removing most of what is adds as it heavily relies upon subclassing Winamp which DSP's do not lend themselves to work with (as they are able to be dynamically unloaded and so breaks the subclass chain leading to what you're seeing).

      the SendMessage(..) call to the embedwnd api in init(..) is where the window is created which is then doing the CreateWindowEx(..) inside of winamp.exe itself. as long as you have a valid HWND (as is obtained) then there shouldn't be a problem doing anything else - excluding not using this example as a DSP / VIS plug-in (or any plug-in type which allows for dynamic unloading).

      -daz
      WACUP Project <‖> "Winamp Ramblings" - Indie Winamp Dev Blog

      Comment

      • Danya Lukin
        Junior Member
        • Jan 2011
        • 9

        #18
        Oh, i see...
        I created a working window in a separate dsp plugin (based of the example dsp in the sdk) but is there a way to skin the window the same way as you did in the gen embedded window plugin?

        Comment

        • DrO
          • Sep 2003
          • 27868

          #19
          you can do it as long as you remove all of the stuff done via subclassing which then just leaves it without the proper means to integrate into the main right-click menu and will have some issues when doing classic->modern and back again if Winamp is closed in middle of that.

          the main aim of the example is as a basic for gen / ml plug-ins as they're the ones more likely to need to be in a skinned window, though the basic usage of the embedwnd api is available to all plug-ins, like how the vis plug-ins use it.

          -daz
          WACUP Project <‖> "Winamp Ramblings" - Indie Winamp Dev Blog

          Comment

          • thinktink
            Forum King
            • May 2009
            • 3371

            #20
            I am currently working on getting my embed framework to automatically emulate what the the example gen window plugin is doing as far as showing and hiding the window from the inserted menu command and accelerator trapping. So far it's going ok. However there seems to be a small snafu:
            code:
            ...
            else if(message == WM_WINDOWPOSCHANGING)
            {
            /*
            if extra_data[EMBED_STATE_EXTRA_REPARENTING] is set, we are being reparented by the freeform lib, so we should
            just ignore this message because our visibility will not change once the freeform
            takeover/restoration is complete
            */
            WINDOWPOS *windowPos = (WINDOWPOS*)lParam;
            embedWindowState *state=(embedWindowState *)GetWindowLongPtr(embedWnd,GWLP_USERDATA);
            if (state && /*Looky here-->*/ state->reparenting /*<---Looky here*/ && !GetParent(embedWnd))
            {
            // this will reset the position of the frame when we need it to
            // usually from going classic->modern->close->start->classic
            SetWindowPos(embedWnd, 0, 0, 0, width, height,
            SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOMOVE |
            SWP_NOSENDCHANGING | SWP_ASYNCWINDOWPOS);
            }
            }
            ...

            However, "reparenting" is not defined as a member of "embedWindowState" inside of wa_ipc.h:
            code:
            ...
            typedef struct
            {
            HWND me; //hwnd of the window

            #define EMBED_FLAGS_NORESIZE 0x1
            // set this bit to keep window from being resizable

            #define EMBED_FLAGS_NOTRANSPARENCY 0x2
            // set this bit to make gen_ff turn transparency off for this window

            #define EMBED_FLAGS_NOWINDOWMENU 0x4
            // set this bit to prevent gen_ff from automatically adding your window to the right-click menu

            #define EMBED_FLAGS_GUID 0x8
            // (5.31+) call SET_EMBED_GUID(yourEmbedWindowStateStruct, GUID) to define a GUID for this window

            #define SET_EMBED_GUID(windowState, windowGUID) { windowState->flags |= EMBED_FLAGS_GUID; *((GUID *)&windowState->extra_data[4])=windowGUID; }
            #define GET_EMBED_GUID(windowState) (*((GUID *)&windowState->extra_data[4]))

            int flags; // see above

            RECT r;
            void *user_ptr; // for application use
            int extra_data[64]; // for internal winamp use
            } embedWindowState;
            ...

            Am I missing something? Do I have the wrong header?
            | Opus Audio Codec plugins 2.0 | Embedded Album Art | DiskWrite |
            | Save your playlist first! | Live voice-over | X-Fade 2.5 |
            | AterKast (Source DSP) | More of my stuff... |

            Comment

            • thinktink
              Forum King
              • May 2009
              • 3371

              #21
              Nevermind, found a work-around:
              code:
              state->extra_data[62]
              | Opus Audio Codec plugins 2.0 | Embedded Album Art | DiskWrite |
              | Save your playlist first! | Live voice-over | X-Fade 2.5 |
              | AterKast (Source DSP) | More of my stuff... |

              Comment

              • DrO
                • Sep 2003
                • 27868

                #22
                code:
                #ifdef __cplusplus
                class ifc_window;
                #endif

                typedef struct embedWindowState embedWindowState;

                #define FFC_CREATEEMBED 0 // param = (LPARAM)(ifc_window*)windowParent; return 1 to terminate creation.
                #define FFC_DESTROYEMBED 1

                typedef int (CALLBACK *FFCALLBACK)(embedWindowState* /*windowState*/, INT /*eventId*/, LPARAM /*param*/);

                typedef struct embedWindowState
                {
                HWND me; //hwnd of the window

                #define EMBED_FLAGS_NORESIZE 0x1
                // set this bit to keep window from being resizable

                #define EMBED_FLAGS_NOTRANSPARENCY 0x2
                // set this bit to make gen_ff turn transparency off for this window

                #define EMBED_FLAGS_NOWINDOWMENU 0x4
                // set this bit to prevent gen_ff from automatically adding your window to the right-click menu

                #define EMBED_FLAGS_GUID 0x8
                // (5.31+) call SET_EMBED_GUID(yourEmbedWindowStateStruct, GUID) to define a GUID for this window

                #define EMBED_FLAGS_FFCALLBACK 0x10
                // 5.55+

                #define SET_EMBED_GUID(windowState, windowGUID) { windowState->flags |= EMBED_FLAGS_GUID; *((GUID *)&windowState->extra_data[4])=windowGUID; }
                #define GET_EMBED_GUID(windowState) (*((GUID *)&windowState->extra_data[4]))

                int flags; // see above

                RECT r;
                void *user_ptr; // for application use

                union
                {
                #pragma warning(push)
                #pragma warning(disable:4201)
                #pragma pack(push, 1)
                struct
                {
                struct embedWindowState *link;
                intptr_t attached;
                intptr_t padding1[2]; //2-3
                GUID guid; // 4-7
                #ifdef _WIN64
                intptr_t guidpadding;
                #endif
                FFCALLBACK callback;
                intptr_t padding2[52]; // 9-60
                intptr_t hostcount; // 61
                intptr_t reparenting; // 62
                #ifdef __cplusplus
                ifc_window *wasabi_window;
                #else
                void *wasabi_window; // ifc_window *
                #endif
                };
                #pragma warning(pop)
                #pragma pack(pop)
                intptr_t extra_data[64]; // for internal winamp use
                };
                } embedWindowState;

                there's stuff in there i've no idea about (mainly the FF* stuff). though clearly no one has bothered to use the example as that should have been caught (so yay, i wasted a few more hours of my life doing that *grumble* ).

                -daz
                WACUP Project <‖> "Winamp Ramblings" - Indie Winamp Dev Blog

                Comment

                • thinktink
                  Forum King
                  • May 2009
                  • 3371

                  #23
                  Thanks.

                  And even though I may not be able to compile the example plugin directly myself, both the compiled plugin itself and the plugin's source code you have provided still has helped greatly and I believe is worth it.

                  btw, do you know if there's going to be an updated version of the SDK anytime soon? If not, no worries.
                  | Opus Audio Codec plugins 2.0 | Embedded Album Art | DiskWrite |
                  | Save your playlist first! | Live voice-over | X-Fade 2.5 |
                  | AterKast (Source DSP) | More of my stuff... |

                  Comment

                  • DrO
                    • Sep 2003
                    • 27868

                    #24
                    there's pretty much nothing of importance on any additions to the sdk for a long time (at most is some random wasabi stuff) so there's generally not too much different between the last one and me posting the above and the other odd snippets over the last 2 years. i had started on trying to make sure everything is ok with the installer to be able to run off a new sdk but just haven't had the time to finish that off.

                    -daz
                    WACUP Project <‖> "Winamp Ramblings" - Indie Winamp Dev Blog

                    Comment

                    • mikenakis
                      Junior Member
                      • Oct 2013
                      • 2

                      #25
                      DrO, the page http://nunzioweb.com/daz/gen_embedwnd/index.html linked from page http://nunzioweb.com/daz/featured.html does not exist anymore. Using archive.org I was able to see an old version of the page, but archive.org does not have the zip file. Is there any chance of you fixing this? Thanks in advance!

                      Comment

                      • DrO
                        • Sep 2003
                        • 27868

                        #26
                        it'll be included in the coming SDK update once i've done a code review of it and applied some fixes to it from since it was released.
                        WACUP Project <‖> "Winamp Ramblings" - Indie Winamp Dev Blog

                        Comment

                        • ForestCat
                          Junior Member
                          • Mar 2018
                          • 7

                          #27
                          Linked files extinct

                          hi, I know this is a very, very old thread, & I apologize for reviving it, but it is a sticky. The examples that are linked to here are long gone, and not in the web archive. If anybody has a copy of this could you possibly post it here? Thanks so much.

                          Comment

                          • thinktink
                            Forum King
                            • May 2009
                            • 3371

                            #28
                            Originally Posted by ForestCat View Post
                            hi, I know this is a very, very old thread, & I apologize for reviving it, but it is a sticky. The examples that are linked to here are long gone, and not in the web archive. If anybody has a copy of this could you possibly post it here? Thanks so much.
                            Discussion and help for Winamp plug-ins and add-on development, because shop talk makes for mo bettah tweaking. <u>Threads not development related will be locked</u>.

                            Note: this is an unauthorized update to the plugin made by DrO who no longer provides support for it.
                            | Opus Audio Codec plugins 2.0 | Embedded Album Art | DiskWrite |
                            | Save your playlist first! | Live voice-over | X-Fade 2.5 |
                            | AterKast (Source DSP) | More of my stuff... |

                            Comment

                            Working...
                            X