LibSunVox?

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

Re: LibSunVox?

Post by Rado1 » Thu Aug 30, 2012 4:00 pm

NightRadio wrote:Is there some ZGE option to switch between different calling conventions for DLL? For example: stdcall, cdecl. ... 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.
Even if ZGE allows to specify either stdcall or cdecl calling convention, it is not able to find exported functions with @ in DLL. So unfortunately your suggestion does not work. I would really appreciate if you could add the set of functions with normal names to the DLL as you wrote.
I'm afraid it is not possible. XM/IT/MOD are sample-based formats, and they have some pattern limitations.
I see. Some naive ideas: cannot be, for instance, the SV modules (instruments modified by effects) "rendered" to samples and then used in patterns at the export time? If there are some pattern limitations, the export could be at least partial.

Anyway, what about to add .mod/.xm file importing directly to the SV's Export/Import menu? It would be much convenient than calling external mod2sunvox.exe.

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

Re: LibSunVox?

Post by NightRadio » Thu Aug 30, 2012 9:26 pm

Ok. Please try this version: http://www.warmplace.ru/soft/beta/sunvox_dll_win32.zip
SV modules (instruments modified by effects) "rendered" to samples and then used in patterns at the export time?
It is possible. But the resulted file will take 100mb or so :)
Anyway, what about to add .mod/.xm file importing directly to the SV's Export/Import menu? It would be much convenient than calling external mod2sunvox.exe.
I hope to implement this in one of the next SunVox updates.

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

Re: LibSunVox?

Post by Rado1 » Thu Aug 30, 2012 11:29 pm

NightRadio wrote:Ok. Please try this version: http://www.warmplace.ru/soft/beta/sunvox_dll_win32.zip
Great, great, great! It works perfectly. I tested just the basic functionality, now is time for more experiments. Thank you!

Looking forward to the Android version...

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

Re: LibSunVox?

Post by Rado1 » Fri Aug 31, 2012 1:53 pm

NightRadio - the SV library is pretty simple and straightforward to use, however, I have several questions regarding to some functions. Could you please explain the semantics of the following functions and their parameters? Thank you in advance.
  • int sv_get_sample_type() - What sample is meant here? Sampling of the whole song?
  • int sv_set_autostop(int slot, int autostop) - What does this function do? What is the meaning and possible values of the autostop parameter?
  • int sv_end_of_song(int slot) - What does this function do?
  • unsigned int sv_get_song_length_frames(int slot) - What is meant by frames here?
  • unsigned int sv_get_ticks() - What's the returned value?
  • unsigned int sv_get_ticks_per_second() - What's the returned value?

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

Re: LibSunVox?

Post by NightRadio » Fri Aug 31, 2012 6:57 pm

int sv_get_sample_type() - What sample is meant here? Sampling of the whole song?
sv_get_sample_type() - get internal sample type of the SunVox engine.
Return value: one of the SV_STYPE_xxx defines.
Use it to get the scope buffer type from get_module_scope() function.

int sv_set_autostop(int slot, int autostop) - What does this function do? What is the meaning and possible values of the autostop parameter?
autostop values: 0 - disable autostop; 1 - enable autostop.
When disabled, song is playing infinitely in the loop.

int sv_end_of_song(int slot) - What does this function do?
Return values: 0 - song is playing now; 1 - stopped.

unsigned int sv_get_song_length_frames(int slot) - What is meant by frames here?
Frame is one discrete of the sound. Sampling frequency 44100 Hz means, that you hear 44100 frames per second.

unsigned int sv_get_ticks() - What's the returned value?
SunVox engine uses its own time space, measured in ticks.
Use sv_get_ticks() to get current tick counter (from 0 to 0xFFFFFFFF).
Use sv_get_ticks_per_second() to get the number of SunVox ticks per second.

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

Re: LibSunVox?

Post by Rado1 » Fri Aug 31, 2012 8:27 pm

Thank you NightRadio for prompt reply with explanation. What's the license of the SunVox Dynamic Library? Can I use it freely?

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

Re: LibSunVox?

Post by NightRadio » Fri Aug 31, 2012 10:50 pm

Yes, you can use it freely. Only one requirement - mention about sunvox library somewhere in app description / about window.

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

Re: LibSunVox?

Post by Rado1 » Sat Sep 01, 2012 1:33 am

Great! Thanks.

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

Re: LibSunVox?

Post by Rado1 » Sun Sep 09, 2012 1:59 pm

1. What is the meaning of the SV_INIT_FLAG_ONE_THREAD flag, how to use it?

2. Why the module number in calling the sv_send_event() function is one number higher than in the original .sunvox file?

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

Re: LibSunVox?

Post by Darkhog » Mon Sep 10, 2012 12:56 am

NR, ZGE is written in Pascal, so I think you would need to provide Pascal Unit header for sunvox library. Tried using h2pas, but it didn't work well (lines that caused troubles are 62-96). Then sunvox support would be able to be included into ZGE codebase, as sources are publicly available (heck, even I could do it).

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

Re: LibSunVox?

Post by Rado1 » Mon Sep 10, 2012 3:55 pm

Preferred way of using SunVox Library in ZGE is by calling an external library, without changing the source code. It is, therefore, sufficient (and very convenient) just to create a simple dll adapter in the form of ZGE ZExternalLibrary component; this component uses a built-in mechanism of calling external dlls (Windows) and so (Android) libraries. See this thread http://www.emix8.org/forum/viewtopic.php?t=911 from ZGE forum for details and examples.

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

Re: LibSunVox?

Post by Darkhog » Tue Sep 11, 2012 7:49 am

Still, it'd be nice to have Pascal headers around, when you would want to use sunvox music in game written in Delphi or Lazarus/freepascal.

Also how about pushing SunVox support to libModPlug?

ajhager

Re: LibSunVox?

Post by ajhager » Wed Oct 17, 2012 11:21 pm

Will there be 64bit dlls for Windows at any point? I have created bindings for the go programming language, and I would like to be able to ship 64bit versions of my games.

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

Re: LibSunVox?

Post by NightRadio » Thu Oct 18, 2012 10:06 pm

Will there be 64bit dlls for Windows at any point?
Of course. But i can't say more right now. May be in one of the next updates.

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

Re: LibSunVox?

Post by Rado1 » Tue Oct 30, 2012 8:10 pm

Hi NightRadio,

any news or plans regarding to porting the SunVox library to Android?

Rado1.

Post Reply