Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   Wasabi Development (http://forums.winamp.com/forumdisplay.php?f=122)
-   -   gen_* style plugins (http://forums.winamp.com/showthread.php?t=100650)

akashra 20th August 2002 08:34

gen_* style plugins
 
I seem to be having a bit of the problem given that the documentation for Wasabi currently consists of little more than just function names.

I'm trying to write a gen_* plugin, it's just for play statistics - and while I can get all the details I want if a window is open, I need it to be able to be done without having the user open a window every time they run winamp, or do anything else - ie, it needs to be always running.

Perhaps someone could post some sample/template code to achieve this, as I can't seem to figure it out.

ta.

schweitn 20th August 2002 14:01

There are no gen plugins anymore. Just like there are no dsp plugins, vis plugins, input plugins, output plugins... There are just Components. Period.

It does what you want it to do. If you want your component to have a window. Fine. If you don't, thats ok too. If you want to mess around with dsp, then register as a media converter. You tell Winamp what your plugin will do. Period.

Download the sdk and look at Example1. In particular example1.cpp, the Components construtor, you will see these lines:
code:

// 1) we are going to make a window,
registerService(new WndCreateCreatorSingle< CreateWndByGuid</**/GenericWnd/*EDITME*/ > >);

// 2) and have it be listed in the Thinger,
registerService(new WndCreateCreatorSingle< CreateBucketItem</**/GenericWnd/*EDITME*/ > >);

// 3) and in the main context menu.
registerAutoPopup(getGUID(), getName());



So if you don't do 1, 2 or 3 then you will have no user interface at all. But your COMPONENT will still be run.

akashra 20th August 2002 14:09

yeh, I understand the fact they're all components etc, I just meant what would have been a gen_* plugin in WA2.

What you've mentioned is all good, but I can only find calls that operate while the window is open.
Unless I'm mistaken - I'll have another try in the morning, but last I tried doing it that way, I needed to open it in a window first.

schweitn 20th August 2002 14:13

What are you trying to do? Because 2 of my 4 plugins don't require a window to operate at all. And they receive notification on Winamp events, and can control Winamp... without a window being open, or even available to use.

akashra 22nd August 2002 14:10

I'm just basically trying to get it that so that when the plugin runs, whenever anything happens, I get some kind of notification so I can fire events of different types.

I can email or paste the skeletal code (as that's all it is atm) if you would like to try see where I'm going wrong...

schweitn 22nd August 2002 14:58

You can do that without a window... here's some basic example code:

code:

class MyPlugin : public WAComponentClient, public CoreCallbackI,
public RunlevelCallbackI
{
public:

// Construction & Destruction
MyPlugin();
virtual ~MyPlugin();

// WAComponentClient Overrides
virtual GUID getGUID();
virtual void onCreate();
virtual void onDestroy();

// CoreCallbackI Overrides
virtual int corecb_onStarted();
virtual int corecb_onStopped();
// There are more in CoreCallback that you can handle,
// look in the .h file for a complete list

// RunlevelCallbackI Overrides
virtual void runlevelcb_onShutdown();
};

//..

void MyPlugin::onCreate()
{
CoreHandle WinampCore;
WinampCore.addCallback( this ); // Registers CoreCallback
api->syscb_registerCallback( this ); // Registers RunlevelCallback
// Do other init here
}

void MyPlugin::onDestroy()
{
// Unregisters runlevel callback
api->syscb_deregisterCallback( this );
// Do other clean up here
}

int MyPlugin::corecb_onStarted()
{
// Handle onStarted
return 0;
}

int MyPlugin::corecb_onStopped()
{
// Handle onStopped
return 0;
}

void MyPlugin::runlevelcb_onShutdown()
{
// Unregister the corecallback
// Have to delete this callback here because the playback core is
// actually a component, and by the time onDestroy is called, the
// core wac could have been destroyed. onShutdown gets called
// before any components are destroyed so its safer.
CoreHandle WinampCore;
WinampCore.delCallback( this );
}



All times are GMT. The time now is 07:31.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.