?: lParam of WM_PN_PLAYSTARTED [Archive] - Quintessential Forum

PDA

View Full Version : ?: lParam of WM_PN_PLAYSTARTED


Tokelil
01-30-2004, 07:14 PM
In my next plug-in I subclass QCD to get the current position of the track, but I ran into a little trouble.
The value of lParam when playing ogg files is 1/1000 second but 1/100 when playing mp3. I dont know about the other formats. Any reason why they the time is sent differently depending on fileformat?

The best would of course be to use opGetTime but it returns the result in seconds and I want 1/10 second.

Any surgestions for work arounds?

Paul
01-30-2004, 07:46 PM
You're probably referring to WM_PN_PLAYBACKPROGRESS since WM_PN_PLAYSTARTED doesn't have an lParam value.

Input plugin define their own units of time measurement. The some use 1000ths of a second, some use 100ths (like the mp3), some use 75ths (like the CD plugin). So you can't count on the lParam.

There is a workaround. QCD emulates a lot of Winamp APIs to support calls from DSP plugins. There is one for retrieving the ms of the current track. Here's how to call it:

HWND hwndQCDWA = FindWindow("Winamp v1.x", NULL);
int ms = SendMessage(hwndQCDWA, WM_USER, 0, 105); // 105 == IPC_GETOUTPUTTIME

I will also add a service op to get the elapsed time in milliseconds.

Tokelil
01-30-2004, 07:54 PM
Heh a little mind fart there... (Should had been WM_PN_POSITIONUPDATE)

Thanks for the help.

Tokelil
01-31-2004, 03:29 AM
"- added op - opGetOutputTime"

That was fast!! :cheerful:

Tokelil
02-02-2004, 05:19 PM
Im using the method you surgested with the Winamp op right now but I have a problem. (I'll rewrite the plug-in when the next release comes out...)

In the init funktion of my plug-in I try to get the handle of the Winamp 1.x window, but it returns NULL if the plug-in is enabled when QCD starts. I guess it is created after the General plug-ins are loaded. Any ideas on how work around this? (Id reather not use the FindWindow function every time I need the time of the playing track.)

Paul
02-02-2004, 06:14 PM
Do a FindWindow the first time you need to make the call only if the window handle is NULL (thus, only calling it once).

Tokelil
02-02-2004, 06:16 PM
Yer okay I should have thought of that. I was thinking way to complicated. Thanks for the help!