Working with Sunvox DLL

Pixilang programming language
Post Reply
User avatar
brickbeard
Posts: 6
Joined: Fri Dec 11, 2015 6:11 am

Working with Sunvox DLL

Post by brickbeard »

Привет
I made the best song of my life ever, and I want to make a video for it in PIxilang.

When calling the Sunvox DLL function sv_get_pattern_data in Pixilang, what kind of information will I get back? I have tried the function to read the notes in a specific pattern, but I received unexpected results for instance, when I call:

Code: Select all

$rawSvNote = $patternData[$line * $patternTracks + 0]
      printf("\n\t\trawnotetype(%%d): %d", get_type($rawSvNote))
      printf("\n\t\trawnotesize: %d", get_size($rawSvNote))
      printf("\n\t\trawnoteesize: %d", get_esize($rawSvNote))
      printf("\n\t\trawnotexsize: %d", get_xsize($rawSvNote))
      printf("\n\t\trawnoteysize: %d", get_ysize($rawSvNote))
 
I receive:

Code: Select all

		rawnotetype(%d): 2
		rawnotesize: 914400
		rawnoteesize: 4
		rawnotexsize: 1270
		rawnoteysize: 720
My question is how do I translate this into the NNVVMMCCEEXXYY format? It seems like a lot more data than I expect.

Thanks for any help you can provide.
User avatar
NightRadio
Site Admin
Posts: 3941
Joined: Fri Jan 23, 2004 12:28 am
Location: Ekaterinburg. Russia
Contact:

Re: Working with Sunvox DLL

Post by NightRadio »

Hi!

Please try this way:

Code: Select all

pat = dlcall( svl, sv_get_pattern_data, 0, pattern_number )
pat_xsize = dlcall( svl, sv_get_pattern_tracks, 0, pattern_number )
pat_ysize = dlcall( svl, sv_get_pattern_lines, 0, pattern_number )
nn = pat[ ( line * pat_xsize + track ) * 8 ]
vv = pat[ ( line * pat_xsize + track ) * 8 + 1 ]
mm = pat[ ( line * pat_xsize + track ) * 8 + 2 ]
cc = pat[ ( line * pat_xsize + track ) * 8 + 4 ]
ee = pat[ ( line * pat_xsize + track ) * 8 + 5 ]
xx = pat[ ( line * pat_xsize + track ) * 8 + 6 ]
yy = pat[ ( line * pat_xsize + track ) * 8 + 7 ]
User avatar
brickbeard
Posts: 6
Joined: Fri Dec 11, 2015 6:11 am

Re: Working with Sunvox DLL

Post by brickbeard »

I had to make a small change and switch the addends for EE & CC and XX & YY as follows:

Code: Select all

cc = pat[ ( line * pat_xsize + track ) * 8 + 5 ]
ee = pat[ ( line * pat_xsize + track ) * 8 + 4 ]
xx = pat[ ( line * pat_xsize + track ) * 8 + 7 ]
yy = pat[ ( line * pat_xsize + track ) * 8 + 6 ]
Perhaps I am making mistakes in some other regard, but it seems to work. :D Спасйбо за пóмощь
User avatar
NightRadio
Site Admin
Posts: 3941
Joined: Fri Jan 23, 2004 12:28 am
Location: Ekaterinburg. Russia
Contact:

Re: Working with Sunvox DLL

Post by NightRadio »

You are right :) It was my mistake
User avatar
brickbeard
Posts: 6
Joined: Fri Dec 11, 2015 6:11 am

Re: Working with Sunvox DLL

Post by brickbeard »

Here is the result (7 minutes)
https://www.youtube.com/watch?v=UYfV2Ig ... e=youtu.be


In my Sunvox song, I made one pattern the length of the entire song so that I could identify which one it was and use it to tell where to change the image in the video. Is there a way to find out the name of a Sunvox pattern from pixilang?
User avatar
NightRadio
Site Admin
Posts: 3941
Joined: Fri Jan 23, 2004 12:28 am
Location: Ekaterinburg. Russia
Contact:

Re: Working with Sunvox DLL

Post by NightRadio »

Great! :)
Is there a way to find out the name of a Sunvox pattern from pixilang?
Not yet. I will implement it in future DLL updates
User avatar
DigitalNematode
Posts: 55
Joined: Thu Dec 17, 2015 10:06 am
Location: Chicago

Re: Working with Sunvox DLL

Post by DigitalNematode »

:shock: This is very helpful. I'm deathly alergic to asking questions. ;) Thank you
Post Reply