Old 17th February 2002, 19:01   #1
Russ
Mostly Harmless
(Alumni)
 
Join Date: Jan 2001
Location: UK
Posts: 2,319
Question on coding WACs

Right, I've decided to have a play around with building some Winamp3 components, and I've got a bit stuck - this is about my first time coding C++, I've come from doing C on UNIX, and (*shudder*) VB.

OK, I've got the thing to compile and load (a struggle in itself ), and I've got integer options showing up in the prefs screen (i.e. _int something("Something", 1); ) , but I'm rather stuck on how to get boolean or string values to work there.

Secondly, can I get Winamp to call me back when the song changes, or do I have to poll it on a timer? (I haven't looked very hard with this)

-- Russ Garrett
Russ is offline  
Old 17th February 2002, 20:39   #2
soundsys
Senior Member
 
Join Date: Oct 2001
Location: Rennes (France)
Posts: 156
Send a message via ICQ to soundsys
the _int is one of the attribute types.
Look in attribute.h

Here are some known types :

INT = 'int',
STRING = 'str',
BOOL = 'bool',
FLOAT = 'flot'

R.N. aka soundsys
soundsys is offline  
Old 17th February 2002, 21:14   #3
Russ
Mostly Harmless
(Alumni)
 
Join Date: Jan 2001
Location: UK
Posts: 2,319
Thanks, I had noticed that - maybe I'm being stupid, but I change:
_int something("Something", 1);
to:
_bool something("Something", TRUE);
and I get:

error C2146: syntax error : missing ';' before identifier 'something'
error C2501: '_bool' : missing storage-class or type specifiers
fatal error C1004: unexpected end of file found

on that line, similarly with str or flot.

-- Russ
Russ is offline  
Old 17th February 2002, 22:15   #4
Darkain
Major Dude
 
Darkain's Avatar
 
Join Date: Apr 2001
Location: Tacoma, WA
Posts: 1,223
Send a message via ICQ to Darkain Send a message via AIM to Darkain Send a message via Yahoo to Darkain
make sure you got the right header included...

use this:
#include "../attribs/attribs.h"


this will automatically include all 4 types of attributes. after this, _bool SHOULD in theory work.


-=- Darkain Dragoon -=-
Darkain is offline  
Old 17th February 2002, 23:03   #5
schweitn
Winamp3 Component Guuuru
Beta Team
 
schweitn's Avatar
 
Join Date: Dec 2000
Location: Milwaukee, WI
Posts: 1,068
Send a message via AIM to schweitn Send a message via Yahoo to schweitn
To answer your question on the Song Change callback... yes there is...

Here is how:

1. include "../studio/corecb.h"
2. Derive a class from CoreCallbackI
3. call api->core_addCallback in your class's constructor and api->core_delCallback in your class's destructor.
4. Override the functions of CoreCallbackI that interest you...

VERY IMPORTANT.... You need to look at CoreHandle to see exactly how your constructor and destructor have to work. You can find their definitions in common\corehandle.h and .cpp

SPECIAL HINT.... for when you are looking at CoreHandle, a token of 0 is the core identifier for the main playback engine in Winamp3.

Hope this helps.

Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.
- Albert Einstein

Winamp 3 Projects | Winamp 2x Plugin Manager | Explorer Playlist | FileSystem Object | Shoutcast List | Sashimi
schweitn is offline  
Old 18th February 2002, 07:40   #6
Russ
Mostly Harmless
(Alumni)
 
Join Date: Jan 2001
Location: UK
Posts: 2,319
Aha... I'd been including attribute.h instead, and it wasn't complaining (should it?). And why does _int work where all the others don't?

Edit: It appears you need to use _string for strings, contrary to what it says in attribute.h.

-- Russ
Russ is offline  
Old 18th February 2002, 11:46   #7
Russ
Mostly Harmless
(Alumni)
 
Join Date: Jan 2001
Location: UK
Posts: 2,319
OK, I'm having a little trouble getting the callbacks to work - could you possibly post an example? I'm struggling a bit with all these classes .

For long you live and high you fly, but only if you ride the tide, and balanced on the biggest wave you race towards an early grave.
|Musicbrainz|Audioscrobbler|last.fm|
Russ is offline  
Old 18th February 2002, 12:36   #8
Russ
Mostly Harmless
(Alumni)
 
Join Date: Jan 2001
Location: UK
Posts: 2,319
Ain't it typical... got it working now . Moved api->core_addCallback from the constructor to onCreate() and now it works. Makes sense now I think about it.. . Thanks everyone.

For long you live and high you fly, but only if you ride the tide, and balanced on the biggest wave you race towards an early grave.
|Musicbrainz|Audioscrobbler|last.fm|
Russ is offline  
Old 18th February 2002, 13:09   #9
schweitn
Winamp3 Component Guuuru
Beta Team
 
schweitn's Avatar
 
Join Date: Dec 2000
Location: Milwaukee, WI
Posts: 1,068
Send a message via AIM to schweitn Send a message via Yahoo to schweitn
Quote:
Originally posted by RussGarrett
Ain't it typical... got it working now . Moved api->core_addCallback from the constructor to onCreate() and now it works. Makes sense now I think about it.. . Thanks everyone.
It probably works in the constructor for me since the class that I have receiving the callback is not the main WAC class... its instead a child window... Just thought I'd mention so that you know that ANY class can receive those callbacks, not just the WACclient derived class.

Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.
- Albert Einstein

Winamp 3 Projects | Winamp 2x Plugin Manager | Explorer Playlist | FileSystem Object | Shoutcast List | Sashimi
schweitn is offline  
Old 18th February 2002, 13:21   #10
Russ
Mostly Harmless
(Alumni)
 
Join Date: Jan 2001
Location: UK
Posts: 2,319
Eek... ran into another problem which I thought would be easy... How the hell do I get info on the currently playing file? Do I have to use this metadb stuff (if so, how? ).

For long you live and high you fly, but only if you ride the tide, and balanced on the biggest wave you race towards an early grave.
|Musicbrainz|Audioscrobbler|last.fm|
Russ is offline  
Old 18th February 2002, 14:20   #11
schweitn
Winamp3 Component Guuuru
Beta Team
 
schweitn's Avatar
 
Join Date: Dec 2000
Location: Milwaukee, WI
Posts: 1,068
Send a message via AIM to schweitn Send a message via Yahoo to schweitn
Thats pretty much the ONLY thing you can do right now involving song info since you can't traverse the playlist with the current SDK... try this:

api->core_getCurrent( ... )

This returns a const char* which has the playstring that can then be passed into the metadb.. I think.

Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.
- Albert Einstein

Winamp 3 Projects | Winamp 2x Plugin Manager | Explorer Playlist | FileSystem Object | Shoutcast List | Sashimi
schweitn is offline  
Old 18th February 2002, 14:33   #12
Russ
Mostly Harmless
(Alumni)
 
Join Date: Jan 2001
Location: UK
Posts: 2,319
Ah, great - I'll have a play

For long you live and high you fly, but only if you ride the tide, and balanced on the biggest wave you race towards an early grave.
|Musicbrainz|Audioscrobbler|last.fm|
Russ is offline  
Old 18th February 2002, 17:05   #13
Russ
Mostly Harmless
(Alumni)
 
Join Date: Jan 2001
Location: UK
Posts: 2,319
Hmmm... the metadb functions are in dire need of documentation... Could someone show me how to get the ID3 info from the playstring?

For long you live and high you fly, but only if you ride the tide, and balanced on the biggest wave you race towards an early grave.
|Musicbrainz|Audioscrobbler|last.fm|
Russ is offline  
Old 18th February 2002, 17:49   #14
schweitn
Winamp3 Component Guuuru
Beta Team
 
schweitn's Avatar
 
Join Date: Dec 2000
Location: Milwaukee, WI
Posts: 1,068
Send a message via AIM to schweitn Send a message via Yahoo to schweitn
Haven't messed around with this really... but I'll give you a few places to start...

Look in common\metatags.h to see the supported tags and their constants...

Then look at these functions in api:

int metadb_getMetaData(const char *playstring, const char *name,
char *data, int data_len, int data_type=0);

int metadb_getMetaDataType(const char *name);

The rest you should try figuring out.

Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.
- Albert Einstein

Winamp 3 Projects | Winamp 2x Plugin Manager | Explorer Playlist | FileSystem Object | Shoutcast List | Sashimi
schweitn is offline  
Old 19th February 2002, 13:22   #15
Russ
Mostly Harmless
(Alumni)
 
Join Date: Jan 2001
Location: UK
Posts: 2,319
Aaaaaaand it works (in the end) - I'll probably post it with the code in another thread as an example of a general plugin, so people can see how it all goes together

For long you live and high you fly, but only if you ride the tide, and balanced on the biggest wave you race towards an early grave.
|Musicbrainz|Audioscrobbler|last.fm|
Russ is offline  
Old 31st March 2002, 07:55   #16
wa21guy
Member
 
Join Date: Nov 2000
Location: Seattle, WA USA area
Posts: 87
Send a message via AIM to wa21guy Send a message via Yahoo to wa21guy
Is it possible to have callbacks for song changes in Winamp 2.x? Also, if it is, can someone please port some code over to Visual Basic 6 for me? I need it bad cause I hate timers!

Ethan
wa21guy is offline  
Old 31st March 2002, 18:21   #17
schweitn
Winamp3 Component Guuuru
Beta Team
 
schweitn's Avatar
 
Join Date: Dec 2000
Location: Milwaukee, WI
Posts: 1,068
Send a message via AIM to schweitn Send a message via Yahoo to schweitn
Quote:
Originally posted by wa21guy
Is it possible to have callbacks for song changes in Winamp 2.x? Also, if it is, can someone please port some code over to Visual Basic 6 for me? I need it bad cause I hate timers!

Ethan
This is not about Winamp 2x, this is for Winamp 3x. Also, coding WACs can only be done in C++, not VB.

Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.
- Albert Einstein

Winamp 3 Projects | Winamp 2x Plugin Manager | Explorer Playlist | FileSystem Object | Shoutcast List | Sashimi
schweitn is offline  
 
Go Back   Winamp & Shoutcast Forums > Winamp3 > Wasabi 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