monome / crow

Crow speaks and listens and remembers bits of text. A scriptable USB-CV-II machine
GNU General Public License v3.0
166 stars 34 forks source link

`to(v,t,'log')` interpreted as `to(v,t,'linear')` #428

Closed beels closed 3 years ago

beels commented 3 years ago

Effectively, "logarithmic" shapes seem to always decay to "linear" in the current version.

The issue seems to be in casl.c:240, where the char * argument to S_str_to_shape is extracted as a char on the stack. S_str_to_shape expects a C-string and relies on the value of the second character in that string to distinguish between the logarithmic and linear cases.

I don't know the lua API, so can't submit a pull request, but it looks like this could be fixed with something on the order of:

        case LUA_TSTRING:{
            char s[2];
            s[0] = ix_char(L, ix);
            s[1] = ix_char(L, ix + 1);
            e->obj.shape = S_str_to_shape( s );
            e->type = ElemT_Shape;
            break;}
trentgill commented 3 years ago

@beels wow thanks for digging all the way in and finding this! i'll get a fix pushed soon.