Author Topic: Winamp API: get track length  (Read 780 times)

emilles

  • Jr. Member
  • **
  • Posts: 22
Is there support in MusicBee's WinAmp (Output Plug-in) API for getting the length of the current track?  WinAmp supports this in 2 ways:
Code
DWORD error;
DWORD_PTR result;
SendMessage(window, WM_WA_IPC, (LPARAM) IPC_GETOUTPUTTIME, (WPARAM) 2, &error, &result);
time_t length = (time_t) result;

Code
void GetBasicFileInfo(time_t& length, const wchar_t* const filePath, HWND hWnd)
{
basicFileInfoStructW fileInfo;
fileInfo.filename = filePath;
fileInfo.quickCheck = 0;
fileInfo.title = NULL;
fileInfo.titlelen = 0;
fileInfo.length = 0;

SendMessageWithTimeout(hWnd, WM_WA_IPC, IPC_GET_BASIC_FILE_INFOW, (WPARAM) &fileInfo);
if (fileInfo.length > 0)
{
length = static_cast<time_t>(fileInfo.length) * 1000;
}
}

IPC_GET_BASIC_FILE_INFOW is 1291.  There is an older message 291 for non-wide chars as well.

I have been using the MusicBee IPC plug-in, which uses the standard MusicBee API and gives me access over IPC.  However, that plug-in seems to have been wiped from the internet.