[muine] OnSongChangeEvent sometimes called twice
- From: David Cournapeau <cournape gmail com>
- To: muine-list gnome org
- Subject: [muine] OnSongChangeEvent sometimes called twice
- Date: Sun, 2 Oct 2005 16:19:53 +0900
Hi,
Having noticed that the muinescrobbler often fails
to submit my songs, I was studying its source to correct the bug. I
actually found a behaviour of muine which looks weird.
The following plugin reproduces the strange behaviour
"""
using System;
using System.IO;
using Muine.PluginLib;
public class TestPlugin : Plugin
{
private IPlayer player;
private ISong currentSong;
public override void Initialize (IPlayer player)
{
this.player = player;
player.SongChangedEvent +=
new SongChangedEventHandler (OnSongChangedEvent);
player.TickEvent +=
new TickEventHandler (OnTickEvent);
}
private void OnSongChangedEvent (ISong song)
{
if (song == null) {
return;
} else {
currentSong = song;
}
Console.WriteLine ("GabouPlugin: Started playing {0}", song.Title);
}
private void OnTickEvent (int position)
{
Console.WriteLine ("GabouPlugin: Tick Event at position {0} for song
{1}", position, currentSong.Title);
}
}
"""
Normally, if I understand correctly, once onSongChangedEvent is called,
each OnTickEvent corresponds to the new song. That's what happens with
some of my mp3; the output is then:
"GabouPlugin: Started playing My Song
GabouPlugin: Tick Event at position 0 for song My Song
GabouPlugin: Tick Event at position 0 for song My Song
[snip]
GabouPlugin: Tick Event at position 120 for song My Song
GabouPlugin: Started playing Your Song
GabouPlugin: Tick Event at position 0 for song Your Song"
So far so good. But with other audio files, what actually happens is:
"GabouPlugin: Started playing Slip
GabouPlugin: Tick Event at position 0 for song Slip
GabouPlugin: Tick Event at position 0 for song Slip
[snip]
GabouPlugin: Tick Event at position 378 for song Slip
GabouPlugin: Started playing Slip
GabouPlugin: Tick Event at position 378 for song Slip
GabouPlugin: Started playing Glitch
GabouPlugin: Tick Event at position 0 for song Glitch
"
OnSongChangedEvent is called twice: once at the beginning, once at the end. I guess this is not normal, right ?
As I don't know much about C#, and I just wanted to have a working
muinescrobbler, I didn't investigate much into muine source to find
where the problem is coming from.
Thanks.
David
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]