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
Mixer MIDI channel mapping support #672
Conversation
- Add fluid_synth_mixer_get_mapping() in fluid_synth.c. - Add getter function fluid_rvoice_mixer_get_fx_out_mapping() in fluid_rvoice_mixer.c. - Add command chanmap in fluid_cmd.c.
- Add fluid_synth_mixer_set_mapping() in fluid_synth.c. - Add setter function fluid_rvoice_mixer_set_fx_out_mapping() in fluid_rvoice_mixer.c. - Add command sechanmapout in fluid_cmd.c.
- fix a bug in fluid_setchanmap(). - in fluid_synth_mixer_set_mapping check out_from_fx in range [0..synth->audio_group[.
- Add fluid_synth_mixer_reset_mapping() in fluid_synth.c. - Add command resetchanmap in fluid_cmd.c.
- Check parameter fxunit_idx and out_from_fx - return FLUID_OK or FLUID_FAILED
- check parameter fxunit_idx.
|
@mawe42 Could you pls. comment before I do? |
Sure, but I won't have time until tomorrow evening. |
|
Overall this looks very nice. But I would suggest to split the public API into two parts:
I think that would make it clearer that the fx unit to output buffer mapping is not necessarily local to a MIDI channel. Consider the following case: fx unit 1 is set to write to output 1 and MIDI channels 1 and 2 both feed fx unit 1. Now the user changes the fx output buffer for MIDI channel 1 by issuing the command It might be surprising to the user that the fx from MIDI channel 2 is now also suddenly on output buffer 2. So by issuing a command for a particular MIDI channel, it's possible that many other MIDI channels are also affected. That doesn't feel quite right to me. Also, the missing symmetry on the API calls is bothering me. I didn't look too deep into the actual implementation, yet. But I'll write some general comments about this feature into #669. |
|
Thanks for your feedback.
Yes, I understand that it would be clearer that this mapping type isn't instructed from a MIDI channel source.
As far the user has decided to map
Actually |
- out_from_chan must be in range [-1..synth->audio_groups[ - fx_from_chan must be in range [-1..synth-effects_groups[
However, I would prefer keeping this API allowing to do the 3 mapping type at the same time. This ensures that the required |
But why is that important? And if it is important, why do the new shell commands not enforce it as well? |
The API is intended to be called in a realtime context playing (or not). Usually, shell command executed by human aren't use for realtime context playing. For simplicity for human, I have chosen to split the shell command mapping to reduce the number of arguments (6) . If you think that it would be useful to add a shell command (allowing 3 mapping) intended to be called in context playing, I am ready to do this, please feel free to request ?. |
Sorry I missed your first question. For example, if I a musician triggers a predefined |
I completely understand. But the API is also consumed by humans, more specifically by the programmer. So in my opinion the API should provide functions in such a way that they are simple to understand and that their effects are obvious and ideally also predictable.
If atomic changes to the channel mappings are important and possible, then yes: I think shell users should also benefit from atomic changes. But if I understand your proposal correctly, then guaranteed atomic changes are only possible for But maybe I didn't express my concerns about the symmetry and parameter structure well enough. Let me give an example of how I think it might be easier to understand for API users: And then make the shell commands follow the same layout. Split this way, it makes it clear to the user of the API that fx_units and channels are separate objects that are manipulated separately. And that changing the output buffer of an fx_unit might affect more than one MIDI channel. And if we went down the path of removing the modulo channel mapping with |
|
Please note that many synth API calls are only "atomic" when executed from synthesis context. So, just like we have different functions for CC and Prog changes, we should split up the |
I am fine for split and clarifying the API usage (and to abandon the atomic property that could be solved at application level).
For path 3, having an API int fluid_synth_mixer_set_fx_mapping(synth, fx_unit, buffer_idx) allows to set So, I suggest rather to use this signature (that does the same job) . So I suggest to split the proposed Of course shell commands should follow the same layout.
Not sure. For users who are lost during their mapping settings, maybe it would be helpful and faster to have a reset function that set things in a well know state (i.e the default state) . |
|
This is really strange. I keep getting notifications from GitHub that you have commented on this PR. And it's always the same comment. Sometimes I get only 2-3, sometimes 10+. |
You means many notifications for only one message ? or many duplicates of the same message!!! ?. The former is probably due because I had fixed some grammar mistake several times on the same message ;). I am sorry for this disorder. |
|
Assuming we agree to split the
and I prefer Marcus's version After split, this could lead to the 3 APIs: Of course these functions name here can be changed. Any opinions about split in 3 APIs ? |
- fluid_synth_mixer_get_channel_mapping(). - fluid_synth_mixer_get_fx_mapping().
- fluid_synth_mixer_set_chan_to_out_mapping(). - fluid_synth_mixer_set_chan_to_fx_mapping(). - fluid_synth_mixer_set_fx_to_out_mapping().
- fluid_synth_mixer_reset_channel_mapping() -fluid_synth_mixer_reset_fx_mapping()
|
This pull request introduces 1 alert when merging 2d4d132 into 90ba627 - view on LGTM.com new alerts:
|
- add comments to explains what fluid_handle_set_map() and fluid_handle_reset_map() functions do.
|
Kudos, SonarCloud Quality Gate passed!
|
This PR addresses #669 point 1.1.
It proposes 3 API functions for mixer MIDI channels mapping:
And the appropriate shell commands: