Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Adapting old 0.8.x plugin to 0.9.x (Read 3170 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Adapting old 0.8.x plugin to 0.9.x

Hi all,

Im having problems converting my old 0.8.x plugin to 0.9.x.

The first problem is with my play_callback class.

It looks something like:

Code: [Select]
class my_play : public play_callback
{
    virtual void on_playback_starting(play_control::t_track_command p_command, bool p_paused)
    {
        if (mem != NULL)
            if (p_paused)
                //paused
                mem->info.status = 2;
            else
                //playing
                mem->info.status = 1;
    }

    virtual void on_playback_stop(play_control::t_stop_reason reason)
    {
        if (mem != NULL)
            mem->info.status = 0;
    }

    virtual void on_playback_pause(bool p_state)
    {
        if (mem != NULL)
            mem->info.status = 2;
    }

//................. and more which i wont put in here
}

static playback_statistics_collector_factory_t<my_play> foo_play;


When compiling i get this error:
Quote
e:\foobar2000_0.9.x\foobar2000\sdk\service.h(376) : error C2039: 't_interface_entrypoint' : is not a member of 'my_play'


Now i gather this has somthing to do with the info in the SDK readme... but the info in there goes straight over my head, im not a C++ junkie (i stay as far away from it as possible).
So i have no idea what im meant to add to this class.

Help.... please.... 
Thanks in advance.

Oh, and also, is there any info/examples on how to get vis data with 0.9.x?

Adapting old 0.8.x plugin to 0.9.x

Reply #1
I think that declarations don't match. You declare a class my_play derived from play_callback, but below you have a factory for a different class, playback_statistics_collector. Decide which one you want and then set things accordingly.

Adapting old 0.8.x plugin to 0.9.x

Reply #2
Ok, i think i have this problem solved.

For future reference.....

Code: [Select]
class my_play : private play_callback
{
public:
    my_play() {}
    ~my_play() {}

    void doregister()
    {
        static_api_ptr_t<play_callback_manager> pcm;
        pcm->register_callback(this, flag_on_playback_new_track | flag_on_playback_dynamic_info_track | flag_on_playback_stop, false);
    }

    void unregister()
    {
        static_api_ptr_t<play_callback_manager> pcm;
        pcm->unregister_callback(this);
    }

    virtual void on_playback_starting(play_control::t_track_command p_command, bool p_paused)
    {
        if (mem != NULL)
            if (p_paused)
                //paused
                mem->info.status = 2;
            else
                //playing
                mem->info.status = 1;
    }
//......... snip
};


And then I:

Code: [Select]
class my_initquit : public initquit
{
public:
    virtual void on_init()
    {
        //create playstatus class
        play_status = new my_play();
        play_status->doregister();
    }
    virtual void on_quit()
    {
    }
};
static initquit_factory_t<my_initquit> foo_initquit;

Adapting old 0.8.x plugin to 0.9.x

Reply #3
Just out of curiousity, what does this plugin do?
Is over the of = % over 100


Adapting old 0.8.x plugin to 0.9.x

Reply #5
Code: [Select]
    virtual void on_playback_time(double p_time)
    {
        mem->info.track_pos = p_time;
    }


It seems this is only returning the time in seconds?
Ie, its not returning milliseconds?

Is there a way to enable this?