Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome General
 PowerHome Messageboard : PowerHome General
Subject Topic: Winamp Control Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: April 19 2003 at 17:19 | IP Logged Quote TonyNo

I went back to Winamp from QCD for playing whole-house audio since the new version has a few issues on my new machine, and, I found this handy utility...

http://www.flippet.org/wacommand.html

It is a command-line util that controls Winamp (like the one built-in to QCD, or, like Dave's Volume app). Winamp has, I think, three command-line options, none of which control the darn thing!

Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: April 28 2003 at 09:44 | IP Logged Quote dhoward

Tony,

I started playing around with a new macro for WinAmp control.  It works really nice in the new version because you can now call a macro with the first five local variables prepopulated.  I can now make a call like: ph_macroparm("WINAMP CONTROL","PLAY",0,0,0,0) and the macro will cause Winamp to play.

You can get close to the same functionality without the parm passing however and not have to use an external program if you like using Windows messages.  Here is a link to the Winamp documentation for external control: http://www.winamp.com/nsdn/winamp2x/dev/sdk/api.jhtml

Here is a way you can roll your own Winamp control:

1.  Declare a global variable called "WINAMP CONTROL"

2.  Declare a macro called "WINAMP CONTROL".  The detail is below:

insert into macroheader values ('WINAMP CONTROL','WINAMP CONTROL',4,4,252,96,0,0,0,12632256,0,0,1,'');
insert into macrodetail values ('WINAMP CONTROL',1,15,'[LOCAL1]',NULL,'"{WINAMP CONTROL}"');
insert into macrodetail values ('WINAMP CONTROL',2,15,'[LOCAL2]',NULL,'ph_findwindow("Winamp v1.x",0)');
insert into macrodetail values ('WINAMP CONTROL',3,16,'',NULL,'if([LOCAL2] = 0,999,1)');
insert into macrodetail values ('WINAMP CONTROL',4,38,'',NULL,'ph_sendmsg([LOCAL2],273,case(upper("[LOCAL1]") when "PREV" then 40044 when "NEXT" then 40048 when "PLAY" then 40045 when "STOP" then 40047 when "PAUSE" then 40046 else 0),0)');

The above macro assumes that WinAmp is already running.  It could be easily modified to launch Winamp if it isn't running.  Also, it currently only has support for previous, next, play, pause, and stop.  It would be easy to add the others.

This should keep you playing for a while .

Dave.

 

Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: April 28 2003 at 12:20 | IP Logged Quote TonyNo

Looks good, Dave.

WACommand is small, so, it's not bad. You should handle that kind of thing like a plugin, so as not to get stuck supporting only one media player. Right now, I'm bouncing back and forth between WinAmp and QCD for various reasons.

Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: April 28 2003 at 20:52 | IP Logged Quote TonyNo

Hmm. After further review, that looks like a nice hint at Windows Messaging in  general!

...what am I doing wrong? I just tried to bring that SQL code in, and got an error: "Modifications to the CONTROL table are not allowed".

Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: April 29 2003 at 09:31 | IP Logged Quote dhoward

Tony,

My bad.  PowerHome has some rudimentary code to prevent direct SQL updates to the CONTROL table.  The CONTROL in WINAMP CONTROL was confusing the check routine.  I changed the macro slightly so that it should import fine now:

insert into macroheader values ('WINAMP CTRL','WINAMP CTRL',4,4,252,96,0,0,0,12632256,0,0,1,'');
insert into macrodetail values ('WINAMP CTRL',1,15,'[LOCAL1]',NULL,'"{WINAMP CTRL}"');
insert into macrodetail values ('WINAMP CTRL',2,15,'[LOCAL2]',NULL,'ph_findwindow("Winamp v1.x",0)');
insert into macrodetail values ('WINAMP CTRL',3,16,'',NULL,'if([LOCAL2] = 0,999,1)');
insert into macrodetail values ('WINAMP CTRL',4,38,'',NULL,'ph_sendmsg([LOCAL2],273,case(upper("[LOCAL1]") when "PREV" then 40044 when "NEXT" then 40048 when "PLAY" then 40045 when "STOP" then 40047 when "PAUSE" then 40046 else 0),0)');


Also, change the Global variable to "WINAMP CTRL".

This should get it working.

Dave.

 

Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: April 29 2003 at 09:34 | IP Logged Quote dhoward

Also....

I forgot to mention how you would typically call this macro for control.

If you wanted to pause WinAmp...just execute the formula:

ph_setglobal_a("WINAMP CTRL","PAUSE") + ph_macro("WINAMP CTRL")

This will set the GV to "PAUSE" and then execute the macro which will read the GV and send the appropriate Windows message.

Dave.

 

Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: April 29 2003 at 21:22 | IP Logged Quote TonyNo

!
Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
fanningp
Groupie
Groupie
Avatar

Joined: December 01 2002
Location: United States
Online Status: Offline
Posts: 55
Posted: April 26 2004 at 15:10 | IP Logged Quote fanningp

Hi Dave...I was looking at this Winamp tip but apparently it's broken with the new DB structure for 1.03.2....

Thoughts?

Pete Fanning

 



__________________
Pete Fanning
Internet: petefanning@hotmail.com
Back to Top View fanningp's Profile Search for other posts by fanningp Visit fanningp's Homepage
 
fanningp
Groupie
Groupie
Avatar

Joined: December 01 2002
Location: United States
Online Status: Offline
Posts: 55
Posted: April 27 2004 at 10:35 | IP Logged Quote fanningp

Nevermind.....I went the route of ph_playsound anyway after I looked at the latest phsample.db macros......

I eventually settled on Mary in TTS anyway!



__________________
Pete Fanning
Internet: petefanning@hotmail.com
Back to Top View fanningp's Profile Search for other posts by fanningp Visit fanningp's Homepage
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: April 27 2004 at 11:46 | IP Logged Quote dhoward

Pete,

Sorry to take so long responding.  Ive updated the above macro so that it will work with the new database structure as well as take advantage of the new ph_macroparm function.  The new SQL is:

insert into macroheader values ('WINAMP CTRL','WINAMP CTRL',4,4,252,96,0,0,0,12632256,0,0,1,'',10);
insert into macrodetail values ('WINAMP CTRL',1,15,'[LOCAL2]',NULL,'ph_findwindow("Winamp v1.x",0)',0);
insert into macrodetail values ('WINAMP CTRL',2,16,'',NULL,'if([LOCAL2] = 0,999,1)',0);
insert into macrodetail values ('WINAMP CTRL',3,38,'',NULL,'ph_sendmsg([LOCAL2],273,case(upper("[LOCAL1]") when "PREV" then 40044 when "NEXT" then 40048 when "PLAY" then 40045 when "STOP" then 40047 when "PAUSE" then 40046 else 0),0)',0);

You would call this function using the following:

ph_macroparm("WINAMP CTRL","PLAY",0,0,0,0)

This would cause WINAMP to play.

Let me know if this works for you or not.

Dave.

 

Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
fanningp
Groupie
Groupie
Avatar

Joined: December 01 2002
Location: United States
Online Status: Offline
Posts: 55
Posted: April 27 2004 at 12:02 | IP Logged Quote fanningp

Okay...thanks....I've been playing with WinAmp too lately so this will be neat.......I've really let Powerhome slide since Christmas and want to get back into the swing of things......I have a whole box of X10 modules just itching to get installed :)



__________________
Pete Fanning
Internet: petefanning@hotmail.com
Back to Top View fanningp's Profile Search for other posts by fanningp Visit fanningp's Homepage
 
fanningp
Groupie
Groupie
Avatar

Joined: December 01 2002
Location: United States
Online Status: Offline
Posts: 55
Posted: April 27 2004 at 18:25 | IP Logged Quote fanningp

Works like a champ!  Was ooohhhhing and ahhhhing the wife and kids by starting and stopping an MP3 with WinAMP 5 by my keychain remote.....

Thanks Dave....ordered my RedRat3....should be here in 5-7.....



__________________
Pete Fanning
Internet: petefanning@hotmail.com
Back to Top View fanningp's Profile Search for other posts by fanningp Visit fanningp's Homepage
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: April 29 2004 at 15:13 | IP Logged Quote dhoward

Hehe,

Yeah, its pretty cool.  I plan on ordering a Ramsey electronics FM transmitter so that I can receive my MP3's from any FM stereo around the house.  It'll be pretty cool when people come over and it appears that Im listening to the radio and decide that I want to change the song without changing the station...all from a keychain remote.

You'll be happy with the RedRat3...it's an excellent little IR controllers.

Dave.

 

Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
dmoreno
Newbie
Newbie
Avatar

Joined: February 15 2002
Location: United States
Online Status: Offline
Posts: 31
Posted: December 01 2005 at 20:28 | IP Logged Quote dmoreno

Dave, Is is possible to control the VOL.and BAL. with this macro?
Back to Top View dmoreno's Profile Search for other posts by dmoreno
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: December 02 2005 at 23:37 | IP Logged Quote dhoward

Don,

You could do it with that macro, but it would require some changes. Below are a couple of simple formulas that will change Winamp's volume and balance settings.

ph_sendmsg(ph_findwindow("Winamp v1.x",0),1024,volume,122)

This formula will set the Winamp volume. The volume should be a value from 0 to 255.

ph_sendmsg(ph_findwindow("Winamp v1.x",0),1024,panning,123)

This formula will control the balance. The balance value should be from 0 to 255 as well but doesnt work quite like you expect. A value of 0 or 255 will center the balance. A value of 127 is far right. A value of 128 is far left.

Hope this helps,

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum