-
-
Notifications
You must be signed in to change notification settings - Fork 69
Opcode parsing and defaults #559
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
Conversation
a3e46f7
to
e8aa201
Compare
This looks fantastic, but now all builds are failing at generating the editor UI. |
No idea I'll check later 😊
Nov 22, 2020 20:21:51 JP Cimalando <notifications@github.com>:
… This looks fantastic, but now all builds are failing at generating the editor UI.
An idea why that is? I will check on my side.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub[#559 (comment)], or unsubscribe[https://github.com/notifications/unsubscribe-auth/ADUFWQNC326JXOUUP3MSHRLSRFQDPANCNFSM4T6TVFIA].
[data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABHNCSVQICAgIfAhkiAAAAB9JREFUaIHtwQEBAAAAgiD/r25IQAEAAAAAAAAAAC8GJDAAAY7rwGcAAAAASUVORK5CYII=###24x24:true###][Tracking image][https://github.com/notifications/beacon/ADUFWQMIXQJRRBJ7YX6X4JDSRFQDPA5CNFSM4T6TVFIKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOFOPMQPI.gif]
|
e8aa201
to
c5aeca2
Compare
The reason of this problem is that the final commit would remove the generated file. |
|
Nevermind I understood it wrong. I take it that |
No actually it's more the "ignoring vs clamping" question when you get a value out of bounds, so not for enumerated. For example what to do if you get |
Imho a maximum of the opcode reading process should be encoded into the spec. |
I'll try to put in more. Regarding the out-of-bounds situation, it seems sforzando has varying behaviors. For example, negative values for |
45db083
to
d19de33
Compare
c6c58f5
to
5b57ed4
Compare
Hi, A bit tired of this PR tbh, but here goes. Now the template<class T>
struct OpcodeSpec
{
T defaultInputValue;
Range<T> bounds;
int flags;
/**
* @brief Normalizes an input as needed for the spec
*
* @param input
* @return T
*/
T normalizeInput(T input) const { .... }
operator T() const { return normalizeInput(defaultInputValue); }
}; Flags can be enum OpcodeFlags : int {
kCanBeNote = 1,
kEnforceLowerBound = 1 << 1,
kEnforceUpperBound = 1 << 2,
kNormalizePercent = 1 << 3,
kNormalizeMidi = 1 << 4,
kNormalizeBend = 1 << 5,
kWrapPhase = 1 << 6,
kDb2Mag = 1 << 7,
}; In usage for parsing, opcodes are initialized as
and parsed as
or if you need an unset optional as default
The Some cleanups, commenting and testing to do still. |
985ce17
to
acb860e
Compare
This reworks the opcode parsing, with 3 main goals:
.cpp
filesetXXXfromOpcode
methods which have to be duplicated for different use cases.The opcodes defaults are now
OpcodeSpec
s, with the following signature:These signatures are in
Default.cpp
for all relevant opcodes. Some opcodes share a spec, most notably thekey
one that spanshikey
,lokey
,pitch_keycenter
,amp_keycenter
, ...Some defaults still have to live outside of this paradigm, for example default ranges for crossfades and enums.
I also kept the
readBooleanFromOpcode
for now.I also moved the effect defaults into
Defaults.h
.The "new" way to parse an opcode is now to use the member function
read(OpcodeSpec<T> spec)
, either asor with the single-line shortcut for simple plain values that could be "replaced" by the new opcode.
The member method properly dispatches between
int
/float
specs, and handles the opcode as specified by the flags.This builds on top of #555. I still need to activate some of the tests, and I will add tests and OSC interfaces for the effects also.