Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   Wasabi Development (http://forums.winamp.com/forumdisplay.php?f=122)
-   -   MetaDB question (http://forums.winamp.com/showthread.php?t=89407)

Russ 30th May 2002 14:42

MetaDB question
 
Has anyone managed to get metadb_getMetaData to return anything sensible with numeric types such as MT_LENGTH, or is it just me? All I seem to be able to get is rubbish. Maybe it's just because I'm not a C++ programmer at heart but it seems a bit stupid returning a number using a char* type :p.

I'm 99% finished on a new Winamp3/mIRC plugin which works using the new mIRC SendMessage interface, and is hopefully more configurable than my previous one :D. I'd like to get track length and so implemented though.

Brennan 31st May 2002 06:55

It returns the number of milliseconds. So 10000 is ten seconds long. Also, it uses a char* interface along with a type parameter so one function can access any kind of metadata.


--Brennan

Aus 3rd June 2002 17:29

since you know it's an int, you'd do something like this to make the return value what you need it to be:

int * len = (int *)metadb_getMetaData(...);

--aus

Brennan 3rd June 2002 20:06

No... no, you wouldn't. That's plain wrong. Ignore what he just said.

You would do:
int val=0;
api->metadb_getMetaData(playstring, MT_LENGTH, (char *)&val, sizeof(val), MDT_INT);


--Brennan

Aus 3rd June 2002 20:12

haha, that's horrible, i should look at the function prototype before answering next time.

=)

LENZ.NET 4th June 2002 02:25

That's cause Aus has overloaded the casting functions so it is ULTRA smart. ;) Maybe you should check with him first Brennan. ;)

Aus 4th June 2002 02:30

yes, and my iq has magically risen 20 points =)

Russ 4th June 2002 08:43

Ah that makes it a bit clearer... types in C++ confuuse me :p.


All times are GMT. The time now is 20:46.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.