Archive: Is there an API for the AVS?


23rd October 2003 13:00 UTC

Is there an API for the AVS?
Boy nothing like a fistfull of anger and a few 2litres of soda to get something accomplished :D

I've written a karaoke zip player for use with the CDG plugin by Yannick. http://www.bathroomsbyhans.com/karaokezipplayer.zip. Eventually it's going to get better, as this is my first windows application of any kind outside of batch files and logon scripts.

I would like to set the AVS overlay color through some kind of API call or what not. Is there any way of doing this?

--toqer


23rd October 2003 13:09 UTC

Erm ... no. But wait ... no!

Unless you like to go through the extremely painfull way of analyzing handles and simulating user actions by the messaging system.

This is no easy job and if you're not used to Win32 programming, probably impossible. Took me 2 years to get things like this done.


23rd October 2003 13:48 UTC

Dude, I got a handle on it, just give me the answer if you got it.

**edit**

Ohhhhh I see what you're saying. You did give me an answer. So there is no easy way to do this through the windows messaging API? Let me make sure I have this straight...

To the best of your knowledge, there's no windows message function I could use to set the overlay value.

You're suggesting that I simulate user input, so basically I would have to find the winamp parent window, find the AVS subwindow, simulate a dbl click on it, simulate a mouse click on settings from the file menu, simulate going to display, then simulate going to the overlay box, simulate a dbl click on the overlay box, then simulate it adding the RGB value to the custom color text box.

Did I miss anything? You're right, that's kludgy as hell, are you SURE there's no easier way of doing it through an API call?

PS nullsoft dev's please chirp in an answer if you can, I gave you atari stuff remember?


23rd October 2003 14:20 UTC

You got the point ;)

I managed to switch between transition modes remotely via hotlist and this needs to:
-get the editor window
-get the menu handle and find the proper menu
-execute the menu, so the config page will show up
-change the controls as i want
-send a friggin notification message (which was damn hard to spy out)

Your task is even more complex as you'll require to work with the selectcolor-popup window as well. Kludgy as hell, you named it.

Even more as the main menu got changed for version 2.7 so you'll need to make it backward compatible.

Good luck on this, don't know if it helps but i could give you some Delphi example code which i use for changing transition if you want. :)

Btw, the link in your first post does not work


23rd October 2003 14:24 UTC

I'm not sure what you need to do, but you can always read out the current overlay color from Winamp.ini, in the [AVS] section "cfg_bkgnd_render_color". It's a regular 32-bit integer either in 0RGB or 0BGR format (not sure which).

If AVS is not running, you can change the color by changing this value in the .ini.


23rd October 2003 14:29 UTC

Hmm, i know that you could turn avs on and off for this via api calls, but i think this was only allowed to plugins. And if it works, turning avs off may cause undesired effects.


23rd October 2003 22:39 UTC

Originally posted by UnConeD
I'm not sure what you need to do, but you can always read out the current overlay color from Winamp.ini, in the [AVS] section "cfg_bkgnd_render_color". It's a regular 32-bit integer either in 0RGB or 0BGR format (not sure which).
YES!! That's damn close to what I need to do. Unfortunatly this method seems to want to want me to completely restart winamp in order for it to work...

Oh in case you're wondering "wtf is toq trying to accomplish" Well basically i'm working on a set of open sore(source) programs for karaoke hosters. Having AVS behind the lyrics in karaoke r0x. 2 more addons I want to do to my program this week is..

A quick way to switch the overlay color, maybe a set of radio buttons for each karaoke manufacturer.

Build a frontend to the imagemagick dll so I can create a "Next Singer" AvS that will basically be a render>picture preset. Type in the singers name, it takes an input image, montages the singers name, and dumps it in the AVS folder.

Oh yah, for that link that doesn't work...
http://www.bathroomsbyhans.com/karaokezipplayer.zip

Thanks again guys for giving me something to chew on. Now I have 2 ways to kludge this. Simulate user input, or write the value to winamp.ini and restart winamp. (I think I might try door#2 first)

24th October 2003 06:40 UTC

Here is the code i use for transmitting transition settings.
Its the pure unchanged function i use, so there will be stuff in, which you won't need, but you should get the main idea i think. ;)


function SubmitSettings: Boolean;
var
h,h2,hm,hs,ht,hc :hwnd;
id :integer;
begin
h:=findwindow('#32770','Winamp AVS Editor - Hotlist Active');
if h=0 then
##begin
##h:=findwindow('#32770','Winamp AVS Editor');
##if h=0 then
####begin
####Result:=false;
####HotlistMain.setdelay:=true;
####end
##else
####begin
####Result:=true;
####HotlistMain.setdelay:=false;
####SetWindowText(h,'Winamp AVS Editor - Hotlist Active');
####end;
##end
else
##begin
##Result:=true;
##HotlistMain.setdelay:=false;
##h2:=findwindowex(h,0,'Button','Transitions');
##if h2=0 then
####begin
####hm:=getmenu(h);
####hs:=GetSubMenu(hm,1);
####if GetMenuItemCount(hs)=2 then hs:=GetSubMenu(hm,2);
####id:=GetMenuItemID(hs,4);
####SendMessage(h,WM_COMMAND,id,0);
####end;
##h2:=findwindowex(h,0,'#32770',nil);
##{Enable Transition}
##ht:=findwindowex(h2,0,nil,'Enable Transition on load preset');
##if HotlistMain.Trans.Checked
####then sendmessage(ht,BM_SetCheck,BST_CHECKED,0)
####else sendmessage(ht,BM_SetCheck,BST_UNCHECKED,0);
##sendmessage(h2,WM_Command,1117,ht);
##{Render Old effect}
##ht:=findwindowex(h2,0,nil,'Keep rendering old effect');
##if HotlistMain.RenderOld.Checked
####then sendmessage(ht,BM_SetCheck,BST_CHECKED,0)
####else sendmessage(ht,BM_SetCheck,BST_UNCHECKED,0);
##sendmessage(h2,WM_Command,1118,ht);
##{Transition}
##hc:=findwindowex(h2,0,'ComboBox',nil);
##sendmessage(hc,cb_setcursel,HotlistMain.ComboBox1.ItemIndex,0);
##sendmessage(h2,WM_Command,$0001043F,hc);
##{Speed}
##ht:=findwindowex(h2,0,nil,'Slider1');
##sendmessage(ht,TBM_SetPos,1,HotlistMain.TrackBar1.Position);
##sendmessage(h2,WM_Notify,$00000418,0);
##{FixOnTop}
##h:=findwindow('avswnd',nil);
##if h=0 then h:=findwindow('Winamp Gen','AVS');
##if HotlistMain.Fixontop.Checked then setwindowpos(h,hwnd_topmost,0,0,0,0,swp_nomove+swp_nosize+swp_noactivate)
##else setwindowpos(h,hwnd_notopmost,0,0,0,0,swp_nomove+swp_nosize+swp_noactivate);
##end;
end;


[edit] used # instead of spaces, because multi spaces won't show up i this forum.


24th October 2003 15:29 UTC

In that case, why don't you just use AVS's color instead of trying to force your own?


25th October 2003 21:35 UTC

Cause each karaoke manufacturer uses a different RGB value for their karaoke backgrounds.


25th October 2003 22:34 UTC

Ah my bad, thought you were doing the karaoke software too.

Note that you don't need to restart winamp for modifying the ini, you can just restart AVS. The Winamp API is documented on the develop section of this site and shouldn't be a problem. Use the standard ini functions in windows and it should be a breeze.


26th October 2003 01:52 UTC

That's it? Damn, so easy.