LibSunVox?

Darkhog
Posts: 245
Joined: Wed Apr 06, 2011 11:03 pm

LibSunVox?

Post by Darkhog » Thu Jul 21, 2011 3:28 pm

Since SV modules can be very small, smaller than any .xm/.it/.mod, I wonder if it'd possible (=NR want to do this) make sunvox player library for games/music players/etc. The api would be similar to api of bass.dll.

Could someone do such thing? I know that sources of sunvox player floates somewhere, but I am unable to code it myself.

User avatar
NightRadio
Site Admin
Posts: 3008
Joined: Fri Jan 23, 2004 12:28 am
Location: Ekaterinburg. Russia
Contact:

Re: LibSunVox?

Post by NightRadio » Thu Jul 21, 2011 4:31 pm

I have such DLL :) But it is only for Win32, Linux and OSX.
I can put it on site, if you need.

Darkhog
Posts: 245
Joined: Wed Apr 06, 2011 11:03 pm

Re: LibSunVox?

Post by Darkhog » Fri Jul 22, 2011 2:06 am

Since Windows, Linux and OSX are 3 main desktop OSes, it's ok with me. Also if you could make c# wrappers it'd be good since I have friend who need small, but good module format for MMO game (tried used SID, but fortunately I got him not to use it) and his game is in C#. Of course since SunVox can produce such wonderful music maintaining file size under 100kb (more only if you use lot of samples it'd be great for his purposes) it'd be wonderful.

Of course API reference and headers is also needed, but I think, I don't have to tell you about it as you're programmer yourself.

User avatar
NightRadio
Site Admin
Posts: 3008
Joined: Fri Jan 23, 2004 12:28 am
Location: Ekaterinburg. Russia
Contact:

Re: LibSunVox?

Post by NightRadio » Tue Jul 26, 2011 7:16 am

Sorry for delay with answer. I will provide this library soon :)

User avatar
NightRadio
Site Admin
Posts: 3008
Joined: Fri Jan 23, 2004 12:28 am
Location: Ekaterinburg. Russia
Contact:

Re: LibSunVox?

Post by NightRadio » Tue Aug 23, 2011 8:46 pm

ok. Here is the first version of such library:
http://www.warmplace.ru/soft/sunvox/sunvox_dll.zip
.so for Linux
.dll for Win32
.dylib for OSX

kmatze
Posts: 47
Joined: Wed Jun 22, 2011 12:36 am

Re: LibSunVox?

Post by kmatze » Wed Aug 24, 2011 10:55 pm

hi, thats very funny:
NightRadio wrote:ok. Here is the first version of such library:
http://www.warmplace.ru/soft/sunvox/sunvox_dll.zip
i try to write an extension / wrapper to use the lib in tcl/tk (under windows). To play and stop a file.sunvox is ready, but the function rewind will not go:

sv_rewind( 0, 0 ); the first parameter ist the slot, the second is ?

i thought, that a sv_stop (0) stoped the play command and the sv_rewind wants to go on play?

thanks and greetings - kmatze

User avatar
NightRadio
Site Admin
Posts: 3008
Joined: Fri Jan 23, 2004 12:28 am
Location: Ekaterinburg. Russia
Contact:

Re: LibSunVox?

Post by NightRadio » Wed Aug 24, 2011 11:36 pm

sv_rewind( int slot, int t )
where slot - is the slot number :) 0 in most cases
and t - line number.

For example
sv_rewind( 0, 8 )
will rewind the song to line 8

kmatze
Posts: 47
Joined: Wed Jun 22, 2011 12:36 am

Re: LibSunVox?

Post by kmatze » Thu Aug 25, 2011 10:26 am

hello,
thanks for your fast answer
NightRadio wrote:sv_rewind( int slot, int t )
where slot - is the slot number :) 0 in most cases
and t - line number.

For example
sv_rewind( 0, 8 )
will rewind the song to line 8
I want to use the functions of the transport buttons
play: sv_play, works
stop: sv_stop, works
pause: ?
resume:?
rewind: sv_rewind, i will test, i understand is a repeat from 0 to t (line number)

thanks and greeting - kmatze

User avatar
NightRadio
Site Admin
Posts: 3008
Joined: Fri Jan 23, 2004 12:28 am
Location: Ekaterinburg. Russia
Contact:

Re: LibSunVox?

Post by NightRadio » Thu Aug 25, 2011 11:44 am

pause: sv_stop
resume: sv_play
Hard audio slot pause will be implemented in the next version, i think :)

kmatze
Posts: 47
Joined: Wed Jun 22, 2011 12:36 am

Re: LibSunVox?

Post by kmatze » Thu Aug 25, 2011 6:39 pm

Hello,
NightRadio wrote:pause: sv_stop
resume: sv_play
Hard audio slot pause will be implemented in the next version, i think :)
it works fine, thanks - kmatze

Darkhog
Posts: 245
Joined: Wed Apr 06, 2011 11:03 pm

Re: LibSunVox?

Post by Darkhog » Sat Aug 27, 2011 12:09 am

I'd appreciate if someone would write Qmmp or Audacious (both are nice Linux equivalents of winamp) plugins.

//edit: Also could you make C# bindings, so my friend, Exe could use sunvox music in his game called Manic Digger?

kmatze
Posts: 47
Joined: Wed Jun 22, 2011 12:36 am

Re: LibSunVox?

Post by kmatze » Sat Aug 27, 2011 3:06 am

hello "NightRadio"
NightRadio wrote:ok. Here is the first version of such library:
http://www.warmplace.ru/soft/sunvox/sunvox_dll.zip
.so for Linux
.dll for Win32
.dylib for OSX
I try to wrote a tcl/tk frontend with an extension / wrapper to your sunvox.dll. Play, stop, "resume" (=play after stop) works fine.
Is it possible to read general information about the song file, e. g. time length or lines, tempo (bps), how many modules and there names etc.
And is it possible to play from an adressed line?
The play function repeats the play of file.sunvox at the end, is it so right, no automaticaly stop?

Thanks and greetings - kmatze

User avatar
NightRadio
Site Admin
Posts: 3008
Joined: Fri Jan 23, 2004 12:28 am
Location: Ekaterinburg. Russia
Contact:

Re: LibSunVox?

Post by NightRadio » Sat Aug 27, 2011 9:21 am

And is it possible to play from an adressed line?
sv_rewind( slot, line_number )
no automaticaly stop?
Not yet, sorry :)
Another features will be available in the next version of library.

User avatar
Rado1
Posts: 12
Joined: Wed Aug 29, 2012 1:38 pm

Re: LibSunVox?

Post by Rado1 » Wed Aug 29, 2012 5:31 pm

Hi NightRadio,

I would like to use SV music in my games and demos created in ZGameEditor (ZGE). SunVox is a really nice tool, easy to learn and use, effective, and producing small files. Ideal for creating music for my projects.

ZGE supports loading and usage of external libraries (.dll on Windows and .so on Android), therefore, sunvox.dll would be a natural solution. However, the problem is that the library exports functions with names that do not adhere to the naming syntax of ZGE, for instance, sv_init@16, sv_open_slot@4, sv_load@8, etc., and these functions cannot be called from ZGE code. '@' is the problem. If the dll is used in C code, you initially call the sv_load_dll() function which initializes pointers to these exported functions with "normal" names used then in application code. The problem is that ZGE cannot call sv_load_dll().

My requests:
- It would really help if the sunvox.dll itself exported functions having usual names, such as sv_init, sv_open_slot, sv_load, etc. Would it be possible to create such a version of your dll? (This "name-mangling" can be solved easily, see e.g. this.) Of course I could write a simple facade/wrapper dll, but this would be not so nice, because two dlls should be distributed with one ZGE application/file in this case. A partial help for writing such a wrapper would be to provide also precompiled .lib file for the SV library.

- Next request is about compiling the SV library for Android ARM platform (armeabi) in the form of .so file. Do you plan to provide it as well in future?

- OPTIONAL: Since ZGE produces pretty small executables, .sunvox files are also small, would not be possible also to reduce the size of the sunvox.dll? For instance, bass.dll is about 97KB. (I guess that probably not, because it probably contains the code of all modules, etc.) But would be nice if some size optimizations are made.

My last question is about the SunVox itself, not the library (you were asked it probably many times before): do you plan to provide also export to any of the .xm, .it, .mod, or .s3m formats? This would highly improve interoperability with other tools and therefore also applicability of SunVox.

User avatar
NightRadio
Site Admin
Posts: 3008
Joined: Fri Jan 23, 2004 12:28 am
Location: Ekaterinburg. Russia
Contact:

Re: LibSunVox?

Post by NightRadio » Thu Aug 30, 2012 9:40 am

Hello!

Is there some ZGE option to switch between different calling conventions for DLL? For example: stdcall, cdecl.
@16, @4 - it is not my idea :) C++ compiler makes these names, because it is the name-decoration convention for STDCALL functions from Microsoft: http://msdn.microsoft.com/en-us/library ... s.71).aspx
Theoretically, ZGE must add these symbols by himself. You tell him: call stdcall function sv_init(). And ZGE makes a call to sv_init@16
If not - i will try to add the set of functions with normal names to DLL.
Next request is about compiling the SV library for Android ARM platform (armeabi) in the form of .so file. Do you plan to provide it as well in future?
Yes, it is in my plans :)
would not be possible also to reduce the size of the sunvox.dll? For instance, bass.dll is about 97KB
It is already size-optimized :) I use -Os key for compilation.
do you plan to provide also export to any of the .xm, .it, .mod, or .s3m formats?
I'm afraid it is not possible. XM/IT/MOD are sample-based formats, and they have some pattern limitations.

Post Reply