missing setters in libSunvox

Post Reply
maks
Posts: 43
Joined: Sat Mar 26, 2022 4:28 am

missing setters in libSunvox

Post by maks »

I'm getting a bit further along in my ML-2 project and I've noticed (dont why it took me so long) that while there are:

Code: Select all

sv_get_song_name()
sv_get_song_bpm()
sv_get_pattern_x()
sv_get_pattern_y()
there are no setters for any of these.
Also I can see there is sv_set_pattern_data() but there doesn't seem to be any way to create a new pattern and as above no way to position a pattern on the timeline?

@NightRadio I can see the sunvox_pattern struct in the pixilangs sunvox_engine.h so hopefully its not too much work to add these setters in the next version of Sunvox? as I think I'm quite stuck without being able to set BPM and create/position new patterns.
User avatar
Logickin λ
Posts: 165
Joined: Sat Sep 08, 2018 8:31 pm
Contact:

Re: missing setters in libSunvox

Post by Logickin λ »

Actually, I did also stuck with creating a pattern. Don't seem to see there is a function for that, but because my project has a fixed number and fixed size pattern, I can create a bunch of SunVox project and load them conditionally as a work around.

However, you can set BPM by using sv_send_event():
https://warmplace.ru/forum/viewtopic.php?p=21356#p21356

Meanwhile, since you have asked an question about the SunVox lib, I decided to ask another question in this post as well:

Is there a way to load a .sunvox file as a module or load a .sunvox project in a metamodule using the library?

I thought sv_load_module() might works, but it turns out that the function only supports sampler and .sunsynth.
Is there any work around for this?
maks
Posts: 43
Joined: Sat Mar 26, 2022 4:28 am

Re: missing setters in libSunvox

Post by maks »

Thanks for the tip about BPM setting!

Maybe I can return the favour and help regarding loading multiple sunvox projects or metamodules: I thought because

Code: Select all

int sv_load( int slot, const char* filename ) 
takes a slot parameter, you should be able to load multiple projects or metamodules into different slots?
maks
Posts: 43
Joined: Sat Mar 26, 2022 4:28 am

Re: missing setters in libSunvox

Post by maks »

But oh man, do I feel silly about the BPM setting as I literally posted replies on that thread earlier in the year! I better write it down in my notes this time so I don't forget again!

But now that I know about Sunvox and libSunvox @NightRadio your previous answer:
You can use sv_send_event():
set BPM: sv_send_event( slot, track_num, 0, 0, 0, 0x001F, BPM );
set TPL or BPM: sv_send_event( slot, track_num, 0, 0, 0, 0x000F, TPL_or_BPM );
Brings another question to mind, does that mean that each track can have its own BPM and/or TPL ? And does that mean there is no project-wide BPM or is that doing a sv_send_event applies to the whole project and not the specified track?

On the topic of creating and editing the position of Patterns, I think I am a bit stuck on my project without that functionality unless I'm missing something I don't think sv_send_event() can be used for that as I dont see any pattern effects that do that the way BPM is listed under pattern effects in the manual: https://warmplace.ru/soft/sunvox/manual.php#patfx
User avatar
Logickin λ
Posts: 165
Joined: Sat Sep 08, 2018 8:31 pm
Contact:

Re: missing setters in libSunvox

Post by Logickin λ »

maks wrote: Wed Nov 09, 2022 3:57 am

Code: Select all

int sv_load( int slot, const char* filename ) 
I am actually aware of this function and I did open a few instances of SunVox in my coding project; sadly, this function behaves like you have opened a few windows of SunVox and load project independently, but the project I am working on generated two SunVox Projects, which one of the SunVox project is located inside another SunVox project as a core logic, and I will export the combined project as a sunsynth.

This was the original plan because I wanted to use the library to design metamodules instead of routing them one by one manually, but a few functions are missing to fully automate the process:

- load projects in metamodules in a project
- set target controller in multictl
- determine the type of a module
- set and define metamodule controllers

I wish these functions will be included for the future version of SunVoxLib, so we can design meta modules or SunVox template dynamically just with a few line of codes.
Last edited by Logickin λ on Fri Nov 11, 2022 7:22 pm, edited 1 time in total.
maks
Posts: 43
Joined: Sat Mar 26, 2022 4:28 am

Re: missing setters in libSunvox

Post by maks »

Ah yes sorry I didn't realise that's how they worked as I haven't had a chance to try using more than 1 module in my libsunvox project so far.

Hopefully more support for handling metamodules in libsunvox will be added.

For my problem with lack of support for modifying Patterns with libsunvox, I think I've now figured out a hacky workaround by tracking "patterns" in my own code and then just combining them all into a single Sunvox pattern because it seems that a single pattern can have a very large number of lines and a max of 32 tracks, which should work for me for now, but @NightRadio it would be great if the functions to add patterns and change thier placement on the timeline could be added to libsunvox.
Post Reply