Demonik
Demonik
CC#
Created by Demonik on 4/15/2024 in #help
Crossplatform VarArg PInvoke
this doesn't really translate to any language other than C and only works in C because of typechecking hacks used in macros
25 replies
CC#
Created by Demonik on 4/15/2024 in #help
Crossplatform VarArg PInvoke
this is just one function that does a lot of things depending on 2nd argument
25 replies
CC#
Created by Demonik on 4/15/2024 in #help
Crossplatform VarArg PInvoke
it's a shitty api design that clearly ignores that languages other than C exist
25 replies
CC#
Created by Demonik on 4/15/2024 in #help
Crossplatform VarArg PInvoke
there is no reason I see why it couldn't have been opus_encoder_set_vbr_constraint(encoder, arg)
25 replies
CC#
Created by Demonik on 4/15/2024 in #help
Crossplatform VarArg PInvoke
and it wlll call it like opus_encoder_ctl(encoder, 4020, arg)
25 replies
CC#
Created by Demonik on 4/15/2024 in #help
Crossplatform VarArg PInvoke
you're supposed to call it like opus_encoder_ctl(encoder, OPUS_SET_VBR_CONSTRAINT(arg))
25 replies
CC#
Created by Demonik on 4/15/2024 in #help
Crossplatform VarArg PInvoke
this is example of defines
#define OPUS_SET_VBR_CONSTRAINT_REQUEST 4020
#define OPUS_SET_VBR_CONSTRAINT(x) OPUS_SET_VBR_CONSTRAINT_REQUEST, __opus_check_int(x)
#define OPUS_SET_VBR_CONSTRAINT_REQUEST 4020
#define OPUS_SET_VBR_CONSTRAINT(x) OPUS_SET_VBR_CONSTRAINT_REQUEST, __opus_check_int(x)
25 replies
CC#
Created by Demonik on 4/15/2024 in #help
Crossplatform VarArg PInvoke
example of a function OPUS_EXPORT int opus_encoder_ctl(OpusEncoder *st, int request, ...) OPUS_ARG_NONNULL(1);
25 replies
CC#
Created by Demonik on 4/15/2024 in #help
Crossplatform VarArg PInvoke
yes but they were used as constants
25 replies
CC#
Created by Demonik on 4/15/2024 in #help
Crossplatform VarArg PInvoke
I mean if you look at docs they literally have names for the functions as #defines which are passed to the vararg as 2nd argument
25 replies
CC#
Created by Abaka on 4/15/2024 in #help
C# for Unity
also keep in mind, unity C# is dated so some of the newer stuff doesn't work in unity + it's using different runtime, so there are unity specific bugs/limitations
7 replies
CC#
Created by Demonik on 4/15/2024 in #help
Crossplatform VarArg PInvoke
the worst part is there doesn't seem to be any reason why it's exposed like that in public api, all it is is a function that receives request id and 1 or 2 arguments based on request, so it could've been just a bunch of 1 / 2 argment functions, yes it would've increased amount of functions exposed because there are like 7 of these _ctl functions and a lot of them share same requests, but still is shitty api design
25 replies
CC#
Created by Demonik on 4/15/2024 in #help
Crossplatform VarArg PInvoke
the library itself is pure C
25 replies
CC#
Created by Demonik on 4/15/2024 in #help
Crossplatform VarArg PInvoke
I'll just have to do it for all platforms
25 replies
CC#
Created by Demonik on 4/15/2024 in #help
Crossplatform VarArg PInvoke
I just added 1 and 2 arg variants to libopus and rebuilt it
25 replies
CC#
Created by Demonik on 4/15/2024 in #help
Crossplatform VarArg PInvoke
ty, I'll ask there
25 replies
CC#
Created by Demonik on 4/15/2024 in #help
Crossplatform VarArg PInvoke
and defining multiple functions also can't find any information on if it will work on all target platforms
25 replies
CC#
Created by Demonik on 4/15/2024 in #help
Crossplatform VarArg PInvoke
looking through information on the interet I found __arglist keyword but I'm finding very conflicting information on if it's ok to use and if it works on other platforms
25 replies
CC#
Created by Demonik on 4/15/2024 in #help
Crossplatform VarArg PInvoke
my idea is to declare 2 functions for different parameter lists and wrappers around them but I'm not sure if that'll correctly follow calling conventions on all platforms
25 replies
CC#
Created by Demonik on 4/15/2024 in #help
Crossplatform VarArg PInvoke
(function is opus_encoder_ctl from libopus)
25 replies