Go Back   Winamp Forums > Developer Center > Winamp Development

Reply
Thread Tools Search this Thread Display Modes
Old 8th October 2009, 02:10   #1
jryan15
Junior Member
 
Join Date: Oct 2009
Posts: 11
changing playlist using sendmessage commands

Is it possible to use sendmessage commands to index through available playlists and/or smartlists? If necessary, a combination of sendmessage strings can be utilized.

Background: I'm setting up an audio zoning system and would like to be able to scroll through smartlists from remotely located keypads. The keypads would send IR signals to USBUIRT device attached to HTPC. From the HTPC, Proximis / Girder software will intercept IR and send out custom sendmessage strings to the specific instance of Winamp that is targeted.

Any help would be greatly appreciated.

Thanks!
jryan15 is offline   Reply With Quote
Old 9th October 2009, 10:04   #2
griffins_Grader
Senior Member
 
Join Date: Aug 2008
Posts: 114
there are some IPC_* in wa_ipc.h for getting playlist name/title/file by index. They are in proc though
griffins_Grader is offline   Reply With Quote
Old 9th October 2009, 21:13   #3
jryan15
Junior Member
 
Join Date: Oct 2009
Posts: 11
Thanks for the reply... I've not used any code solutions before though. Would the scripts run from within winamp and allow me to tie an external trigger to them? thanks!
jryan15 is offline   Reply With Quote
Old 10th October 2009, 06:59   #4
griffins_Grader
Senior Member
 
Join Date: Aug 2008
Posts: 114
I have never triggered IPC_* message through exported function of a plugin linked to an external application but by convention it is possible.
griffins_Grader is offline   Reply With Quote
Old 11th October 2009, 20:18   #5
DrO
-
 
DrO's Avatar
 
Join Date: Sep 2003
Location: UK
Posts: 22,272
there are also playlist api's in ipc_pe.h which gives a bit more control over what is shown in wa_ipc.h though for accessing the 'smartlsts' and media library playlists it is generally something that is best done through a true plugin rather than some SendMessage(..) calls to Winamp (due to accessing of strings from the Winamp process). this is able to be worked around (via ReadProcessMemory(..) methods) but i'm not sure that'd be reliable enough for the ml playlists, etc for the level that i guess you're working towards.

the other way is to have a plugin which interacts with your system and can do the required access/manipulation through a SendMessage(..) based api from controller to Winamp+plugin combination. there should be enough information in the 5.55 sdk examples to get going with accessing the media library playlist data (think it'll require Wasabi dependances) and the 'smartlist' (i'd assume you're refering to the media library query views) are in ml.h in one of the query options/sdk examples.

-daz
DrO is offline   Reply With Quote
Old 13th October 2009, 14:38   #6
jryan15
Junior Member
 
Join Date: Oct 2009
Posts: 11
Thanks for jumping in... I can see though that I've got a long road ahead.

I reviewed the latest sdk and specifically the ipc's that you referrenced. I don't see a direct path to navigating through an unspecified list of playlists. Since there doesn't appear to be a direct means of navigation, would a process such as the one that I outline below be possible? What's you opinion on this approach?

Concept: Index through playlists (and hopefully smartlists) using forward/previous buttons managed by an external application (girder).

Playlist: All playlists (and smartlists if possible) will be saved into a specific - "c:\music\kids" directory.

1. Forward button pressed.
2. Via sendmessage command, Girder triggers a "playlist forward" function inside winamp.
3. "Playlist forward" function polls the "c:\music\kids" directory for playlist files and imports into a variable
4. The function retrieves the active playlist from winamp
5. The active playlist is compared to the list of available playlists to find an index location.
6. The following playlist alphabetically is identified.
7. The function clears the active playlist (except maybe for the current sond) and imports the new playlist.
8. The playlist is radomized and the function ends.

A similar method would be used for the Previous button.


I'm having trouble reading through the sdk and translating them into real world examples. I went through the plugin development wiki and even created my own dll, but I still am having trouble with the overall big picture of how to use an external app to hook into one of the many scripts in the sdk... Also the scripts in the sdk are for the most part h files, do they need to be individually compiled and converted to dlls to work with winamp?
jryan15 is offline   Reply With Quote
Old 14th October 2009, 17:38   #7
jryan15
Junior Member
 
Join Date: Oct 2009
Posts: 11
After working with the plugin developer wiki, I tried moving onto something closer to my objective, but I'm having trouble with compile errors (see below). If I change plugin.hwndLibraryParent to plugin.hwndParent, I can get it to compile and run, but it returns 0 for the number of smartlists...

I'm think that I've made a mistake trying to use the ml files in a general purpose plugin, but I'm really talking out my rear .

code:

1>------ Build started: Project: gen_myplugin, Configuration: Debug Win32 ------
1>Compiling...
1>gen_myplugin.cpp
1>.\gen_myplugin.cpp(117) : error C2039: 'hwndLibraryParent' : is not a member of 'winampGeneralPurposePlugin'
1> c:\users\valued customer\documents\apps\visual studio\gen_myplugin\gen_myplugin\gen_myplugin.h(16) : see declaration of 'winampGeneralPurposePlugin'
1>.\gen_myplugin.cpp(134) : error C2039: 'hwndLibraryParent' : is not a member of 'winampGeneralPurposePlugin'
1> c:\users\valued customer\documents\apps\visual studio\gen_myplugin\gen_myplugin\gen_myplugin.h(16) : see declaration of 'winampGeneralPurposePlugin'
1>Build log was saved at "file://c:\Users\valued customer\Documents\apps\visual studio\gen_myplugin\gen_myplugin\Debug\BuildLog.htm"
1>gen_myplugin - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========




code:

/*

Winamp generic plugin template code.
This code should be just the basics needed to get a plugin up and running.
You can then expand the code to build your own plugin.

Updated details compiled June 2009 by culix, based on the excellent code examples
and advice of forum members Kaboon, kichik, baafie, burek021, and bananskib.
Thanks for the help everyone!

*/

#include "stdafx.h"
#include <windows.h>
#include "gen_myplugin.h"
#include "wa_ipc.h"
#include <stdio.h>
#include "ml.h"


// these are callback functions/events which will be called by Winamp
int init(void);
void config(void);
void quit(void);


// this structure contains plugin information, version, name...
// GPPHDR_VER is the version of the winampGeneralPurposePlugin (GPP) structure
winampGeneralPurposePlugin plugin = {
GPPHDR_VER, // version of the plugin, defined in "gen_myplugin.h"
PLUGIN_NAME, // name/title of the plugin, defined in "gen_myplugin.h"
// init, // function name which will be executed on init event
config, // function name which will be executed on config event
// quit, // function name which will be executed on quit event
0, // handle to Winamp main window, loaded by winamp when this dll is loaded
0 // hinstance to this dll, loaded by winamp when this dll is loaded
};


void config() {

int n = SendMessage(plugin.hwndLibraryParent,WM_ML_IPC,0,ML_IPC_SMARTVIEW_COUNT);

//just a test
wchar_t msg[1024];
wsprintf(msg,L"The number is: %x\n",n);
MessageBox(plugin.hwndParent,msg,0,0); //test to see n value



mlSmartViewInfo m={0};
m.size = sizeof(mlSmartViewInfo);
for(int i=0; i<n; i++) {
m.smartViewNum=i;

MessageBox(plugin.hwndParent,L"Inside for loop",0,0); //test to see if i'm here

if(SendMessage(plugin.hwndLibraryParent,WM_ML_IPC,(WPARAM)&m,ML_IPC_SMARTVIEW_INFO) == 1) {
// use contents of m

MessageBoxW(plugin.hwndParent,m.smartViewName,0,0);
}

jryan15 is offline   Reply With Quote
Old 15th October 2009, 04:49   #8
jryan15
Junior Member
 
Join Date: Oct 2009
Posts: 11
Looks like I'm way off. Any chance anyone can point me to a good example of a Media Library Plugin that I could try to work through or maybe walk me through how to actually implement this code to output a list of playlists or smartlists? Thanks!

code:

typedef struct {
int version;
char *description;
int (*init)(); // return 0 on success, non-zero for failure (quit WON'T be called)
void (*quit)();


// return NONZERO if you accept this message as yours, otherwise 0 to pass it
// to other plugins
INT_PTR (*MessageProc)(int message_type, INT_PTR param1, INT_PTR param2, INT_PTR param3);
//note: INT_PTR becomes 64bit on 64bit compiles... if you don't like windows types or caps, you can #include <stddef.h> and use intptr_t

//all the following data is filled in by the library
HWND hwndWinampParent;
HWND hwndLibraryParent; // send this any of the WM_ML_IPC messages
HINSTANCE hDllInstance;
} winampMediaLibraryPlugin;


Last edited by jryan15; 15th October 2009 at 05:08.
jryan15 is offline   Reply With Quote
Reply
Go Back   Winamp 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