-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
[MU3] Fix #127341: Implements portamento for fluid #5853
Conversation
7d079b3
to
ae707d8
Compare
fluid/fluid.cpp
Outdated
@@ -38,6 +38,11 @@ namespace FluidS { | |||
|
|||
bool Fluid::initialized = false; | |||
|
|||
/* better than a macro to determine inappropriate values for notes*/ | |||
bool validNote(const int input) { | |||
return (input < 255 && input > -1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't it be input < 256
or input <= 255
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question. At another place in this file this is claimed to "usually be the TPC" (Tonal Pitch Class), but that in turn has a range of -2 (TPC_INVALID
) to 33 (TPC_B_SS
), so that doesn't seem to be the case.
It it were (MIDI) pitches though, the limit would rather be 0-127, I believe.
However, as far as I can tell this validNote()
is called only from Fluid::setFromKeyPortamento()
and that in turn is never called!?!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code was copied from fluid synth 2, which isn't quite possible to completely incorporate into MuseScore. Jojo could actually be right, I just wasn't entirely too sure what's necessary for portamento and what's not, or what might be necessary in the future, and I wanted to add as much of fluid synth 2's extra features as possible. It's specifically to do with line 219 of this file:
https://github.com/FluidSynth/fluidsynth/blob/master/src/synth/fluid_chan.h#L219
If the file has changed, look for a macro like #define fluid_channel_is_valid_note(n) (n != INVALID_NOTE)
I'm not a fan of macros because I think they can occasionally be unpredictable and otherwise some compilers may or may not optimise them well or add unnecessary symbols.
Long story short, 255 is indeed an invalid value as is any value that's negative.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
So
const int INVALID_NOTE = 255;
rather than a magic number?
Instead with have this though:enum { INVALID_NOTE = -1};
Confusing? Yes...
- That comment about TPC seems missleading maybe it means PTC, PortamenTo Controler? Or is it really TPC?
ae707d8
to
8d5cc60
Compare
ev.setPortamento(true); | ||
if (onTime == 0) | ||
onTime++; | ||
events->insert(std::pair<int, NPlayEvent>(onTime-1, portamentoOn)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would these events also be present if I exported a midi? That's kind of where I got stuck.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No idea. How to check?
Anyway, are you going to continue on your PR then? The rebase itself was rather trivial.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I see you did rebase your PR, so I'm going to close mine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I didn't ;-)
8d5cc60
to
6226178
Compare
6226178
to
ed9e7dc
Compare
ed9e7dc
to
21f87f7
Compare
to replace/rebase @MichaelFroelich's #4824
Resolves https://musescore.org/en/node/127341