Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only include su_delay_times into source when a delay unit is present. #139

Closed
wants to merge 1 commit into from

Conversation

LeStahL
Copy link
Contributor

@LeStahL LeStahL commented Aug 14, 2024

No description provided.

@vsariola
Copy link
Owner

Did see this actually happening? Because I thought this line:

{{- if gt (.DelayTimes | len ) 0}}

would already make sure that it does not get included if there is no delay units, as I thought DelayTimes would be empty then?

@vsariola
Copy link
Owner

vsariola commented Aug 14, 2024

Let me guess what might be happening: the delay times get added to the delay table even when the unit disabled? There definitely is an oversight in this: I checked the code and I noticed the delaytime table construction does not care about the new "disabled" flag.

I think a more future proof approach would be to make a copy of the patch before compiling and just filter out all the disabled units, so when compiling, we can just assume all units are enabled. This way disabled units cannot have any effect on the resulting synth.

@LeStahL
Copy link
Contributor Author

LeStahL commented Aug 14, 2024

yes, this happened in a track with commented delay ops -

990,996d952
< ;-------------------------------------------------------------------------------
< ;    Delay times
< ;-------------------------------------------------------------------------------
< section .data.su_delay_times progbits alloc noexec write align=1
< su_delay_times:
<     dw 1116,1188,1276,1356,1422,1492,1556,1618,33075,689
< 

can try and reproduce with minimal example after evoke (we're some bytes short) tho if you think that we should rather tackle the underlying problem with the other if not being false while it should :)

@vsariola
Copy link
Owner

The issue starts from here:

func NewBytecode(patch sointu.Patch, featureSet FeatureSet, bpm int) (*Bytecode, error) {

func newBytecodeBuilder(patch sointu.Patch, bpm int) *bytecodeBuilder {

delayTimesInt, delayIndices := constructDelayTimeTable(patch, bpm)

func constructDelayTimeTable(patch sointu.Patch, bpm int) ([]int, [][]int) {

https://github.com/vsariola/sointu/blob/2667c3c72c95f7b91669d97d1435a1814cb97c01/vm/delaytable.go#L120C16-L120C17

Long story short: I think the "constructDelayTimeTable" does not check if your delay unit is disabled. It's a bug (or uh... feature). Is this your issue?

As an immediate quick fix, just delete the disabled delay unit(s) :)

@LeStahL
Copy link
Contributor Author

LeStahL commented Aug 14, 2024

Double-checked: Yes, this is exactly the code path that breaks, and removing the commented ops resolves it.

@vsariola
Copy link
Owner

Or, rather the proper "quick fix" for now, if you are can compile Sointu, is

if unit.Type == "delay" && !unit.Disabled {

On line 120 of delaytable.go

@vsariola
Copy link
Owner

What the hell I faster push that master than typing here :D Just a sec.

@LeStahL
Copy link
Contributor Author

LeStahL commented Aug 14, 2024

Thanks a lot! -- I assume we should close this PR, as it does not fix the issue but rather hides it.

@vsariola vsariola closed this in 75bd9c5 Aug 14, 2024
@vsariola
Copy link
Owner

vsariola commented Aug 14, 2024

Fixed. Binaries should be soon available from Github Actions, as always.

@vsariola vsariola reopened this Aug 14, 2024
@vsariola vsariola closed this Aug 14, 2024
@vsariola
Copy link
Owner

I thought of reopening this pull request, but I think I'll open a new issue instead: write unit tests for the disabled flag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants