COM Automation Server for 0.9
Reply #12 –
Hey, this is really cool.
Thanks for writing this foosion, a friendly foobar2k event sender to other applications is exactly what I needed.
However, I'm running into a strange bug(?).
I have referenced the foobar COM component in my C# project, and have added the following (pseudo)code:
private void connectFoobar()
{
// Connect to foobar
foobar = new Application07Class();
foobar.Playback.PositionChanged += new _IVBPlaybackEvents_PositionChangedEventHandler(Playback_PositionChanged);
}
private void Playback_PositionChanged(double dSecondsFromStart, bool bSeekFlag)
{
info.Position = (int)dSecondsFromStart;
// Draw track information to Logitech G15 LCD.
}
This works for 5 or 6 events, then I stop recieving events.
(.. after many edits of this post..)
Aha, it appears calling the garbage collector (GC.Collect()) stops me from recieving COM events. This is why I stop recieving events after 5 or 6 memory-intensive operations. After a couple hundred k's of memory have been moved the GC is called.
I could try to fix this or use a timer instead. I'm glad to have found the cause anyways.