Old 11th November 2005, 22:56   #1
aceman118
Junior Member
 
Join Date: Nov 2005
Posts: 11
looking for the artist/song of currently playing file

I'm working on a plugin and I have gotten it to run but I havent gotten it to do what I want it to do. Basically, I'm totally new to winamp plugin writing and dont know where to go next.

I'm looking to get the song title and artist from whatever file is playing. Where would I find this? is their a struct that gets this info or is it something I have to set up? A point in the right direction would be wonderful. Thanks.
aceman118 is offline   Reply With Quote
Old 11th November 2005, 23:49   #2
DrO
 
Join Date: Sep 2003
Posts: 27,873
taken from the modified wa_ipc.h

code:
char* GetExtendedFileInfo(char* file, char* field){
extendedFileInfoStruct exFIS = {0};
static char metadata[256] = {0};
exFIS.filename = file;
exFIS.ret = metadata;
exFIS.retlen = sizeof(metadata);
// "ARTIST", "TITLE", "ALBUM", "TRACK", "YEAR", "GENRE", "COMMENT"
exFIS.metadata = field;
if(SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)
&exFIS,IPC_GET_EXTENDED_FILE_INFO)){
// can do stuff since data was received
return metadata;
}
return 0;
}


that can be used (with 5.x) to query the artist and title as needed. the current song is obtained with char* file = (char*)SendMessage(hwnd_winamp,WM_WA_IPC,SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETLISTPOS),IPC_GETPLAYLISTFILE);

-daz
DrO is offline   Reply With Quote
Old 12th November 2005, 00:20   #3
aceman118
Junior Member
 
Join Date: Nov 2005
Posts: 11
Thanks a bunch for the help. I got it compiling again but winamp crashes when I try and use the "char* file = (char*)SendMessage(hwnd_winamp,WM_WA_IPC,SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETLISTPOS),IPC_GETPLAYLISTFILE);"

I had to change the hwnd to plugin.hwndParent cause I thought I remember reading somewhere that they are used the same way and the template I had used hwndParent. If I am wrong about that please let me know. Thanks again.

EDIT: I just thought of something. Would it be a problem if nothing is being played at the time? When I first open winamp, nothing is being played so that may be causing the crash.
aceman118 is offline   Reply With Quote
Old 12th November 2005, 20:35   #4
aceman118
Junior Member
 
Join Date: Nov 2005
Posts: 11
I get everything basically working. I've learned a lot in the past day or so. I'm still having one very strange problem.

The first time I get all the info from the mp3 it works great. When the next song starts or I click a new song the info I get back is garbage. Does the code above only work for a 1 time deal? or maybe I'm doing somethign completely wrong.
aceman118 is offline   Reply With Quote
Reply
Go Back   Winamp & SHOUTcast Forums > Developer Center > Winamp Development

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump