On Sun, 2005-02-27 at 18:01 +0100, Eelco Schijf wrote:
> Hi,
>
> I just started playing around with libvisual in an attempt to get the hang of
> it. So far there's been one thing I haven't gotten to work; detectig a new
> song.
> To spot a new song I figured that the events function would be the best place
> for this. Check the event queue and see if there's a VISUAL_EVENT_NEWSONG
> type in the queue. However, nothing happens (tested it with amarok and xmms),
> there is no event indicating a new song started playing. What could be the
> problem? Is this a libvisual problem or isn't it implemented in the player(s)?
> I've pasted the events function below for reference.
Amarok does not support this but beep-media-player and xmms should work
fine.
> Btw, as you can see there's also the VISUAL_EVENT_RESIZE event, which works
> fine.
>
> int liquidmp3_events (VisPluginData *plugin, VisEventQueue *events)
> {
> VisEvent ev;
> VisSongInfo *songinfo;
>
> // retrieve songinfo
> songinfo = visual_plugin_actor_get_songinfo( VISUAL_PLUGIN_ACTOR
> (visual_plugin_get_specific(plugin)) );
>
> while (visual_event_queue_poll (events, &ev)) {
> switch (ev.type) {
> case VISUAL_EVENT_RESIZE:
> liquidmp3_dimension (plugin, ev.resize.video,
> ev.resize.width, ev.resize.height);
> break;
>
> case VISUAL_EVENT_NEWSONG:
> printf( New song detected (%s)", songinfo->song );
> break;
>
> default: // to avoid warnings
> break;
> }
> }
>
> return 0;
> }
>
This should actually work, tho I advice you to retrieve the VisSongInfo
from the VisEvent.
struct _VisEventNewSong {
VisObject object; /**< The VisObject data. */
VisEventType type; /**< Event type of the event
being emitted. */
VisSongInfo *songinfo; /**< Pointer to the VisSongInfo
structure containing all the information about
* the new song. */
};
so that would end up in being "event.newsong.songinfo;".
Tho this does not explain why it's not detecting new songs, could
you send me your code so I can have a try with it :)
Good luck,
Dennis
|