Old 25th April 2007, 02:49   #1
bruno.m-a
Junior Member
 
Join Date: Apr 2007
Location: Montreal, Qc
Posts: 2
Winamp SDK + C#?

Hi all,

I am a to-be software engineer. I live in Montreal, Quebec and I study in École Polytechnique de Montréal.

I was wondering if there was a way to interface Winamp SDK with C#. I searched for a way to do so but didn't find any.

Thanks for the help,
Bruno M-A.
bruno.m-a is offline   Reply With Quote
Old 25th April 2007, 08:28   #2
DrO
 
Join Date: Sep 2003
Posts: 27,873
i've no idea how c# interacts with standard win32 apps. i believe there's been some libraries to allow for such languages to interact with winamp (unless it's only been for visual basic - just can't remember for certain at the moment)

it all comes down to what you're intending to do since for best support, you need to be working as a plugin though i don't know how well/easily c# will allow you to create a standard dll and run in the winamp as that (i know vb ones generally needed a c/c++ dll to act as a com bridge or something for them to then be able to be loaded in)

-daz
DrO is offline   Reply With Quote
Old 25th April 2007, 13:07   #3
bruno.m-a
Junior Member
 
Join Date: Apr 2007
Location: Montreal, Qc
Posts: 2
Well, C# would be able to use a C/C++ compiled DLL as a COM bridge for SURE. Is there any COM DLL available? Else, how do I compile my own making sure it is usable (like I would do for VB)?

And what i am intending to do is to retrieve, in C#, the full path to the currently playing file + updating it when a song changes (are there any events generated by Winamp when the playing song changes?)
bruno.m-a is offline   Reply With Quote
Old 25th April 2007, 17:49   #4
emilles
Member
 
Join Date: Mar 2006
Posts: 52
I have actually seen an open-source output plug-in that used primarily C#. It used C++ as bridge to Winamp's Win32 API. This C++ code should do the job, assuming your main C# object is named OutObject.

code:
// C# includes here

extern "C" {

// C includes here

...

int getwrittentime() {
OutObject __gc *outObject;
outObject = new OutObject;
return outObject->GetWrittenTime();
}

Out_Module out = {
OUT_VER,
"",
1,
0,
0,
config,
about,
init,
quit,
open,
close,
write,
canwrite,
isplaying,
pause,
setvolume,
setpan,
flush,
getwrittentime,
getwrittentime
};

__declspec(dllexport) Out_Module *winampGetOutModule() {
return &out;
}
}



It seems a little suspect that a new object is created for every call of the callback function, so I would investigate this mechanism more deeply before counting on it.

Remote Speakers Output Plug-In
Stream audio from Nullsoft Winamp to the Apple AirPort Express (aka AirTunes)
emilles is offline   Reply With Quote
Old 10th May 2007, 00:17   #5
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,185
The problem with .net plugins is that you can only have one version of the .net runtime in a single process (You are not supposed to write shell exstensions for explorer in .net for example) You could solve this by hosting the c# part in a host process and have a helper plugin written in native code, but its probably not that easy to do

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 15th May 2007, 19:06   #6
ChaosBlade
Senior Member
 
ChaosBlade's Avatar
 
Join Date: Nov 2003
Location: Israel
Posts: 115
Send a message via ICQ to ChaosBlade Send a message via AIM to ChaosBlade Send a message via Yahoo to ChaosBlade
Anyone found a solution to this?
I'm also trying to achieve the same thing, Where my goal is much simpler (only getting metadata for the currently playing track\general playlist details such as length). Is the best 'official' solution to use a native COM bridge DLL?

I'm pretty sure such a solution would work (the .NET assembly using the PInvoke platform to call whichever method defined in the COM DLL), But it is a rather ugly approach (if any of you also use foobar, you can look at the foobar COM server plugin and its C# COM client example).
ChaosBlade is offline   Reply With Quote
Old 15th May 2007, 19:28   #7
DrO
 
Join Date: Sep 2003
Posts: 27,873
have a look at the winampmagic code (that should bring up something in the search results) and would allow you to use the inprocess sendmessage apis to get the info you need from an external app. is worth a look, just not sure how well that'd fit your needs/how well the c# will work with it+winamp

-daz
DrO is offline   Reply With Quote
Old 16th May 2007, 05:59   #8
ChaosBlade
Senior Member
 
ChaosBlade's Avatar
 
Join Date: Nov 2003
Location: Israel
Posts: 115
Send a message via ICQ to ChaosBlade Send a message via AIM to ChaosBlade Send a message via Yahoo to ChaosBlade
I'll give it a look, Thanks. I'll be more than happy to post some sample code when i have it working and cleaned up

EDIT: Had a look at that, As well as ActiveWinamp. Is any of them still maintained? If anyone has any working sample in C#, I might be able to adapt that into an (at least partial) C# SDK port.
ChaosBlade is offline   Reply With Quote
Old 16th May 2007, 09:25   #9
DrO
 
Join Date: Sep 2003
Posts: 27,873
no idea on activewinamp, as for the winampmagic code, there's nothing really to maintain on the code as there's nothing else to really do with it. porting to c# should be pretty simple i'd have thought since it's plain OS api calls (unless c# makes that a pain to do - only do c/c++ here so haven't had to look at c# style coding)

-daz
DrO is offline   Reply With Quote
Old 16th May 2007, 11:38   #10
ChaosBlade
Senior Member
 
ChaosBlade's Avatar
 
Join Date: Nov 2003
Location: Israel
Posts: 115
Send a message via ICQ to ChaosBlade Send a message via AIM to ChaosBlade Send a message via Yahoo to ChaosBlade
The .NET platform has PInvoke, Which allows to call native API methods rather easilly.. The marshaling layer also makes .NET<->native type casting pretty easily.

I'll have a closer look at WinampMagic( or MagiC++ ? Not sure whats the difference, The latter seems like an updated version from what i get) and play around, I'll post sample results if i get it working stable enough.

Thanks for the help so far
ChaosBlade is offline   Reply With Quote
Old 16th May 2007, 11:45   #11
DrO
 
Join Date: Sep 2003
Posts: 27,873
the ++ version is just a c++ wrapped version if i remember correctly, otherwise it just works the same as the original code

-daz
DrO is offline   Reply With Quote
Old 17th May 2007, 19:05   #12
ChaosBlade
Senior Member
 
ChaosBlade's Avatar
 
Join Date: Nov 2003
Location: Israel
Posts: 115
Send a message via ICQ to ChaosBlade Send a message via AIM to ChaosBlade Send a message via Yahoo to ChaosBlade
Anyone has a copy of WinampMagiC++, By the way? The link in the thread is dead.
ChaosBlade is offline   Reply With Quote
Old 25th May 2007, 15:05   #13
Joel
Debian user
(Forum King)
 
Joel's Avatar
 
Join Date: Jan 2003
Location: Arch land
Posts: 4,917
Hi Chaos...

You send me an email, right? Sorry....I deleted for accident because it landed on my junke email

send me again, I'll send you a copy.


* PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux-i686 with MATE.
* Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Archlinux-x86-64 with MATE.
Joel is offline   Reply With Quote
Old 25th May 2007, 16:12   #14
ChaosBlade
Senior Member
 
ChaosBlade's Avatar
 
Join Date: Nov 2003
Location: Israel
Posts: 115
Send a message via ICQ to ChaosBlade Send a message via AIM to ChaosBlade Send a message via Yahoo to ChaosBlade
Sent. Thanks for the quick response
ChaosBlade is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast 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