Old 7th July 2006, 23:09   #1
jamba
Junior Member
 
Join Date: Apr 2006
Location: Austria
Posts: 3
Winamp C# SDK

hi

today I found a winamp c# SDK at this location: http://sourceforge.net/projects/cswinampsdk.

I am a C# programmer and not very talented in writing c++ code. That's why I wanted to ask if anyone has used this SDK before, and how youre experiences where.

And if not, maybe someone has any other good links concerning C# programming in relation to winamp plugin development.

Thanks

Klaus
jamba is offline   Reply With Quote
Old 18th August 2007, 04:11   #2
James420
Junior Member
 
Join Date: May 2006
Posts: 6
Is there any chance of us getting the link...?
James420 is offline   Reply With Quote
Old 18th August 2007, 14:02   #3
CraigF
Passionately Apathetic
Administrator
 
CraigF's Avatar
 
Join Date: May 2000
Location: Hell
Posts: 5,436
http://sourceforge.net/projects/cswinampsdk

CraigF is offline   Reply With Quote
Old 19th August 2007, 04:36   #4
James420
Junior Member
 
Join Date: May 2006
Posts: 6
Thanks, there is there no support on it? Seems that it's kinda been abandoned.
James420 is offline   Reply With Quote
Old 19th August 2007, 19:42   #5
DrO
 
Join Date: Sep 2003
Posts: 27,880
it's down to author of that version to maintain it's update or for others linked to that project to do so since nullsoft only support the c/c++ one that they offer (as sparse as it is)

-daz
DrO is offline   Reply With Quote
Old 18th February 2011, 02:05   #6
MagusBR
Junior Member
 
Join Date: May 2008
Posts: 19
unmanaged C#

Some years later...

I found out a way to build unmanaged C# dll's.
I did try some basic gen plugin, but only got winamp crashs... well, at least winamp is seens to load it in some way

There is how "magic" works: C# Project Template for Unmanaged Exports (the template download link is at the bottom of the page)

It will be interesting if someone could provide some C# plugin example

Thanks all,
Willian
MagusBR is offline   Reply With Quote
Old 22nd February 2011, 12:38   #7
Tsuyo
Junior Member
 
Join Date: Dec 2009
Posts: 37
Writing an unmanaged C# Library would be harder than just writing a simple C++ DLL.
Tsuyo is offline   Reply With Quote
Old 13th March 2011, 10:32   #8
RobertGee
Junior Member
 
Join Date: Mar 2011
Posts: 3
Quote:
Originally Posted by Tsuyo View Post
Writing an unmanaged C# Library would be harder than just writing a simple C++ DLL.
Depends on what he wants to accomplish.
My guess is anything except very low-level stuff is going to be a lot easier done in C# than in C++.

@MagusBR
I am the author of the project template you linked to.
It would be much easier for us to help you if you gave us some infos what you were trying to run.
Particularly the methods you've written.
There are some rules as to how managed types are marshalled to unmanaged and back. But there aren't many rules and most of them are pretty straightforward.
So, if I'd knew the method you compiled and the assemblies you referenced, I'm pretty optimistic that I can get you where you want to go.

Cheers,
Robert
RobertGee is offline   Reply With Quote
Old 16th March 2011, 18:47   #9
RobertGee
Junior Member
 
Join Date: Mar 2011
Posts: 3
Oops, thought the last messages where from this year. o_O
RobertGee is offline   Reply With Quote
Old 9th April 2011, 23:16   #10
MagusBR
Junior Member
 
Join Date: May 2008
Posts: 19
Hello,

I didn't see your reply until now (thread subscription fail).

Currently I have an open-source plugin project named Lyrik (svn) written in Visual Basic 6, and I pretend to release next version (2.x) in C#.

Actually I can use managed C# to do this job, I just need a dll wrapper as I used in Lyrik 1.x versions (VB6 is managed only too), but then I'll loose certain functions, like the possibility of embedded window.

In Winamp SDK we can find some simple examples written in C++. I did try something using your Template for Unmanaged Exports Project, but the best I got was a winamp crash.
I really got lost with some differences, like how to handle hWnd in C#
I made some tests using Unmanaged Exports, generated simple dll and then used VB6 API calls to test it, all worked fine, I guess it's only a matter of time (and "time") to make it work.
All code I had try was only for testing purposes, and I lost it somewhere between format and raid problems... As soon as possible I'll code more, and I'll appreciate if you can help me out.

Thanks for the reply, and good luck with motorola & android, thank goodness I bought a LG one

See ya,
Willian
MagusBR is offline   Reply With Quote
Old 23rd May 2011, 03:07   #11
MagusBR
Junior Member
 
Join Date: May 2008
Posts: 19
first real try

Well, today I woke up in programming spirit
And try working winamp + C# using Unmanaged DLL.

It still doesn't work, but winamp is not crashing more and it did call for the 'winampGetGeneralPurposePlugin' function (used a debug file), but did not call the 'Init' function

I did try many 'winampGeneralPurposePlugin' structs, from IntPtr + manual Marshall.Alloc to MarshalAs property (current). None worked.

The code is avaiable here, I'm using VisualStudio2010 with framework4, and the debug file will be written in "C:\debug.log" (see line 286 in UnmanagedExports.cs).
I would be grateful if someone could help me in that

Thanks,


P.s: I couldn't find a better expression for 'acordar inspirado' (pt-br).
MagusBR is offline   Reply With Quote
Old 23rd May 2011, 05:38   #12
RobertGee
Junior Member
 
Join Date: Mar 2011
Posts: 3
Hi Willian,
I'll have a look at it. One thing I noticed right away is that you let the CLR marshal struct fields as function pointers. But you didn't tell it which callingconvention to use.
Could be that stdcall is the default one, not sure right now, though.
You can provide the callingconvention directly onto the delegate declaration.
Just decorate it with [UmanagedFunctionPointer(CallingConvention.Stdcall)] (or whatever convention is required.)

will come back to you when I've setup a Windows VM, which I had to do anyways,
Robert
RobertGee is offline   Reply With Quote
Old 23rd May 2011, 06:47   #13
MagusBR
Junior Member
 
Join Date: May 2008
Posts: 19
Hello Robert,

Thanks for the reply, tested UnmanagedFunctionPointer with all CallingConvention options, none worked =/

I'll try later this decoration plus Marshal.GetDelegateForFunctionPointer instead of MarshalAs(UnmanagedType.FunctionPtr). In theory both are the same, but C# is not always a exact science when unmanaged memory is in field

Thanks,

Ps: winamp 'auto-plays' when use 'CallingConvention.ThisCall' for main call (winampGetGeneralPurposePlugin), just weird
MagusBR is offline   Reply With Quote
Old 2nd March 2013, 15:06   #14
MagusBR
Junior Member
 
Join Date: May 2008
Posts: 19
After a while without touching the code, I did find some issues and try it one more time: success

Source-code: http://www.lyrikproject.net/misc/win...harp_r0002.zip
Visual Studio: 2012
Framework: 4.5
NuGet: Unmanaged Exports already included in source-code (https://nuget.org/packages/UnmanagedExports)
Plugin type: General purpose

The main class is the 'Plugin.cs', anything you want change may be done there.
MagusBR is offline   Reply With Quote
Old 1st April 2013, 17:31   #15
Cel123
Junior Member
 
Join Date: Sep 2006
Location: Tallinn, Estonia
Posts: 20
Wow, thanks MagusBR, this is awesome!!! I got your plugintest project to work from winamp in a matter of minutes The only thing i had to do was make sure to run visual studio as administrator as it otherwise failed to compile the project due to some access issue to the Windows 8 user appdata local temp folder..

It seems like a good idea to put your code into a public repository somewhere and let people contribute / grab the latest source code? What do you think?

Thanks again!
Cel123 is offline   Reply With Quote
Old 27th October 2013, 20:00   #16
mikenakis
Junior Member
 
Join Date: Oct 2013
Posts: 2
Thank you, winamp_csharp_r0002 works and it saved me quite some time.
mikenakis is offline   Reply With Quote
Old 4th March 2016, 15:16   #17
lookatmike
Junior Member
 
Join Date: Mar 2013
Posts: 2
@MagusBR

It looks like this link is dead -- do you happen to have that sample plugin still kicking around somewhere?
lookatmike 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