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

[MU3] Fix #127341: Implements portamento for fluid #5853

Merged
merged 1 commit into from
Oct 23, 2020

Conversation

Jojo-Schmitz
Copy link
Contributor

@Jojo-Schmitz Jojo-Schmitz commented Mar 20, 2020

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);
Copy link
Contributor

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?

Copy link
Contributor Author

@Jojo-Schmitz Jojo-Schmitz Mar 21, 2020

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!?!

Copy link
Contributor

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.

Copy link
Contributor Author

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?

ev.setPortamento(true);
if (onTime == 0)
onTime++;
events->insert(std::pair<int, NPlayEvent>(onTime-1, portamentoOn));
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I didn't ;-)

@Jojo-Schmitz Jojo-Schmitz marked this pull request as draft April 11, 2020 10:20
@Jojo-Schmitz Jojo-Schmitz marked this pull request as ready for review April 14, 2020 13:34
@Jojo-Schmitz Jojo-Schmitz marked this pull request as draft April 14, 2020 13:36
@Jojo-Schmitz Jojo-Schmitz marked this pull request as ready for review April 17, 2020 11:11
@Jojo-Schmitz Jojo-Schmitz marked this pull request as draft April 17, 2020 11:17
@Jojo-Schmitz Jojo-Schmitz marked this pull request as ready for review April 20, 2020 13:31
@Jojo-Schmitz Jojo-Schmitz marked this pull request as draft April 20, 2020 13:32
@Jojo-Schmitz Jojo-Schmitz marked this pull request as ready for review April 21, 2020 20:11
@Jojo-Schmitz Jojo-Schmitz marked this pull request as draft April 21, 2020 20:11
@Jojo-Schmitz Jojo-Schmitz changed the base branch from master to 3.x May 8, 2020 07:28
@Jojo-Schmitz Jojo-Schmitz marked this pull request as ready for review May 8, 2020 07:50
@Jojo-Schmitz Jojo-Schmitz marked this pull request as draft May 8, 2020 07:51
@Jojo-Schmitz Jojo-Schmitz marked this pull request as ready for review May 20, 2020 15:09
@Jojo-Schmitz Jojo-Schmitz marked this pull request as draft May 20, 2020 15:09
@Jojo-Schmitz Jojo-Schmitz changed the title fix #127341: implements portamento for fluid fix #127341: implements portamento for fluid (3.x) Aug 23, 2020
@Jojo-Schmitz Jojo-Schmitz marked this pull request as ready for review August 23, 2020 12:42
@Jojo-Schmitz Jojo-Schmitz marked this pull request as draft August 23, 2020 12:42
@Jojo-Schmitz Jojo-Schmitz marked this pull request as ready for review September 27, 2020 08:59
@Jojo-Schmitz Jojo-Schmitz marked this pull request as draft September 27, 2020 09:00
@Jojo-Schmitz Jojo-Schmitz marked this pull request as ready for review October 5, 2020 11:14
@Jojo-Schmitz Jojo-Schmitz changed the title fix #127341: implements portamento for fluid (3.x) [MU3] Fix #127341: Implements portamento for fluid Oct 20, 2020
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.

5 participants